CallNtPowerInformation API fails with error code STATUS_INVALID_PARAMETER

2

I run the following code to get the video display timeout from a Windows OS:

SYSTEM_POWER_POLICY spp = {0};
DWORD dwRes = CallNtPowerInformation(SystemPowerPolicyAc, NULL, 0, &spp, sizeof(spp));
if(dwRes != STATUS_SUCCESS)
{
    //Error 0xC000000D or STATUS_INVALID_PARAMETER
    //An invalid parameter was passed to a service or function.
}
else
{
    int nTimeout = spp.VideoTimeout;
}

It works on my Windows 7 but then on another laptop running Windows 7 as well it returns the error code STATUS_INVALID_PARAMETER. Does anyone have any idea why? And how to remedy it?

c++
windows
winapi
power-management
asked on Stack Overflow Sep 10, 2012 by ahmd0

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0