From ae176d1629cbd8519eb5938bbc99f45c7658feff Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 18 Mar 2004 01:34:23 +0000 Subject: [PATCH] Allow RegConnectRegistryW to the local machine name. --- dlls/advapi32/registry.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 45508e0826f..9af8dbb79d3 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1849,15 +1849,35 @@ DWORD WINAPI RegFlushKey( HKEY hkey ) LONG WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult ) { + LONG ret; + TRACE("(%s,%p,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult); if (!lpMachineName || !*lpMachineName) { /* Use the local machine name */ - return RegOpenKeyW( hKey, NULL, phkResult ); + ret = RegOpenKeyW( hKey, NULL, phkResult ); } + else if (lpMachineName[0] != '\\' || lpMachineName[1] != '\\') + ret = ERROR_BAD_NETPATH; + else + { + WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = sizeof(compName) / sizeof(WCHAR); - FIXME("Cannot connect to %s\n",debugstr_w(lpMachineName)); - return ERROR_BAD_NETPATH; + if (GetComputerNameW(compName, &len)) + { + if (!strcmpiW(lpMachineName + 2, compName)) + ret = RegOpenKeyW(hKey, NULL, phkResult); + else + { + FIXME("Cannot connect to %s\n",debugstr_w(lpMachineName)); + ret = ERROR_BAD_NETPATH; + } + } + else + ret = GetLastError(); + } + return ret; } -- 2.11.4.GIT