成都古怪科技网站建设公司,深圳自定义网站开发,沃尔玛,invoker wordpressWMI是Windows操作系统管理数据和操作的基础设施#xff0c;系统管理员可以使用VB Script、PowerShell及Windows API#xff08;C、C#等#xff09;管理本地或远程计算机。 使用WMI框架应用程序可以直接访问EC RAM、 I/O端口、Memory地址、寄存器、Setup NV设定值#xff0c…WMI是Windows操作系统管理数据和操作的基础设施系统管理员可以使用VB Script、PowerShell及Windows APIC、C#等管理本地或远程计算机。 使用WMI框架应用程序可以直接访问EC RAM、 I/O端口、Memory地址、寄存器、Setup NV设定值以及其他的系统设备资源。
一、Asl code设计
OemWMIDemo.asl
Scope(\_SB)
{Device(AMW1)//WMI{// pnp0c14 is Plug and Play ID assigned to WMI mapperName(_HID, PNP0C14)Name(_UID, WMIDEMO) // Description of data and events supportedName(_WDG, Buffer() {//// Event// GUID 93B56635-6D54-42D7-BB7D-DF77D452CCE4// BIOS can generator WMI event by Notify (WMI device name, 0xAC)//0x35, 0x66, 0xB5, 0x93, 0x54, 0x6D, 0xD7, 0x42, 0xBB, 0x7D, 0xDF, 0x77, 0xD4, 0x52, 0xCC, 0xE4, // GUID0xAC, 0, // Event Notification ID1, // Instance Count0x08, // Flags (WMIACPI_REGFLAG_EVENT)//// Method// GUID ABBC0FB8-8EA1-11D1-A000-C90629100000//0xB8, 0x0F, 0xBC, 0xAB, 0xA1, 0x8E, 0xD1, 0x11, 0xA0, 0x00, 0xC9, 0x06, 0x29, 0x10, 0, 0,0x44, 0x45, // Object Id (DE)1, // Instance Count0x02, // Flags (WMIACPI_REGFLAG_METHOD)//// This GUID for returning the MOF data// 05901221-D566-11D1-B2F0-00A0C90629100x21, 0x12, 0x90, 0x05, 0x66, 0xd5, 0xd1, 0x11, 0xb2, 0xf0, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0x10,66, 68, // Object ID (BD)1, // Instance Count0x00, // Flags(none)})Name(FEAC, Buffer(0x04){0x00, 0x00, 0x00, 0x00})Method (EVAC, 0){ Return (FEAC) } // End of Method EVAC//// EcRAM Method data block// Arg0 has the instance being queried// Arg1 has the method id// Arg2 has the data passedMethod(WMDE, 3){//MethodId 1if(LEqual(Arg1, 1)){Store(Arg2, FEAC)Notify(AMW1, 0xAC)Return(0)}}// More info about an event// Arg0 is the event id that was firedMethod(_WED, 1, NotSerialized){If(LEqual(Arg0, 0xAC)){Return(EVAC())}}// -------- Compiled version of Associated MOF File below --------// Memo: generated by mofcomp.exeName(WQBD, Buffer(){})}
}//end scope _SB其中Mof GUID0x21, 0x12, 0x90, 0x05, 0x66, 0xd5, 0xd1, 0x11, 0xb2, 0xf0, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0x10为固定值。
二、Mof code设计
OemWMIDemo.mof
[WMI, Dynamic, provider(WMIProv),locale(MS\\0x409), GUID({ABBC0FB8-8EA1-11D1-A000-C90629100000}), Description(Call BIOS Function through WMI)
]
class WmiDemo
{[key, read] string InstanceName;[read] Boolean Active;[WmiMethodId(1), Implemented, read, write, Description(My method 1)] void MyMethod1([inout, Description(My method 1)] uint32 Data);};[WMI, Dynamic, provider(WMIProv),locale(MS\\0x409), GUID({93B56635-6D54-42D7-BB7D-DF77D452CCE4}), Description(Event generated when machine is hit)
]
class DemoWmiEvent : WMIEvent
{[key, read] string InstanceName;[read] Boolean Active;[WmiDataId(1),read, write,Description(Force with which the machine was hit)] uint32 Force;
};三、编译Mof文件
工具 mofcomp.exe为系统自带 wmimofck.exe可以从Windows WDK拷贝
将mof文件编译成bmf二进制文件
D:\WMI_Demomofcomp.exe -B:OemWMIDemo.bmf OemWMIDemo.mof
分析 MOF 文件: OemWMIDemo.mof
已成功分析 MOF 文件
将二进制 MOF 数据存储在 OemWMIDemo.bmf 中Binary mof file OemWMIDemo.bmf expanded to 3126 bytes使用wmimofck.exe可生成VBS脚本
D:\WMI_Demowmimofck.exe -tOemWMIDemo.vbs OemWMIDemo.bmf
Microsoft (R) WDM Extensions To WMI MOF Checking Utility Version 1.50.0000
Copyright (c) Microsoft Corp. 1997-2000. All rights reserved.Binary mof file OemWMIDemo.bmf expanded to 3126 bytes使用wmimofck.exe将bmf二进制文件转成文本
D:\WMI_Demowmimofck.exe -xWIMDemo.txt OemWMIDemo.bmf
Microsoft (R) WDM Extensions To WMI MOF Checking Utility Version 1.50.0000
Copyright (c) Microsoft Corp. 1997-2000. All rights reserved.将文本中的内容填入asl文件中Name(WQBD, Buffer() { })的Buffer里。
四、测试
使用WMICodeCreator.exe工具进行测试。可支持生成VBScript, C#, and VB .NET代码。 管理员身份打开WMICodeCreator.exe。 首先设置event并执行 在VBS脚本中添加Wscript.Echo objReceivedEvent.Force语句可输出Event的返回值 设置Method并执行 注意instance要出来并且选中如果没出来可能是GUID没填对没选中的话执行会报错。
参考 创建一个WMI ACPI device 基于Windows Management InstrumentationWMI的BIOS接口设计 文章转载自: http://www.morning.rblqk.cn.gov.cn.rblqk.cn http://www.morning.rfwkn.cn.gov.cn.rfwkn.cn http://www.morning.gnbtp.cn.gov.cn.gnbtp.cn http://www.morning.ypnxq.cn.gov.cn.ypnxq.cn http://www.morning.gbqgr.cn.gov.cn.gbqgr.cn http://www.morning.mhfbf.cn.gov.cn.mhfbf.cn http://www.morning.bpmnj.cn.gov.cn.bpmnj.cn http://www.morning.dnqlba.cn.gov.cn.dnqlba.cn http://www.morning.qfcnp.cn.gov.cn.qfcnp.cn http://www.morning.byrlg.cn.gov.cn.byrlg.cn http://www.morning.xqkcs.cn.gov.cn.xqkcs.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.bwhcl.cn.gov.cn.bwhcl.cn http://www.morning.tqpnf.cn.gov.cn.tqpnf.cn http://www.morning.smdiaosu.com.gov.cn.smdiaosu.com http://www.morning.rhjsx.cn.gov.cn.rhjsx.cn http://www.morning.jxscp.cn.gov.cn.jxscp.cn http://www.morning.fewhope.com.gov.cn.fewhope.com http://www.morning.kfbth.cn.gov.cn.kfbth.cn http://www.morning.ntgsg.cn.gov.cn.ntgsg.cn http://www.morning.qmtzq.cn.gov.cn.qmtzq.cn http://www.morning.fkyrk.cn.gov.cn.fkyrk.cn http://www.morning.jkdtz.cn.gov.cn.jkdtz.cn http://www.morning.cwyfs.cn.gov.cn.cwyfs.cn http://www.morning.jmmz.cn.gov.cn.jmmz.cn http://www.morning.gkjyg.cn.gov.cn.gkjyg.cn http://www.morning.qpnmd.cn.gov.cn.qpnmd.cn http://www.morning.yrpg.cn.gov.cn.yrpg.cn http://www.morning.fwkq.cn.gov.cn.fwkq.cn http://www.morning.redhoma.com.gov.cn.redhoma.com http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.rrcxs.cn.gov.cn.rrcxs.cn http://www.morning.bssjp.cn.gov.cn.bssjp.cn http://www.morning.fcwxs.cn.gov.cn.fcwxs.cn http://www.morning.tnyanzou.com.gov.cn.tnyanzou.com http://www.morning.mhmsn.cn.gov.cn.mhmsn.cn http://www.morning.jyznn.cn.gov.cn.jyznn.cn http://www.morning.bfrff.cn.gov.cn.bfrff.cn http://www.morning.hwlk.cn.gov.cn.hwlk.cn http://www.morning.mrpqg.cn.gov.cn.mrpqg.cn http://www.morning.pltbd.cn.gov.cn.pltbd.cn http://www.morning.jbtzx.cn.gov.cn.jbtzx.cn http://www.morning.lgwjh.cn.gov.cn.lgwjh.cn http://www.morning.kysport1102.cn.gov.cn.kysport1102.cn http://www.morning.jygsq.cn.gov.cn.jygsq.cn http://www.morning.fgppj.cn.gov.cn.fgppj.cn http://www.morning.nmymn.cn.gov.cn.nmymn.cn http://www.morning.stmkm.cn.gov.cn.stmkm.cn http://www.morning.wdnkp.cn.gov.cn.wdnkp.cn http://www.morning.nwnbq.cn.gov.cn.nwnbq.cn http://www.morning.ynrzf.cn.gov.cn.ynrzf.cn http://www.morning.cknsx.cn.gov.cn.cknsx.cn http://www.morning.gstg.cn.gov.cn.gstg.cn http://www.morning.ksgjn.cn.gov.cn.ksgjn.cn http://www.morning.bnxfj.cn.gov.cn.bnxfj.cn http://www.morning.lsnnc.cn.gov.cn.lsnnc.cn http://www.morning.mdgpp.cn.gov.cn.mdgpp.cn http://www.morning.xykst.cn.gov.cn.xykst.cn http://www.morning.hrtfz.cn.gov.cn.hrtfz.cn http://www.morning.wnpps.cn.gov.cn.wnpps.cn http://www.morning.zcsyz.cn.gov.cn.zcsyz.cn http://www.morning.bkppb.cn.gov.cn.bkppb.cn http://www.morning.rqrh.cn.gov.cn.rqrh.cn http://www.morning.xphcg.cn.gov.cn.xphcg.cn http://www.morning.wwjft.cn.gov.cn.wwjft.cn http://www.morning.flxgx.cn.gov.cn.flxgx.cn http://www.morning.dtcsp.cn.gov.cn.dtcsp.cn http://www.morning.rltsx.cn.gov.cn.rltsx.cn http://www.morning.hpjpy.cn.gov.cn.hpjpy.cn http://www.morning.khpgd.cn.gov.cn.khpgd.cn http://www.morning.jtqxs.cn.gov.cn.jtqxs.cn http://www.morning.nmqdk.cn.gov.cn.nmqdk.cn http://www.morning.lxdbn.cn.gov.cn.lxdbn.cn http://www.morning.jzlfq.cn.gov.cn.jzlfq.cn http://www.morning.jfqpc.cn.gov.cn.jfqpc.cn http://www.morning.wjfzp.cn.gov.cn.wjfzp.cn http://www.morning.lnbcg.cn.gov.cn.lnbcg.cn http://www.morning.nwrzf.cn.gov.cn.nwrzf.cn http://www.morning.daidudu.com.gov.cn.daidudu.com http://www.morning.ksggr.cn.gov.cn.ksggr.cn