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)

Creates a registry key from a specified handle.

public:
 static Microsoft::Win32::RegistryKey ^ FromHandle(Microsoft::Win32::SafeHandles::SafeRegistryHandle ^ handle);
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);
[System.Security.SecurityCritical]
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);
[System.Security.SecurityCritical]
[System.Runtime.InteropServices.ComVisible(false)]
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle);
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle -> Microsoft.Win32.RegistryKey
[<System.Security.SecurityCritical>]
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle -> Microsoft.Win32.RegistryKey
[<System.Security.SecurityCritical>]
[<System.Runtime.InteropServices.ComVisible(false)>]
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle -> Microsoft.Win32.RegistryKey
Public Shared Function FromHandle (handle As SafeRegistryHandle) As RegistryKey

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

FromHandle(SafeRegistryHandle, RegistryView)

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

public:
 static Microsoft::Win32::RegistryKey ^ FromHandle(Microsoft::Win32::SafeHandles::SafeRegistryHandle ^ handle, Microsoft::Win32::RegistryView view);
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);
[System.Security.SecurityCritical]
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);
[System.Security.SecurityCritical]
[System.Runtime.InteropServices.ComVisible(false)]
public static Microsoft.Win32.RegistryKey FromHandle (Microsoft.Win32.SafeHandles.SafeRegistryHandle handle, Microsoft.Win32.RegistryView view);
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle * Microsoft.Win32.RegistryView -> Microsoft.Win32.RegistryKey
[<System.Security.SecurityCritical>]
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle * Microsoft.Win32.RegistryView -> Microsoft.Win32.RegistryKey
[<System.Security.SecurityCritical>]
[<System.Runtime.InteropServices.ComVisible(false)>]
static member FromHandle : Microsoft.Win32.SafeHandles.SafeRegistryHandle * Microsoft.Win32.RegistryView -> Microsoft.Win32.RegistryKey
Public Shared Function FromHandle (handle As SafeRegistryHandle, view As RegistryView) As RegistryKey

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