Author: pschweitzer
Date: Sat Dec 10 22:12:53 2016
New Revision: 73446
URL:
http://svn.reactos.org/svn/reactos?rev=73446&view=rev
Log:
[NET/USE]
In case of an error, display the error message.
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] Sat Dec 10 22:12:53
2016
@@ -193,6 +193,18 @@
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)
ConPrintf(StdOut, L"%s is now connected to %s\n", argv[3],
Access);
+ else if (Status != NO_ERROR)
+ {
+ LPWSTR Buffer;
+
+ ConPrintf(StdErr, L"The system error %d happened.\n", Status);
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, Status, 0, (LPWSTR)&Buffer, 0, NULL))
+ {
+ ConPrintf(StdErr, L"\n%s\n", Buffer);
+ LocalFree(Buffer);
+ }
+ }
return Status;
}