NS_HELPER_START_FN callback function (netsh.h)
The NS_HELPER_START_FN command is the start function for helpers. The start function provides an opportunity for helpers to register contexts and is registered in the RegisterContext function. The following is an example of a start function. Be aware that SampleStartHelper is a placeholder for the application-defined function name.
Syntax
NS_HELPER_START_FN NsHelperStartFn;
DWORD NsHelperStartFn(
[in] const GUID *pguidParent,
[in] DWORD dwVersion
)
{...}
Parameters
[in] pguidParent
The parent under which the helper DLL should be registered.
[in] dwVersion
The version of the parent helper DLL.
Return value
Returns NO_ERROR upon success. Any other return value indicates an error.
Remarks
A typical implementation of the start function is as follows:
DWORD WINAPI SampleStartHelper(
CONST GUID *pguidParent,
DWORD dwVersion
)
{
DWORD dwErr;
NS_CONTEXT_ATTRIBUTES attMyAttributes;
ZeroMemory(&attMyAttributes, sizeof(attMyAttributes));
attMyAttributes.pwszContext = L"samplecontext";
attMyAttributes.guidHelper = g_SampleGuid;
attMyAttributes.dwVersion = 1;
attMyAttributes.dwFlags = 0;
attMyAttributes.ulNumTopCmds = g_ulSampleNumTopCmds;
attMyAttributes.pTopCmds = (CMD_ENTRY (*)[])&g_SampleTopCmds;
attMyAttributes.ulNumGroups = g_ulSampleCmdGroups;
attMyAttributes.pCmdGroups = (CMD_GROUP_ENTRY (*)[])&g_SampleCmdsGroups;
attMyAttributes.pfnCommitFn = SampleCommit;
attMyAttributes.pfnDumpFn = SampleDump;
attMyAttributes.pfnConnectFn = SampleConnect;
dwErr = RegisterContext( &attMyAttributes );
return dwErr;
}
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 |