Archive: Syntax for retrieving data from GetPwrCapabilities


Syntax for retrieving data from GetPwrCapabilities
  Hello,

I am having some problems with the syntax for this one. What I need is to check these values:

- SystemBatteriesPresent
- UpsPresent

through the GetPwrCapabilities function, this will be done onInit. Can anyone help me with the correct syntax for retrieving the structure data? I need this to check if the computer is a laptop.

Any help will be greatly appreciated!

Also, two quick questions, anyone knows if there is a way to check from the installer if Antivirus is present and if Windows is Genuine?

Thanks!



1 

>
I probably got the offsets wrong in the system::call '*$1(..call (I'm not on a laptop so I can't really verify), also 666 is bogus, you could use a smaller number, too lazy to calculate the minimal size ATM

I think you might be able to check the WGA with WMI, and there is a api for the security center to check AV IIRC but ClamAV etc probably don't use it so its not 100%

You can use thw WmiInpector plugin to check WMI values.
In your case:


Name TestWmiInspector
OutFile TestWmiInspector.exe
RequestExecutionLevel user
XPStyle on
Page instfiles

!Macro ShowResult ItemName
Pop $0
Pop $1
MessageBox MB_OK "$\tTested item ${ItemName}$\r$\n$\r$\n$\r$\nResult call: $0$\r$\n$\r$\nValue: $1"
!MacroEnd

Section
WmiInspector::Request "CIMV2" "Win32_WindowsProductActivation" "ActivationRequired"
!InsertMacro ShowResult "ActivationRequired"

WmiInspector::AntiVirus
!InsertMacro ShowResult "AV"
END:
SectionEnd
>
but as Anders said, some AV does not integrate with MS that well (at least ClamAV doesn't...)

Thank you very much! That is very helpful, I will test the code tomorrow with a laptop and let you know.

The Anti-Virus and Windows Activation part is for information purposes so it's perfect :)


Hello!

It's me again. I'm having problems with getting the correct offsets for the values. How do you calculate them?
I have made a few tries but the data recovered seems inconsistent with the SYSTEM_POWER_CAPABILITIES structure. How do you point to a specific value? I understand that <&i12,&i1.r2> should retrieve the 12th integer of 1 byte and store it in $2 but it seems this is not happening ( I have made some tests with the Hiberfile value but it returns always 0.)


it gets the 13th byte actually