i have some code which queries BIOS information from a Win based PC. The
code is based on microsofts code at msdn.
(eq. http://msdn.microsoft.com/en-us/library/aa390424%28VS.85%29.aspx)
This worked fine so far
Now i have to run this code on a QSeven Board running Windows XP embedded,
my code crashes.
.....
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_ComputerSystem"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
if (!lAlreadyInit)
::CoUninitialize();
_DBG(printf("Error in %s(%d) : %X\n",__FILE__,__LINE__,hres));
_DBG(fflush(0));
return hres;
}
_DBG(printf("%s(%d) reached\n",__FILE__,__LINE__)); // 09-12-15 | MS |
##!!!@@@
while (pEnumerator)
{
_DBG(printf("%s(%d) reached\n",__FILE__,__LINE__)); // 09-12-15 | MS
| ##!!!@@@
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
hres = pEnumerator->Next(WBEM_INFINITE, 1,&pclsObj, &uReturn);
_DBG(printf("%s(%d) reached\n",__FILE__,__LINE__)); // 09-12-15 |
MS | ##!!!@@@ <<<---------- line 518
_DBG(printf("uReturn=%d, hres=%X\n",uReturn,hres));
LCCrt_chk_XEN.cpp(518) reached
uReturn=1, hres=0
looks ok.
if(0 == uReturn)
{
_DBG(printf("%s(%d) reached\n",__FILE__,__LINE__)); // 09-12-15
| MS | ##!!!@@@
break;
}
VARIANT vtProp;
hres = pclsObj->Get(L"Manufacturer", 0, &vtProp, 0, 0);
_DBG(printf("%s(%d) reached\n",__FILE__,__LINE__)); // 09-12-15 |
MS | ##!!!@@@ <<---------- line 530
_DBG(printf("hres=%X,ptr=%p\n",hres,vtProp.bstrVal));
LCCrt_chk_XEN.cpp(530) reached
hres=0,ptr=00000016
this does not look good. as next statement i interpret the vtProp.bstrVal
and .... this will crash. (0x16 is not a good pointer).
_DBG(printf("System::Hersteller =
%s<%s>\n",(char*)_bstr_t(vtProp.bstrVal,true),"Xen"));
anyone with an idea?
i attach the base sample, this is not exactly the code which is shown above,
but is the base for the above code and traps in exactly the same way.
--
mit freundlichen Gr��en
mario semo