ReadPwrScheme ... WritePwrScheme
Posted: Wed Mar 30, 2005 8:51 am
read powerscheme "4" and write it as "9" with new name/description .
http://msdn.microsoft.com/library/defau ... scheme.asp
the code crashs on WritePwrScheme
- any hints ?
Code: Select all
Structure POWER_ACTION_POLICY
Action.l
Flags.l
EventCode.l
EndStructure
Structure MACHINE_POWER_POLICY
Revision.l
MinSleepAc.l
MinSleepDc.l
ReducedLatencySleepAc.l
ReducedLatencySleepDc.l
DozeTimeoutAc.l
DozeTimeoutDc.l
DozeS4TimeoutAc.l
DozeS4TimeoutDc.l
MinThrottleAc.b
MinThrottleDc.b
pad1.b[2]
OverThrottledAc.POWER_ACTION_POLICY
OverThrottledDc.POWER_ACTION_POLICY
EndStructure
Structure USER_POWER_POLICY
Revision.l
IdleAc.POWER_ACTION_POLICY
IdleDc.POWER_ACTION_POLICY
IdleTimeoutAc.l
IdleTimeoutDc.l
IdleSensitivityAc.b
IdleSensitivityDc.b
ThrottlePolicyAc.b
ThrottlePolicyDc.b
MaxSleepAc.l
MaxSleepDc.l
Reserved.l[2]
VideoTimeoutAc.l
VideoTimeoutDc.l
SpindownTimeoutAc.l
SpindownTimeoutDc.l
OptimizeForPowerAc.b
OptimizeForPowerDc.b
FanThrottleToleranceAc.b
FanThrottleToleranceDc.b
ForcedThrottleAc.b
ForcedThrottleDc.b
EndStructure
Structure POWER_POLICY
user.USER_POWER_POLICY
mach.MACHINE_POWER_POLICY
EndStructure
PP.POWER_POLICY
OpenLibrary(1, "PowrProf.DLL")
F1 = IsFunction(1, "ReadPwrScheme")
F2 = IsFunction(1, "WritePwrScheme")
CallFunctionFast(F1,4,@PP)
scheme.s = "scheme 9"
schemeinfo.s = "scheme 9 info"
Debug CallFunctionFast(F2,9,@scheme,@schemeinfo,@PP) ;<- crash !
CloseLibrary(1)
the code crashs on WritePwrScheme