网站首页  词典首页

请输入您要查询的函数:

 

术语 regconnectregistry
释义 RegConnectRegistry
语法:
C++
LONG WINAPI RegConnectRegistry(
__in_opt LPCTSTR lpMachineName,
__in HKEY hKey,
__out PHKEY phkResult
);
RegConnectRegistry功能
建立一个连接到另一台计算机上预定义的注册表项。
参数
lpMachineName [中,可选]
在远程计算机的名称。该字符串有以下形式:
\\ \\计算机
调用者必须能够访问到远程计算机或函数失败。
如果该参数为NULL,则本地计算机的名称使用。
hKey [in]
预定义的注册表句柄。此参数可以是下列之一预定在远程计算机上的关键。
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA
HKEY_USERS
phkResult [out]
对变量的接收处理确定一个关键的预定义处理远程计算机上的指针。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是一个非零错误代码Winerror.h中定义。您可以使用带有FORMAT_MESSAGE_FROM_SYSTEM标记的FormatMessage函数获得错误的一般说明。
备注
RegConnectRegistry需要远程注册表服务在远程计算机上运行。默认情况下此服务被配置为手动启动。要配置远程注册表服务为自动启动,运行services.msc,然后更改为自动服务的启动类型。
Windows Server 2003和Windows XP/2000操作系统:远程注册表服务配置为自动启动默认。
当返回的处理RegConnectRegistry不再需要,应该通过调用RegCloseKey关闭。
如果将计算机加入到工作组和“部队使用本地网络登录帐户以来宾身份验证”策略已启用,功能失败。请注意,这项政策是默认打开的,如果计算机加入到工作组。
如果当前用户没有适当的访问到远程计算机,对RegConnectRegistry调用失败。要连接到远程注册表,然后调用LogonUser调用RegConnectRegistry与LOGON32_LOGON_NEW_CREDENTIALS和ImpersonateLoggedOnUser。
Windows 2000中:一个可能的解决方法是建立一个会话管理共享如IPC $使用不同的凭据集。要指定凭据比当前用户以外,使用WNetAddConnection2函数连接到共享。当您完成访问注册表,取消连接。
Windows XP家庭版:您不能使用此功能连接到远程计算机上运行Windows XP家庭版。此函数与当地即使是运行Windows XP家庭版,因为这层绕过身份验证计算机名工作。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinreg.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesRegConnectRegistryW(Unicode)和RegConnectRegistryA(ANSI)的
参见
RegCloseKey
登记职能
注册表概述
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==RegConnectRegistry Function
Establishes a connection to a predefined registry key on another computer.
Syntax
C++
LONG WINAPI RegConnectRegistry(
__in_opt LPCTSTR lpMachineName,
__in HKEY hKey,
__out PHKEY phkResult
);
Parameters
lpMachineName [in, optional]
The name of the remote computer. The string has the following form:
\\\\computername
The caller must have access to the remote computer or the function fails.
If this parameter is NULL, the local computer name is used.
hKey [in]
A predefined registry handle. This parameter can be one of the following predefined keys on the remote computer.
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA
HKEY_USERS
phkResult [out]
A pointer to a variable that receives a key handle identifying the predefined handle on the remote computer.
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
RegConnectRegistry requires the Remote Registry service to be running on the remote computer. By default, this service is configured to be started manually. To configure the Remote Registry service to start automatically, run Services.msc and change the Startup Type of the service to Automatic.
Windows Server 2003 and Windows XP/2000: The Remote Registry service is configured to start automatically by default.
When a handle returned by RegConnectRegistry is no longer needed, it should be closed by calling RegCloseKey .
If the computer is joined to a workgroup and the "Force network logons using local accounts to authenticate as Guest" policy is enabled, the function fails. Note that this policy is enabled by default if the computer is joined to a workgroup.
If the current user does not have proper access to the remote computer, the call to RegConnectRegistry fails. To connect to a remote registry, call LogonUser with LOGON32_LOGON_NEW_CREDENTIALS and ImpersonateLoggedOnUser before calling RegConnectRegistry.
Windows 2000: One possible workaround is to establish a session to an administrative share such as IPC$ using a different set of credentials. To specify credentials other than those of the current user, use the WNetAddConnection2 function to connect to the share. When you have finished accessing the registry, cancel the connection.
Windows XP Home Edition: You cannot use this function to connect to a remote computer running Windows XP Home Edition. This function does work with the name of the local computer even if it is running Windows XP Home Edition because this bypasses the authentication layer.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinreg.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesRegConnectRegistryW (Unicode) and RegConnectRegistryA (ANSI)
See Also
RegCloseKey
Registry Functions
Registry Overview
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms724840(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:18:40