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

ORGetValue function (Offreg.h)

· 52CE 我爱测

Retrieves the type and data for the specified registry value in an offline registry hive.

Retrieves the type and data for the specified registry value in an offline registry hive.

Syntax

DWORD ORGetValue(
  _In_        ORHKEY Handle,
  _In_opt_    PCWSTR lpSubKey,
  _In_opt_    PCWSTR lpValue,
  _Out_opt_   PDWORD pdwType,
  _Out_opt_   PVOID  pvData,
  _Inout_opt_ PDWORD pcbData
);

Parameters

Handle [in]

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

lpSubKey [in, optional]

The name of the registry key. This key must be a subkey of the key specified by the Handle parameter. This parameter can be NULL.

Key names are not case sensitive.

lpValue [in, optional]

The name of the registry value. If this parameter is NULL or an empty string, "", the function retrieves the type and data for the key's unnamed or default value, if any. For more information, see Registry Element Size Limits.

Keys do not automatically have an unnamed or default value. Unnamed values can be of any type.

Value names are not case sensitive.

pdwType [out, optional]

A pointer to a variable that receives a code indicating the type of data stored in the specified value. For a list of the possible type codes, see Registry Value Types. This parameter can be NULL if the type is not required.

pvData [out, optional]

A pointer to a buffer that receives the value's data. This parameter can be NULL if the data is not required.

If the data is a string, the function checks for a terminating null character. If one is not found, the string is stored with a null terminator if the buffer is large enough to accommodate the extra character. Otherwise, the function fails and returns ERROR_MORE_DATA.

pcbData [in, out, optional]

A pointer to a variable that specifies the size of the buffer pointed to by the pvData parameter, in bytes. When the function returns, this variable contains the size of the data copied to pvData.

The pcbData parameter can be NULL only if pvData is NULL.

If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes any terminating null character or characters. For more information, see Remarks.

If the buffer specified by pvData parameter is not large enough to hold the data, the function returns ERROR_MORE_DATA and stores the required buffer size in the variable pointed to by pcbData. In this case, the contents of the pvData buffer are undefined.

If pvData is NULL, and pcbData is non-NULL, the function returns ERROR_SUCCESS and stores the size of the data, in bytes, in the variable pointed to by pcbData. This enables an application to determine the best way to allocate a buffer for the value's data.

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.

Remarks

An application typically calls the OREnumValue function to determine the value names and then calls the ORGetValue function to retrieve the data for the names.

Requirements

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

See also

ORCreateKey

OREnumKey

OREnumValue

OROpenKey

ORQueryInfoKey

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)

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

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