网站首页  词典首页

请输入您要查询的函数:

 

术语 regcreatekeyex
释义 RegCreateKeyEx
语法:
C++
LONG WINAPI RegCreateKeyEx(
__in HKEY hKey,
__in LPCTSTR lpSubKey,
__reserved DWORD Reserved,
__in_opt LPTSTR lpClass,
__in DWORD dwOptions,
__in REGSAM samDesired,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
__out PHKEY phkResult,
__out_opt LPDWORD lpdwDisposition
);
RegCreateKeyEx函数
创建指定的注册表项。如果该键已经存在,该函数打开它。请注意,键名不区分大小写。
要执行交易的一个关键的注册表操作,调用RegCreateKeyTransacted功能。
参数
hKey [in]
句柄到打开注册表项。调用进程必须具有KEY_CREATE_SUB_KEY访问的关键。有关更多信息,请参见注册表关键的安全和访问权限。
这种处理是由RegCreateKeyEx的或RegOpenKeyEx函数,返回的,也可以是下列预定义项之一:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [in]
的一个子项,这个函数打开或创建的名称。子项的规定必须由hKey参数确定的关键子项,它可以达到32级的注册表树深。欲了解更多有关键名信息,请书记官处的结构。
这个参数不能为NULL。
保留
这个参数是保留,必须为零。
lpClass [中,可选]
用户定义的类此密钥的类型。此参数可能被忽略。此参数可以为NULL。
dwOptions [in]
此参数可以是下列值之一。
ValueMeaning
REG_OPTION_BACKUP_RESTORE
0x00000004LIf设置此标志,函数忽略samDesired参数,并试图打开备份所需的访问键或恢复的关键。如果调用线程有SE_BACKUP_NAME特权启用,关键是开放的ACCESS_SYSTEM_SECURITY和KEY_READ访问权限。如果调用线程有SE_RESTORE_NAME特权启用,关键是开放的ACCESS_SYSTEM_SECURITY和KEY_WRITE访问权限。如果这两个特权被启用,主要有两个特权相结合的访问权限。有关更多信息,请运行特权。
REG_OPTION_CREATE_LINK
0x00000002LThis关键是一个符号链接。目标路径指定到L“SymbolicLinkValue”的键值。目标路径必须是绝对的注册表路径。
注册表符号连接应使用只有在绝对必要的应用程序兼容性。
REG_OPTION_NON_VOLATILE
0x00000000LThis关键不挥发,这是默认的。这些信息存储在一个文件中,并保留在系统重新启动。该RegSaveKey功能键保存不属于不稳定。
REG_OPTION_VOLATILE
该函数创建0x00000001LAll键不稳定。这些信息存储在内存中时,无法保留相应的注册表配置单元被卸载。表示HKEY_LOCAL_MACHINE,发生这种情况时,系统关闭。对于由RegLoadKey函数加载的注册表项,发生这种情况时,相应的RegUnLoadKey的执行。该RegSaveKey功能不保存动荡的关键。这个标志被忽略键已经存在。
samDesired [in]
阿掩码指定了关键的访问权限。有关更多信息,请参见注册表关键的安全和访问权限。
lpSecurityAttributes [中,可选]
一个 SECURITY_ATTRIBUTES结构,决定是否返回的句柄可以被继承的子进程的指针。如果lpSecurityAttributes为NULL,则句柄不能被继承。
结构的lpSecurityDescriptor成员指定为新的主要安全描述符。如果lpSecurityAttributes为NULL,则主要得到默认的安全描述。在默认的安全描述为ACL的一个关键是它的直接继承父项。
phkResult [out]
一个变量,它接收句柄指针打开或创建的关键。如果关键不是预定义的注册表项之一,调用RegCloseKey函数完成后,您使用的处理。
lpdwDisposition [指出,可选]
一个变量,它接收下列处置值之一指针。
ValueMeaning
REG_CREATED_NEW_KEY
0x00000001LThe键不存在,已建立。
REG_OPENED_EXISTING_KEY
0x00000002LThe关键是存在的,只是没有被改变打开。
如果lpdwDisposition为NULL,没有处置信息返回。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
关键是RegCreateKeyEx函数创建没有值。一个应用程序可以使用RegSetValueEx函数来设置键值。
应用程序不能创建一个键是HKEY_USERS或HKEY_LOCAL_MACHINE直接子。应用程序可以创建的于HKEY_USERS或HKEY_LOCAL_MACHINE树木下级子项。
如果您的服务或应用程序模拟不同的用户,不要使用HKEY_CURRENT_USER此功能。相反,调用RegOpenCurrentUser功能。
请注意,操作访问某些注册表项被重定向。有关更多信息,请在注册处注册,虚拟化和32位和64位应用程序数据。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegCreateKeyExW(Unicode)和RegCreateKeyExA(ANSI)的
参见
RegCloseKey
RegDeleteKey
登记职能
注册表概述
RegOpenKeyEx
RegSaveKey
SECURITY_ATTRIBUTES
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegCreateKeyEx Function
Creates the specified registry key. If the key already exists, the function opens it. Note that key names are not case sensitive.
To perform transacted registry operations on a key, call the RegCreateKeyTransacted function.
Syntax
C++
LONG WINAPI RegCreateKeyEx(
__in HKEY hKey,
__in LPCTSTR lpSubKey,
__reserved DWORD Reserved,
__in_opt LPTSTR lpClass,
__in DWORD dwOptions,
__in REGSAM samDesired,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
__out PHKEY phkResult,
__out_opt LPDWORD lpdwDisposition
);
Parameters
hKey [in]
A handle to an open registry key. The calling process must have KEY_CREATE_SUB_KEY access to the key. For more information, see Registry Key Security and Access Rights .
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_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
lpSubKey [in]
The name of a subkey that this function opens or creates. The subkey specified must be a subkey of the key identified by the hKey parameter; it can be up to 32 levels deep in the registry tree. For more information on key names, see Structure of the Registry .
This parameter cannot be NULL.
Reserved
This parameter is reserved and must be zero.
lpClass [in, optional]
The user-defined class type of this key. This parameter may be ignored. This parameter can be NULL.
dwOptions [in]
This parameter can be one of the following values.
ValueMeaning
REG_OPTION_BACKUP_RESTORE
0x00000004LIf this flag is set, the function ignores the samDesired parameter and attempts to open the key with the access required to backup or restore the key. If the calling thread has the SE_BACKUP_NAME privilege enabled, the key is opened with the ACCESS_SYSTEM_SECURITY and KEY_READ access rights. If the calling thread has the SE_RESTORE_NAME privilege enabled, the key is opened with the ACCESS_SYSTEM_SECURITY and KEY_WRITE access rights. If both privileges are enabled, the key has the combined access rights for both privileges. For more information, see Running with Special Privileges .
REG_OPTION_CREATE_LINK
0x00000002LThis key is a symbolic link. The target path is assigned to the L"SymbolicLinkValue" value of the key. The target path must be an absolute registry path.
Registry symbolic links should be used only when absolutely necessary for application compatibility.
REG_OPTION_NON_VOLATILE
0x00000000LThis key is not volatile; this is the default. The information is stored in a file and is preserved when the system is restarted. The RegSaveKey function saves keys that are not volatile.
REG_OPTION_VOLATILE
0x00000001LAll keys created by the function are volatile. The information is stored in memory and is not preserved when the corresponding registry hive is unloaded. For HKEY_LOCAL_MACHINE, this occurs when the system is shut down. For registry keys loaded by the RegLoadKey function, this occurs when the corresponding RegUnLoadKey is performed. The RegSaveKey function does not save volatile keys. This flag is ignored for keys that already exist.

samDesired [in]
A mask that specifies the access rights for the key. For more information, see Registry Key Security and Access Rights .
lpSecurityAttributes [in, optional]
A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited.
The lpSecurityDescriptor member of the structure specifies a security descriptor for the new key. If lpSecurityAttributes is NULL, the key gets a default security descriptor. The ACLs in a default security descriptor for a key are inherited from its direct parent key.
phkResult [out]
A pointer to a variable that receives a handle to the opened or created key. If the key is not one of the predefined registry keys, call the RegCloseKey function after you have finished using the handle.
lpdwDisposition [out, optional]
A pointer to a variable that receives one of the following disposition values.
ValueMeaning
REG_CREATED_NEW_KEY
0x00000001LThe key did not exist and was created.
REG_OPENED_EXISTING_KEY
0x00000002LThe key existed and was simply opened without being changed.

If lpdwDisposition is NULL, no disposition information is returned.
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
The key that the RegCreateKeyEx function creates has no values. An application can use the RegSetValueEx function to set key values.
An application cannot create a key that is a direct child of HKEY_USERS or HKEY_LOCAL_MACHINE. An application can create subkeys in lower levels of the HKEY_USERS or HKEY_LOCAL_MACHINE trees.
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 .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegCreateKeyExW (Unicode) and RegCreateKeyExA (ANSI)
See Also
RegCloseKey
RegDeleteKey
Registry Functions
Registry Overview
RegOpenKeyEx
RegSaveKey
SECURITY_ATTRIBUTES
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724844(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:16:26