2 zw1988116 zw1988116 于 2014.02.27 13:26 提问

Windows Embeded 8 WMI C++ 问题 ,好像是没找Enable到该方法,会是什么原因呢

提问者悬赏:10分 | ZW1988116 | 分类:C/C++ | 浏览5次
IWbemLocator pLocator = NULL;
IWbemServices *pNamespace = 0;
//IWbemClassObject * pClass = NULL;
// IWbemClassObject * pOutInst = NULL;
// IWbemClassObject * pInClass = NULL;
IWbemCallResult * ppCallResult = NULL;
//IWbemClassObject * pInst = NULL;
BSTR path = SysAllocString(L"root\standardcimv2\embedded");
BSTR ClassPath = SysAllocString(L"UWF_Filter");
BSTR MethodName = SysAllocString(L"Enable");
HRESULT hr = CoInitialize(0);
hr = CoInitializeSecurity(NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_PKT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
NULL);
hr=CoCreateInstance(CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator,
(LPVOID
)&pLocator);
hr=pLocator->ConnectServer(path,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
&pNamespace);

hr=pNamespace->ExecMethod(ClassPath,MethodName,0,NULL,NULL,NULL,&ppCallResult);
SysFreeString(path);
SysFreeString(ClassPath);
SysFreeString(MethodName);
pClass->Release();
//pInst->Release();
//pInClass->Release();
//ppCallResult->Release();
pNamespace->Release();
pLocator->Release();
CoUninitialize();

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!