AdvApi32RegOpenKeyEx(SafeRegistryHandle, String, UInt32, Int32, IntPtr) Method
Opens the specified registry key. Note that key names are not case sensitive.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static Win32ErrorCode RegOpenKeyEx(
SafeRegistryHandle hKey,
string subKey,
uint options,
int samDesired,
ref IntPtr refResult
)
<DllImportAttribute("AdvApi32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function RegOpenKeyEx (
hKey As SafeRegistryHandle,
subKey As String,
options As UInteger,
samDesired As Integer,
ByRef refResult As IntPtr
) As Win32ErrorCode
Dim hKey As SafeRegistryHandle
Dim subKey As String
Dim options As UInteger
Dim samDesired As Integer
Dim refResult As IntPtr
Dim returnValue As Win32ErrorCode
returnValue = AdvApi32.RegOpenKeyEx(hKey,
subKey, options, samDesired, refResult)
public:
[DllImportAttribute(L"AdvApi32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static Win32ErrorCode RegOpenKeyEx(
SafeRegistryHandle^ hKey,
String^ subKey,
unsigned int options,
int samDesired,
IntPtr% refResult
)
[<DllImportAttribute("AdvApi32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member RegOpenKeyEx :
hKey : SafeRegistryHandle *
subKey : string *
options : uint32 *
samDesired : int *
refResult : IntPtr byref -> Win32ErrorCode
No code example is currently available or this language may not be supported.
- hKey SafeRegistryHandle
-
A handle to an open registry key.
This handle is returned by the RegCreateKeyEx or RegOpenKeyEx(SafeRegistryHandle, String, UInt32, Int32, IntPtr) function.
- subKey String
-
The name of the registry subkey to be opened.
Key names are not case sensitive.
The subKey parameter can be a pointer to an empty string.
If subKey is a pointer to an empty string
and hKey is ClassesRoot,
refResult receives the same hKey handle passed into the function.
Otherwise, refResult receives a new handle to the key specified by hKey.
The subKey parameter can be
only if hKey is one of the predefined keys.
If subKey is
and hKey is ClassesRoot,
refResult receives a new handle to the key specified by hKey.
Otherwise, refResult receives the same hKey handle passed in to the function.
- options UInt32
-
Specifies the option to apply when opening the key.
- samDesired Int32
-
A mask that specifies the desired access rights to the key to be opened.
The function fails if the security descriptor of the key does not permit the requested access for the calling process.
- refResult IntPtr
-
A pointer to a variable that receives a handle to the opened key.
If the key is not one of the predefined registry keys,
call the RegCloseKey(SafeRegistryHandle) function after you have finished using the handle.
Win32ErrorCode
If the function succeeds, the return value is
ERROR_SUCCESS.
If the function fails, the return value is other
Win32ErrorCode error code.
To get extended error information, call
GetLastWin32Error.