title: CoInitializeSecurity error
body: <p>I have an .exe that loads 1.dll and 1.dll loads 1_1.dll.
  In the .exe I create multiple threads, from one of them I call a function that calls upon a 1.dll function that between other things .. calls a function from 1_1.dll that fails in doing this:</p>
  <pre><code>//  Initialize COM.
      HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
      if( FAILED(hr) )
      {
          //m_iStatus = ERROR_COINITIALIZE_EX;
          return;
      }
      //  Set general COM security levels.
      hr = CoInitializeSecurity(
          NULL,
          -1,
          NULL,
          NULL,
          RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
          RPC_C_IMP_LEVEL_IMPERSONATE,
          NULL,
          0,
          NULL);
      if( FAILED(hr) )
      {
          CoUninitialize();
          //m_iStatus = ERROR_COINITIALIZE_SEC;
          return;
      }
  </code></pre>
  <p>It falis on the call to CoInitializeSecurity with this message:</p>
  <p><strong>Security must be initialized before any interfaces are marshalled or unmarshalled. It cannot be changed once initialized.</strong></p>
  <p>Can anyone expalin me what is happening here, what am I doing wrong and how should I fix this?</p>