static private void ValidateKeyOptions(RegistryOptions options) { if (options < RegistryOptions.None || options > RegistryOptions.Volatile) { ThrowHelper.ThrowArgumentException(SR.Argument_InvalidRegistryOptionsCheck, nameof(options)); } }
public RegistryCacheInitializer(IConfiguration configuration, IHostEnvironment hostEnvironment, ILoggerFactory loggerFactory, IOptions <RegistryOptions> registryOptionsAccessor, RegistryCacheSingleton registryCacheSingleton) { this.configuration = configuration; this.hostEnvironment = hostEnvironment; this.loggerFactory = loggerFactory; registryOptions = registryOptionsAccessor.Value; this.registryCacheSingleton = registryCacheSingleton; }
//============================================================ // <T>创建一个新子项或打开一个现有子项以进行写访问。</T> // // @param path 要创建或打开的子项的名称或路径, // @param check 类型检查, // @param option 项的选项 //============================================================ public FRegister CreateSubKey(string path, RegistryKeyPermissionCheck check, RegistryOptions options) { FRegister register = new FRegister(); RegistryKey key = _rootNode.CreateSubKey(path, check, options); register.Key = key; return(register); }
private static extern int RegCreateKeyEx( SafeRegistryHandle hKey, string lpSubKey, int Reserved, string lpClass, RegistryOptions dwOptions, RegistryRights samDesired, IntPtr lpSecurityAttributes, out SafeRegistryHandle phkResult, out int lpdwDisposition);
public void RegistryOptionsTestsValid(bool alreadyExists, RegistryOptions options) { string subkey = "TEST_" + options.ToString(); if (alreadyExists) { TestRegistryKey.CreateSubKey(subkey, true, options); } Assert.NotNull(TestRegistryKey.CreateSubKey(subkey, true, options)); }
public void RegistryOptionsTestsValid(bool alreadyExists, RegistryOptions options) { string subkey = "TEST_" + options.ToString(); if (alreadyExists) { TestRegistryKey.CreateSubKey(subkey, true, options).Dispose(); } using RegistryKey created = TestRegistryKey.CreateSubKey(subkey, true, options); Assert.NotNull(created); }
public RegistryKey CreateSubKey(RegistryKey rkey, string keyName, RegistryOptions options) { IntPtr handle = GetHandle(rkey); IntPtr subKeyHandle; int disposition; int result = RegCreateKeyEx(handle, keyName, 0, IntPtr.Zero, options == RegistryOptions.Volatile ? RegOptionsVolatile : RegOptionsNonVolatile, OpenRegKeyRead | OpenRegKeyWrite, IntPtr.Zero, out subKeyHandle, out disposition); if (result != Win32ResultCode.Success) { GenerateException(result); } return(new RegistryKey(subKeyHandle, CombineName(rkey, keyName), true)); }
private RegistryKey CreateSubKeyInternal(string subkey, bool writable, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!_remoteKey) { RegistryKey key = InternalOpenSubKey(subkey, writable); if (key != null) { // Key already exits return(key); } } return(CreateSubKeyInternalCore(subkey, writable, registryOptions)); }
public void RegistryOptionsTestsInvalid() { //Options is -1 Action a = () => { RegistryOptions options = (RegistryOptions)(-1); RegistryKey rk2 = _rk.CreateSubKey(_testKeyName, true, options); }; Assert.Throws <ArgumentException>(() => { a(); }); //Options is 3 Action a1 = () => { RegistryOptions options = (RegistryOptions)(3); RegistryKey rk2 = _rk.CreateSubKey(_testKeyName, true, options); }; Assert.Throws <ArgumentException>(() => { a1(); }); }
private unsafe RegistryKey CreateSubKeyInternalCore(string subkey, bool writable, RegistryOptions registryOptions) { Interop.mincore.SECURITY_ATTRIBUTES secAttrs = default(Interop.mincore.SECURITY_ATTRIBUTES); int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Interop.mincore.RegCreateKeyEx(_hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, (int)GetRegistryKeyRights(writable) | (int)_regView, ref secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, writable, false, _remoteKey, false, _regView); if (subkey.Length == 0) { key._keyName = _keyName; } else { key._keyName = _keyName + "\\" + subkey; } return key; } else if (ret != 0) // syscall failed, ret is an error code. { Win32Error(ret, _keyName + "\\" + subkey); // Access denied? } Debug.Fail("Unexpected code path in RegistryKey::CreateSubKey"); return null; }
public virtual IServiceRegistry CreateRegistry(RegistryOptions options) { return new GenericRegistry(options.RegistryDataStore, options.RegistryNotify, options.Watcher); }
public RegistryKey CreateSubKey (string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity) { return CreateSubKey (subkey, permissionCheck, registryOptions); }
public RegistryKey CreateSubKey (RegistryKey rkey, string keyname, RegistryOptions options) { return CreateSubKey (rkey, keyname, true, options == RegistryOptions.Volatile); }
private unsafe RegistryKey CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); ValidateKeyMode(permissionCheck); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!remoteKey) { RegistryKey key = InternalOpenSubKey(subkey, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree)); if (key != null) { // Key already exits CheckPermission(RegistryInternalCheck.CheckSubKeyWritePermission, subkey, false, RegistryKeyPermissionCheck.Default); CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key.checkMode = permissionCheck; return key; } } CheckPermission(RegistryInternalCheck.CheckSubKeyCreatePermission, subkey, false, RegistryKeyPermissionCheck.Default); Win32Native.SECURITY_ATTRIBUTES secAttrs = null; #if FEATURE_MACL RegistrySecurity registrySecurity = (RegistrySecurity)registrySecurityObj; // For ACL's, get the security descriptor from the RegistrySecurity. if (registrySecurity != null) { secAttrs = new Win32Native.SECURITY_ATTRIBUTES(); secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); byte[] sd = registrySecurity.GetSecurityDescriptorBinaryForm(); // We allocate memory on the stack to improve the speed. // So this part of code can't be refactored into a method. byte* pSecDescriptor = stackalloc byte[sd.Length]; Buffer.Memcpy(pSecDescriptor, 0, sd, 0, sd.Length); secAttrs.pSecurityDescriptor = pSecDescriptor; } #endif int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Win32Native.RegCreateKeyEx(hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree) | (int)regView, secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree), false, remoteKey, false, regView); CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key.checkMode = permissionCheck; if (subkey.Length == 0) key.keyName = keyName; else key.keyName = keyName + "\\" + subkey; return key; } else if (ret != 0) // syscall failed, ret is an error code. Win32Error(ret, keyName + "\\" + subkey); // Access denied? BCLDebug.Assert(false, "Unexpected code path in RegistryKey::CreateSubKey"); return null; }
public RegistryKey CreateSubKey(String subkey, bool writable, RegistryOptions options) { return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, options); }
static private void ValidateKeyOptions(RegistryOptions options) { if (options < RegistryOptions.None || options > RegistryOptions.Volatile) { ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidRegistryOptionsCheck, ExceptionArgument.options); } }
private RegistryKey CreateSubKeyInternal(string subkey, bool writable, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!_remoteKey) { RegistryKey key = InternalOpenSubKey(subkey, writable); if (key != null) { // Key already exits return key; } } return CreateSubKeyInternalCore(subkey, writable, registryOptions); }
public virtual IServiceRegistry CreateRegistry(RegistryOptions options) { return(new GenericRegistry(options.RegistryDataStore, options.RegistryNotify, options.Watcher)); }
public IServiceRegistry GetRegistry(RegistryOptions options) { return(CreateRegistry(options)); }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { AssertKeyStillValid(); AssertKeyNameNotNull(subkey); AssertKeyNameLength(subkey); if (!IsWritable) { throw new UnauthorizedAccessException("Cannot write to the registry key."); } return(RegistryApi.CreateSubKey(this, subkey, options)); }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity) { throw new NotImplementedException(); }
private static RegistryKey CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_Registry); }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, System.Security.AccessControl.RegistrySecurity registrySecurity) { return(default(RegistryKey)); }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { return(default(RegistryKey)); }
public RegistryKey CreateSubKey(string subkey, bool writable, RegistryOptions options);
public IServiceRegistry GetRegistry(RegistryOptions options) { return CreateRegistry(options); }
public RegistryKey CreateSubKey(string subkey, bool writable, RegistryOptions options) { return(CreateSubKey(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, options)); }
private unsafe RegistryKey CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); ValidateKeyMode(permissionCheck); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!remoteKey) { RegistryKey key = InternalOpenSubKey(subkey, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree)); if (key != null) { // Key already exits CheckPermission(RegistryInternalCheck.CheckSubKeyWritePermission, subkey, false, RegistryKeyPermissionCheck.Default); CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key.checkMode = permissionCheck; return key; } } CheckPermission(RegistryInternalCheck.CheckSubKeyCreatePermission, subkey, false, RegistryKeyPermissionCheck.Default); Win32Native.SECURITY_ATTRIBUTES secAttrs = null; int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Win32Native.RegCreateKeyEx(hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree) | (int)regView, secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree), false, remoteKey, false, regView); CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key.checkMode = permissionCheck; if (subkey.Length == 0) key.keyName = keyName; else key.keyName = keyName + "\\" + subkey; return key; } else if (ret != 0) // syscall failed, ret is an error code. Win32Error(ret, keyName + "\\" + subkey); // Access denied? BCLDebug.Assert(false, "Unexpected code path in RegistryKey::CreateSubKey"); return null; }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity) { return(CreateSubKey(subkey, permissionCheck, registryOptions)); }
public RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { return CreateSubKeyInternal(subkey, permissionCheck, null, options); }
public RegistryCacheUpdater(RegistryCacheSingleton currentRegistryCache, ILogger <RegistryCacheUpdater> logger, IOptions <RegistryOptions> registryOptionsAccessor) { _currentRegistryCache = currentRegistryCache; _logger = logger; _registryOptions = registryOptionsAccessor.Value; }
public unsafe RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity) { return CreateSubKeyInternal(subkey, permissionCheck, registrySecurity, registryOptions); }
public void RegistryOptionsTestsValid(bool alreadyExists, RegistryOptions options) { string subkey = "TEST_" + options.ToString(); if (alreadyExists) { TestRegistryKey.CreateSubKey(subkey); } Assert.NotNull(TestRegistryKey.CreateSubKey(subkey)); }
private static void ValidateKeyOptions(RegistryOptions options) { }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, System.Security.AccessControl.RegistrySecurity registrySecurity) { return default(RegistryKey); }
public RegistryKey CreateSubKey (string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { AssertKeyStillValid (); AssertKeyNameNotNull (subkey); AssertKeyNameLength (subkey); if (!IsWritable) throw new UnauthorizedAccessException ("Cannot write to the registry key."); return RegistryApi.CreateSubKey (this, subkey, options); }
private unsafe RegistryKey CreateSubKeyInternal(string subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); ValidateKeyMode(permissionCheck); this.EnsureWriteable(); subkey = FixupName(subkey); if (!this.remoteKey) { RegistryKey key = this.InternalOpenSubKey(subkey, permissionCheck != RegistryKeyPermissionCheck.ReadSubTree); if (key != null) { this.CheckPermission(RegistryInternalCheck.CheckSubKeyWritePermission, subkey, false, RegistryKeyPermissionCheck.Default); this.CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key.checkMode = permissionCheck; return key; } } this.CheckPermission(RegistryInternalCheck.CheckSubKeyCreatePermission, subkey, false, RegistryKeyPermissionCheck.Default); Win32Native.SECURITY_ATTRIBUTES structure = null; RegistrySecurity security = (RegistrySecurity) registrySecurityObj; if (security != null) { structure = new Win32Native.SECURITY_ATTRIBUTES { nLength = Marshal.SizeOf(structure) }; byte[] securityDescriptorBinaryForm = security.GetSecurityDescriptorBinaryForm(); byte* pDest = stackalloc byte[(IntPtr) securityDescriptorBinaryForm.Length]; Buffer.memcpy(securityDescriptorBinaryForm, 0, pDest, 0, securityDescriptorBinaryForm.Length); structure.pSecurityDescriptor = pDest; } int lpdwDisposition = 0; SafeRegistryHandle hkResult = null; int errorCode = Win32Native.RegCreateKeyEx(this.hkey, subkey, 0, null, (int) registryOptions, GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree, this.regView), structure, out hkResult, out lpdwDisposition); if ((errorCode == 0) && !hkResult.IsInvalid) { RegistryKey key2 = new RegistryKey(hkResult, permissionCheck != RegistryKeyPermissionCheck.ReadSubTree, false, this.remoteKey, false, this.regView); this.CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key2.checkMode = permissionCheck; if (subkey.Length == 0) { key2.keyName = this.keyName; return key2; } key2.keyName = this.keyName + @"\" + subkey; return key2; } if (errorCode != 0) { this.Win32Error(errorCode, this.keyName + @"\" + subkey); } return null; }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); ValidateKeyMode(permissionCheck); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!_remoteKey) { RegistryKey key = InternalOpenSubKeyWithoutSecurityChecks(subkey, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree)); if (key != null) { // Key already exits key._checkMode = permissionCheck; return(key); } } return(CreateSubKeyInternalCore(subkey, permissionCheck, registryOptions)); }
/// <summary> /// TODO: Add Comment /// </summary> /// <param name="subkey"></param> /// <param name="permissionCheck"></param> /// <param name="registryOptions"></param> /// <param name="registrySecurity"></param> /// <returns></returns> public IRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, IRegistrySecurity registrySecurity) { RegistryKey key = RegistryKeyInstance.CreateSubKey(subkey, permissionCheck, registryOptions, registrySecurity.RegistrySecurityInstance); if (null == key) return null; else return new RegistryKeyWrap(key); }
private unsafe RegistryKey CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES); int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Interop.Advapi32.RegCreateKeyEx(_hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree) | (int)_regView, ref secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree), false, _remoteKey, false, _regView); CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck); key._checkMode = permissionCheck; if (subkey.Length == 0) { key._keyName = _keyName; } else { key._keyName = _keyName + "\\" + subkey; } return(key); } else if (ret != 0) // syscall failed, ret is an error code. { Win32Error(ret, _keyName + "\\" + subkey); // Access denied? } Debug.Fail("Unexpected code path in RegistryKey::CreateSubKey"); return(null); }
private unsafe RegistryKey CreateSubKeyInternal(String subkey, bool writable, RegistryOptions registryOptions) { ValidateKeyOptions(registryOptions); ValidateKeyName(subkey); EnsureWriteable(); subkey = FixupName(subkey); // Fixup multiple slashes to a single slash // only keys opened under read mode is not writable if (!remoteKey) { RegistryKey key = InternalOpenSubKey(subkey, writable); if (key != null) { // Key already exits return key; } } Interop.mincore.SECURITY_ATTRIBUTES secAttrs = default(Interop.mincore.SECURITY_ATTRIBUTES); int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Interop.mincore.RegCreateKeyEx(hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, GetRegistryKeyAccess(writable) | (int)regView, ref secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, writable, false, remoteKey, false, regView); if (subkey.Length == 0) key.keyName = keyName; else key.keyName = keyName + "\\" + subkey; return key; } else if (ret != 0) // syscall failed, ret is an error code. Win32Error(ret, keyName + "\\" + subkey); // Access denied? Debug.Fail("Unexpected code path in RegistryKey::CreateSubKey"); return null; }
public RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { return default(RegistryKey); }
public RegistryKey CreateSubKey(string subkey, bool writable, RegistryOptions options) { return(CreateSubKeyInternal(subkey, writable, options)); }
public virtual RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { return(this.CreateSubKey(subkey, permissionCheck, options, null)); }
static extern int RegCreateKeyEx( SafeRegistryHandle hKey, string lpSubKey, int Reserved, string lpClass, RegistryOptions dwOptions, RegistryRights samDesired, IntPtr lpSecurityAttributes, out SafeRegistryHandle phkResult, out int lpdwDisposition);
/// <summary> /// TODO: Add Comment /// </summary> /// <param name="subkey"></param> /// <param name="permissionCheck"></param> /// <param name="options"></param> /// <returns></returns> public IRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) { RegistryKey key = RegistryKeyInstance.CreateSubKey(subkey, permissionCheck, options); ; if (null == key) return null; else return new RegistryKeyWrap(key); }
public abstract RegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity);
private RegistryKey CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_Registry); }
public void ReadWritePermissionCheckWithRegistryOptionsTestsValid(bool alreadyExists, RegistryOptions options) { string subkey = "TEST_" + options.ToString(); if (alreadyExists) { TestRegistryKey.CreateSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, options); } Assert.NotNull(TestRegistryKey.CreateSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, options)); }
private RegistryKey CreateSubKeyInternalCore(string subkey, bool writable, RegistryOptions registryOptions) { // TODO: Implement this throw new PlatformNotSupportedException(); }
public RegistryKey CreateSubKey (RegistryKey rkey, string keyName, RegistryOptions options) { IntPtr handle = GetHandle (rkey); IntPtr subKeyHandle; int disposition; int result = RegCreateKeyEx (handle , keyName, 0, IntPtr.Zero, options == RegistryOptions.Volatile ? RegOptionsVolatile : RegOptionsNonVolatile, OpenRegKeyRead | OpenRegKeyWrite, IntPtr.Zero, out subKeyHandle, out disposition); if (result == Win32ResultCode.MarkedForDeletion) throw RegistryKey.CreateMarkedForDeletionException (); if (result != Win32ResultCode.Success) GenerateException (result); return new RegistryKey (subKeyHandle, CombineName (rkey, keyName), true); }
public RegistryKey CreateSubKey(RegistryKey rkey, string keyname, RegistryOptions options) { return(CreateSubKey(rkey, keyname, true, options == RegistryOptions.Volatile)); }
public RegistryKey CreateSubKey(string subkey, bool writable, RegistryOptions options) { return CreateSubKeyInternal(subkey, writable, options); }
private unsafe RegistryKey CreateSubKeyInternalCore(string subkey, bool writable, RegistryOptions registryOptions) { Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES); int disposition = 0; // By default, the new key will be writable. SafeRegistryHandle result = null; int ret = Interop.mincore.RegCreateKeyEx(_hkey, subkey, 0, null, (int)registryOptions /* specifies if the key is volatile */, (int)GetRegistryKeyRights(writable) | (int)_regView, ref secAttrs, out result, out disposition); if (ret == 0 && !result.IsInvalid) { RegistryKey key = new RegistryKey(result, writable, false, _remoteKey, false, _regView); if (subkey.Length == 0) { key._keyName = _keyName; } else { key._keyName = _keyName + "\\" + subkey; } return(key); } else if (ret != 0) // syscall failed, ret is an error code. { Win32Error(ret, _keyName + "\\" + subkey); // Access denied? } Debug.Fail("Unexpected code path in RegistryKey::CreateSubKey"); return(null); }
public RegistryKey CreateSubKey (String subkey, bool writable, RegistryOptions options) { throw new PlatformNotSupportedException (); }