前两天为了写个流量监控的程序,网上的太那个了。。。很不爽,才结识WMI,嘿嘿,研究了一下,还行!!接口找到了,再调用其它的又有何难?
本机显示结果如下:
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;Win32汇编调用WMI (COM组件) 得到name和ProcessorId (抛砖引玉).
; ___By G-Spider 2010-9-19
;Web: http://blog.csdn.net/G_Spider
;QQ : 287014897
;----------------------------------------------------------
;ml /c /coff my.asm
;link /subsystem:console my.obj
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include masm32.inc
include ole32.inc
include Oleaut32.inc
includelib kernel32.lib
includelib user32.lib
includelib masm32.lib
includelib ole32.lib
includelib Oleaut32.lib
.data
;-------------------------
;///测试用
buf db 'good',0
szTitleSave db 'good luck',0
;fmt db '%d',0
reLine db 0dh,0ah,'ProcessorId: ',0
;---------------------------
CLSID_WbemLocator GUID <04590f811h, 01d3ah, 011d0h, <089h, 01fh, 000h, 0aah, 000h, 04bh, 02eh, 024h>>
;/// 4590f811-1d3a-11d0-891f-00aa004b2e24
IID_IWbemLocator GUID <0dc12a687h, 0737fh, 011cfh, <088h, 04dh, 000h, 0aah, 000h, 04bh, 02eh, 024h>>
;/// dc12a687-737f-11cf-884d-00aa004b2e24
stresource word 'R','O','O','T','/','C','I','M','V','2',0
stlanguage word 'W','Q','L',0
stquery word 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','P','r','o','c','e','s','s','o','r'