PreprocessCommand function (netsh.h)

The PreprocessCommand function parses an argument string and verifies that all required tags are present.

Syntax

DWORD PreprocessCommand(
            HANDLE   hModule,
  [in, out] LPWSTR   *ppwcArguments,
  [in]      DWORD    dwCurrentIndex,
  [in]      DWORD    dwArgCount,
  [in]      TAG_TYPE *pttTags,
  [in]      DWORD    dwTagCount,
  [in]      DWORD    dwMinArgs,
  [in]      DWORD    dwMaxArgs,
  [out]     DWORD    *pdwTagType
);

Parameters

hModule

Reserved. Set to null.

[in, out] ppwcArguments

The arguments passed to FN_HANDLE_CMD (the command function) as its ppwcArguments parameter.

[in] dwCurrentIndex

A value that specifies the first argument to process, such that ppwcArguments[dwCurrentIndex] is the first.

[in] dwArgCount

The argument count passed as the dwArgCount parameter.

[in] pttTags

An array of tags of type TAG_TYPE.

[in] dwTagCount

A number of entries in the pttTags array.

[in] dwMinArgs

The minimum number of arguments required for this command.

[in] dwMaxArgs

The maximum number of arguments allowed for this command.

[out] pdwTagType

An array of DWORDs, with at least enough space for a number of entries equal to dwArgCount - dwCurrentIndex. Each DWORD contains the array index number in the pttTags array to which the array index number in the ppwcArguments array is matched. For example, if ppwcArguments[0] is matched to pttTags[2], pdwTagType[0] is 2.

Return value

Return code Description
NO_ERROR
The function completed successfully.
ERROR_INVALID_SYNTAX
Invalid syntax.
ERROR_TAG_ALREADY_PRESENT
The tag is already present.
ERROR_INVALID_PARAMETER
An invalid parameter was entered.
ERROR_INVALID_OPTION_TAG
An invalid option tag.
ERROR_NOT_ENOUGH_MEMORY
There is not enough memory available to carry out the command.
 
 

Remarks

The PreprocessCommand function is typically called by command functions. This function parses all arguments, matching arguments with tags, and leaves the type (tag index) of each argument in the pdwTagType array, where pdwTagType[0] corresponds to the type of ppwcArguments[dwCurrentIndex]. The PreprocessCommand function also ensures that tags required to be present are present.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header netsh.h
Library Netsh.lib
DLL Netsh.exe

See also

FN_HANDLE_CMD

TAG_TYPE