ReactOS 0.4.16-dev-329-g9223134
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
 

Typedefs

typedef DWORD(WINAPIPGET_RESOURCE_STRING_FN) (_In_ DWORD dwMsgID, _Out_ LPWSTR lpBuffer, _In_ DWORD nBufferMax)
 
typedef DWORD(WINAPIPNS_DLL_INIT_FN) (_In_ DWORD dwNetshVersion, _Out_ PVOID pReserved)
 
typedef DWORD(WINAPIPNS_HELPER_START_FN) (_In_ const GUID *pguidParent, _In_ DWORD dwVersion)
 
typedef DWORD(WINAPIPNS_HELPER_STOP_FN) (_In_ DWORD dwReserved)
 
typedef DWORD(WINAPIPNS_CONTEXT_COMMIT_FN) (_In_ DWORD dwAction)
 
typedef DWORD(WINAPIPNS_CONTEXT_CONNECT_FN) (_In_ LPCWSTR pwszMachine)
 
typedef DWORD(WINAPIPNS_CONTEXT_DUMP_FN) (_In_ LPCWSTR pwszRouter, _In_ LPWSTR *ppwcArguments, _In_ DWORD dwArgCount, _In_ LPCVOID pvData)
 
typedef BOOL(WINAPIPNS_OSVERSIONCHECK) (_In_ UINT CIMOSType, _In_ UINT CIMOSProductSuite, _In_ LPCWSTR CIMOSVersion, _In_ LPCWSTR CIMOSBuildNumber, _In_ LPCWSTR CIMServicePackMajorVersion, _In_ LPCWSTR CIMServicePackMinorVersion, _In_ UINT uiReserved, _In_ DWORD dwReserved)
 
typedef DWORD(WINAPIPFN_HANDLE_CMD) (_In_ LPCWSTR pwszMachine, _In_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _In_ DWORD dwFlags, _In_ LPCVOID pvData, _Out_ BOOL *pbDone)
 
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
 

Functions

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_ 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)
 

Typedef Documentation

◆ CMD_ENTRY

◆ CMD_GROUP_ENTRY

◆ NS_CONTEXT_ATTRIBUTES

◆ NS_HELPER_ATTRIBUTES

◆ PCMD_ENTRY

◆ PCMD_GROUP_ENTRY

◆ PFN_HANDLE_CMD

typedef DWORD(WINAPI * PFN_HANDLE_CMD) (_In_ LPCWSTR pwszMachine, _In_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _In_ DWORD dwFlags, _In_ LPCVOID pvData, _Out_ BOOL *pbDone)

Definition at line 63 of file netsh.h.

◆ PGET_RESOURCE_STRING_FN

typedef DWORD(WINAPI * PGET_RESOURCE_STRING_FN) (_In_ DWORD dwMsgID, _Out_ LPWSTR lpBuffer, _In_ DWORD nBufferMax)

Definition at line 9 of file netsh.h.

◆ PNS_CONTEXT_ATTRIBUTES

◆ PNS_CONTEXT_COMMIT_FN

typedef DWORD(WINAPI * PNS_CONTEXT_COMMIT_FN) (_In_ DWORD dwAction)

Definition at line 33 of file netsh.h.

◆ PNS_CONTEXT_CONNECT_FN

typedef DWORD(WINAPI * PNS_CONTEXT_CONNECT_FN) (_In_ LPCWSTR pwszMachine)

Definition at line 38 of file netsh.h.

◆ PNS_CONTEXT_DUMP_FN

typedef DWORD(WINAPI * PNS_CONTEXT_DUMP_FN) (_In_ LPCWSTR pwszRouter, _In_ LPWSTR *ppwcArguments, _In_ DWORD dwArgCount, _In_ LPCVOID pvData)

Definition at line 43 of file netsh.h.

◆ PNS_DLL_INIT_FN

typedef DWORD(WINAPI * PNS_DLL_INIT_FN) (_In_ DWORD dwNetshVersion, _Out_ PVOID pReserved)

Definition at line 16 of file netsh.h.

◆ PNS_HELPER_ATTRIBUTES

◆ PNS_HELPER_START_FN

typedef DWORD(WINAPI * PNS_HELPER_START_FN) (_In_ const GUID *pguidParent, _In_ DWORD dwVersion)

Definition at line 22 of file netsh.h.

◆ PNS_HELPER_STOP_FN

typedef DWORD(WINAPI * PNS_HELPER_STOP_FN) (_In_ DWORD dwReserved)

Definition at line 28 of file netsh.h.

◆ PNS_OSVERSIONCHECK

typedef BOOL(WINAPI * PNS_OSVERSIONCHECK) (_In_ UINT CIMOSType, _In_ UINT CIMOSProductSuite, _In_ LPCWSTR CIMOSVersion, _In_ LPCWSTR CIMOSBuildNumber, _In_ LPCWSTR CIMServicePackMajorVersion, _In_ LPCWSTR CIMServicePackMinorVersion, _In_ UINT uiReserved, _In_ DWORD dwReserved)

Definition at line 51 of file netsh.h.

◆ PTAG_TYPE

◆ PTOKEN_VALUE

◆ TAG_TYPE

◆ TOKEN_VALUE

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
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ PreprocessCommand()

DWORD WINAPI PreprocessCommand ( _In_ 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 220 of file netsh.c.

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

◆ PrintMessage()

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

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}

◆ RegisterContext()

DWORD WINAPI RegisterContext ( _In_ const NS_CONTEXT_ATTRIBUTES pChildContext)

Definition at line 326 of file context.c.

328{
329 PCONTEXT_ENTRY pContext;
330 DWORD i;
331
332 DPRINT1("RegisterContext(%p)\n", pChildContext);
333 if (pChildContext == NULL)
334 {
335 DPRINT1("Invalid child context!\n");
337 }
338
339 if ((pChildContext->pwszContext == NULL) ||
340 (wcslen(pChildContext->pwszContext) == 0) ||
341 (wcschr(pChildContext->pwszContext, L' ') != 0) ||
342 (wcschr(pChildContext->pwszContext, L'=') != 0))
343 {
344 DPRINT1("Invalid context name!\n");
346 }
347
348 DPRINT1("Name: %S\n", pChildContext->pwszContext);
349
350 pContext = AddContext(pRootContext, pChildContext->pwszContext, (GUID*)&pChildContext->guidHelper);
351 if (pContext != NULL)
352 {
353 for (i = 0; i < pChildContext->ulNumTopCmds; i++)
354 {
355 AddContextCommand(pContext,
356 pChildContext->pTopCmds[i].pwszCmdToken,
357 pChildContext->pTopCmds[i].pfnCmdHandler,
358 pChildContext->pTopCmds[i].dwShortCmdHelpToken,
359 pChildContext->pTopCmds[i].dwCmdHlpToken,
360 pChildContext->pTopCmds[i].dwFlags);
361 }
362
363 /* Add command groups */
364 for (i = 0; i < pChildContext->ulNumGroups; i++)
365 {
366 AddCommandGroup(pContext,
367 pChildContext->pCmdGroups[i].pwszCmdGroupToken,
368 pChildContext->pCmdGroups[i].dwShortCmdHelpToken,
369 pChildContext->pCmdGroups[i].dwFlags);
370 }
371 }
372
373 return ERROR_SUCCESS;
374}
PCOMMAND_GROUP AddCommandGroup(PCONTEXT_ENTRY pContext, LPCWSTR pwszCmdGroupToken, DWORD dwShortCmdHelpToken, DWORD dwFlags)
Definition: context.c:130
PCOMMAND_ENTRY AddContextCommand(PCONTEXT_ENTRY pContext, LPCWSTR pwszCmdToken, PFN_HANDLE_CMD pfnCmdHandler, DWORD dwShortCmdHelpToken, DWORD dwCmdHlpToken, DWORD dwFlags)
Definition: context.c:79
PCONTEXT_ENTRY pRootContext
Definition: context.c:17
PCONTEXT_ENTRY AddContext(PCONTEXT_ENTRY pParentContext, PWSTR pszName, GUID *pGuid)
Definition: context.c:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define wcschr
Definition: compat.h:17
#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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define L(x)
Definition: ntvdm.h:50
Definition: precomp.h:98

◆ RegisterHelper()

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

Definition at line 358 of file helper.c.

361{
362 PHELPER_ENTRY pHelper = NULL, pParentHelper;
363 DWORD dwError = ERROR_SUCCESS;
364
365 DPRINT("RegisterHelper(%p %p)\n", pguidParentHelper, pHelperAttributes);
366
367 if (FindHelper(&pHelperAttributes->guidHelper) != NULL)
368 {
369 DPRINT1("The Helper has already been registered!\n");
370 return 1;
371 }
372
374 if (pHelper == NULL)
375 {
376 dwError = ERROR_OUTOFMEMORY;
377 goto done;
378 }
379
380 CopyMemory(&pHelper->Attributes, pHelperAttributes, sizeof(NS_HELPER_ATTRIBUTES));
381 pHelper->pDllEntry = pCurrentDll;
382 DPRINT("pHelper->pDllEntry: %p\n", pHelper->pDllEntry);
383
384 if (pguidParentHelper == NULL)
385 {
386 if (pHelperListTail == NULL)
387 {
388 pHelperListHead = pHelper;
389 pHelperListTail = pHelper;
390 }
391 else
392 {
393 pHelper->pNext = pHelperListHead;
394 pHelperListHead->pPrev = pHelper;
395 pHelperListHead = pHelper;
396 }
397 }
398 else
399 {
400 pParentHelper = FindHelper(&pHelperAttributes->guidHelper);
401 if (pParentHelper == NULL)
403
404 if (pParentHelper->pSubHelperHead == NULL && pParentHelper->pSubHelperTail == NULL)
405 {
406 pParentHelper->pSubHelperHead = pHelper;
407 pParentHelper->pSubHelperTail = pHelper;
408 }
409 else
410 {
411 pHelper->pPrev = pParentHelper->pSubHelperTail;
412 pParentHelper->pSubHelperTail->pNext = pHelper;
413 pParentHelper->pSubHelperTail = pHelper;
414 }
415 }
416
417done:
418
419 return dwError;
420}
struct _HELPER_ENTRY * PHELPER_ENTRY
struct _HELPER_ENTRY HELPER_ENTRY
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PHELPER_ENTRY FindHelper(_In_ const GUID *pguidHelper)
Definition: helper.c:338
PDLL_LIST_ENTRY pCurrentDll
Definition: helper.c:23
PHELPER_ENTRY pHelperListHead
Definition: helper.c:20
PHELPER_ENTRY pHelperListTail
Definition: helper.c:21
#define DPRINT
Definition: sndvol32.h:73
Definition: precomp.h:56
struct _HELPER_ENTRY * pSubHelperTail
Definition: precomp.h:66
NS_HELPER_ATTRIBUTES Attributes
Definition: precomp.h:60
PDLL_LIST_ENTRY pDllEntry
Definition: precomp.h:62
struct _HELPER_ENTRY * pNext
Definition: precomp.h:58
struct _HELPER_ENTRY * pPrev
Definition: precomp.h:57
#define CopyMemory
Definition: winbase.h:1735