ReactOS  0.4.14-dev-552-g2fad488
cmdHelpMsg.c File Reference
#include "net.h"
#include <stdlib.h>
Include dependency graph for cmdHelpMsg.c:

Go to the source code of this file.

Functions

INT cmdHelpMsg (INT argc, WCHAR **argv)
 

Function Documentation

◆ cmdHelpMsg()

INT cmdHelpMsg ( INT  argc,
WCHAR **  argv 
)

Definition at line 14 of file cmdHelpMsg.c.

15 {
16  INT i;
17  LONG errNum;
18  PWSTR endptr;
19  PWSTR pBuffer;
20  PWSTR pInserts[10] = {L"***", L"***", L"***", L"***",
21  L"***", L"***", L"***", L"***",
22  L"***", NULL};
23 
24  if (argc < 3)
25  {
26  PrintMessageString(4381);
27  ConPuts(StdOut, L"\n");
28  PrintNetMessage(MSG_HELPMSG_SYNTAX);
29  return 1;
30  }
31 
32  for (i = 2; i < argc; i++)
33  {
34  if (_wcsicmp(argv[i], L"/help") == 0)
35  {
36  PrintMessageString(4381);
37  ConPuts(StdOut, L"\n");
38  PrintNetMessage(MSG_HELPMSG_SYNTAX);
39  PrintNetMessage(MSG_HELPMSG_HELP);
40  return 1;
41  }
42  }
43 
44  errNum = wcstol(argv[2], &endptr, 10);
45  if (*endptr != 0)
46  {
47  PrintMessageString(4381);
48  ConPuts(StdOut, L"\n");
49  PrintNetMessage(MSG_HELPMSG_SYNTAX);
50  return 1;
51  }
52 
53  if (errNum >= MIN_LANMAN_MESSAGE_ID && errNum <= MAX_LANMAN_MESSAGE_ID)
54  {
58  errNum,
60  (LPWSTR)&pBuffer,
61  0,
62  (va_list *)pInserts);
63  if (pBuffer)
64  {
65  ConPrintf(StdOut, L"\n%s\n", pBuffer);
67  }
68  else
69  {
70  PrintErrorMessage(3871);
71  }
72  }
73  else
74  {
75  /* Retrieve the message string without appending extra newlines */
78  NULL,
79  errNum,
81  (LPWSTR)&pBuffer,
82  0,
83  (va_list *)pInserts);
84  if (pBuffer)
85  {
86  ConPrintf(StdOut, L"\n%s\n", pBuffer);
88  }
89  else
90  {
91  PrintErrorMessage(3871);
92  }
93  }
94 
95  return 0;
96 }
static int argc
Definition: ServiceArgs.c:12
uint16_t * PWSTR
Definition: typedefs.h:54
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:228
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
int32_t INT
Definition: typedefs.h:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
#define MIN_LANMAN_MESSAGE_ID
Definition: lmcons.h:10
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
#define MAX_LANMAN_MESSAGE_ID
Definition: lmcons.h:11
static const WCHAR L[]
Definition: oid.c:1250
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
VOID PrintMessageString(DWORD dwMessage)
Definition: main.c:109
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76
HMODULE hModuleNetMsg
Definition: main.c:49
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50