Author: pschweitzer
Date: Wed Aug 3 14:42:49 2016
New Revision: 72098
URL:
http://svn.reactos.org/svn/reactos?rev=72098&view=rev
Log:
[NET/USE]
In case an automatic drive letter assignment was asked (net use * REMOTE), print the
mapping that was performed on success.
ROSAPPS-303
Modified:
trunk/reactos/base/applications/network/net/cmdUse.c
Modified: trunk/reactos/base/applications/network/net/cmdUse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] Wed Aug 3 14:42:49
2016
@@ -8,6 +8,8 @@
*/
#include "net.h"
+
+#define COUNT_OF(a) (sizeof(a) / sizeof(a[0]))
static
DWORD
@@ -130,6 +132,8 @@
{
BOOL Persist = FALSE;
NETRESOURCE lpNet;
+ WCHAR Access[256];
+ DWORD OutFlags = 0, Size = COUNT_OF(Access);
Len = wcslen(argv[3]);
if (Len < 4)
@@ -186,6 +190,10 @@
lpNet.lpRemoteName = argv[3];
lpNet.lpProvider = NULL;
- return WNetAddConnection2(&lpNet, NULL, NULL, CONNECT_REDIRECT | (Persist ?
CONNECT_UPDATE_PROFILE : 0));
+ Status = WNetUseConnection(NULL, &lpNet, NULL, NULL, CONNECT_REDIRECT |
(Persist ? CONNECT_UPDATE_PROFILE : 0), Access, &Size, &OutFlags);
+ if (argv[2][0] == L'*' && Status == NO_ERROR && OutFlags
== CONNECT_LOCALDRIVE)
+ printf("%S is now connected to %S\n", argv[3], Access);
+
+ return Status;
}
}