I just checked on Windows 11 22H2, build 22621.521, GetProcessInformation API with ProcessPowerThrottling parameter works as expected.
GetProcessInformation ProcessPowerThrottling does not seem to work
Hi. trying to examine the ProcessPowerThrottling structure because I want to make sure I am changing it. VS2019, SDK 10.0.22000.0
The Get fails, the Set succeeds (or so it says)
PROCESS_POWER_THROTTLING_STATE PowerThrottling;
// ProcessPowerThrottling - get PROCESS_POWER_THROTTLING_EXECUTION_SPEED
RtlZeroMemory(&PowerThrottling, sizeof(PROCESS_POWER_THROTTLING_STATE));
PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
passFail = GetProcessInformation(
GetCurrentProcess(),
ProcessPowerThrottling,
&PowerThrottling,
sizeof(PROCESS_POWER_THROTTLING_STATE));
std::cout << "Get PowerThrottling, passFail:" << passFail << std::endl;
if (!passFail) {
DWORD dw = GetLastError();
std::cout << "PowerThrottling, failed:" << dw << std::endl;
}
output is
Get PowerThrottling, passFail:0
PowerThrottling, failed:87
Version:1
ControlMask:0
StateMask:0
2 additional answers
Sort by: Most helpful
-
Castorix31 83,206 Reputation points
2022-04-02T07:54:48.92+00:00 ProcessPowerThrottling seems to be valid only for SetProcessInformation;
For GetProcessInformation, it returns first :RtlNtStatusToDosError(STATUS_INVALID_INFO_CLASS)
(then ERROR_INVALID_PARAMETER)
-
Jeanine Zhang-MSFT 9,431 Reputation points Microsoft Vendor
2022-04-13T09:07:54.15+00:00 Hi,
Welcome to Microsoft Q&A!
This is document content issue in the statement of GetProcessInformation() API. Actually
ProcessPowerThrottling
is not a supported parameter in GetProcessInformation() API, but this is only used in SetProcessInformation() API. This is also claimed in the documentation of PROCESS_POWER_THROTTLING_STATE structure.According to the code of GetProcessInformation(), it will check ProcessInformationClass parameter for ProcessMemoryPriority / ProcessAppMemoryInfo / ProcessInPrivateInfo / ProcessProtectionLevelInfo / ProcessLeapSecondInfo / ProcessMachineTypeInfo, and other values will be treated as STATUS_INVALID_INFO_CLASS which eventually returns ERROR_INVALID_PARAMETER (0x57) in GetLastError().
And I'm trying to report document content issue.
Best Regards,
Jeanine
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.