I wrote a C ++ DLL that will be used in C #. The DLL has some function where I call
hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
and the next call
hres = CoInitializeSecurity(
NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_PKT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
NULL
);
There are no errors , then I try to use this DLL in C ++ . But if I call a function from a DLL through a C # application, I see Error (80010106) It is not possible to change the flow mode after installing it. I changed
hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
to
hres = CoInitialize(NULL);
After that, an error message appears after CoInitializeSecurity :
(80010119) Security must be initialized before any
interfaces are marshalled or unmarshalled. It
cannot be changed once initialized.
How to solve this problem?
source
share