ReactOS 0.4.17-dev-357-ga8f14ff
netsh_undoc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VOID WINAPI FreeQuotedString (_In_ LPWSTR pszQuotedString)
 
VOID WINAPI FreeString (_In_ LPWSTR pszString)
 
LPWSTR WINAPI MakeQuotedString (_In_ LPWSTR pszString)
 
LPWSTR CDECL MakeString (_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
 
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)
 
DWORD WINAPI NsGetFriendlyNameFromIfName (_In_ DWORD dwParam1, _In_ PWSTR pszIfName, _Inout_ PWSTR pszFriendlyName, _Inout_ PDWORD pdwFriendlyName)
 
DWORD WINAPI NsGetIfNameFromFriendlyName (_In_ DWORD dwUnknown1, _In_ PWSTR pszFriendlyName, _Inout_ PWSTR pszIfName, _Inout_ PDWORD pdwIfName)
 

Function Documentation

◆ FreeQuotedString()

VOID WINAPI FreeQuotedString ( _In_ LPWSTR  pszQuotedString)

Definition at line 270 of file netsh.c.

272{
273 DPRINT("FreeQuotedString(%S)\n", pszQuotedString);
274 HeapFree(GetProcessHeap(), 0, pszQuotedString);
275}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
#define DPRINT
Definition: sndvol32.h:73

◆ FreeString()

VOID WINAPI FreeString ( _In_ LPWSTR  pszString)

Definition at line 279 of file netsh.c.

281{
282 DPRINT("FreeString(%S)\n", pszString);
283 LocalFree(pszString);
284}
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594

Referenced by CreateProcessInternalW(), IKsFilterFactory_fnInitialize(), and LoadLibraryExW().

◆ MakeQuotedString()

LPWSTR WINAPI MakeQuotedString ( _In_ LPWSTR  pszString)

Definition at line 288 of file netsh.c.

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}
#define NULL
Definition: types.h:112
#define HeapAlloc
Definition: compat.h:733
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define L(x)
Definition: resources.c:13
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
short WCHAR
Definition: pedump.c:58
uint16_t * LPWSTR
Definition: typedefs.h:56

◆ MakeString()

LPWSTR CDECL MakeString ( _In_ HANDLE  hModule,
_In_ DWORD  dwMsgId,
  ... 
)

Definition at line 306 of file netsh.c.

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}
HMODULE hModule
Definition: animate.c:44
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
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CopyMemory
Definition: minwinbase.h:29
#define UNICODE_NULL
#define LoadStringW
Definition: utils.h:64
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ MatchTagsInCmdLine()

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 at line 375 of file netsh.c.

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}
#define DPRINT1
Definition: precomp.h:8
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define wcschr
Definition: compat.h:17
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
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
_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 DWORD
Definition: nt_native.h:44
wcscpy
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by IpAddAddress(), IpAddDns(), IpDeleteAddress(), IpDeleteArpCache(), IpDeleteDns(), IpSetAddress(), IpSetDns(), and PreprocessCommand().

◆ NsGetFriendlyNameFromIfName()

DWORD WINAPI NsGetFriendlyNameFromIfName ( _In_ DWORD  dwParam1,
_In_ PWSTR  pszIfName,
_Inout_ PWSTR  pszFriendlyName,
_Inout_ PDWORD  pdwFriendlyName 
)

Definition at line 462 of file netsh.c.

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}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
return ret
Definition: mutex.c:146
Status
Definition: gdiplustypes.h:24
DWORD WINAPI NhGetInterfaceNameFromDeviceGuid(_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen, DWORD dwUnknown4, DWORD dwUnknown5)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static const GUID InterfaceGuid
Definition: wlanapi.c:25

◆ NsGetIfNameFromFriendlyName()

DWORD WINAPI NsGetIfNameFromFriendlyName ( _In_ DWORD  dwUnknown1,
_In_ PWSTR  pszFriendlyName,
_Inout_ PWSTR  pszIfName,
_Inout_ PDWORD  pdwIfName 
)

Definition at line 499 of file netsh.c.

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}
DWORD WINAPI NhGetGuidFromInterfaceName(_In_ PWCHAR pInterfaceName, _Out_ GUID *pInterfaceGUID, DWORD dwUnknown3, DWORD dwUnknown4)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)