Discussion:
ConnectServer .... hangs
(too old to reply)
mario semo
2009-05-04 15:59:24 UTC
Permalink
Hello,

I try to read some BIOS informations with sample code from microsoft.
( http://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx )

this works fine, except... when i try to call my code in a DLLMain
(InitTerm) routine and the operating System is Windows VISTA.
in this case the connect server call simple does not return anymore.

trace1

hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // WMI namespace
NULL, // User name
NULL, // User password
0, // Locale
NULL, // Security flags
0, // Authority
0, // Context object
&pSvc // IWbemServices proxy
);

trace2

i see trace1 but not trace2.

when
a) i call the code from a global static var constructor inside .exe -> no
problem
or
b) when OS!=VISTA : no problem
or
c) when i call the code from anywhere after main() -> no problem

any ideas whats the problem or what i can do against it?
(yes, i know ... global variables are never a good programming technique and
should be avoided, but i would like to understand the problem).

any ideas?
--
mit freundlichen Grüßen

mario semo
boris
2009-05-04 16:29:28 UTC
Permalink
Post by mario semo
QUOTE>>>>>
Warning There are serious limits on what you can do in a DLL entry point.
To provide more complex initialization, create an initialization routine for
the DLL. You can require applications to call the initialization routine
before calling any other routines in the DLL.

<<<QUOTE<<<<<
http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx

Boris
Post by mario semo
Hello,
I try to read some BIOS informations with sample code from microsoft.
( http://msdn.microsoft.com/en-us/library/aa390423(VS.85).aspx )
this works fine, except... when i try to call my code in a DLLMain
(InitTerm) routine and the operating System is Windows VISTA.
in this case the connect server call simple does not return anymore.
trace1
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // WMI namespace
NULL, // User name
NULL, // User password
0, // Locale
NULL, // Security flags
0, // Authority
0, // Context object
&pSvc // IWbemServices proxy
);
trace2
i see trace1 but not trace2.
when
a) i call the code from a global static var constructor inside .exe -> no
problem
or
b) when OS!=VISTA : no problem
or
c) when i call the code from anywhere after main() -> no problem
any ideas whats the problem or what i can do against it?
(yes, i know ... global variables are never a good programming technique
and should be avoided, but i would like to understand the problem).
any ideas?
--
mit freundlichen Grüßen
mario semo
Loading...