FN_HANDLE_CMD callback function (netsh.h)

The FN_HANDLE_CMD command is the command function for helpers. Helpers expose commands through the pTopCmds and pCmdGroups parameters in the RegisterContext function. The following is an example of a command function. Be aware that SampleCommand is a placeholder for the application-defined function name.

Syntax

FN_HANDLE_CMD FnHandleCmd;

DWORD FnHandleCmd(
  [in]  LPCWSTR pwszMachine,
  [in]  LPWSTR *ppwcArguments,
  [in]  DWORD dwCurrentIndex,
  [in]  DWORD dwArgCount,
  [in]  DWORD dwFlags,
  [in]  LPCVOID pvData,
  [out] BOOL *pbDone
)
{...}

Parameters

[in] pwszMachine

The name of the computer on which to perform the command, or null if the command applies to the local computer. The default value is null.

If the context uses a connect function, this argument can be ignored.

[in] ppwcArguments

A set of command tokens.

[in] dwCurrentIndex

The current index into ppwcArguments of the last token processed before the function was called.

[in] dwArgCount

The number of arguments in the ppwcArguments parameter.

[in] dwFlags

The command flags that pertain to the current state.

[in] pvData

A data pointer. Value is null unless changed by a parent context SubEntry function.

[out] pbDone

A set pbDone to TRUE before returning to instruct NetShell to terminate after the command function completes. The pbDone parameter is set to FALSE by default.

Return value

Returns NO_ERROR upon success. Any other return value indicates an error.

Remarks

The computer name specified in pwszMachine is passed to each function, so a connect function is not required, as would be the case if a helper has only one command. Helpers with multiple commands can create remotability code in the connect function, rather than duplicating it in each command function.

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

See also

NS_HELPER_ATTRIBUTES

RegisterContext