Error using WMI in 32 bit app in 64 bit OS

116 views
Skip to first unread message

ds

unread,
Feb 4, 2008, 5:10:01 PM2/4/08
to
Hello,

I'm getting an error when setting up my WMI connection. The error I'm
getting is RPC_E_CANTCALLOUT_ININPUTSYNCCALL(0x8001010d) and is returned when
I call IWbemLocator::ConnectServer( ). I've done some reading on the error,
but the proposed solutions in those cases don't seem to be applicable here.
The WMI calls are part of a plugin that runs as a 32 bit process. I don't
get the error if the plugin is run within a 32 bit host application, only
when it is run within a 64 bit host application. To set up WMI I'm using
essentially the exact code pulled from MS's API documentation. Here are the
initialization calls including the ConnectServer call, which generates the
error:

HRESULT hres;

hres = CoInitializeEx(0, COINIT_APARTMENTTHREADED );
if (FAILED(hres))
{
//Error handling
}

hres = CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);


if ((hres != S_OK) && (hres != RPC_E_TOO_LATE))
{
// Error handling
}

IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);

if (FAILED(hres))
{
// Error handling and cleanup
}

IWbemServices *pSvc = NULL;

// Connect to the root\cimv2 namespace with
// the current user and obtain pointer pSvc
// to make IWbemServices calls.
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
NULL, // User name. NULL = current user
NULL, // User password. NULL = current
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
0, // Context object
&pSvc // pointer to IWbemServices proxy
);

if (FAILED(hres))
{
// This is where the error is returned
}

Does anyone have any ideas about what is causing the error and how to solve
it? Thanks in advance for any replies.

Alex

unread,
Feb 21, 2008, 7:58:01 PM2/21/08
to
I was under the impression that the WMI namespace should be "ROOT\\WMI"
instead of "ROOT\\CIMV2"

ds

unread,
Feb 21, 2008, 8:37:00 PM2/21/08
to
Thanks for the reply. I was going from Microsoft's example here:

http://msdn2.microsoft.com/en-us/library/aa390423(VS.85).aspx

dhiraj

unread,
Mar 8, 2013, 3:17:48 AM3/8/13
to
ds wrote on 02/21/2008 20:37 ET :
> Thanks for the reply. I was going from Microsoft's example here:
>
> http://msdn2.microsoft.com/en-us/library/aa390423(VS.85).aspx
>
>
> "Alex" wrote:
>
>> I was under the impression that the WMI namespace should be
>> "ROOTWMI"
>> instead of "ROOTCIMV2"
>> > // Connect to the rootcimv2 namespace with
>> > // the current user and obtain pointer pSvc
>> > // to make IWbemServices calls.
>> > hres = pLoc->ConnectServer(
>> > _bstr_t(L"ROOTCIMV2"), // Object path of WMI namespace
>> > NULL, // User name. NULL = current user
>> > NULL, // User password. NULL = current
>> > 0, // Locale. NULL indicates current
>> > NULL, // Security flags.
>> > 0, // Authority (e.g. Kerberos)
>> > 0, // Context object
>> > &pSvc // pointer to IWbemServices proxy
>> > );
>> >
>> > if (FAILED(hres))
>> > {
>> > // This is where the error is returned
>> > }
>> >
>> > Does anyone have any ideas about what is causing the error and how to
>> solve
>> > it? Thanks in advance for any replies.
>>
>>
>
I am facing the same issue and stuck on it.
Could you please help me on how did you solve the issue ??
Reply all
Reply to author
Forward
0 new messages