这是我的代码,我发现a的值永远不会改变,然后我检查返回值,它是STATUS_BUFFER_TOO_SMALL
#include "stdafx.h"
#include <Windows.h>
extern "C" {
#include <Powrprof.h>
}
#pragma comment(lib, "Powrprof.lib")
typedef struct _PROCESSOR_POWER_INFORMATION {
ULONG Number;
ULONG MaxMhz;
ULONG CurrentMhz;
ULONG MhzLimit;
ULONG MaxIdleState;
ULONG CurrentIdleState;
} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
int main(int argc, char* argv[])
{
PROCESSOR_POWER_INFORMATION a;
while (1)
{
CallNtPowerInformation(ProcessorInformation, NULL, 0, &a, sizeof(a));
}
system("pause");
return 0;
}
OutputBufferSize是sizeof(a),但为什么它会返回STATUS_BUFFER_TOO_SMALL,以及如何修复它?