Win32 SDK Registry Operation Function - REGQUERYVALUE

zhaozj2021-02-08  223

RegQueryValue

The RegQueryValue function retrieves the default value of the given registry key or the data associated with the unnamed value. This data must be a string ended with empty characters.

This function is compatible with Windows 3.1. Win32-based applications should use the RegQueryValueex function.

LONG RegQueryValue (HKEY hKey, handle LPCTSTR lpSubKey // To query key, // To query name LPTSTR lpValue subkey, // return the cached PLONG lpcbValue string // receiving the returned string size);

parameter

HKEY

The currently open key or the following has been determined to keep the handle value:

HKEY_CLASS_ROTHKEY_CURRENT_CONFIGHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_USERSWINDOWS NT: HKEY_PERFORMANCE_DATA Windows 95 and Windows 98: HKEY_DYN_DATA

LPSUBKEY

Point to the default value

The name of the HKEY parameter subkey is ended with empty characters. If this parameter is null or pointing to an empty string, then this function finds a return energy

The default value identified by HKEY.

LPValue

Point to the buffer of a string ended with an empty string that is associated with the default value of the given value.

If lpvalue is null and lpcbvalue is not null, this function returns ERROR_SUCCESS and retrieves the size of the variable cache specified by LPCBDATA (in bytes). This value of data cache is allocated the best way.

LPCBVALUE

In-byte, pointing

The LPDATA parameter specifies the variable of the cache size. Function returns to copy

LPDATA's data size variable (including end characters).

If the cache specified by the LPDATA parameter is not large enough, this function returns an error_more_data value and retrieves the size (in byte) of the variable cache specified by lpcbdata.

In all cases, the size of the value returned in LPCBValue contains the end of the string.

return value

Returns Error_Success if the call is successful.

If the call fails, a non-zero error code is returned (defined in WineError.h). You can use the FormatMessage function with the format_message_from_system tag to get the wrong universal description information.

note

The key that can be identified by the HKEY parameter must be opened with key_query_value access (key_read access rights including Key_Query_Value Access permissions).

If the ANSI version of this function is used (clear call regQueryValueexa or if unicode containing the Windows.h file), this function converts the stored Unicode string to ANSI before copying it to the LPVALUE parameter. String.

Quick information

Windows NT: It takes 3.1 or higher. Windows: Need Windows 95 or higher. Windows CE: does not support. Header file: WinReg.h. Enter the library: Advapi32.lib. Unicode: Performed in Unicode and ANSI in Windows NT.

See

REGISTRY, REGENUEEX, RegSetValue, Regqueex, RegSetValueex, RegSetValueex, RegSetValueEx

转载请注明原文地址:https://www.9cbs.com/read-3377.html

New Post(0)