ORGetValue function

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

Redistributable

Windows Offline Registry library version 1.0 or later

Header

Offreg.h

DLL

Offreg.dll

See also

ORCreateKey
OREnumKey
OREnumValue
OROpenKey
ORQueryInfoKey

 

 

Show: