public static RegistryKey OpenSubKey(RegistryKey pParentKey, string pSubKeyName, bool pWriteable, eRegWow64Options pOptions) { if (pParentKey == null || GetRegistryKeyHandle(pParentKey).Equals(System.IntPtr.Zero)) { throw new System.Exception("OpenSubKey: Parent key is not open"); } eRegistryRights Rights = eRegistryRights.ReadKey; if (pWriteable) { Rights = eRegistryRights.WriteKey; } System.IntPtr SubKeyHandle; System.Int32 Result = RegOpenKeyEx(GetRegistryKeyHandle(pParentKey), pSubKeyName, 0, (int)Rights | (int)pOptions, out SubKeyHandle); if (Result != 0) { System.ComponentModel.Win32Exception W32ex = new System.ComponentModel.Win32Exception(); throw new System.Exception("OpenSubKey: Exception encountered opening key", W32ex); } return(PointerToRegistryKey(SubKeyHandle, pWriteable, false)); }
public static RegistryKey OpenSubKey(RegistryKey pParentKey, string pSubKeyName, bool pWriteable, eRegWow64Options pOptions) { if (pParentKey == null || GetRegistryKeyHandle(pParentKey).Equals(System.IntPtr.Zero)) throw new System.Exception("OpenSubKey: Parent key is not open"); eRegistryRights Rights = eRegistryRights.ReadKey; if (pWriteable) Rights = eRegistryRights.WriteKey; System.IntPtr SubKeyHandle; System.Int32 Result = RegOpenKeyEx(GetRegistryKeyHandle(pParentKey), pSubKeyName, 0, (int)Rights | (int)pOptions, out SubKeyHandle); if (Result != 0) { System.ComponentModel.Win32Exception W32ex = new System.ComponentModel.Win32Exception(); throw new System.Exception("OpenSubKey: Exception encountered opening key", W32ex); } return PointerToRegistryKey(SubKeyHandle, pWriteable, false); }