WmiInspector plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
No edit summary
Line 6: Line 6:


== Description ==
== Description ==
This plugin sends request to the system using MS WMI API and returns the value on the stack.


== Command line ==
== Command line ==


Plug-in DLL functions (entry points):  
Plug-in DLL functions (entry points): Request, OS, OSVersion, FullOS, AntiVirus, FireWall, CPU, Resolution
 
=== Request DLL Function ===
 
<highlight-nsis>
WmiInspector::Request DomainName TableName ValueName
</highlight-nsis>
 
This call returns "OK" string and value if successful, "error" and error description string if failed.
 
=== OS DLL Function ===
 
<highlight-nsis>
WmiInspector::OS
</highlight-nsis>
 
This call returns "OK" string and OS caption if successful, "error" and error description string if failed.
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption"'''''.
 
=== OSVersion DLL Function ===
 
<highlight-nsis>
WmiInspector::OSVersion
</highlight-nsis>
 
This call returns "OK" string and OS version number if successful, "error" and error description string if failed.
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Version"'''''.
 
=== FullOS DLL Function ===
 
<highlight-nsis>
WmiInspector::FullOS
</highlight-nsis>
 
If successful, this call returns "OK" string and full OS informations (including version number and service pack), "error" and error description string otherwise.
 
This function is a combination of several '''''WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Xxx"''''' calls.
 
=== AntiVirus DLL Function ===
 
<highlight-nsis>
WmiInspector::AntiVirus
</highlight-nsis>
 
If successful, this call returns "OK" string and installed antivirus name, "error" and error description string otherwise.
This function is equivalent to '''''WmiInspector::Request "SecurityCenter" "AntiVirusProduct" "DisplayName"'''''.
 
=== FireWall DLL Function ===
 
<highlight-nsis>
WmiInspector::FireWall
</highlight-nsis>
 
If successful, this call returns "OK" string and installed firewallname, "error" and error description string otherwise.
This function is equivalent to '''''WmiInspector::Request "SecurityCenter" "FirewallProduct" "DisplayName"'''''.
 
=== CPU DLL Function ===
 
<highlight-nsis>
WmiInspector::CPU
</highlight-nsis>
 
If successful, this call returns "OK" string and CPU name, "error" and error description string otherwise.
This function is equivalent to '''''WmiInspector::Request "CIMV2" "Win32_Processor" "Caption"'''''.
 
=== Resolution DLL Function ===


=== DLL Function ===
<highlight-nsis>
WmiInspector::Resolution
</highlight-nsis>


If successful, this call returns "OK" string and desktop resolution, "error" and error description string otherwise.


=== DLL Function ===
This function is a combination of several '''''WmiInspector::Request "CIMV2" "Win32_Win32_DesktopMonitor" "Xxx"''''' calls.


== Examples ==
== Examples ==


<highlight-nsis>
<highlight-nsis>
WmiInspector::
START:
Pop $0
    WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption"
Pop $1
    Pop $0
    StrCmp $0 "ok" SHOWVALUE SHOWERROR
SHOWVALUE:
    Pop $1
    MessageBox MB_OK "Value: $1"
    GoTo END
SHOWERROR:
    Pop $1
    MessageBox MB_OK "Error: $1"
END:
</highlight-nsis>
</highlight-nsis>



Revision as of 13:44, 30 April 2008

Work in progress...

Links

Download:

Description

This plugin sends request to the system using MS WMI API and returns the value on the stack.

Command line

Plug-in DLL functions (entry points): Request, OS, OSVersion, FullOS, AntiVirus, FireWall, CPU, Resolution

Request DLL Function

WmiInspector::Request DomainName TableName ValueName

This call returns "OK" string and value if successful, "error" and error description string if failed.

OS DLL Function

WmiInspector::OS

This call returns "OK" string and OS caption if successful, "error" and error description string if failed. This function is equivalent to WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption".

OSVersion DLL Function

WmiInspector::OSVersion

This call returns "OK" string and OS version number if successful, "error" and error description string if failed. This function is equivalent to WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Version".

FullOS DLL Function

WmiInspector::FullOS

If successful, this call returns "OK" string and full OS informations (including version number and service pack), "error" and error description string otherwise.

This function is a combination of several WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Xxx" calls.

AntiVirus DLL Function

WmiInspector::AntiVirus

If successful, this call returns "OK" string and installed antivirus name, "error" and error description string otherwise. This function is equivalent to WmiInspector::Request "SecurityCenter" "AntiVirusProduct" "DisplayName".

FireWall DLL Function

WmiInspector::FireWall

If successful, this call returns "OK" string and installed firewallname, "error" and error description string otherwise. This function is equivalent to WmiInspector::Request "SecurityCenter" "FirewallProduct" "DisplayName".

CPU DLL Function

WmiInspector::CPU

If successful, this call returns "OK" string and CPU name, "error" and error description string otherwise. This function is equivalent to WmiInspector::Request "CIMV2" "Win32_Processor" "Caption".

Resolution DLL Function

WmiInspector::Resolution

If successful, this call returns "OK" string and desktop resolution, "error" and error description string otherwise.

This function is a combination of several WmiInspector::Request "CIMV2" "Win32_Win32_DesktopMonitor" "Xxx" calls.

Examples

START:
     WmiInspector::Request "CIMV2" "Win32_OperatingSystem" "Caption"
     Pop $0
     StrCmp $0 "ok" SHOWVALUE SHOWERROR
SHOWVALUE:
     Pop $1
     MessageBox MB_OK "Value: $1"
     GoTo END
SHOWERROR:
     Pop $1
     MessageBox MB_OK "Error: $1"
END:

Credits