Seite 1 von 1

wmi abfrage mit advapi32.dll

Verfasst: 02.07.2008 11:35
von bingo
alles undokumentiert aber ähnlich ...
IoWmiOpenBlock = WmiOpenBlock in advapi32.dll 8)
IoWmiQueryAllDataA = WmiQueryAllDataA ...

http://msdn.microsoft.com/en-us/library/aa490467.aspx

muster code ... (xp/vista)

Code: Alles auswählen

OpenLibrary(0, "advapi32.dll")

f1 = GetFunction(0,"WmiOpenBlock")
f2 = GetFunction(0,"WmiQueryAllDataA")
f3 = GetFunction(0,"WmiCloseBlock")

memsize.l = 5000
membuffer.l = AllocateMemory(memsize)

#WMIGUID_QUERY = 1

;init
Debug CallFunctionFast(f1,?MSSmBios_RawSMBiosTables,#WMIGUID_QUERY,@wmiblock.l)

;query
Debug CallFunctionFast(f2,wmiblock,@memsize,membuffer)

;close
Debug CallFunctionFast(f3,wmiblock)

CloseLibrary(0)

;save wmi-data
If CreateFile(0,"d:\wmi.bin")
WriteData(0,membuffer,memsize)
CloseFile(0)
EndIf

FreeMemory(membuffer)

End

DataSection ;test it
MSWmi_PnPDeviceId:
Data.l $c7bf35d2
Data.w $aadb,$11d1
Data.b $bf,$4a,$00,$a0,$c9,$06,$29,$10
MSSmBios_RawSMBiosTables:
Data.l $8f680850
Data.w $a584,$11d1
Data.b $bf,$38,$00,$a0,$c9,$06,$29,$10
MSDiskDriver_Geometry:
Data.l $25007f51
Data.w $57c2,$11d1
Data.b $a5,$28,$00,$a0,$c9,$06,$29,$10
EndDataSection
man hat also hier zugriff auf wmi-"rohdaten" .

alles weitere in der wmicore.mof und wmidata.h aus dem wdk !

weitere funktionen zum testen : WmiQuerySingleInstance , WMIExecuteMethod :lol:

schön , wenn jemand hier "bissl" mitprobiert - eben undokumentiert !