开发者

CoInitializeEx and CoInitializeSecurity failure

I have a C# method that is calling a C++ method. The C++ method uses WMI, so it calls CoInitializeEx(0, COINIT_MULTITHREAD开发者_JAVA百科ED) and then CoInitializeSecurity etc... before making the WMI select. My Problem, CoInitializeEX if failing with code 2147417850 (RPC_E_CHANGED_MODE)

I tried to create a new STA thread from c# and call the c++ method from this thread (and i disabled the visual studio hosting process), no more error in CoInitilalize, but the error happens in CoInitializeSecurity (2147417831, RPC_E_TOO_LATE).

what is the best solution to correct all this?


I removed both calls, problem solved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜