[NET]
[reactos.git] / reactos / base / applications / network / net / cmdHelpMsg.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: cmdHelpmsg.c
5 * PURPOSE:
6 *
7 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8 */
9
10 #include "net.h"
11
12 #include <stdlib.h>
13
14 INT cmdHelpMsg(INT argc, WCHAR **argv)
15 {
16 LPWSTR endptr;
17 LPWSTR lpBuffer;
18 LONG errNum;
19
20 if (argc < 3)
21 {
22 puts("Usage: NET HELPMSG <Error Code>");
23 return 1;
24 }
25
26 errNum = wcstol(argv[2], &endptr, 10);
27 if (*endptr != 0)
28 {
29 puts("Usage: NET HELPMSG <Error Code>");
30 return 1;
31 }
32
33 /* Unicode printing is not supported in ReactOS yet */
34 if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
35 NULL,
36 errNum,
37 LANG_USER_DEFAULT,
38 (LPWSTR)&lpBuffer,
39 0,
40 NULL))
41 {
42 printf("\n%S\n", lpBuffer);
43 LocalFree(lpBuffer);
44 }
45 else
46 {
47 printf("Unrecognized error code: %ld\n", errNum);
48 }
49
50 return 0;
51 }
52
53 /* EOF */
54