Does CallNtPowerInformation (SystemPowerInfomation ...) use work on WIndows XP?

I am trying to access the "TimeRemaining" value for the idle power management counter. A Google search shows that many people (including me) can get the value once, but each subsequent call gives the same results. No countdown, no change to CurIdle ...

Here is a short version of the code:

#include <windows.h>
#include <tchar.h>
#include <powrprof.h>
typedef struct _SYSTEM_POWER_INFORMATION {
  ULONG MaxIdlenessAllowed;
  ULONG Idleness;
  ULONG TimeRemaining;
  UCHAR CoolingMode;
}SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;

int _tmain(int argc, _TCHAR* argv[])
{
    SYSTEM_POWER_INFORMATION spin;
    CallNtPowerInformation(SystemPowerInformation,NULL,0,&spin,sizeof(SYSTEM_POWER_INFORMATION));
    _tprintf(_T("MaxIdleness\t%d\t"),spin.MaxIdlenessAllowed);
    _tprintf(_T("CurIdle\t%d\t"),spin.Idleness);
    _tprintf(_T("TimeRemaining\t%d\n"),spin.TimeRemaining);
    return 0;
}

, MaxIdleness ( ), CurIdle ( ) TimeRemaining ( ... , 'm, , , sleep.exe , "" CallNtPowerInformation).

- , TimeRemaining CurIdle?

+3
1

, . , :

1). , , , , , - ... . ( ) , .

2) , ( sleep.exe ), - . , sleep.exe, .

3). , ( , ) , (MaxIdle ..) 15 . , WinXP, , , , , . ( , CallNtPowerInformation , , , ... , , , , 15 .)

4) ... : ) ... reset b) ( CurIdle MaxIdleness) 15 , ( , reset ).

, , .

dscottm

+3

Source: https://habr.com/ru/post/1726822/


All Articles