NS_CONTEXT_ATTRIBUTES structure (netsh.h)

The NS_CONTEXT_ATTRIBUTES structure defines attributes of a context.

Syntax

typedef struct _NS_CONTEXT_ATTRIBUTES {
  union {
    struct {
      DWORD dwVersion;
      DWORD dwReserved;
    };
    ULONGLONG _ullAlign;
  };
  LPWSTR                 pwszContext;
  GUID                   guidHelper;
  DWORD                  dwFlags;
  ULONG                  ulPriority;
  ULONG                  ulNumTopCmds;
  _CMD_ENTRY( )            *pTopCmds[];
  struct                 _CMD_ENTRY;
  ULONG                  ulNumGroups;
  _CMD_GROUP_ENTRY( )      *pCmdGroups[];
  struct                 _CMD_GROUP_ENTRY;
  PNS_CONTEXT_COMMIT_FN  pfnCommitFn;
  PNS_CONTEXT_DUMP_FN    pfnDumpFn;
  PNS_CONTEXT_CONNECT_FN pfnConnectFn;
  PVOID                  pReserved;
  PNS_OSVERSIONCHECK     pfnOsVersionCheck;
} NS_CONTEXT_ATTRIBUTES, *PNS_CONTEXT_ATTRIBUTES;

Members

dwVersion

The version of the helper.

dwReserved

Reserved. Must be zero.

_ullAlign

pwszContext

A unicode string that identifies the new context. This string is the command available to users. The string must not contain spaces.

guidHelper

A pointer to the GUID of this helper. Identical to the value passed to the RegisterHelper function as the pguidHelper member of the NS_HELPER_ATTRIBUTES structure.

dwFlags

A set of flags that limit when this context is available.

Flag Meaning
CMD_FLAG_INTERACTIVE
If set, context is available only when NetSh is run in interactive mode, but is not available to be passed to NetSh on the command line.
CMD_FLAG_LOCAL
If set, the context is not valid from a remote computer.
CMD_FLAG_ONLINE
If set, the context is not valid in offline mode.
CMD_FLAG_PRIORITY
If set, the ulPriority field is used.

ulPriority

A priority value used when ordering dump and commit commands. Used only when the CMD_FLAG_PRIORITY flag is set in dwFlags. Default value is DEFAULT_CONTEXT_PRIORITY, defined as 100 in NetSh.h. Lower values indicate higher priority.

ulNumTopCmds

The number of entries in the pTopCmds member.

pTopCmds

An array of CMD_ENTRY structures that contain helper commands.

_CMD_ENTRY

ulNumGroups

A number of entries in the pCmdGroups member.

pCmdGroups

An array of CMD_GROUP_ENTRY structures that contain helper command groups.

_CMD_GROUP_ENTRY

pfnCommitFn

A function called to commit changes from offline mode. Can be null. For more information about the commit function, see NS_CONTEXT_COMMIT_FN.

pfnDumpFn

A function called to dump the current configuration. Can be null. For more information about the dump function, see NS_CONTEXT_DUMP_FN.

pfnConnectFn

A function called to connect to a remote computer, or to update the set of available commands. Can be null. For more information about the connect function, see NS_CONTEXT_CONNECT_FN.

pReserved

Reserved. Must be null.

pfnOsVersionCheck

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header netsh.h

See also

CMD_ENTRY

CMD_GROUP_ENTRY

NS_CONTEXT_COMMIT_FN

NS_CONTEXT_CONNECT_FN

NS_CONTEXT_DUMP_FN

NS_HELPER_ATTRIBUTES

NetShell Flags