ReactOS 0.4.16-dev-91-g764881a
netsh.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for netsh.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL RunScript (_In_ LPCWSTR filename)
 
int wmain (_In_ int argc, _In_ const LPWSTR argv[])
 
DWORD WINAPI MatchEnumTag (_In_ HANDLE hModule, _In_ LPCWSTR pwcArg, _In_ DWORD dwNumArg, _In_ const TOKEN_VALUE *pEnumTable, _Out_ PDWORD pdwValue)
 
BOOL WINAPI MatchToken (_In_ LPCWSTR pwszUserToken, _In_ LPCWSTR pwszCmdToken)
 
DWORD CDECL PrintError (_In_opt_ HANDLE hModule, _In_ DWORD dwErrId,...)
 
DWORD CDECL PrintMessageFromModule (_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
 
DWORD CDECL PrintMessage (_In_ LPCWSTR pwszFormat,...)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file netsh.c.

Function Documentation

◆ MatchEnumTag()

DWORD WINAPI MatchEnumTag ( _In_ HANDLE  hModule,
_In_ LPCWSTR  pwcArg,
_In_ DWORD  dwNumArg,
_In_ const TOKEN_VALUE pEnumTable,
_Out_ PDWORD  pdwValue 
)

Definition at line 197 of file netsh.c.

203{
204 DPRINT1("MatchEnumTag()\n");
205 return 0;
206}
#define DPRINT1
Definition: precomp.h:8

◆ MatchToken()

BOOL WINAPI MatchToken ( _In_ LPCWSTR  pwszUserToken,
_In_ LPCWSTR  pwszCmdToken 
)

Definition at line 210 of file netsh.c.

213{
214 DPRINT1("MatchToken %S %S\n", pwszUserToken, pwszCmdToken);
215 return (wcsicmp(pwszUserToken, pwszCmdToken) == 0) ? TRUE : FALSE;
216}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define wcsicmp
Definition: compat.h:15

◆ PrintError()

DWORD CDECL PrintError ( _In_opt_ HANDLE  hModule,
_In_ DWORD  dwErrId,
  ... 
)

Definition at line 220 of file netsh.c.

224{
225 DPRINT1("PrintError()\n");
226 return 1;
227}

◆ PrintMessage()

DWORD CDECL PrintMessage ( _In_ LPCWSTR  pwszFormat,
  ... 
)

Definition at line 242 of file netsh.c.

245{
246 INT Length;
247 va_list ap;
248
249 va_start(ap, pwszFormat);
250 Length = ConPrintf(StdOut, pwszFormat);
251 va_end(ap);
252
253 return Length;
254}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
void ConPrintf(FILE *fp, LPCWSTR psz,...)
Definition: fc.c:20
#define StdOut
Definition: fc.c:14
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
int32_t INT
Definition: typedefs.h:58
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ PrintMessageFromModule()

DWORD CDECL PrintMessageFromModule ( _In_ HANDLE  hModule,
_In_ DWORD  dwMsgId,
  ... 
)

Definition at line 231 of file netsh.c.

235{
236 DPRINT1("PrintMessageFromModule()\n");
237 return 1;
238}

◆ RunScript()

BOOL RunScript ( _In_ LPCWSTR  filename)

Definition at line 18 of file netsh.c.

20{
21 FILE *script;
22 WCHAR tmp_string[MAX_STRING_SIZE];
23
24 /* Open the file for processing */
25 script = _wfopen(filename, L"r");
26 if (script == NULL)
27 {
29 return FALSE;
30 }
31
32 /* Read and process the script */
33 while (fgetws(tmp_string, MAX_STRING_SIZE, script) != NULL)
34 {
35 if (InterpretScript(tmp_string) == FALSE)
36 {
38 return FALSE;
39 }
40 }
41
42 /* Close the file */
44
45 return TRUE;
46}
BOOL InterpretScript(_In_ LPWSTR pszInputLine)
Definition: interpreter.c:150
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
#define StdErr
Definition: fc.c:15
#define MAX_STRING_SIZE
Definition: precomp.h:34
#define IDS_OPEN_FAILED
Definition: resource.h:15
#define NULL
Definition: types.h:112
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
const char * filename
Definition: ioapi.h:137
script
Definition: msipriv.h:383
#define L(x)
Definition: ntvdm.h:50
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)
Definition: wmain.c:22
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wmain().

◆ wmain()

int wmain ( _In_ int  argc,
_In_ const LPWSTR  argv[] 
)

Definition at line 53 of file netsh.c.

56{
57 LPCWSTR tmpBuffer = NULL;
59 int index;
60 int result = EXIT_SUCCESS;
61
62 DPRINT("main()\n");
63
64 /* Initialize the Console Standard Streams */
66
67 /* FIXME: Init code goes here */
70
71 if (argc < 2)
72 {
73 /* If there are no command arguments, then go straight to the interpreter */
75 }
76 else
77 {
78 /* If there are command arguments, then process them */
79 for (index = 1; index < argc; index++)
80 {
81 if ((argv[index][0] == '/')||
82 (argv[index][0] == '-'))
83 {
84 tmpBuffer = argv[index] + 1;
85 }
86 else
87 {
88 if (pszFileName != NULL)
89 {
92 goto done;
93 }
94
95 /* Run a command from the command line */
98 goto done;
99 }
100
101 if (_wcsicmp(tmpBuffer, L"?") == 0)
102 {
103 /* Help option */
106 goto done;
107 }
108 else if (_wcsicmp(tmpBuffer, L"a") == 0)
109 {
110 /* Aliasfile option */
111 if ((index + 1) < argc)
112 {
113 index++;
114 ConPuts(StdOut, L"\nThe -a option is not implemented yet\n");
115// aliasfile = argv[index];
116 }
117 else
118 {
121 }
122 }
123 else if (_wcsicmp(tmpBuffer, L"c") == 0)
124 {
125 /* Context option */
126 if ((index + 1) < argc)
127 {
128 index++;
129 ConPuts(StdOut, L"\nThe -c option is not implemented yet\n");
130// context = argv[index];
131 }
132 else
133 {
136 }
137 }
138 else if (_wcsicmp(tmpBuffer, L"f") == 0)
139 {
140 /* File option */
141 if ((index + 1) < argc)
142 {
143 index++;
145 }
146 else
147 {
150 }
151 }
152 else if (_wcsicmp(tmpBuffer, L"r") == 0)
153 {
154 /* Remote option */
155 if ((index + 1) < argc)
156 {
157 index++;
158 ConPuts(StdOut, L"\nThe -r option is not implemented yet\n");
159// remote = argv[index];
160 }
161 else
162 {
165 }
166 }
167 else
168 {
169 /* Invalid command */
172 goto done;
173 }
174 }
175
176 /* Now we process the filename if it exists */
177 if (pszFileName != NULL)
178 {
180 {
182 goto done;
183 }
184 }
185 }
186
187done:
188 /* FIXME: Cleanup code goes here */
190
191 return result;
192}
static int argc
Definition: ServiceArgs.c:12
BOOL InterpretCommand(_In_ LPWSTR *argv, _In_ DWORD dwArgCount)
Definition: interpreter.c:18
VOID InterpretInteractive(VOID)
Definition: interpreter.c:188
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define ConInitStdStreams()
Definition: fc.c:13
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define index(s, c)
Definition: various.h:29
BOOL CreateRootContext(VOID)
Definition: context.c:282
#define IDS_INVALID_COMMAND
Definition: resource.h:14
#define IDS_APP_USAGE
Definition: resource.h:12
GLuint index
Definition: glext.h:6031
GLuint64EXT * result
Definition: glext.h:11304
VOID LoadHelpers(VOID)
Definition: helper.c:241
VOID UnloadHelpers(VOID)
Definition: helper.c:318
#define EXIT_FAILURE
Definition: jerror.c:33
#define argv
Definition: mplay32.c:18
BOOL RunScript(_In_ LPCWSTR filename)
Definition: netsh.c:18
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define DPRINT
Definition: sndvol32.h:73
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185