ReactOS 0.4.16-dev-1946-g52006dd
netsh.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CMD_ENTRY
 
struct  _CMD_GROUP_ENTRY
 
struct  _NS_HELPER_ATTRIBUTES
 
struct  _NS_CONTEXT_ATTRIBUTES
 
struct  _TAG_TYPE
 
struct  _TOKEN_VALUE
 

Macros

#define NETSH_ERROR_BASE   15000
 
#define ERROR_NO_ENTRIES   (NETSH_ERROR_BASE + 0)
 
#define ERROR_INVALID_SYNTAX   (NETSH_ERROR_BASE + 1)
 
#define ERROR_PROTOCOL_NOT_IN_TRANSPORT   (NETSH_ERROR_BASE + 2)
 
#define ERROR_NO_CHANGE   (NETSH_ERROR_BASE + 3)
 
#define ERROR_CMD_NOT_FOUND   (NETSH_ERROR_BASE + 4)
 
#define ERROR_ENTRY_PT_NOT_FOUND   (NETSH_ERROR_BASE + 5)
 
#define ERROR_DLL_LOAD_FAILED   (NETSH_ERROR_BASE + 6)
 
#define ERROR_INIT_DISPLAY   (NETSH_ERROR_BASE + 7)
 
#define ERROR_TAG_ALREADY_PRESENT   (NETSH_ERROR_BASE + 8)
 
#define ERROR_INVALID_OPTION_TAG   (NETSH_ERROR_BASE + 9)
 
#define ERROR_NO_TAG   (NETSH_ERROR_BASE + 10)
 
#define ERROR_MISSING_OPTION   (NETSH_ERROR_BASE + 11)
 
#define ERROR_TRANSPORT_NOT_PRESENT   (NETSH_ERROR_BASE + 12)
 
#define ERROR_SHOW_USAGE   (NETSH_ERROR_BASE + 13)
 
#define ERROR_INVALID_OPTION_VALUE   (NETSH_ERROR_BASE + 14)
 
#define ERROR_OKAY   (NETSH_ERROR_BASE + 15)
 
#define ERROR_CONTINUE_IN_PARENT_CONTEXT   (NETSH_ERROR_BASE + 16)
 
#define ERROR_SUPPRESS_OUTPUT   (NETSH_ERROR_BASE + 17)
 
#define ERROR_HELPER_ALREADY_REGISTERED   (NETSH_ERROR_BASE + 18)
 
#define ERROR_CONTEXT_ALREADY_REGISTERED   (NETSH_ERROR_BASE + 19)
 
#define ERROR_PARSING_FAILURE   (NETSH_ERROR_BASE + 20)
 
#define NETSH_ERROR_END   ERROR_CONTEXT_ALREADY_REGISTERED
 
#define DEFAULT_CONTEXT_PRIORITY   100
 
#define NETSH_ROOT_GUID   {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}
 

Typedefs

typedef enum _NS_REQS NS_REQS
 
typedef _Out_ LPWSTR lpBuffer
 
typedef _Out_ LPWSTR _In_ DWORD nBufferMax
 
typedef GET_RESOURCE_STRING_FN * PGET_RESOURCE_STRING_FN
 
typedef _Out_ PVOID pReserved
 
typedef NS_DLL_INIT_FN * PNS_DLL_INIT_FN
 
typedef _In_ DWORD dwVersion
 
typedef NS_HELPER_START_FN * PNS_HELPER_START_FN
 
typedef NS_HELPER_STOP_FN * PNS_HELPER_STOP_FN
 
typedef NS_CONTEXT_COMMIT_FN * PNS_CONTEXT_COMMIT_FN
 
typedef NS_CONTEXT_CONNECT_FN * PNS_CONTEXT_CONNECT_FN
 
typedef _In_ LPWSTRppwcArguments
 
typedef _In_ LPWSTR _In_ DWORD dwArgCount
 
typedef _In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
 
typedef NS_CONTEXT_DUMP_FN * PNS_CONTEXT_DUMP_FN
 
typedef _In_ UINT CIMOSProductSuite
 
typedef _In_ UINT _In_ LPCWSTR CIMOSVersion
 
typedef _In_ UINT _In_ LPCWSTR _In_ LPCWSTR CIMOSBuildNumber
 
typedef _In_ UINT _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR CIMServicePackMajorVersion
 
typedef _In_ UINT _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR CIMServicePackMinorVersion
 
typedef _In_ UINT _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR _In_ UINT uiReserved
 
typedef _In_ UINT _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR _In_ LPCWSTR _In_ UINT _In_ DWORD dwReserved
 
typedef NS_OSVERSIONCHECK * PNS_OSVERSIONCHECK
 
typedef _In_ LPWSTR _In_ DWORD dwCurrentIndex
 
typedef _In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
 
typedef _In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD _In_ LPCVOID _Out_ BOOLpbDone
 
typedef FN_HANDLE_CMD * PFN_HANDLE_CMD
 
typedef struct _CMD_ENTRY CMD_ENTRY
 
typedef struct _CMD_ENTRYPCMD_ENTRY
 
typedef struct _CMD_GROUP_ENTRY CMD_GROUP_ENTRY
 
typedef struct _CMD_GROUP_ENTRYPCMD_GROUP_ENTRY
 
typedef struct _NS_HELPER_ATTRIBUTES NS_HELPER_ATTRIBUTES
 
typedef struct _NS_HELPER_ATTRIBUTESPNS_HELPER_ATTRIBUTES
 
typedef struct _NS_CONTEXT_ATTRIBUTES NS_CONTEXT_ATTRIBUTES
 
typedef struct _NS_CONTEXT_ATTRIBUTESPNS_CONTEXT_ATTRIBUTES
 
typedef struct _TAG_TYPE TAG_TYPE
 
typedef struct _TAG_TYPEPTAG_TYPE
 
typedef struct _TOKEN_VALUE TOKEN_VALUE
 
typedef struct _TOKEN_VALUEPTOKEN_VALUE
 

Enumerations

enum  _NS_REQS { NS_REQ_ZERO = 0 , NS_REQ_PRESENT = 1 , NS_REQ_ALLOW_MULTIPLE = 2 , NS_REQ_ONE_OR_MORE = 3 }
 
enum  NS_CMD_FLAGS {
  CMD_FLAG_PRIVATE = 0x01 , CMD_FLAG_INTERACTIVE = 0x02 , CMD_FLAG_LOCAL = 0x08 , CMD_FLAG_ONLINE = 0x10 ,
  CMD_FLAG_HIDDEN = 0x20 , CMD_FLAG_LIMIT_MASK = 0xffff , CMD_FLAG_PRIORITY = 0x80000000
}
 
enum  NS_MODE_CHANGE {
  NETSH_COMMIT = 0 , NETSH_UNCOMMIT = 1 , NETSH_FLUSH = 2 , NETSH_COMMIT_STATE = 3 ,
  NETSH_SAVE = 4
}
 

Functions

typedef DWORD (WINAPI GET_RESOURCE_STRING_FN)(_In_ DWORD dwMsgID
 
typedef BOOL (WINAPI NS_OSVERSIONCHECK)(_In_ UINT CIMOSType
 
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 WINAPI PreprocessCommand (_In_opt_ HANDLE hModule, _Inout_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _Inout_ PTAG_TYPE pttTags, _In_ DWORD dwTagCount, _In_ DWORD dwMinArgs, _In_ DWORD dwMaxArgs, _Out_ DWORD *pdwTagType)
 
DWORD CDECL PrintError (_In_opt_ HANDLE hModule, _In_ DWORD dwErrId,...)
 
DWORD CDECL PrintMessageFromModule (_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
 
DWORD CDECL PrintMessage (_In_ LPCWSTR pwszMessage,...)
 
DWORD WINAPI RegisterContext (_In_ const NS_CONTEXT_ATTRIBUTES *pChildContext)
 
DWORD WINAPI RegisterHelper (_In_ const GUID *pguidParentContext, _In_ const NS_HELPER_ATTRIBUTES *pfnRegisterSubContext)
 

Macro Definition Documentation

◆ DEFAULT_CONTEXT_PRIORITY

#define DEFAULT_CONTEXT_PRIORITY   100

Definition at line 60 of file netsh.h.

◆ ERROR_CMD_NOT_FOUND

#define ERROR_CMD_NOT_FOUND   (NETSH_ERROR_BASE + 4)

Definition at line 13 of file netsh.h.

◆ ERROR_CONTEXT_ALREADY_REGISTERED

#define ERROR_CONTEXT_ALREADY_REGISTERED   (NETSH_ERROR_BASE + 19)

Definition at line 28 of file netsh.h.

◆ ERROR_CONTINUE_IN_PARENT_CONTEXT

#define ERROR_CONTINUE_IN_PARENT_CONTEXT   (NETSH_ERROR_BASE + 16)

Definition at line 25 of file netsh.h.

◆ ERROR_DLL_LOAD_FAILED

#define ERROR_DLL_LOAD_FAILED   (NETSH_ERROR_BASE + 6)

Definition at line 15 of file netsh.h.

◆ ERROR_ENTRY_PT_NOT_FOUND

#define ERROR_ENTRY_PT_NOT_FOUND   (NETSH_ERROR_BASE + 5)

Definition at line 14 of file netsh.h.

◆ ERROR_HELPER_ALREADY_REGISTERED

#define ERROR_HELPER_ALREADY_REGISTERED   (NETSH_ERROR_BASE + 18)

Definition at line 27 of file netsh.h.

◆ ERROR_INIT_DISPLAY

#define ERROR_INIT_DISPLAY   (NETSH_ERROR_BASE + 7)

Definition at line 16 of file netsh.h.

◆ ERROR_INVALID_OPTION_TAG

#define ERROR_INVALID_OPTION_TAG   (NETSH_ERROR_BASE + 9)

Definition at line 18 of file netsh.h.

◆ ERROR_INVALID_OPTION_VALUE

#define ERROR_INVALID_OPTION_VALUE   (NETSH_ERROR_BASE + 14)

Definition at line 23 of file netsh.h.

◆ ERROR_INVALID_SYNTAX

#define ERROR_INVALID_SYNTAX   (NETSH_ERROR_BASE + 1)

Definition at line 10 of file netsh.h.

◆ ERROR_MISSING_OPTION

#define ERROR_MISSING_OPTION   (NETSH_ERROR_BASE + 11)

Definition at line 20 of file netsh.h.

◆ ERROR_NO_CHANGE

#define ERROR_NO_CHANGE   (NETSH_ERROR_BASE + 3)

Definition at line 12 of file netsh.h.

◆ ERROR_NO_ENTRIES

#define ERROR_NO_ENTRIES   (NETSH_ERROR_BASE + 0)

Definition at line 9 of file netsh.h.

◆ ERROR_NO_TAG

#define ERROR_NO_TAG   (NETSH_ERROR_BASE + 10)

Definition at line 19 of file netsh.h.

◆ ERROR_OKAY

#define ERROR_OKAY   (NETSH_ERROR_BASE + 15)

Definition at line 24 of file netsh.h.

◆ ERROR_PARSING_FAILURE

#define ERROR_PARSING_FAILURE   (NETSH_ERROR_BASE + 20)

Definition at line 29 of file netsh.h.

◆ ERROR_PROTOCOL_NOT_IN_TRANSPORT

#define ERROR_PROTOCOL_NOT_IN_TRANSPORT   (NETSH_ERROR_BASE + 2)

Definition at line 11 of file netsh.h.

◆ ERROR_SHOW_USAGE

#define ERROR_SHOW_USAGE   (NETSH_ERROR_BASE + 13)

Definition at line 22 of file netsh.h.

◆ ERROR_SUPPRESS_OUTPUT

#define ERROR_SUPPRESS_OUTPUT   (NETSH_ERROR_BASE + 17)

Definition at line 26 of file netsh.h.

◆ ERROR_TAG_ALREADY_PRESENT

#define ERROR_TAG_ALREADY_PRESENT   (NETSH_ERROR_BASE + 8)

Definition at line 17 of file netsh.h.

◆ ERROR_TRANSPORT_NOT_PRESENT

#define ERROR_TRANSPORT_NOT_PRESENT   (NETSH_ERROR_BASE + 12)

Definition at line 21 of file netsh.h.

◆ NETSH_ERROR_BASE

#define NETSH_ERROR_BASE   15000

Definition at line 8 of file netsh.h.

◆ NETSH_ERROR_END

Definition at line 30 of file netsh.h.

◆ NETSH_ROOT_GUID

#define NETSH_ROOT_GUID   {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}

Definition at line 62 of file netsh.h.

Typedef Documentation

◆ CIMOSBuildNumber

Definition at line 126 of file netsh.h.

◆ CIMOSProductSuite

Definition at line 124 of file netsh.h.

◆ CIMOSVersion

Definition at line 125 of file netsh.h.

◆ CIMServicePackMajorVersion

◆ CIMServicePackMinorVersion

◆ CMD_ENTRY

◆ CMD_GROUP_ENTRY

◆ dwArgCount

Definition at line 115 of file netsh.h.

◆ dwCurrentIndex

Definition at line 139 of file netsh.h.

◆ dwFlags

static DWORD dwFlags

Definition at line 141 of file netsh.h.

◆ dwReserved

◆ dwVersion

typedef _In_ DWORD dwVersion

Definition at line 85 of file netsh.h.

◆ lpBuffer

Definition at line 68 of file netsh.h.

◆ nBufferMax

Definition at line 69 of file netsh.h.

◆ NS_CONTEXT_ATTRIBUTES

◆ NS_HELPER_ATTRIBUTES

◆ NS_REQS

◆ pbDone

Definition at line 143 of file netsh.h.

◆ PCMD_ENTRY

◆ PCMD_GROUP_ENTRY

◆ PFN_HANDLE_CMD

typedef FN_HANDLE_CMD* PFN_HANDLE_CMD

Definition at line 145 of file netsh.h.

◆ PGET_RESOURCE_STRING_FN

typedef GET_RESOURCE_STRING_FN* PGET_RESOURCE_STRING_FN

Definition at line 71 of file netsh.h.

◆ PNS_CONTEXT_ATTRIBUTES

◆ PNS_CONTEXT_COMMIT_FN

typedef NS_CONTEXT_COMMIT_FN* PNS_CONTEXT_COMMIT_FN

Definition at line 101 of file netsh.h.

◆ PNS_CONTEXT_CONNECT_FN

typedef NS_CONTEXT_CONNECT_FN* PNS_CONTEXT_CONNECT_FN

Definition at line 108 of file netsh.h.

◆ PNS_CONTEXT_DUMP_FN

typedef NS_CONTEXT_DUMP_FN* PNS_CONTEXT_DUMP_FN

Definition at line 118 of file netsh.h.

◆ PNS_DLL_INIT_FN

typedef NS_DLL_INIT_FN* PNS_DLL_INIT_FN

Definition at line 79 of file netsh.h.

◆ PNS_HELPER_ATTRIBUTES

◆ PNS_HELPER_START_FN

typedef NS_HELPER_START_FN* PNS_HELPER_START_FN

Definition at line 87 of file netsh.h.

◆ PNS_HELPER_STOP_FN

typedef NS_HELPER_STOP_FN* PNS_HELPER_STOP_FN

Definition at line 94 of file netsh.h.

◆ PNS_OSVERSIONCHECK

typedef NS_OSVERSIONCHECK* PNS_OSVERSIONCHECK

Definition at line 132 of file netsh.h.

◆ ppwcArguments

Definition at line 114 of file netsh.h.

◆ pReserved

Definition at line 77 of file netsh.h.

◆ PTAG_TYPE

◆ PTOKEN_VALUE

◆ pvData

◆ TAG_TYPE

◆ TOKEN_VALUE

◆ uiReserved

Enumeration Type Documentation

◆ _NS_REQS

Enumerator
NS_REQ_ZERO 
NS_REQ_PRESENT 
NS_REQ_ALLOW_MULTIPLE 
NS_REQ_ONE_OR_MORE 

Definition at line 32 of file netsh.h.

33{
34 NS_REQ_ZERO = 0,
38} NS_REQS;
enum _NS_REQS NS_REQS
@ NS_REQ_PRESENT
Definition: netsh.h:35
@ NS_REQ_ONE_OR_MORE
Definition: netsh.h:37
@ NS_REQ_ALLOW_MULTIPLE
Definition: netsh.h:36
@ NS_REQ_ZERO
Definition: netsh.h:34

◆ NS_CMD_FLAGS

Enumerator
CMD_FLAG_PRIVATE 
CMD_FLAG_INTERACTIVE 
CMD_FLAG_LOCAL 
CMD_FLAG_ONLINE 
CMD_FLAG_HIDDEN 
CMD_FLAG_LIMIT_MASK 
CMD_FLAG_PRIORITY 

Definition at line 40 of file netsh.h.

41{
42 CMD_FLAG_PRIVATE = 0x01,
44 CMD_FLAG_LOCAL = 0x08,
45 CMD_FLAG_ONLINE = 0x10,
46 CMD_FLAG_HIDDEN = 0x20,
47 CMD_FLAG_LIMIT_MASK = 0xffff,
48 CMD_FLAG_PRIORITY = 0x80000000
49};
@ CMD_FLAG_ONLINE
Definition: netsh.h:45
@ CMD_FLAG_HIDDEN
Definition: netsh.h:46
@ CMD_FLAG_PRIVATE
Definition: netsh.h:42
@ CMD_FLAG_LIMIT_MASK
Definition: netsh.h:47
@ CMD_FLAG_PRIORITY
Definition: netsh.h:48
@ CMD_FLAG_INTERACTIVE
Definition: netsh.h:43
@ CMD_FLAG_LOCAL
Definition: netsh.h:44

◆ NS_MODE_CHANGE

Enumerator
NETSH_COMMIT 
NETSH_UNCOMMIT 
NETSH_FLUSH 
NETSH_COMMIT_STATE 
NETSH_SAVE 

Definition at line 51 of file netsh.h.

52{
53 NETSH_COMMIT = 0,
55 NETSH_FLUSH = 2,
57 NETSH_SAVE = 4
58};
@ NETSH_COMMIT
Definition: netsh.h:53
@ NETSH_FLUSH
Definition: netsh.h:55
@ NETSH_SAVE
Definition: netsh.h:57
@ NETSH_UNCOMMIT
Definition: netsh.h:54
@ NETSH_COMMIT_STATE
Definition: netsh.h:56

Function Documentation

◆ BOOL()

typedef BOOL ( WINAPI  NS_OSVERSIONCHECK)

◆ DWORD()

typedef DWORD ( WINAPI  GET_RESOURCE_STRING_FN)

◆ MatchEnumTag()

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

Definition at line 343 of file netsh.c.

349{
350 DWORD i;
351
352 DPRINT("MatchEnumTag(%p %p %lu %p %p)\n", hModule, pwcArg, dwNumArg, pEnumTable, pdwValue);
353
354 if ((pEnumTable == NULL) || (pdwValue == NULL))
356
357 for (i = 0; i < dwNumArg; i++)
358 {
359 if (MatchToken(pwcArg, pEnumTable[i].pwszToken))
360 {
361 *pdwValue = pEnumTable[i].dwValue;
362 return ERROR_SUCCESS;
363 }
364 }
365
366 return ERROR_NOT_FOUND;
367}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
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
BOOL WINAPI MatchToken(_In_ LPCWSTR pwszUserToken, _In_ LPCWSTR pwszCmdToken)
Definition: netsh.c:371
HMODULE hModule
Definition: netsh.c:17
#define DPRINT
Definition: sndvol32.h:73
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

◆ MatchToken()

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

Definition at line 371 of file netsh.c.

374{
375 DPRINT("MatchToken(%S %S)\n", pwszUserToken, pwszCmdToken);
376
377 if ((pwszUserToken == NULL) || (pwszCmdToken == NULL))
378 return FALSE;
379
380 return (_wcsnicmp(pwszUserToken, pwszCmdToken, wcslen(pwszUserToken)) == 0) ? TRUE : FALSE;
381}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)

Referenced by GetContextCommand(), GetContextGroup(), GetContextSubContext(), GetGroupCommand(), IpShowAdapters(), and MatchEnumTag().

◆ PreprocessCommand()

DWORD WINAPI PreprocessCommand ( _In_opt_ HANDLE  hModule,
_Inout_ LPWSTR ppwcArguments,
_In_ DWORD  dwCurrentIndex,
_In_ DWORD  dwArgCount,
_Inout_ PTAG_TYPE  pttTags,
_In_ DWORD  dwTagCount,
_In_ DWORD  dwMinArgs,
_In_ DWORD  dwMaxArgs,
_Out_ DWORD pdwTagType 
)

◆ PrintError()

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

Definition at line 439 of file netsh.c.

443{
444 PWSTR pszInBuffer = NULL, pszOutBuffer = NULL;
445 DWORD dwLength = 0;
446 va_list ap;
447
448 DPRINT("PrintError(%p %lu ...)\n", hModule, dwErrId);
449
450 va_start(ap, dwErrId);
451
452 pszOutBuffer = HeapAlloc(GetProcessHeap(), 0, HUGE_BUFFER_SIZE * sizeof(WCHAR));
453 if (pszOutBuffer == NULL)
454 goto done;
455
456 if (hModule)
457 {
458 pszInBuffer = HeapAlloc(GetProcessHeap(), 0, HUGE_BUFFER_SIZE * sizeof(WCHAR));
459 if (pszInBuffer == NULL)
460 goto done;
461
462 dwLength = LoadStringW(hModule, dwErrId, pszInBuffer, HUGE_BUFFER_SIZE);
463 if (dwLength == 0)
464 goto done;
465
467 pszInBuffer,
468 0,
469 0,
470 pszOutBuffer,
472 &ap);
473 }
474 else
475 {
476 if ((dwErrId > NETSH_ERROR_BASE) && (dwErrId < NETSH_ERROR_END))
477 {
478 pszInBuffer = HeapAlloc(GetProcessHeap(), 0, HUGE_BUFFER_SIZE * sizeof(WCHAR));
479 if (pszInBuffer == NULL)
480 goto done;
481
482 dwLength = LoadStringW(GetModuleHandle(NULL), dwErrId, pszInBuffer, HUGE_BUFFER_SIZE);
483 if (dwLength == 0)
484 goto done;
485
487 pszInBuffer,
488 0,
489 0L,
490 pszOutBuffer,
492 &ap);
493 }
494 else
495 {
497 NULL,
498 dwErrId,
500 pszOutBuffer,
502 &ap);
503 }
504 }
505
506 va_end(ap);
507
508 if (dwLength > 0)
509 ConPuts(StdOut, pszOutBuffer);
510
511done:
512 if (pszOutBuffer)
513 HeapFree(GetProcessHeap(), 0, pszOutBuffer);
514
515 if (pszInBuffer)
516 HeapFree(GetProcessHeap(), 0, pszInBuffer);
517
518 return dwLength;
519}
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 ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define StdOut
Definition: fc.c:14
#define HUGE_BUFFER_SIZE
Definition: precomp.h:38
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
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
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
#define L(x)
Definition: resources.c:13
#define NETSH_ERROR_BASE
Definition: netsh.h:8
#define NETSH_ERROR_END
Definition: netsh.h:30
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
uint16_t * PWSTR
Definition: typedefs.h:56
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define GetModuleHandle
Definition: winbase.h:3576
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wmain().

◆ PrintMessage()

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

Definition at line 542 of file netsh.c.

545{
546 INT Length;
547 va_list ap;
548
549 va_start(ap, pwszFormat);
550 Length = ConPrintfV(StdOut, pwszFormat, ap);
551 va_end(ap);
552
553 return Length;
554}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
INT ConPrintfV(IN PCON_STREAM Stream, IN PCWSTR szStr, IN va_list args)
Definition: outstream.c:466
int32_t INT
Definition: typedefs.h:58

◆ PrintMessageFromModule()

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

Definition at line 523 of file netsh.c.

527{
528 INT Length;
529 va_list ap;
530
531 va_start(ap, dwMsgId);
534 ap);
535 va_end(ap);
536
537 return Length;
538}
INT ConResPrintfExV(IN PCON_STREAM Stream, IN HINSTANCE hInstance OPTIONAL, IN UINT uID, IN LANGID LanguageId, IN va_list args)
Definition: outstream.c:653
#define SUBLANG_NEUTRAL
Definition: nls.h:167

Referenced by InterfaceDumpFn(), IpDumpFn(), and IpShowAdapters().

◆ RegisterContext()

DWORD WINAPI RegisterContext ( _In_ const NS_CONTEXT_ATTRIBUTES pChildContext)

Definition at line 909 of file context.c.

911{
912 PHELPER_ENTRY pHelper;
913 PCONTEXT_ENTRY pContext, pParentContext;
914 PCOMMAND_GROUP pGroup;
915 DWORD i, j;
916
917 DPRINT1("RegisterContext(%p)\n", pChildContext);
918 if (pChildContext == NULL)
919 {
920 DPRINT1("Invalid child context!\n");
922 }
923
924 if ((pChildContext->pwszContext == NULL) ||
925 (wcslen(pChildContext->pwszContext) == 0) ||
926 (wcschr(pChildContext->pwszContext, L' ') != 0) ||
927 (wcschr(pChildContext->pwszContext, L'=') != 0))
928 {
929 DPRINT1("Invalid context name!\n");
931 }
932
933 DPRINT("Name: %S\n", pChildContext->pwszContext);
934 DPRINT("Groups: %lu\n", pChildContext->ulNumGroups);
935 DPRINT("Top commands: %lu\n", pChildContext->ulNumTopCmds);
936
937 pHelper = FindHelper(&pChildContext->guidHelper, pHelperListHead);
938 DPRINT("Helper %p\n", pHelper);
939 pParentContext = pRootContext;
940 if (pHelper != NULL)
941 {
942 pParentContext = FindContextByGuid(&pHelper->ParentHelperGuid);
943 DPRINT("pParentContext %p\n", pParentContext);
944 if (pParentContext == NULL)
945 pParentContext = pRootContext;
946 }
947
948 pContext = AddContext(pParentContext, pChildContext->pwszContext, (GUID*)&pChildContext->guidHelper);
949 if (pContext != NULL)
950 {
951 pContext->pfnCommitFn = pChildContext->pfnCommitFn;
952 pContext->pfnDumpFn = pChildContext->pfnDumpFn;
953 pContext->pfnConnectFn = pChildContext->pfnConnectFn;
954 pContext->ulPriority = (pChildContext->dwFlags & CMD_FLAG_PRIORITY) ?
955 pChildContext->ulPriority : DEFAULT_CONTEXT_PRIORITY;
956
957 if ((pHelper != NULL) && (pHelper->pDllEntry != NULL))
958 {
959 pContext->hModule = pHelper->pDllEntry->hModule;
960 }
961
962 for (i = 0; i < pChildContext->ulNumTopCmds; i++)
963 {
964 AddContextCommand(pContext,
965 pChildContext->pTopCmds[i].pwszCmdToken,
966 pChildContext->pTopCmds[i].pfnCmdHandler,
967 pChildContext->pTopCmds[i].dwShortCmdHelpToken,
968 pChildContext->pTopCmds[i].dwCmdHlpToken,
969 pChildContext->pTopCmds[i].dwFlags);
970 }
971
972 /* Add command groups */
973 for (i = 0; i < pChildContext->ulNumGroups; i++)
974 {
975 pGroup = AddCommandGroup(pContext,
976 pChildContext->pCmdGroups[i].pwszCmdGroupToken,
977 pChildContext->pCmdGroups[i].dwShortCmdHelpToken,
978 pChildContext->pCmdGroups[i].dwFlags);
979 if (pGroup != NULL)
980 {
981 for (j = 0; j < pChildContext->pCmdGroups[i].ulCmdGroupSize; j++)
982 {
983 AddGroupCommand(pGroup,
984 pChildContext->pCmdGroups[i].pCmdGroup[j].pwszCmdToken,
985 pChildContext->pCmdGroups[i].pCmdGroup[j].pfnCmdHandler,
986 pChildContext->pCmdGroups[i].pCmdGroup[j].dwShortCmdHelpToken,
987 pChildContext->pCmdGroups[i].pCmdGroup[j].dwCmdHlpToken,
988 pChildContext->pCmdGroups[i].pCmdGroup[j].dwFlags);
989 }
990 }
991 }
992 }
993
994 return ERROR_SUCCESS;
995}
PCONTEXT_ENTRY FindContextByGuid(const GUID *pGuid)
Definition: context.c:898
PCOMMAND_GROUP AddCommandGroup(PCONTEXT_ENTRY pContext, LPCWSTR pwszCmdGroupToken, DWORD dwShortCmdHelpToken, DWORD dwFlags)
Definition: context.c:152
PCOMMAND_ENTRY AddContextCommand(PCONTEXT_ENTRY pContext, LPCWSTR pwszCmdToken, PFN_HANDLE_CMD pfnCmdHandler, DWORD dwShortCmdHelpToken, DWORD dwCmdHlpToken, DWORD dwFlags)
Definition: context.c:101
PCOMMAND_ENTRY AddGroupCommand(PCOMMAND_GROUP pGroup, LPCWSTR pwszCmdToken, PFN_HANDLE_CMD pfnCmdHandler, DWORD dwShortCmdHelpToken, DWORD dwCmdHlpToken, DWORD dwFlags)
Definition: context.c:197
PCONTEXT_ENTRY pRootContext
Definition: context.c:26
PCONTEXT_ENTRY AddContext(PCONTEXT_ENTRY pParentContext, PWSTR pszName, GUID *pGuid)
Definition: context.c:39
#define DPRINT1
Definition: precomp.h:8
#define wcschr
Definition: compat.h:17
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
PHELPER_ENTRY FindHelper(_In_ const GUID *pguidHelper, _In_ PHELPER_ENTRY pHelper)
Definition: helper.c:360
PHELPER_ENTRY pHelperListHead
Definition: helper.c:20
if(dx< 0)
Definition: linetemp.h:194
#define DEFAULT_CONTEXT_PRIORITY
Definition: netsh.h:60
Definition: precomp.h:105
PNS_CONTEXT_CONNECT_FN pfnConnectFn
Definition: precomp.h:118
ULONG ulPriority
Definition: precomp.h:115
PNS_CONTEXT_COMMIT_FN pfnCommitFn
Definition: precomp.h:116
HMODULE hModule
Definition: precomp.h:114
PNS_CONTEXT_DUMP_FN pfnDumpFn
Definition: precomp.h:117
HMODULE hModule
Definition: precomp.h:57
Definition: precomp.h:62
PDLL_LIST_ENTRY pDllEntry
Definition: precomp.h:69
GUID ParentHelperGuid
Definition: precomp.h:67

Referenced by InterfaceStart(), IpStart(), and WinsockStart().

◆ RegisterHelper()

DWORD WINAPI RegisterHelper ( _In_ const GUID pguidParentContext,
_In_ const NS_HELPER_ATTRIBUTES pfnRegisterSubContext 
)

Definition at line 385 of file helper.c.

388{
389 PHELPER_ENTRY pHelper = NULL, pParentHelper;
390 DWORD dwError = ERROR_SUCCESS;
391
392 DPRINT("RegisterHelper(%p %p)\n", pguidParentHelper, pHelperAttributes);
393
394 if (FindHelper(&pHelperAttributes->guidHelper, pHelperListHead) != NULL)
395 {
396 DPRINT1("The Helper has already been registered!\n");
398 }
399
401 if (pHelper == NULL)
402 {
403 dwError = ERROR_OUTOFMEMORY;
404 goto done;
405 }
406
407 DPRINT("Guid: %lx\n", pHelperAttributes->guidHelper.Data1);
408 DPRINT("dwVersion: %lu\n", pHelperAttributes->dwVersion);
409 DPRINT("pfnStart: %p\n", pHelperAttributes->pfnStart);
410 DPRINT("pfnStop: %p\n", pHelperAttributes->pfnStop);
411
412 CopyMemory(&pHelper->Attributes, pHelperAttributes, sizeof(NS_HELPER_ATTRIBUTES));
413 pHelper->pDllEntry = pCurrentDll;
414 DPRINT("pHelper->pDllEntry: %p\n", pHelper->pDllEntry);
415
416 if (pguidParentHelper == NULL)
417 {
418 if ((pHelperListHead == NULL) && (pHelperListTail == NULL))
419 {
420 pHelperListHead = pHelper;
421 pHelperListTail = pHelper;
422 }
423 else
424 {
425 pHelper->pNext = pHelperListHead;
426 pHelperListHead->pPrev = pHelper;
427 pHelperListHead = pHelper;
428 }
429 }
430 else
431 {
432 CopyMemory(&pHelper->ParentHelperGuid, pguidParentHelper, sizeof(GUID));
433 pParentHelper = FindHelper(pguidParentHelper, pHelperListHead);
434 if (pParentHelper == NULL)
435 {
436 DPRINT("Parent helper %lx not found!\n", pguidParentHelper->Data1);
438 }
439
440 if ((pParentHelper->pSubHelperHead == NULL) && (pParentHelper->pSubHelperTail == NULL))
441 {
442 pParentHelper->pSubHelperHead = pHelper;
443 pParentHelper->pSubHelperTail = pHelper;
444 }
445 else
446 {
447 pHelper->pPrev = pParentHelper->pSubHelperTail;
448 pParentHelper->pSubHelperTail->pNext = pHelper;
449 pParentHelper->pSubHelperTail = pHelper;
450 }
451 }
452
453done:
454
455 return dwError;
456}
struct _HELPER_ENTRY * PHELPER_ENTRY
struct _HELPER_ENTRY HELPER_ENTRY
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PDLL_LIST_ENTRY pCurrentDll
Definition: helper.c:23
PHELPER_ENTRY pHelperListTail
Definition: helper.c:21
#define CopyMemory
Definition: minwinbase.h:29
struct _HELPER_ENTRY * pSubHelperTail
Definition: precomp.h:73
NS_HELPER_ATTRIBUTES Attributes
Definition: precomp.h:66
struct _HELPER_ENTRY * pNext
Definition: precomp.h:64
struct _HELPER_ENTRY * pPrev
Definition: precomp.h:63

Referenced by RegisterInterfaceHelper(), RegisterIpHelper(), and RegisterWinsockHelper().