网站首页  词典首页

请输入您要查询的函数:

 

术语 regcreatekeytransacted
释义 RegCreateKeyTransacted
语法:
C++
LONG WINAPI RegCreateKeyTransacted(
__in HKEY hKey,
__in LPCTSTR lpSubKey,
__reserved DWORD Reserved,
__in_opt LPTSTR lpClass,
__in DWORD dwOptions,
__in REGSAM samDesired,
__in_opt const LPSECURITY_ATTRIBUTES lpSecurityAttributes,
__out PHKEY phkResult,
__out_opt LPDWORD lpdwDisposition,
__in HANDLE hTransaction,
__reserved PVOID pExtendedParemeter
);
RegCreateKeyTransacted功能
创建一个具有交易指定的注册表键和关联。如果该键已经存在,该函数打开它。请注意,键名不区分大小写。
参数
hKey [in]
句柄到打开注册表项。调用进程必须具有KEY_CREATE_SUB_KEY访问的关键。有关更多信息,请参见注册表关键的安全和访问权限。
此句柄返回的RegCreateKeyTransacted或RegOpenKeyTransacted功能,也可以是下列预定义项之一:
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_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,没有处置信息返回。
hTransaction [in]
一个句柄,积极交易。这种处理是由CreateTransaction函数返回。
pExtendedParemeter
这个参数是保留,必须为NULL。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
当一个关键是使用此功能,就主要是交易随后的行动中。如果非交易操作完成的关键交易前承诺,交易回滚。在交易完成后提交或回滚,则必须重新打开键使用RegCreateKeyTransacted或以积极的事务处理,使更多的交易业务RegOpenKeyTransacted。欲了解更多有关交易的信息,请参阅内核事务管理器。
注意,在这一关键是不会自动交易子随后的行动中。因此,RegDeleteKeyEx不会执行删除操作交易。相反,使用RegDeleteKeyTransacted函数来执行删除操作交易。
关键是RegCreateKeyTransacted函数创建没有值。一个应用程序可以使用RegSetValueEx函数来设置键值。
应用程序不能创建一个键是HKEY_USERS或HKEY_LOCAL_MACHINE直接子。应用程序可以创建的于HKEY_USERS或HKEY_LOCAL_MACHINE树木下级子项。
要求:
client最低支持Vista
server最低支持 Windows Server 2008
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegCreateKeyTransactedW(Unicode)和RegCreateKeyTransactedA(ANSI)的
参见
RegCloseKey
RegDeleteKeyTransacted
登记职能
注册表概述
RegOpenKeyTransacted
RegSaveKey
SECURITY_ATTRIBUTES
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegCreateKeyTransacted Function
Creates the specified registry key and associates it with a transaction. If the key already exists, the function opens it. Note that key names are not case sensitive.
Syntax
C++
LONG WINAPI RegCreateKeyTransacted(
__in HKEY hKey,
__in LPCTSTR lpSubKey,
__reserved DWORD Reserved,
__in_opt LPTSTR lpClass,
__in DWORD dwOptions,
__in REGSAM samDesired,
__in_opt const LPSECURITY_ATTRIBUTES lpSecurityAttributes,
__out PHKEY phkResult,
__out_opt LPDWORD lpdwDisposition,
__in HANDLE hTransaction,
__reserved PVOID pExtendedParemeter
);
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 RegCreateKeyTransacted or RegOpenKeyTransacted 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 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_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.
hTransaction [in]
A handle to an active transaction. This handle is returned by the CreateTransaction function.
pExtendedParemeter
This parameter is reserved and must be NULL.
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
When a key is created using this function, subsequent operations on the key are transacted. If a non-transacted operation is performed on the key before the transaction is committed, the transaction is rolled back. After a transaction is committed or rolled back, you must re-open the key using RegCreateKeyTransacted or RegOpenKeyTransacted with an active transaction handle to make additional operations transacted. For more information about transactions, see Kernel Transaction Manager .
Note that subsequent operations on subkeys of this key are not automatically transacted. Therefore, RegDeleteKeyEx does not perform a transacted delete operation. Instead, use the RegDeleteKeyTransacted function to perform a transacted delete operation.
The key that the RegCreateKeyTransacted 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.
Requirements
Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegCreateKeyTransactedW (Unicode) and RegCreateKeyTransactedA (ANSI)
See Also
RegCloseKey
RegDeleteKeyTransacted
Registry Functions
Registry Overview
RegOpenKeyTransacted
RegSaveKey
SECURITY_ATTRIBUTES
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa965882(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:17:57