// Token: 0x06000225 RID: 549 RVA: 0x0000A09C File Offset: 0x0000829C
        internal static string[] ReadValueNames(AmClusterRegkeyHandle handle)
        {
            List <string> list          = new List <string>();
            int           num           = 1024;
            StringBuilder stringBuilder = new StringBuilder(num);
            int           num2          = 0;
            int           num6;

            for (;;)
            {
                int num3 = num;
                int num4 = 0;
                int num5 = 0;
                num6 = ClusapiMethods.ClusterRegEnumValue(handle, num2, stringBuilder, ref num3, ref num4, IntPtr.Zero, ref num5);
                if (num6 != 0)
                {
                    break;
                }
                string item = stringBuilder.ToString();
                list.Add(item);
                num2++;
            }
            if (num6 != 259)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num6, "ClusterRegEnumValue()", new object[0]);
            }
            return(list.ToArray());
        }
        // Token: 0x06000224 RID: 548 RVA: 0x0000A060 File Offset: 0x00008260
        internal static void Delete(string valueName, AmClusterRegkeyHandle handle)
        {
            int num = ClusapiMethods.ClusterRegDeleteValue(handle, valueName);

            if (num != 2 && num != 3 && num != 1018 && num != 0)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegDeleteValue()", new object[0]);
            }
        }
        // Token: 0x06000221 RID: 545 RVA: 0x00009EA4 File Offset: 0x000080A4
        internal static T Get <T>(string valueName, AmClusterRegkeyHandle hKey, out bool doesValueExist)
        {
            object raw = AmClusterRegProperty.GetRaw(valueName, hKey, out doesValueExist);

            if (!doesValueExist)
            {
                return(default(T));
            }
            return((T)((object)raw));
        }
Пример #4
0
        // Token: 0x060002FB RID: 763 RVA: 0x0000D3B4 File Offset: 0x0000B5B4
        internal static int ClusterRegCreateBatch([In] AmClusterRegkeyHandle hKey, out AmClusterBatchHandle hBatch)
        {
            AmClusterBatchHandle hBatchTmp = null;
            int retCode = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegCreateBatch, string.Format("KeyName = {0}", hKey.Name), delegate
            {
                retCode = ClusapiMethods.ClusterRegCreateBatchInternal(hKey, out hBatchTmp);
                return(retCode);
            });

            hBatch = hBatchTmp;
            return(retCode);
        }
        // Token: 0x06000220 RID: 544 RVA: 0x00009E4C File Offset: 0x0000804C
        internal static T GetBestEffort <T>(string key, AmClusterRegkeyHandle handle, out bool doesKeyExist, out Exception ex)
        {
            T    result          = default(T);
            bool doesKeyExistTmp = false;

            ex = SharedHelper.RunClusterOperation(delegate
            {
                result = AmClusterRegProperty.Get <T>(key, handle, out doesKeyExistTmp);
            });
            doesKeyExist = doesKeyExistTmp;
            return(result);
        }
Пример #6
0
        // Token: 0x060002F3 RID: 755 RVA: 0x0000D114 File Offset: 0x0000B314
        internal static int ClusterRegQueryValue(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName, out RegistryValueKind valueType, IntPtr lpbData, ref int lpcbData)
        {
            int lpcbDataTmp  = lpcbData;
            int valueTypeInt = 0;
            int retCode      = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegQueryValue, string.Format("KeyName = {0} lpszValueName = {1}", RegKeyHandle.Name, lpszValueName), delegate
            {
                retCode = ClusapiMethods.ClusterRegQueryValueInternal(RegKeyHandle, lpszValueName, out valueTypeInt, lpbData, ref lpcbDataTmp);
                return(retCode);
            });

            valueType = (RegistryValueKind)valueTypeInt;
            lpcbData  = lpcbDataTmp;
            return(retCode);
        }
Пример #7
0
        // Token: 0x060002F7 RID: 759 RVA: 0x0000D28C File Offset: 0x0000B48C
        internal static int ClusterRegDeleteValue(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName)
        {
            int num = 0;
            RegistryValueKind registryValueKind;
            int retCode = ClusapiMethods.ClusterRegQueryValue(RegKeyHandle, lpszValueName, out registryValueKind, IntPtr.Zero, ref num);

            if (retCode == 0)
            {
                retCode = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegDeleteValue, string.Format("KeyName = {0} lpszValueName = {1}", RegKeyHandle.Name, lpszValueName), delegate
                {
                    retCode = ClusapiMethods.ClusterRegDeleteValueUnsafe(RegKeyHandle, lpszValueName);
                    return(retCode);
                });
            }
            return(retCode);
        }
Пример #8
0
        // Token: 0x060002F5 RID: 757 RVA: 0x0000D1D0 File Offset: 0x0000B3D0
        internal static int ClusterRegSetValue(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName, RegistryValueKind dwType, IntPtr lpbData, int cbData)
        {
            string text    = "ClusterRegSetValue";
            string text2   = string.Format("KeyName = {0} lpszValueName = {1}", RegKeyHandle.Name, lpszValueName);
            int    retCode = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegSetValue, text2, delegate
            {
                retCode = ClusapiMethods.ClusterRegSetValueInternal(RegKeyHandle, lpszValueName, dwType, lpbData, cbData);
                return(retCode);
            });

            if (retCode != 0)
            {
                ReplayCrimsonEvents.CriticalClusterApiFailed.Log <string, string, int>(text, text2, retCode);
            }
            return(retCode);
        }
Пример #9
0
        // Token: 0x060002EF RID: 751 RVA: 0x0000CF50 File Offset: 0x0000B150
        internal static int ClusterRegOpenKey(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey, RegSAM samDesired, out AmClusterRegkeyHandle phkResult)
        {
            AmClusterRegkeyHandle phkResultTmp = null;
            int retCode = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegOpenKey, string.Format("RootKeyName = {0} SubKey = {1}", RegKeyHandle.Name, lpszSubKey), delegate
            {
                retCode = ClusapiMethods.ClusterRegOpenKeyInternal(RegKeyHandle, lpszSubKey, samDesired, out phkResultTmp);
                if (retCode == 0 && phkResultTmp != null)
                {
                    phkResultTmp.Name = RegKeyHandle.Name + "\\" + lpszSubKey;
                }
                return(retCode);
            });

            phkResult = phkResultTmp;
            return(retCode);
        }
Пример #10
0
        // Token: 0x060002A4 RID: 676 RVA: 0x0000CB9C File Offset: 0x0000AD9C
        public static int ClusterRegDeleteKey(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey)
        {
            AmClusterRegkeyHandle amClusterRegkeyHandle = null;
            int retCode = ClusapiMethods.ClusterRegOpenKey(RegKeyHandle, lpszSubKey, RegSAM.Read, out amClusterRegkeyHandle);

            if (retCode == 0)
            {
                amClusterRegkeyHandle.Dispose();
                retCode = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegDeleteKey, string.Format("RootKey = {0} Subkey = {1}", RegKeyHandle.Name, lpszSubKey), delegate
                {
                    retCode = ClusapiMethods.ClusterRegDeleteKeyUnsafe(RegKeyHandle, lpszSubKey);
                    return(retCode);
                });
            }
            return(retCode);
        }
        // Token: 0x06000222 RID: 546 RVA: 0x00009ED0 File Offset: 0x000080D0
        internal static object GetRaw(string valueName, AmClusterRegkeyHandle hKey, out bool doesValueExist)
        {
            IntPtr intPtr = IntPtr.Zero;
            int    num    = 1024;
            object result;

            try
            {
                intPtr = Marshal.AllocHGlobal(num);
                RegistryValueKind valueType;
                int num2 = ClusapiMethods.ClusterRegQueryValue(hKey, valueName, out valueType, intPtr, ref num);
                if (num2 == 234)
                {
                    int num3 = 0;
                    do
                    {
                        Marshal.FreeHGlobal(intPtr);
                        intPtr = Marshal.AllocHGlobal(num);
                        num2   = ClusapiMethods.ClusterRegQueryValue(hKey, valueName, out valueType, intPtr, ref num);
                    }while (num2 == 234 && num3++ < 3);
                }
                if (num2 == 2 || num2 == 1018)
                {
                    doesValueExist = false;
                    result         = null;
                }
                else
                {
                    if (num2 != 0)
                    {
                        throw AmExceptionHelper.ConstructClusterApiException(num2, "ClusterRegQueryValue()", new object[0]);
                    }
                    doesValueExist = true;
                    result         = AmClusterRegProperty.ParseRegistryValue(valueType, intPtr, num);
                }
            }
            finally
            {
                if (intPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(intPtr);
                }
            }
            return(result);
        }
Пример #12
0
        // Token: 0x060002F1 RID: 753 RVA: 0x0000D048 File Offset: 0x0000B248
        internal static int ClusterRegCreateKey(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey, uint options, RegSAM samDesired, IntPtr securityAttributes, out AmClusterRegkeyHandle phkResult, out uint disposition)
        {
            AmClusterRegkeyHandle phkResultTmp = null;
            uint dispositionTmp = 0U;
            int  retCode        = ClusApiHook.CallBackDriver(ClusApiHooks.ClusterRegCreateKey, string.Format("RootKeyName = {0} SubKey = {1}", RegKeyHandle.Name, lpszSubKey), delegate
            {
                retCode = ClusapiMethods.ClusterRegCreateKeyInternal(RegKeyHandle, lpszSubKey, options, samDesired, securityAttributes, out phkResultTmp, out dispositionTmp);
                if (retCode == 0 && phkResultTmp != null)
                {
                    phkResultTmp.Name = RegKeyHandle.Name + "\\" + lpszSubKey;
                }
                return(retCode);
            });

            phkResult   = phkResultTmp;
            disposition = dispositionTmp;
            return(retCode);
        }
Пример #13
0
        // Token: 0x060002ED RID: 749 RVA: 0x0000CE80 File Offset: 0x0000B080
        internal static AmClusterRegkeyHandle GetClusterKey(AmClusterHandle clusterHandle, RegSAM samDesired)
        {
            AmClusterRegkeyHandle handle = null;

            ClusApiHook.CallBackDriver(ClusApiHooks.GetClusterKey, string.Format("clusterHandle = {0} samDesired = {1}", clusterHandle, samDesired), delegate
            {
                int result = 0;
                handle     = ClusapiMethods.GetClusterKeyInternal(clusterHandle, samDesired);
                if (handle == null || handle.IsInvalid)
                {
                    result = Marshal.GetLastWin32Error();
                }
                else
                {
                    handle.Name = "HKLM:\\Cluster";
                }
                return(result);
            });
            return(handle);
        }
Пример #14
0
 private static extern int ClusterRegDeleteValueUnsafe(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName);
Пример #15
0
 private static extern int ClusterRegSetValueInternal(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName, RegistryValueKind dwType, IntPtr lpbData, int cbData);
Пример #16
0
 private static extern int ClusterRegQueryValueInternal(AmClusterRegkeyHandle RegKeyHandle, string lpszValueName, out int lpdwValueType, IntPtr lpbData, ref int lpcbData);
Пример #17
0
 public static extern int ClusterRegEnumKey(AmClusterRegkeyHandle RegKeyHandle, int dwIndex, StringBuilder lpszName, ref int lpcchName, IntPtr lpftLastWriteTime);
Пример #18
0
 private static extern int ClusterRegCreateKeyInternal(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey, uint options, RegSAM samDesired, IntPtr securityAttributes, out AmClusterRegkeyHandle phkResult, out uint disposition);
Пример #19
0
 public static extern int ClusterRegDeleteKeyUnsafe(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey);
Пример #20
0
 public static extern int ClusterRegEnumValue(AmClusterRegkeyHandle RegKeyHandle, int dwIndex, StringBuilder lpszName, ref int lpcchName, ref int lpdwType, IntPtr lpData, ref int lpcbData);
Пример #21
0
 private static extern int ClusterRegCreateBatchInternal([In] AmClusterRegkeyHandle hKey, out AmClusterBatchHandle hBatch);
Пример #22
0
 private static extern int ClusterRegOpenKeyInternal(AmClusterRegkeyHandle RegKeyHandle, string lpszSubKey, RegSAM samDesired, out AmClusterRegkeyHandle phkResult);
        // Token: 0x0600021F RID: 543 RVA: 0x00009B74 File Offset: 0x00007D74
        internal static void Set <T>(string key, T oValue, AmClusterRegkeyHandle handle)
        {
            IntPtr intPtr  = IntPtr.Zero;
            IntPtr intPtr2 = IntPtr.Zero;

            try
            {
                int num;
                if (oValue is string)
                {
                    string text = oValue as string;
                    intPtr = Marshal.StringToHGlobalUni(text);
                    num    = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.String, intPtr, (text.Length + 1) * 2);
                }
                else if (oValue is string[])
                {
                    string[] array   = oValue as string[];
                    int      num2    = 0;
                    IntPtr   intPtr3 = IntPtr.Zero;
                    foreach (string text2 in array)
                    {
                        num2 += text2.Length + 1;
                    }
                    num2   *= 2;
                    intPtr2 = Marshal.AllocHGlobal(num2);
                    intPtr3 = intPtr2;
                    foreach (string text3 in array)
                    {
                        Marshal.Copy(text3.ToCharArray(), 0, intPtr3, text3.Length);
                        intPtr3 = new IntPtr(intPtr3.ToInt64() + (long)(text3.Length * 2));
                        Marshal.WriteInt16(intPtr3, '\0');
                        intPtr3 = new IntPtr(intPtr3.ToInt64() + 2L);
                    }
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.MultiString, intPtr2, num2);
                }
                else if (oValue is byte[])
                {
                    byte[] array4 = oValue as byte[];
                    intPtr2 = Marshal.AllocHGlobal(array4.Length);
                    Marshal.Copy(array4, 0, intPtr2, array4.Length);
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.Binary, intPtr2, array4.Length);
                }
                else if (oValue is int)
                {
                    intPtr2 = Marshal.AllocHGlobal(4);
                    Marshal.WriteInt32(intPtr2, Convert.ToInt32(oValue));
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.DWord, intPtr2, 4);
                }
                else if (oValue is uint)
                {
                    intPtr2 = Marshal.AllocHGlobal(4);
                    Marshal.WriteInt32(intPtr2, (int)Convert.ToUInt32(oValue));
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.DWord, intPtr2, 4);
                }
                else if (oValue is long)
                {
                    intPtr2 = Marshal.AllocHGlobal(8);
                    Marshal.WriteInt64(intPtr2, Convert.ToInt64(oValue));
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.QWord, intPtr2, 8);
                }
                else
                {
                    if (!(oValue is ulong))
                    {
                        throw new ClusterUnsupportedRegistryTypeException(typeof(T).ToString());
                    }
                    intPtr2 = Marshal.AllocHGlobal(8);
                    Marshal.WriteInt64(intPtr2, (long)Convert.ToUInt64(oValue));
                    num = ClusapiMethods.ClusterRegSetValue(handle, key, RegistryValueKind.QWord, intPtr2, 8);
                }
                if (num != 0)
                {
                    throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegSetValue()", new object[0]);
                }
            }
            finally
            {
                if (intPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(intPtr);
                }
                if (intPtr2 != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(intPtr2);
                }
            }
        }