这个函数是用来获得电源信息的,但是呢……
extern "C" NTSYSCALLAPI NTSTATUS __stdcall NtPowerInformation(
POWER_INFORMATION_LEVEL InformationLevel,
PVOID InputBuffer,
ULONG InputBufferLength,
PVOID OutputBuffer,
ULONG OutputBufferLength
);
//...
POWER_PLATFORM_INFORMATION PlatformInfo = {0};
NTSTATUS Result = NtPowerInformation(PlatformInformation, NULL, 0, &PlatformInfo, sizeof(PlatformInfo));
什么意思呢?前 3 3 3 个参数目前必须填这几个(别说 PlatformInfomation 未定义,在 Windows.h 里),后两个参数分别填 PlatformInfo(用于接收返回值)的地址和大小。
看起来很厉害,实际上目前 POWER_PLATFORM_INFORMATION
类型目前只有一个布尔值 AoAc
,代表的是 Windows 是否支持你的设备的电源(电池)……显然,结果一定是
1
1
1,否则你的程序怎么可能被运行呢(人择原理!)