RegistryKey.FromHandle Method

Definition

Creates a registry key from a specified handle.

Overloads

FromHandle(SafeRegistryHandle)

Creates a registry key from a specified handle.

FromHandle(SafeRegistryHandle, RegistryView)

Creates a registry key from a specified handle and registry view setting.

FromHandle(SafeRegistryHandle)

Source:
RegistryKey.cs

Creates a registry key from a specified handle.

C#
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);
C#
[System.Security.SecurityCritical]
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);
C#
[System.Security.SecurityCritical]
[System.Runtime.InteropServices.ComVisible(false)]
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);

Parameters

handle
SafeRegistryHandle

The handle to the registry key.

Returns

A registry key.

Attributes

Exceptions

handle is null.

The user does not have the necessary registry rights.

The user does not have the permissions required to perform this action.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 1.0, Core 1.1, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

FromHandle(SafeRegistryHandle, RegistryView)

Source:
RegistryKey.cs

Creates a registry key from a specified handle and registry view setting.

C#
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);
C#
[System.Security.SecurityCritical]
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);
C#
[System.Security.SecurityCritical]
[System.Runtime.InteropServices.ComVisible(false)]
public static Microsoft.Win32.RegistryKey FromHandle(Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);

Parameters

handle
SafeRegistryHandle

The handle to the registry key.

view
RegistryView

The registry view to use.

Returns

A registry key.

Attributes

Exceptions

view is invalid.

handle is null.

The user does not have the necessary registry rights.

The user does not have the permissions required to perform this action.

Remarks

The view parameter for this method is used in subsequent operations, such as opening subkeys.

If view is Registry64 but the machine is running a 32-bit operating system, the returned key will use the Registry32 view.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 1.0, Core 1.1, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5