internal static SafeHResource GetTransactionManagerClusterResource(string virtualServerName, out string[] nodes)
        {
            nodes = null;

#pragma warning suppress 56523
            SafeHCluster hCluster = SafeNativeMethods.OpenCluster(null);
            if (hCluster.IsInvalid)
            {
                return null;
            }

            using (hCluster)
            {
                //W2k3 cluster
                if (Utilities.OSMajor <= 5)
                {
                    if (Utilities.IsLocalMachineName(virtualServerName))
                    {
                        virtualServerName = GetClusterName(hCluster);
                    }
                }
#pragma warning suppress 56523
                SafeHClusEnum hEnum = SafeNativeMethods.ClusterOpenEnum(hCluster, ClusterEnum.Resource);
                if (hEnum.IsInvalid)
                {
                    return null;
                }

                using (hEnum)
                {
                    uint index = 0;
                    bool moreToEnumerate;
                    SafeHResource hResource;
                    do
                    {
                        string theResourceName = string.Empty; 
                        moreToEnumerate = GetResourceFromEnumeration(hCluster, hEnum, index, out hResource, out theResourceName);
                        if (moreToEnumerate)
                        {                            
                            if (IsTransactionManager(hResource))
                            {
                                string networkName = GetResourceNetworkName(hResource);
                                Utilities.Log("Resource network name: " + networkName);
                                if (Utilities.SafeCompare(networkName, virtualServerName))
                                {
                                    nodes = GetClusterNodes(hCluster);
                                    return hResource;
                                }
                            }
                            hResource.Dispose();
                            index++;
                        }
                    } while (moreToEnumerate);
                }
            }

            return null;
        }
        internal static bool ResolveVirtualServerName(string machineName, string dtcResourceName, out string virtualServer)
        {
            virtualServer = string.Empty;
#pragma warning suppress 56523
            SafeHCluster hCluster = SafeNativeMethods.OpenCluster(Utilities.IsLocalMachineName(machineName) ? null : machineName);
            if (hCluster.IsInvalid)
            {
                return false;
            }

            using (hCluster)
            {
#pragma warning suppress 56523
                SafeHClusEnum hEnum = SafeNativeMethods.ClusterOpenEnum(hCluster, ClusterEnum.Resource);
                if (hEnum.IsInvalid)
                {
                    return false;
                }

                using (hEnum)
                {
                    uint index = 0;
                    bool moreToEnumerate;
                    SafeHResource hResource;
                    do
                    {
                        string theResourceName = string.Empty;
                        moreToEnumerate = GetResourceFromEnumeration(hCluster, hEnum, index, out hResource, out theResourceName);
                        if (moreToEnumerate)
                        {
                            if (IsTransactionManager(hResource))
                            {
                                if (string.CompareOrdinal(theResourceName, dtcResourceName) == 0)
                                {
                                    virtualServer = GetResourceNetworkName(hResource);
                                    return true;
                                }
                            }
                            hResource.Dispose();
                            index++;
                        }
                    } while (moreToEnumerate);
                }
            }
            return false;
        }
        static string[] GetClusterNodes(SafeHCluster hCluster)
        {
#pragma warning suppress 56523
            SafeHClusEnum hEnum = SafeNativeMethods.ClusterOpenEnum(hCluster, ClusterEnum.Node);
            if (hEnum.IsInvalid)
            {
                return null;
            }

            List<string> nodeList = new List<string>(2); // 2 nodes are a typical cluster configuration            

            using (hEnum)
            {
                uint ret, index = 0;
                do
                {
                    uint type, cch = 0;
                    ret = SafeNativeMethods.ClusterEnum(hEnum, index, out type, null, ref cch);
                    if (ret == SafeNativeMethods.ERROR_NO_MORE_ITEMS)
                    {
                        break;
                    }
                    else if (ret == SafeNativeMethods.ERROR_SUCCESS || ret == SafeNativeMethods.ERROR_MORE_DATA)
                    {
                        StringBuilder sb = new StringBuilder((int)(++cch));
                        ret = SafeNativeMethods.ClusterEnum(hEnum, index, out type, sb, ref cch);
                        if (ret == SafeNativeMethods.ERROR_SUCCESS)
                        {
                            Utilities.Log("Found a node: [" + sb.ToString() + "]");
                            nodeList.Add(sb.ToString());
                        }
                    }
                    index++;
                } while (ret == SafeNativeMethods.ERROR_SUCCESS);
            }

            return nodeList.ToArray();
        }