// Token: 0x06000536 RID: 1334 RVA: 0x0001393C File Offset: 0x00011B3C
        private IDistributedStoreKey OpenKeyInternal(string subKeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist)
        {
            AmClusterRegkeyHandle amClusterRegkeyHandle = null;
            AmClusterRegkeyHandle keyHandle             = this.KeyHandle;
            RegSAM regSam = ClusterDbKey.GetRegSam(mode);
            int    num    = ClusapiMethods.ClusterRegOpenKey(keyHandle, subKeyName, regSam, out amClusterRegkeyHandle);

            if (mode == DxStoreKeyAccessMode.CreateIfNotExist && (num == 2 || num == 3))
            {
                uint num2;
                num = ClusapiMethods.ClusterRegCreateKey(keyHandle, subKeyName, 0U, regSam, IntPtr.Zero, out amClusterRegkeyHandle, out num2);
            }
            if (num == 0)
            {
                return(new ClusterDbKey(amClusterRegkeyHandle, this.ClusterHandle));
            }
            if (amClusterRegkeyHandle != null && !amClusterRegkeyHandle.IsInvalid)
            {
                amClusterRegkeyHandle.Dispose();
            }
            amClusterRegkeyHandle = null;
            if (!isIgnoreIfNotExist)
            {
                throw new ClusterApiException("ClusterRegOpenKey", new Win32Exception(num));
            }
            return(null);
        }
        // Token: 0x06000533 RID: 1331 RVA: 0x000138B8 File Offset: 0x00011AB8
        internal static IDistributedStoreKey GetBaseKey(AmClusterHandle clusterHandle, DxStoreKeyAccessMode mode)
        {
            RegSAM regSam = ClusterDbKey.GetRegSam(mode);
            AmClusterRegkeyHandle clusterKey = ClusapiMethods.GetClusterKey(clusterHandle, regSam);

            if (clusterKey == null || clusterKey.IsInvalid)
            {
                throw AmExceptionHelper.ConstructClusterApiExceptionNoErr("GetClusterKey", new object[0]);
            }
            return(new ClusterDbKey(clusterKey, clusterHandle));
        }
示例#3
0
		private void RegisterForChangeNotification(IDistributedStoreKey dsKey, AmClusterNotifyHandle hChange)
		{
			AmClusterRegkeyHandle clusdbKeyHandle = this.GetClusdbKeyHandle(dsKey);
			if (clusdbKeyHandle != null && !clusdbKeyHandle.IsInvalid)
			{
				ClusterNotifyFlags dwFilter = ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE;
				IntPtr dwNotifyKey = (IntPtr)1;
				int num = ClusapiMethods.RegisterClusterNotify(hChange, dwFilter, clusdbKeyHandle, dwNotifyKey);
				if (num != 0)
				{
					NetworkManager.TraceError("RegisterClusterNotify for reg notification 0x{0:X8}", new object[]
					{
						num
					});
					throw AmExceptionHelper.ConstructClusterApiException(num, "RegisterClusterNotify(Network Registry)", new object[0]);
				}
			}
		}
        // Token: 0x06000538 RID: 1336 RVA: 0x00013A44 File Offset: 0x00011C44
        private object GetRaw(AmClusterRegkeyHandle hKey, string valueName, out bool doesValueExist, out RegistryValueKind valueKind)
        {
            IntPtr intPtr = IntPtr.Zero;
            int    num    = 1024;
            object result;

            try
            {
                intPtr = Marshal.AllocHGlobal(num);
                int num2 = ClusapiMethods.ClusterRegQueryValue(hKey, valueName, out valueKind, intPtr, ref num);
                if (num2 == 234)
                {
                    int num3 = 0;
                    do
                    {
                        Marshal.FreeHGlobal(intPtr);
                        intPtr = Marshal.AllocHGlobal(num);
                        num2   = ClusapiMethods.ClusterRegQueryValue(hKey, valueName, out valueKind, intPtr, ref num);
                    }while (num2 == 234 && num3++ < 3);
                }
                if (num2 == 2 || num2 == 1018)
                {
                    doesValueExist = false;
                    result         = null;
                }
                else
                {
                    if (num2 != 0)
                    {
                        throw new ClusterApiException("GetRaw()", new Win32Exception(num2));
                    }
                    doesValueExist = true;
                    result         = this.ParseRegistryValue(valueKind, intPtr, num);
                }
            }
            finally
            {
                if (intPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(intPtr);
                }
            }
            return(result);
        }
 // Token: 0x06000520 RID: 1312 RVA: 0x0001341D File Offset: 0x0001161D
 internal ClusterDbKey(AmClusterRegkeyHandle keyHandle, AmClusterHandle clusterHandle)
 {
     this.KeyHandle     = keyHandle;
     this.ClusterHandle = clusterHandle;
 }