NTSTATUS 无法解析

Dus*_*n01 2 c++ windows mingw nt-native-api

我试图制作一个程序,通过进程 ID 获取进程的命令行。我使用 eclipse c++ 和 mingw 编译器

所以我找到了一个教程如何做到这一点,它需要ntstatus就像我包含的教程中那样#include <ntstatus.h>

我添加了代码的第一部分:

typedef NTSTATUS (NTAPI *_NtQueryInformationProcess)(
    HANDLE ProcessHandle,
    DWORD ProcessInformationClass,
    PVOID ProcessInformation,
    DWORD ProcessInformationLength,
    PDWORD ReturnLength
    );
Run Code Online (Sandbox Code Playgroud)

我发现这 3 个错误:

expected primary-expression before '__attribute__

Type 'NTSTATUS' could not be resolved

typedef 'NTSTATUS' is initialized (use decltype instead)
Run Code Online (Sandbox Code Playgroud)

在这一行:typedef NTSTATUS (NTAPI *_NtQueryInformationProcess)(

我用谷歌搜索了这个问题,但我找不到它......

小智 5

NTSTATUS 定义于

#include <winternl.h>
Run Code Online (Sandbox Code Playgroud)

作为

typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
Run Code Online (Sandbox Code Playgroud)

其值定义在

#include <ntstatus.h>
Run Code Online (Sandbox Code Playgroud)