网站首页  词典首页

请输入您要查询的函数:

 

术语 regopenkeyex
释义 RegOpenKeyEx
语法:
C++
LONG WINAPI RegOpenKeyEx(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__reserved DWORD ulOptions,
__in REGSAM samDesired,
__out PHKEY phkResult
);
RegOpenKeyEx函数
打开指定的注册表项。请注意,键名不区分大小写。
要执行交易的一个关键的注册表操作,调用RegOpenKeyTransacted功能。
参数
hKey [in]
句柄到打开注册表项。这种处理是由RegCreateKeyEx的或RegOpenKeyEx函数,返回的,也可以是下列预定义项之一:
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [中,可选]
该注册表子项的名称被打开。
键名不区分大小写。
如果此参数为NULL或为空字符串的指针,该函数将打开一个新的句柄的hKey参数确定的关键。
有关更多信息,请注册元素的大小限制。
ulOptions
这个参数是保留,必须为零。
samDesired [in]
阿面具,指定所需的访问权限的关键。函数失败如果关键的安全描述符不允许为调用进程的请求的访问。有关更多信息,请参见注册表关键的安全和访问权限。
phkResult [out]
一个变量,它接收的句柄打开的关键指针。如果关键不是预定义的注册表项之一,调用RegCloseKey函数完成后,您使用的处理。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
RegCreateKeyEx函数不同的是,该RegOpenKeyEx函数不创建指定键,如果不存在注册表中。
如果您的服务或应用程序模拟不同的用户,不要使用HKEY_CURRENT_USER此功能。相反,调用RegOpenCurrentUser功能。
请注意,操作访问某些注册表项被重定向。有关更多信息,请在注册处注册,虚拟化和32位和64位应用程序数据。
实例
有关示例,请参阅删除的子项的一把钥匙。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegOpenKeyExW(Unicode)和RegOpenKeyExA(ANSI)的
参见
RegCloseKey
RegCreateKeyEx的
RegDeleteKey
登记职能
注册表概述
RegOpenKeyTransacted
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegOpenKeyEx Function
Opens the specified registry key. Note that key names are not case sensitive.
To perform transacted registry operations on a key, call the RegOpenKeyTransacted function.
Syntax
C++
LONG WINAPI RegOpenKeyEx(
__in HKEY hKey,
__in_opt LPCTSTR lpSubKey,
__reserved DWORD ulOptions,
__in REGSAM samDesired,
__out PHKEY phkResult
);
Parameters
hKey [in]
A handle to an open registry key. This handle is returned by the RegCreateKeyEx or RegOpenKeyEx function, or it can be one of the following predefined keys :
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [in, optional]
The name of the registry subkey to be opened.
Key names are not case sensitive.
If this parameter is NULL or a pointer to an empty string, the function will open a new handle to the key identified by the hKey parameter.
For more information, see Registry Element Size Limits .
ulOptions
This parameter is reserved and must be zero.
samDesired [in]
A mask that specifies the desired access rights to the key. The function fails if the security descriptor of the key does not permit the requested access for the calling process. For more information, see Registry Key Security and Access Rights .
phkResult [out]
A pointer to a variable that receives a handle to the opened key. If the key is not one of the predefined registry keys, call the RegCloseKey function 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.
Remarks
Unlike the RegCreateKeyEx function, the RegOpenKeyEx function does not create the specified key if the key does not exist in the registry.
If your service or application impersonates different users, do not use this function with HKEY_CURRENT_USER. Instead, call the RegOpenCurrentUser function.
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 .
Examples
For an example, see Deleting a Key with Subkeys .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegOpenKeyExW (Unicode) and RegOpenKeyExA (ANSI)
See Also
RegCloseKey
RegCreateKeyEx
RegDeleteKey
Registry Functions
Registry Overview
RegOpenKeyTransacted
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724897(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:20:51