MsdtcWrapper(string machineName, string virtualServerName, ConfigurationProvider configProvider)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            this.machineName       = machineName;
            this.virtualServerName = virtualServerName;
            this.configProvider    = configProvider;

            this.proxy = null;

            int hr;

            string hostName = GetTransactionManagerHostName(machineName, virtualServerName);

            if (IsLongHornClusterLocalDtc(machineName, virtualServerName))
            {
                SafeNativeMethods.OLE_TM_CONFIG_PARAMS_V2 configParams = new SafeNativeMethods.OLE_TM_CONFIG_PARAMS_V2();
                configParams.dwVersion = SafeNativeMethods.OLE_TM_CONFIG_VERSION_2;
                configParams.pwszClusterResourceName = "LOCAL";

                hr = SafeNativeMethods.DtcGetTransactionManagerEx_WithConfigParams(
                    hostName,
                    string.Empty,
                    ref IDtcNetworkAccessConfigInterfaceId,
                    SafeNativeMethods.OLE_TM_FLAG_NONE,
                    ref configParams,
                    out proxy);
            }
            else
            {
                hr = SafeNativeMethods.DtcGetTransactionManagerEx(
                    hostName,
                    string.Empty,
                    ref IDtcNetworkAccessConfigInterfaceId,
                    SafeNativeMethods.OLE_TM_FLAG_NONE,
                    IntPtr.Zero,
                    out proxy);
            }

            if (proxy == null)
            {
                // Chances are we are on a XP machine; even on XP SP2 this interface is not available
                Utilities.Log("Unable to query IDtcNetworkAccessConfig" + hr);

                if (Utilities.IsLocalMachineName(machineName))
                {
                    controller = new System.ServiceProcess.ServiceController("MSDTC");
                }
                else
                {
                    // We do not use ServiceController to control remote services for secuirty concerns - use WMI remote process invocation to do that
                    controller = null;
                }
            }
        }