int WbemNative.IWbemProviderInit.Initialize(
            string wszUser,
            Int32 lFlags,
            string wszNamespace,
            string wszLocale,
            WbemNative.IWbemServices wbemServices,
            WbemNative.IWbemContext wbemContext,
            WbemNative.IWbemProviderInitSink wbemSink
            )
        {
            if (wbemServices == null || wbemContext == null || wbemSink == null)
            {
                return((int)WbemNative.WbemStatus.WBEM_E_INVALID_PARAMETER);
            }

            try
            {
                MTAExecute(new WaitCallback(this.RelocateWbemServicesRCWToMTA), wbemServices);
                wbemSink.SetStatus((int)WbemNative.tag_WBEM_EXTRA_RETURN_CODES.WBEM_S_INITIALIZED, 0);
            }
            catch (WbemException e)
            {
                wbemSink.SetStatus(e.ErrorCode, 0);
                return(e.ErrorCode);
            }
#pragma warning suppress 56500 // covered by FxCOP
            catch (Exception)
            {
                wbemSink.SetStatus((int)WbemNative.WbemStatus.WBEM_E_FAILED, 0);
                return((int)WbemNative.WbemStatus.WBEM_E_FAILED);
            }
            finally
            {
                // WMI relies on destructor of this interface to perform certain task
                // explicitly release this so that the GC won't hold on to the ref of
                // this after the function
                Marshal.ReleaseComObject(wbemSink);
            }

            return((int)WbemNative.WbemStatus.WBEM_S_NO_ERROR);
        }
 int WbemNative.IWbemProviderInit.Initialize(string wszUser, int lFlags, string wszNamespace, string wszLocale, WbemNative.IWbemServices wbemServices, WbemNative.IWbemContext wbemContext, WbemNative.IWbemProviderInitSink wbemSink)
 {
     if (((wbemServices == null) || (wbemContext == null)) || (wbemSink == null))
     {
         return(-2147217400);
     }
     try
     {
         MTAExecute(new WaitCallback(this.RelocateWbemServicesRCWToMTA), wbemServices);
         wbemSink.SetStatus(0, 0);
     }
     catch (WbemException exception)
     {
         wbemSink.SetStatus(exception.ErrorCode, 0);
         return(exception.ErrorCode);
     }
     catch (Exception)
     {
         wbemSink.SetStatus(-2147217407, 0);
         return(-2147217407);
     }
     finally
     {
         Marshal.ReleaseComObject(wbemSink);
     }
     return(0);
 }