Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

[RESOLVED] VMI Provider convert out parameters

$
0
0
Hi, I need to use some methods of the WMI Provider but, one method has a non stardard out parameter. I am try to convert the out parameters of the function "IWbemServices::ExecMethod", the returned variable "pOutParams" has a CIMTYPE = CIM-ARRAY-OBJECT (8205). If i use the function "IWbemClassObject::GetObjectText" I receive the following value: [abstract] class __PARAMETERS { [Out, EmbeddedInstance("UWF_ExcludedFile"): ToSubClass, ID(0): DisableOverride ToInstance] UWF_ExcludedFile ExcludedFiles[] = { instance of UWF_ExcludedFile { FileName = "\\MyFolder"; }}; [out] uint32 ReturnValue = 0; }; following I post a code snippet: Code: --------- // set up to call the Win32_Process::Create method IEnumWbemClassObject *pEnum = NULL; BSTR ObjectName = SysAllocString(L"GetExclusions"); BSTR ClassName = SysAllocString(L"UWF_Volume"); BSTR bstrQuery = SysAllocString(L"Select * from UWF_Volume"); hres = pSvc->ExecQuery(_bstr_t(L"WQL"), //Query Language bstrQuery, //Query to Execute WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, //Make a semi-synchronous call NULL, //Context &pEnum /*Enumeration Interface*/); hres = WBEM_S_NO_ERROR; ULONG ulReturned; IWbemClassObject *pObj; DWORD retVal = 0; //Get the Next Object from the collection hres = pEnum->Next(WBEM_INFINITE, //Timeout 1, //No of objects requested &pObj, //Returned Object &ulReturned /*No of object returned*/); IWbemClassObject* pClass = NULL; hres = pSvc->GetObject(ClassName, 0, NULL, &pClass, NULL); IWbemClassObject* pInParamsDefinition = NULL; IWbemClassObject* pOutParamsDefinition = NULL; hres = pClass->GetMethod(ObjectName, 0, &pInParamsDefinition, &pOutParamsDefinition); VARIANT pathVariable; VariantInit(&pathVariable); hres = pObj->Get(_bstr_t(L"__PATH"), 0, &pathVariable, NULL, NULL); printf("\npObj Get returned 0x%x:", hres); IWbemClassObject* pOutParams = NULL; if (callType == EXEC_METHOD) { // Execute Method hres = pSvc->ExecMethod(pathVariable.bstrVal, ObjectName, 0, NULL, NULL, &pOutParams, NULL); VARIANT varReturnValue; hres = pOutParams->Get(_bstr_t(L"ReturnValue"), 0, &varReturnValue, NULL, 0); CIMTYPE pType; VARIANT value; hres = pOutParams->Get(_bstr_t(L"ExcludedFiles"), 0, &value, &pType, 0); ;Value has the CIMTYPE = CIM-ARRAY-OBJECT --------- Do You know what do i need to convert this data?

Viewing all articles
Browse latest Browse all 3042

Trending Articles