NTSTATUS could not be resolved

9k Views Asked by At

im trying to make a program witch will get command line of proces by a Process id. Im using eclipse c++ and mingw compiler

So i found a 1 tutorial how to do that, and it needs ntstatus so like in tutorial i included #include <ntstatus.h>

And i added first part of code what is:

typedef NTSTATUS (NTAPI *_NtQueryInformationProcess)(
    HANDLE ProcessHandle,
    DWORD ProcessInformationClass,
    PVOID ProcessInformation,
    DWORD ProcessInformationLength,
    PDWORD ReturnLength
    );

And im gettig this 3 errors:

expected primary-expression before '__attribute__

Type 'NTSTATUS' could not be resolved

typedef 'NTSTATUS' is initialized (use decltype instead)

On this line: typedef NTSTATUS (NTAPI *_NtQueryInformationProcess)(

I googled about this problem, and i colud not find it...

2

There are 2 best solutions below

0
On

NTSTATUS is defined in

#include <winternl.h>

as

typedef _Return_type_success_(return >= 0) LONG NTSTATUS;

and its values are defined in

#include <ntstatus.h>
0
On

Thee also needs to be a _WIN32_WINNT defined, otherwise <winternl.h> will generate no code. My DLL project only spat Syntax error: NTSTATUS. How to fix:

#include <windows.h>
#include <winternl.h>