Initializing DCOM Security

[This is preliminary documentation and subject to change.]

Because CIMOM handles security through DCOM, all temporary consumers that implement IWbemObjectSink to receive notifications must call the COM function CoInitializeSecurity in their process. Calling CoInitializeSecurity grants CIMOM the permission to call into the consumer's process.

Use the following parameters in the CoInitializeSecurity call:

CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,
        RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);

Call CoInitializeSecurity immediately after calling CoInitialize to initialize COM as is shown in the following code sample:

void main(int argc, char **argv)
{
    CoInitializeEx(0, COINIT_MULTITHREADED);
    CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,
        RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
...
}