Author: pschweitzer
Date: Mon Oct 31 21:20:32 2016
New Revision: 73092
URL:
http://svn.reactos.org/svn/reactos?rev=73092&view=rev
Log:
[MPR]
Delete saved connection on disconnection if asked (even though the resource wasn't
connected).
This allows net use to properly remove connections it may have created.
CORE-11757
Modified:
trunk/reactos/dll/win32/mpr/mpr_ros.diff
trunk/reactos/dll/win32/mpr/wnet.c
Modified: trunk/reactos/dll/win32/mpr/mpr_ros.diff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mpr/mpr_ros.diff…
==============================================================================
--- trunk/reactos/dll/win32/mpr/mpr_ros.diff [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mpr/mpr_ros.diff [iso-8859-1] Mon Oct 31 21:20:32 2016
@@ -113,7 +113,45 @@
return ret;
}
-@@ -2188,6 +2221,7 @@
+@@ -2061,6 +2094,37 @@
+ }
+ }
+ }
++#ifdef __REACTOS__
++
++ if (dwFlags & CONNECT_UPDATE_PROFILE)
++ {
++ HKEY user_profile;
++ WCHAR *coma = strchrW(lpName, ':');
++
++ if (coma && 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;
++
++ TRACE("Removing: %S\n", subkey);
++
++ RegDeleteKeyW(user_profile, subkey);
++ HeapFree(GetProcessHeap(), 0, subkey);
++ }
++
++ RegCloseKey(user_profile);
++ }
++ }
++
++#endif
+ return ret;
+ }
+
+@@ -2188,6 +2252,7 @@
/* find the network connection for a given drive; helper for WNetGetConnection */
static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
{
@@ -121,7 +159,7 @@
char buffer[1024];
struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
HANDLE mgr;
-@@ -2230,6 +2264,32 @@
+@@ -2230,6 +2295,32 @@
}
CloseHandle( mgr );
return ret;
Modified: trunk/reactos/dll/win32/mpr/wnet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mpr/wnet.c?rev=7…
==============================================================================
--- trunk/reactos/dll/win32/mpr/wnet.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mpr/wnet.c [iso-8859-1] Mon Oct 31 21:20:32 2016
@@ -2094,6 +2094,37 @@
}
}
}
+#ifdef __REACTOS__
+
+ if (dwFlags & CONNECT_UPDATE_PROFILE)
+ {
+ HKEY user_profile;
+ WCHAR *coma = strchrW(lpName, ':');
+
+ if (coma && 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;
+
+ TRACE("Removing: %S\n", subkey);
+
+ RegDeleteKeyW(user_profile, subkey);
+ HeapFree(GetProcessHeap(), 0, subkey);
+ }
+
+ RegCloseKey(user_profile);
+ }
+ }
+
+#endif
return ret;
}