ReactOS 0.4.17-dev-357-ga8f14ff
netsh.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS NetSh
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Network Shell main file
5 * COPYRIGHT: Copyright 2023 Eric Kohl <eric.kohl@reactos.org>
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include "precomp.h"
11
12#define NDEBUG
13#include <debug.h>
14
15/* GLOBALS ********************************************************************/
16
18
19/* FUNCTIONS ******************************************************************/
20
24{
25 WCHAR tmp_string[MAX_STRING_SIZE];
26 FILE *script;
27 DWORD dwError = ERROR_SUCCESS;
28
29 /* Open the file for processing */
30 script = _wfopen(filename, L"r");
31 if (script == NULL)
32 {
35 }
36
37 /* Read and process the script */
38 while (fgetws(tmp_string, MAX_STRING_SIZE, script) != NULL)
39 {
40 dwError = InterpretLine(tmp_string);
41 if (dwError != ERROR_SUCCESS)
42 break;
43 }
44
45 /* Close the file */
47
48 return dwError;
49}
50
51
54 _In_ LPWSTR pszStringArray[],
55 _In_ UINT nCount)
56{
57 LPWSTR pszOutString = NULL;
58 size_t nLength;
59 UINT i;
60
61 if ((pszStringArray == NULL) || (nCount == 0))
62 return NULL;
63
64 nLength = 0;
65 for (i = 0; i < nCount; i++)
66 nLength += wcslen(pszStringArray[i]);
67
68 if (nLength > 0)
69 nLength += nCount; /* Space characters and terminating zero */
70
71 pszOutString = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength * sizeof(WCHAR));
72 if (pszOutString == NULL)
73 return NULL;
74
75 for (i = 0; i < nCount; i++)
76 {
77 if (i != 0)
78 wcscat(pszOutString, L" ");
79 wcscat(pszOutString, pszStringArray[i]);
80 }
81
82 return pszOutString;
83}
84
85
86/*
87 * wmain():
88 * Main entry point of the application.
89 */
90int
92 _In_ int argc,
93 _In_ const LPWSTR argv[])
94{
95 LPCWSTR pszScriptFileName = NULL;
96 LPCWSTR pszAliasFileName = NULL;
97 LPCWSTR pszContext = NULL;
98 LPWSTR pszCommand = NULL;
99 int index;
100 DWORD dwError = ERROR_SUCCESS;
101
102 DPRINT("wmain(%S)\n", GetCommandLineW());
103
105
106 /* Initialize the Console Standard Streams */
108
109 /* FIXME: Init code goes here */
110 InitAliases();
113 LoadHelpers();
114
115 /* Process the command arguments */
116 for (index = 1; index < argc; index++)
117 {
118 if ((_wcsicmp(argv[index], L"-?") == 0) ||
119 (_wcsicmp(argv[index], L"/?") == 0) ||
120 (_wcsicmp(argv[index], L"?") == 0))
121 {
122 /* Help option */
124 dwError = ERROR_SUCCESS;
125 goto done;
126 }
127 else if ((_wcsicmp(argv[index], L"-a") == 0) ||
128 (_wcsicmp(argv[index], L"/a") == 0))
129 {
130 /* Aliasfile option */
131 if ((index + 1) < argc)
132 {
133 index++;
134 ConPuts(StdOut, L"\nThe -a option is not implemented yet\n");
135 pszAliasFileName = argv[index];
136 }
137 else
138 {
140 dwError = ERROR_INVALID_SYNTAX;
141 goto done;
142 }
143 }
144 else if ((_wcsicmp(argv[index], L"-c") == 0) ||
145 (_wcsicmp(argv[index], L"/c") == 0))
146 {
147 /* Context option */
148 if ((index + 1) < argc)
149 {
150 index++;
151 pszContext = argv[index];
152 }
153 else
154 {
156 dwError = ERROR_INVALID_SYNTAX;
157 goto done;
158 }
159 }
160 else if ((_wcsicmp(argv[index], L"-f") == 0) ||
161 (_wcsicmp(argv[index], L"/f") == 0))
162 {
163 /* File option */
164 if ((index + 1) < argc)
165 {
166 index++;
167 pszScriptFileName = argv[index];
168 }
169 else
170 {
172 dwError = ERROR_INVALID_SYNTAX;
173 goto done;
174 }
175 }
176 else if ((_wcsicmp(argv[index], L"-r") == 0) ||
177 (_wcsicmp(argv[index], L"/r") == 0))
178 {
179 /* Remote option */
180 if ((index + 1) < argc)
181 {
182 index++;
183 pszMachine = HeapAlloc(GetProcessHeap(), 0, (wcslen(argv[index]) + 1) * sizeof(WCHAR));
184 if (pszMachine == NULL)
185 {
186 dwError = ERROR_NOT_ENOUGH_MEMORY;
187 PrintError(g_hModule, dwError);
188 goto done;
189 }
190
192 }
193 else
194 {
196 dwError = ERROR_INVALID_SYNTAX;
197 goto done;
198 }
199 }
200 else
201 {
202 if (pszScriptFileName != NULL)
203 {
205 dwError = ERROR_INVALID_SYNTAX;
206 goto done;
207 }
208 else if (pszCommand == NULL)
209 {
210 pszCommand = MergeStrings((LPWSTR*)&argv[index], argc - index);
211 if (pszCommand == NULL)
212 {
213 dwError = ERROR_NOT_ENOUGH_MEMORY;
214 PrintError(g_hModule, dwError);
215 goto done;
216 }
217
218 break;
219 }
220 }
221 }
222
223 /* Run the alias file */
224 if (pszAliasFileName != NULL)
225 {
226 dwError = RunScript(pszAliasFileName);
227 if (dwError != ERROR_SUCCESS)
228 goto done;
229 }
230
231 /* Set a context */
232 if (pszContext)
233 {
234 dwError = InterpretLine((LPWSTR)pszContext);
235 if (dwError != ERROR_SUCCESS)
236 goto done;
237 }
238
239 /* Run a script, the command line instruction or the interactive interpeter */
240 if (pszScriptFileName != NULL)
241 {
242 dwError = RunScript(pszScriptFileName);
243 }
244 else if (pszCommand != NULL)
245 {
246 dwError = InterpretLine(pszCommand);
247 }
248 else
249 {
251 }
252
253done:
254 /* FIXME: Cleanup code goes here */
255 if (pszMachine != NULL)
257
258 if (pszCommand != NULL)
259 HeapFree(GetProcessHeap(), 0, pszCommand);
260
264
265 return (dwError == ERROR_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE;
266}
267
268VOID
269WINAPI
271 _In_ LPWSTR pszQuotedString)
272{
273 DPRINT("FreeQuotedString(%S)\n", pszQuotedString);
274 HeapFree(GetProcessHeap(), 0, pszQuotedString);
275}
276
277VOID
278WINAPI
280 _In_ LPWSTR pszString)
281{
282 DPRINT("FreeString(%S)\n", pszString);
283 LocalFree(pszString);
284}
285
286LPWSTR
287WINAPI
289 _In_ LPWSTR pszString)
290{
291 LPWSTR pszQuotedString;
292
293 DPRINT("MakeQuotedString(%S)\n", pszString);
294
295 pszQuotedString = HeapAlloc(GetProcessHeap(), 0, (wcslen(pszString) + 3) * sizeof(WCHAR));
296 if (pszQuotedString == NULL)
297 return NULL;
298
299 _swprintf(pszQuotedString, L"\"%s\"", pszString);
300
301 return pszQuotedString;
302}
303
304LPWSTR
305CDECL
308 _In_ DWORD dwMsgId,
309 ...)
310{
311 LPCWSTR pszStr;
312 LPWSTR pszInBuffer, pszOutBuffer = NULL;
314 va_list ap;
315
316 DPRINT("MakeString(%p %lu ...)\n", hModule, dwMsgId);
317
318 dwLength = LoadStringW(hModule, dwMsgId, (LPWSTR)&pszStr, 0);
319 if (dwLength == 0)
320 return NULL;
321
322 /* Allocate and copy the resource string, NUL-terminated */
323 pszInBuffer = HeapAlloc(GetProcessHeap(), 0, (dwLength + 1) * sizeof(WCHAR));
324 if (pszInBuffer == NULL)
325 return NULL;
326 CopyMemory(pszInBuffer, pszStr, dwLength * sizeof(WCHAR));
327 pszInBuffer[dwLength] = UNICODE_NULL;
328
329 va_start(ap, dwMsgId);
331 pszInBuffer,
332 0,
333 0,
334 (LPWSTR)&pszOutBuffer,
335 0,
336 &ap);
337 va_end(ap);
338
339 HeapFree(GetProcessHeap(), 0, pszInBuffer);
340
341 return pszOutBuffer;
342}
343
344DWORD
345WINAPI
348 _In_ LPCWSTR pwcArg,
349 _In_ DWORD dwNumArg,
350 _In_ const TOKEN_VALUE *pEnumTable,
351 _Out_ PDWORD pdwValue)
352{
353 DWORD i;
354
355 DPRINT("MatchEnumTag(%p %p %lu %p %p)\n", hModule, pwcArg, dwNumArg, pEnumTable, pdwValue);
356
357 if ((pEnumTable == NULL) || (pdwValue == NULL))
359
360 for (i = 0; i < dwNumArg; i++)
361 {
362 DPRINT("%S -- %S\n", pwcArg, pEnumTable[i].pwszToken);
363 if (MatchToken(pwcArg, pEnumTable[i].pwszToken))
364 {
365 *pdwValue = pEnumTable[i].dwValue;
366 return ERROR_SUCCESS;
367 }
368 }
369
370 return ERROR_NOT_FOUND;
371}
372
373DWORD
374WINAPI
380 _Inout_ TAG_TYPE *pttTags,
381 _In_ DWORD dwTagCount,
382 _Out_ DWORD *pdwTagType)
383{
384 PWSTR pszEqual;
385 DWORD i, j, dwTagLength;
386
387 DPRINT1("MatchTagsInCmdLine(%p %p %lu %lu %p %lu %p)\n",
389 pttTags, dwTagCount, pdwTagType);
390
391 /* Identify tagged arguments (tag=value) */
392 for (i = dwCurrentIndex; i < dwArgCount; i++)
393 {
394 DPRINT("Argument %lu: %S\n", i, ppwcArguments[i]);
395 pdwTagType[i - dwCurrentIndex] = (DWORD)-1;
396
397 /* Skip arguments that do not have a tag */
398 pszEqual = wcschr(ppwcArguments[i], L'=');
399 if (pszEqual == NULL)
400 continue;
401
402 dwTagLength = pszEqual - ppwcArguments[i];
403 DPRINT("Tag length %lu\n", dwTagLength);
404 DPRINT("Value length %lu\n", wcslen(pszEqual + 1));
405
406 pdwTagType[i - dwCurrentIndex] = (DWORD)-1;
407 for (j = 0; j < dwTagCount; j++)
408 {
409 DPRINT("Test tag %S -- %S\n", pttTags[j].pwszTag, ppwcArguments[i]);
410 if ((wcslen(pttTags[j].pwszTag) == dwTagLength) &&
411 (_wcsnicmp(ppwcArguments[i], pttTags[j].pwszTag, dwTagLength) == 0))
412 {
413 DPRINT("Found tag %S\n", pttTags[j].pwszTag);
414 pttTags[j].bPresent = TRUE;
415 pdwTagType[i - dwCurrentIndex] = j;
416
417 /* Remove the tag name from the argument */
418 wcscpy(ppwcArguments[i], pszEqual + 1);
419 break;
420 }
421 }
422 }
423
424 /* Identify un-tagged arguments (value) */
425 for (i = dwCurrentIndex; i < dwArgCount; i++)
426 {
427 if (pdwTagType[i - dwCurrentIndex] != (DWORD)-1)
428 continue;
429
430 for (j = 0; j < dwTagCount; j++)
431 {
432 DPRINT("Test tag %S\n", pttTags[j].pwszTag);
433 if (pttTags[j].bPresent == FALSE)
434 {
435 DPRINT("Found tag %S\n", pttTags[j].pwszTag);
436 pttTags[j].bPresent = TRUE;
437 pdwTagType[i - dwCurrentIndex] = j;
438 break;
439 }
440 }
441 }
442
443 return ERROR_SUCCESS;
444}
445
446BOOL
447WINAPI
449 _In_ LPCWSTR pwszUserToken,
450 _In_ LPCWSTR pwszCmdToken)
451{
452 DPRINT("MatchToken(%S %S)\n", pwszUserToken, pwszCmdToken);
453
454 if ((pwszUserToken == NULL) || (pwszCmdToken == NULL))
455 return FALSE;
456
457 return (_wcsnicmp(pwszUserToken, pwszCmdToken, wcslen(pwszUserToken)) == 0) ? TRUE : FALSE;
458}
459
460DWORD
461WINAPI
463 _In_ DWORD dwUnknown1,
464 _In_ PWSTR pszIfName,
465 _Inout_ PWSTR pszFriendlyName,
466 _Inout_ PDWORD pdwFriendlyName)
467{
468 UNICODE_STRING UnicodeIfName;
471 DWORD ret;
472
473 DPRINT("NsGetFriendlyNameFromIfName(%lx %S %p %p)\n",
474 dwUnknown1, pszIfName, pszFriendlyName, pdwFriendlyName);
475
476 RtlInitUnicodeString(&UnicodeIfName, pszIfName);
477 Status = RtlGUIDFromString(&UnicodeIfName,
479 if (!NT_SUCCESS(Status))
480 {
481 DPRINT1("RtlGUIDFromString failed 0x%08lx\n", Status);
483 }
484
486 pszFriendlyName,
487 pdwFriendlyName,
488 0, 0);
489 if (ret != ERROR_SUCCESS)
490 {
491 DPRINT1("NhGetInterfaceNameFromDeviceGuid() failed %lu\n", ret);
492 }
493
494 return ret;
495}
496
497DWORD
498WINAPI
500 _In_ DWORD dwUnknown1,
501 _In_ PWSTR pszFriendlyName,
502 _Inout_ PWSTR pszIfName,
503 _Inout_ PDWORD pdwIfName)
504{
505 UNICODE_STRING UnicodeIfName;
508 DWORD ret;
509
510 DPRINT("NsGetIfNameFromFriendlyName(%lx %S %p %p)\n",
511 dwUnknown1, pszFriendlyName, pszIfName, pdwIfName);
512
513 ret = NhGetGuidFromInterfaceName(pszFriendlyName,
515 0, 0);
516 if (ret != ERROR_SUCCESS)
517 {
518 DPRINT1("NhGetGuidFromInterfaceName failed %lu\n", ret);
519 return ret;
520 }
521
522 RtlInitUnicodeString(&UnicodeIfName, NULL);
524 &UnicodeIfName);
525 if (!NT_SUCCESS(Status))
526 {
527 DPRINT1("RtlStringFromGUID failed 0x%08lx\n", Status);
529 }
530
531 if (*pdwIfName >= UnicodeIfName.MaximumLength)
532 {
533 CopyMemory(pszIfName, UnicodeIfName.Buffer, UnicodeIfName.MaximumLength);
534 *pdwIfName = UnicodeIfName.MaximumLength;
535 }
536
537 RtlFreeUnicodeString(&UnicodeIfName);
538
539 return ret;
540}
541
542DWORD
543WINAPI
549 _Inout_ TAG_TYPE *pttTags,
550 _In_ DWORD dwTagCount,
551 _In_ DWORD dwMinArgs,
552 _In_ DWORD dwMaxArgs,
553 _Out_ DWORD *pdwTagType)
554{
555 DWORD i;
556 DWORD dwError = ERROR_SUCCESS;
557
558 DPRINT("PreprocessCommand()\n");
559
560 if ((ppwcArguments == NULL) || (pttTags == NULL) || (pdwTagType == NULL))
562
563 if (((dwArgCount - dwCurrentIndex) < dwMinArgs) || ((dwArgCount - dwCurrentIndex) > dwMaxArgs))
565
566 for (i = 0; i < dwTagCount; i++)
567 {
568 pttTags[i].bPresent = FALSE;
569 }
570
571 if ((dwArgCount - dwCurrentIndex) > 0)
572 {
573 dwError = MatchTagsInCmdLine(hModule,
577 pttTags,
578 dwTagCount,
579 pdwTagType);
580 if (dwError != ERROR_SUCCESS)
581 {
582 return dwError;
583 }
584 }
585
586 /* Fail, if a required tag is missing */
587 for (i = 0; i < dwTagCount; i++)
588 {
589 if ((pttTags[i].dwRequired & NS_REQ_PRESENT) && (pttTags[i].bPresent == FALSE))
591 }
592
593 return 0;
594}
595
596DWORD
597CDECL
600 _In_ DWORD dwErrId,
601 ...)
602{
603 INT Length;
604 va_list ap;
605
606 va_start(ap, dwErrId);
607
608 if (hModule)
609 {
612 }
613 else
614 {
615 if ((dwErrId > NETSH_ERROR_BASE) && (dwErrId < NETSH_ERROR_END))
616 {
619 }
620 else
621 {
623 NULL, dwErrId,
625 }
626 }
627
628 va_end(ap);
629
630 return (DWORD)Length;
631}
632
633DWORD
634CDECL
637 _In_ DWORD dwMsgId,
638 ...)
639{
640 INT Length;
641 va_list ap;
642
643 va_start(ap, dwMsgId);
646 va_end(ap);
647
648 return (DWORD)Length;
649}
650
651DWORD
652CDECL
654 _In_ LPCWSTR pwszFormat,
655 ...)
656{
657 INT Length;
658 va_list ap;
659
660 va_start(ap, pwszFormat);
661 Length = ConPrintfV(StdOut, pwszFormat, ap);
662 va_end(ap);
663
664 return (DWORD)Length;
665}
LONG NTSTATUS
Definition: precomp.h:26
#define index(s, c)
Definition: various.h:29
VOID DestroyAliases(VOID)
Definition: alias.c:103
VOID InitAliases(VOID)
Definition: alias.c:95
BOOL CreateRootContext(VOID)
Definition: context.c:805
VOID CleanupContext(VOID)
Definition: context.c:999
PWSTR pszMachine
Definition: context.c:32
DWORD InterpretLine(_In_ LPWSTR pszInputLine)
Definition: interpreter.c:333
VOID InterpretInteractive(VOID)
Definition: interpreter.c:405
#define MAX_STRING_SIZE
Definition: precomp.h:36
#define IDS_OPEN_FAILED
Definition: resource.h:14
#define IDS_APP_USAGE
Definition: resource.h:12
#define DPRINT1
Definition: precomp.h:8
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: conutils_noros.h:8
#define ConInitStdStreams()
Definition: conutils_noros.h:5
#define StdOut
Definition: conutils_noros.h:6
void ConResPrintf(FILE *fp, UINT nID,...)
#define StdErr
Definition: conutils_noros.h:7
void ConResPuts(FILE *fp, UINT nID)
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
HMODULE hModule
Definition: animate.c:44
#define CDECL
Definition: compat.h:29
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static DWORD DWORD * dwLength
Definition: fusion.c:86
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
LPWSTR WINAPI GetCommandLineW(void)
Definition: process.c:1338
MonoAssembly int argc
Definition: metahost.c:107
int CDECL fclose(FILE *file)
Definition: file.c:3757
wchar_t *CDECL fgetws(wchar_t *s, int size, FILE *file)
Definition: file.c:4043
FILE *CDECL _wfopen(const wchar_t *path, const wchar_t *mode)
Definition: file.c:4335
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:24
GLuint index
Definition: glext.h:6031
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
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 GLint GLint j
Definition: glfuncs.h:250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
DWORD CreateRootHelper(VOID)
Definition: helper.c:245
VOID LoadHelpers(VOID)
Definition: helper.c:263
VOID UnloadHelpers(VOID)
Definition: helper.c:340
const char * filename
Definition: ioapi.h:137
DWORD WINAPI NhGetGuidFromInterfaceName(_In_ PWCHAR pInterfaceName, _Out_ GUID *pInterfaceGUID, DWORD dwUnknown3, DWORD dwUnknown4)
DWORD WINAPI NhGetInterfaceNameFromDeviceGuid(_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen, DWORD dwUnknown4, DWORD dwUnknown5)
#define EXIT_FAILURE
Definition: jerror.c:33
#define CopyMemory
Definition: minwinbase.h:29
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define argv
Definition: mplay32.c:18
script
Definition: msipriv.h:383
unsigned int UINT
Definition: ndis.h:50
VOID WINAPI FreeQuotedString(_In_ LPWSTR pszQuotedString)
Definition: netsh.c:270
DWORD WINAPI MatchEnumTag(_In_ HANDLE hModule, _In_ LPCWSTR pwcArg, _In_ DWORD dwNumArg, _In_ const TOKEN_VALUE *pEnumTable, _Out_ PDWORD pdwValue)
Definition: netsh.c:346
VOID WINAPI FreeString(_In_ LPWSTR pszString)
Definition: netsh.c:279
DWORD CDECL PrintError(_In_opt_ HANDLE hModule, _In_ DWORD dwErrId,...)
Definition: netsh.c:598
LPWSTR CDECL MakeString(_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
Definition: netsh.c:306
DWORD CDECL PrintMessage(_In_ LPCWSTR pwszFormat,...)
Definition: netsh.c:653
DWORD RunScript(_In_ LPCWSTR filename)
Definition: netsh.c:22
DWORD WINAPI MatchTagsInCmdLine(_In_ HANDLE hModule, _Inout_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _Inout_ TAG_TYPE *pttTags, _In_ DWORD dwTagCount, _Out_ DWORD *pdwTagType)
Definition: netsh.c:375
DWORD WINAPI NsGetIfNameFromFriendlyName(_In_ DWORD dwUnknown1, _In_ PWSTR pszFriendlyName, _Inout_ PWSTR pszIfName, _Inout_ PDWORD pdwIfName)
Definition: netsh.c:499
BOOL WINAPI MatchToken(_In_ LPCWSTR pwszUserToken, _In_ LPCWSTR pwszCmdToken)
Definition: netsh.c:448
LPWSTR MergeStrings(_In_ LPWSTR pszStringArray[], _In_ UINT nCount)
Definition: netsh.c:53
HMODULE g_hModule
Definition: netsh.c:17
DWORD WINAPI NsGetFriendlyNameFromIfName(_In_ DWORD dwUnknown1, _In_ PWSTR pszIfName, _Inout_ PWSTR pszFriendlyName, _Inout_ PDWORD pdwFriendlyName)
Definition: netsh.c:462
DWORD CDECL PrintMessageFromModule(_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
Definition: netsh.c:635
LPWSTR WINAPI MakeQuotedString(_In_ LPWSTR pszString)
Definition: netsh.c:288
DWORD WINAPI PreprocessCommand(_In_ HANDLE hModule, _Inout_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _Inout_ TAG_TYPE *pttTags, _In_ DWORD dwTagCount, _In_ DWORD dwMinArgs, _In_ DWORD dwMaxArgs, _Out_ DWORD *pdwTagType)
Definition: netsh.c:544
@ NS_REQ_PRESENT
Definition: netsh.h:35
#define NETSH_ERROR_BASE
Definition: netsh.h:8
#define ERROR_INVALID_SYNTAX
Definition: netsh.h:10
_In_ LPWSTR * ppwcArguments
Definition: netsh.h:114
_In_ LPWSTR _In_ DWORD dwArgCount
Definition: netsh.h:115
_In_ LPWSTR _In_ DWORD dwCurrentIndex
Definition: netsh.h:139
#define NETSH_ERROR_END
Definition: netsh.h:30
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
INT ConResMsgPrintfExV(IN PCON_STREAM Stream, IN HINSTANCE hInstance OPTIONAL, IN DWORD dwFlags, IN UINT uID, IN LANGID LanguageId, IN va_list *Arguments OPTIONAL)
Definition: outstream.c:1216
INT ConPrintfV(IN PCON_STREAM Stream, IN PCWSTR szStr, IN va_list args)
Definition: outstream.c:465
INT ConMsgPrintfV(IN PCON_STREAM Stream, IN DWORD dwFlags, IN LPCVOID lpSource OPTIONAL, IN DWORD dwMessageId, IN DWORD dwLanguageId, IN va_list *Arguments OPTIONAL)
Definition: outstream.c:1028
short WCHAR
Definition: pedump.c:58
DWORD * PDWORD
Definition: pedump.c:68
int wmain()
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
wcscat
wcscpy
#define LoadStringW
Definition: utils.h:64
#define DPRINT
Definition: sndvol32.h:73
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define GetModuleHandle
Definition: winbase.h:3548
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
WINBASEAPI _In_ DWORD nLength
Definition: wincon.h:682
#define WINAPI
Definition: msvc.h:6
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERROR_NOT_FOUND
Definition: winerror.h:1014
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
static const GUID InterfaceGuid
Definition: wlanapi.c:25