开发者

CoInitializeEx and CoInitializeSecurity failure

开发者 https://www.devze.com 2023-01-08 03:26 出处:网络
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

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

精彩评论

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