https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bcad6700ec7d0e98cfe0f…
commit bcad6700ec7d0e98cfe0f1c27cc8addb161beb21
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Dec 6 22:44:43 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Thu Dec 6 22:44:43 2018 +0100
[MPR] Import Wine commit: 773ff2e83b0547540639c6d4aeb9f817b621fb2f
Implement support for deleting persistent connections.
---
dll/win32/mpr/wnet.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/dll/win32/mpr/wnet.c b/dll/win32/mpr/wnet.c
index b16ec98165..bc492c2afe 100644
--- a/dll/win32/mpr/wnet.c
+++ b/dll/win32/mpr/wnet.c
@@ -2298,37 +2298,23 @@ DWORD WINAPI WNetCancelConnection2W( LPCWSTR lpName, DWORD
dwFlags, BOOL fForce
}
}
}
-#ifdef __REACTOS__
- if (dwFlags & CONNECT_UPDATE_PROFILE)
+ if (ret == WN_SUCCESS && dwFlags & CONNECT_UPDATE_PROFILE)
{
HKEY user_profile;
- WCHAR *coma = strchrW(lpName, ':');
- if (coma && RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) ==
ERROR_SUCCESS)
+ /* FIXME: Only remove it if that's a drive letter */
+ if (isalphaW(lpName[0]) && lpName[1] == ':' &&
+ RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
{
- WCHAR *subkey;
- DWORD len;
-
- len = (ULONG_PTR)coma - (ULONG_PTR)lpName + sizeof(L"Network\\");
- subkey = HeapAlloc(GetProcessHeap(), 0, len);
- if (subkey)
- {
- strcpyW(subkey, L"Network\\");
- memcpy(subkey + (sizeof(L"Network\\") / sizeof(WCHAR)) - 1,
lpName, (ULONG_PTR)coma - (ULONG_PTR)lpName);
- subkey[len / sizeof(WCHAR) - 1] = 0;
+ WCHAR subkey[10] = {'N', 'e', 't', 'w',
'o', 'r', 'k', '\\', lpName[0], 0};
- TRACE("Removing: %S\n", subkey);
-
- RegDeleteKeyW(user_profile, subkey);
- HeapFree(GetProcessHeap(), 0, subkey);
- }
+ RegDeleteKeyW(user_profile, subkey);
RegCloseKey(user_profile);
}
}
-#endif
return ret;
}