ClusterRegistryConfigurationProvider(SafeHKey key, string registryKey) { this.hKey = key; this.registryExceptionHelper = new RegistryExceptionHelper(registryKey); this.registryKey = registryKey; RegistryExceptionHelper.EnsureEndsWithSlash(ref registryKey); }
internal static extern int ClusterRegCreateKey( [In] SafeHKey hKey, [In, MarshalAs(UnmanagedType.LPWStr)] string lpszSubKey, [In] uint dwOption, [In] RegistryRights samDesired, [In] IntPtr lpSecurityAttributes, [Out] out SafeHKey phkResult, [Out] out int lpdwDisposition);
internal ClusterRegistryConfigurationProvider(SafeHResource hResource, string key) { SafeHKey rootKey = SafeNativeMethods.GetClusterResourceKey(hResource, RegistryRights.ReadKey | RegistryRights.EnumerateSubKeys | RegistryRights.QueryValues); if (rootKey.IsInvalid) { int lastError = Marshal.GetLastWin32Error(); throw new WsatAdminException(WsatAdminErrorCode.REGISTRY_ACCESS, SR.GetString(SR.CannotOpenClusterRegistry, lastError)); } if (string.IsNullOrEmpty(key)) { hKey = rootKey; } else { using (rootKey) { int disposition; int ret = SafeNativeMethods.ClusterRegCreateKey(rootKey, key, SafeNativeMethods.REG_OPTION_NON_VOLATILE, RegistryRights.FullControl, IntPtr.Zero, out this.hKey, out disposition); if (ret != SafeNativeMethods.ERROR_SUCCESS) { throw new WsatAdminException(WsatAdminErrorCode.REGISTRY_ACCESS, SR.GetString(SR.CannotOpenClusterRegistry, ret)); } } } registryExceptionHelper = new RegistryExceptionHelper(key); this.registryKey = key; RegistryExceptionHelper.EnsureEndsWithSlash(ref this.registryKey); }
public override void Dispose() { this.hKey = null; GC.SuppressFinalize(this); }
internal static extern int ClusterRegSetKeySecurity( [In] SafeHKey hKey, [In] SecurityInfos securityInformation, [In] byte[] securityDescriptor);
internal static extern int ClusterRegGetKeySecurity( [In] SafeHKey hKey, [In] SecurityInfos securityInformation, [In, Out] byte[] securityDescriptor, [In, Out] ref uint lpcbSecurityDescriptor);
internal static extern int ClusterRegSetValue( [In] SafeHKey hKey, [In, MarshalAs(UnmanagedType.LPWStr)] string lpszValueName, [In] RegistryValueKind lpdwValueType, [In, MarshalAs(UnmanagedType.LPArray)] byte[] lpbData, [In] uint lpcbData);