网站首页  词典首页

请输入您要查询的函数:

 

术语 regqueryvalue
释义 RegQueryValue
语法:
C++
LONG WINAPI RegQueryValue(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__out_opt LPTSTR lpValue,
__inout_opt PLONG lpcbValue
);
RegQueryValue函数
检索与默认或指定的注册表项未命名的值相关的数据。这些数据必须是一个NULL结尾的字符串。
注意:此功能仅提供了兼容性与16位的Windows版本。应用程序应该使用RegQueryValueEx函数。
参数
hKey [in]
句柄到打开注册表项。密钥必须与已开放的KEY_QUERY_VALUE访问权限。有关更多信息,请参见注册表关键的安全和访问权限。
这种处理是由RegCreateKeyEx的,RegCreateKeyTransacted,RegOpenKeyEx,或RegOpenKeyTransacted函数返回。它也可以是下列预定义项之一:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [中,可选]
在对那些hKey参数的默认值是检索子项的名称。
键名不区分大小写。
如果此参数为NULL或为空字符串点,函数检索由hKey确定的重要的默认值。
有关更多信息,请注册元素的大小限制。
lpValue [指出,可选]
阿一个缓冲区,它接收指定的键的默认值的指针。
如果lpValue为NULL,lpcbValue不为NULL,则函数返回ERROR_SUCCESS,并存储数据的大小,以字节的变量,指向lpcbValue。这使得一个应用程序,以确定最佳方式分配一个值的数据缓冲区。
lpcbValue [中,指出,可选]
一个变量,它指定的缓冲区大小的指针指向的lpValue参数,以字节为单位。当函数返回时,该变量包含了复制到lpValue数据,包括任何终止空字符的大小。
如果数据是REG_SZ,均为REG_MULTI_SZ或REG_EXPAND_SZ类型,这样的规模包括任何终止空字符或字符。有关更多信息,请参见备注。
如果缓冲区指定lpValue是不够大,无法容纳数据,该函数返回ERROR_MORE_DATA并存储在变量所需的缓冲区大小指向lpcbValue。在这种情况下,在lpValue缓冲区的内容是不确定的。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个系统错误代码。
如果lpValue缓冲区太小,无法接受值,该函数返回ERROR_MORE_DATA。
备注
如果此函数的ANSI版本的使用,也可以通过显式调用RegQueryValueA或不明确之前,包括WINDOWS.H文件的UNICODE)(,这个函数转换成Unicode字符串存储的ANSI字符串拷贝前,由指定的缓冲区lpValue参数。
如果数据是REG_SZ,均为REG_MULTI_SZ或REG_EXPAND_SZ类型,字符串可能不会被存储在正确的空终止字符。因此,即使该函数返回ERROR_SUCCESS,应用程序应确保正确的字符串使用前终止,否则,就可能会覆盖缓冲区。 (请注意,均为REG_MULTI_SZ字符串应该有两空终止字符。)
请注意,操作访问某些注册表项被重定向。有关更多信息,请在注册处注册,虚拟化和32位和64位应用程序数据。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegQueryValueW(Unicode)和RegQueryValueA(ANSI)的
参见
RegEnumKeyEx
RegEnumValue
登记职能
注册表概述
RegQueryInfoKey
RegQueryValueEx
RegSetValueEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegQueryValue Function
Retrieves the data associated with the default or unnamed value of a specified registry key. The data must be a null-terminated string.
Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the RegQueryValueEx function.
Syntax
C++
LONG WINAPI RegQueryValue(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__out_opt LPTSTR lpValue,
__inout_opt PLONG lpcbValue
);
Parameters
hKey [in]
A handle to an open registry key. The key must have been opened with the KEY_QUERY_VALUE access right. For more information, see Registry Key Security and Access Rights .
This handle is returned by the RegCreateKeyEx , RegCreateKeyTransacted , RegOpenKeyEx , or RegOpenKeyTransacted function. It can also be one of the following predefined keys :
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [in, optional]
The name of the subkey of the hKey parameter for which the default value is retrieved.
Key names are not case sensitive.
If this parameter is NULL or points to an empty string, the function retrieves the default value for the key identified by hKey.
For more information, see Registry Element Size Limits .
lpValue [out, optional]
A pointer to a buffer that receives the default value of the specified key.
If lpValue is NULL, and lpcbValue is non-NULL, the function returns ERROR_SUCCESS, and stores the size of the data, in bytes, in the variable pointed to by lpcbValue. This enables an application to determine the best way to allocate a buffer for the value's data.
lpcbValue [in, out, optional]
A pointer to a variable that specifies the size of the buffer pointed to by the lpValue parameter, in bytes. When the function returns, this variable contains the size of the data copied to lpValue, including any terminating null characters.
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 lpValue 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 lpcbValue. In this case, the contents of the lpValue buffer are undefined.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a system error code .
If the lpValue buffer is too small to receive the value, the function returns ERROR_MORE_DATA.
Remarks
If the ANSI version of this function is used (either by explicitly calling RegQueryValueA or by not defining UNICODE before including the Windows.h file), this function converts the stored Unicode string to an ANSI string before copying it to the buffer specified by the lpValue parameter.
If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the string may not have been stored with the proper null-terminating characters. Therefore, even if the function returns ERROR_SUCCESS, the application should ensure that the string is properly terminated before using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ strings should have two null-terminating characters.)
Note that operations that access certain registry keys are redirected. For more information, see Registry Virtualization and 32-bit and 64-bit Application Data in the Registry .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegQueryValueW (Unicode) and RegQueryValueA (ANSI)
See Also
RegEnumKeyEx
RegEnumValue
Registry Functions
Registry Overview
RegQueryInfoKey
RegQueryValueEx
RegSetValueEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724909(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:23:02