public RegistryKey CreateSubKey(RegistryKey rkey, string keyName) { IntPtr handle = Win32RegistryApi.GetHandle(rkey); IntPtr intPtr; int num = Win32RegistryApi.RegCreateKey(handle, keyName, out intPtr); if (num == 1018) { throw RegistryKey.CreateMarkedForDeletionException(); } if (num != 0) { this.GenerateException(num); } return(new RegistryKey(intPtr, Win32RegistryApi.CombineName(rkey, keyName), true)); }
public RegistryKey OpenSubKey(RegistryKey rkey, string keyName, bool writable) { int num = 131097; if (writable) { num |= 131078; } IntPtr handle = Win32RegistryApi.GetHandle(rkey); IntPtr intPtr; int num2 = Win32RegistryApi.RegOpenKeyEx(handle, keyName, IntPtr.Zero, num, out intPtr); if (num2 == 2 || num2 == 1018) { return(null); } if (num2 != 0) { this.GenerateException(num2); } return(new RegistryKey(intPtr, Win32RegistryApi.CombineName(rkey, keyName), writable)); }