大网数据广告活动
Windows 系统接口

OROpenKey function (Offreg.h)

· 52CE 我爱测

Opens the specified registry key in an offline registry hive.

Opens the specified registry key in an offline registry hive.

Syntax

DWORD OROpenKey(
  _In_     ORHKEY  Handle,
  _In_opt_ PCWSTR  lpSubKeyName,
  _Out_    PORHKEY phkResult
);

Parameters

Handle [in]

A handle to an open registry key in an offline registry hive.

lpSubKeyName [in, optional]

A pointer to a UNICODE string that contains the name of the registry key to be opened. This key must be a subkey of the key identified by the Handle parameter.

Key names are not case sensitive.

If this parameter is NULL or a pointer to an empty string, the function returns the same handle that was passed in. If the key specified by the Handle parameter is the root key of the hive, the function returns ERROR_INVALID_PARAMETER.

For more information, see Registry Element Size Limits.

phkResult [out]

A pointer to a variable that receives a handle to the opened key. Use the ORCloseKey function to close the key after you have finished using the handle.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.

If the handle to be returned would be a handle to the root key of the hive, the function returns ERROR_INVALID_PARAMETER.

If the specified key has been marked as deleted, this function returns ERROR_KEY_DELETED.

Remarks

The OROpenKey function cannot be used to open the root key in an offline registry hive. To obtain a handle to the root key of a hive, use the OROpenHive function to load the hive into memory.

Requirements

Requirement Value
Redistributable Windows Offline Registry library version 1.0 or later
Header Offreg.h
DLL Offreg.dll

See also

ORCloseKey

ORCreateKey

ORDeleteKey

OROpenHive

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。