Windows API interpreter [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this questionIs there an interp开发者_运维百科reter that can give output of windows api calls such as GetVersionEx ?
Not sure if that's what you want/need, but I'd say Python with with pywin32 module.
Ruby may also be a possibility. The following is an example that shows the results of a call to GetVersionEx.
require "Win32API"
gvex = Win32API.new( 'kernel32', 'GetVersionEx', ['P'], 'I' )
s = [20+128, 0, 0, 0, 0, '' ].pack('LLLLLa128')
gvex.call( s );
a = s.unpack( 'LLLLLa128' )
puts "gvex: ", a
This example just passes 148 bytes (the size of the OSVERSION
structure) rather than the entire OSVERSIONEX structure.
Information like version and other data from the operating system can also be obtained using WMI.
Here's a VBScript example, no need to compile anything:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOS in colOSes
Wscript.Echo "Computer Name: " & objOS.CSName
Wscript.Echo "Caption: " & objOS.Caption 'Name
Wscript.Echo "Version: " & objOS.Version 'Version & build
Wscript.Echo "Build Number: " & objOS.BuildNumber 'Build
Wscript.Echo "Build Type: " & objOS.BuildType
Wscript.Echo "OS Type: " & objOS.OSType
Wscript.Echo "Other Type Description: " & objOS.OtherTypeDescription
WScript.Echo "Service Pack: " & objOS.ServicePackMajorVersion & "." & _
objOS.ServicePackMinorVersion
Next
精彩评论