xref: /reactos/sdk/include/psdk/netsh.h (revision cce399e7)
1 #ifndef _NETSH_H_
2 #define _NETSH_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 typedef
9 DWORD
10 (WINAPI *PGET_RESOURCE_STRING_FN)(
11     _In_ DWORD dwMsgID,
12     _Out_ LPWSTR lpBuffer,
13     _In_ DWORD nBufferMax);
14 
15 typedef
16 DWORD
17 (WINAPI *PNS_DLL_INIT_FN)(
18     _In_ DWORD dwNetshVersion,
19     _Out_ PVOID pReserved);
20 
21 typedef
22 DWORD
23 (WINAPI *PNS_HELPER_START_FN)(
24     _In_ const GUID *pguidParent,
25     _In_ DWORD dwVersion);
26 
27 typedef
28 DWORD
29 (WINAPI *PNS_HELPER_STOP_FN)(
30     _In_ DWORD dwReserved);
31 
32 typedef
33 DWORD
34 (WINAPI *PNS_CONTEXT_COMMIT_FN)(
35     _In_ DWORD dwAction);
36 
37 typedef
38 DWORD
39 (WINAPI *PNS_CONTEXT_CONNECT_FN)(
40     _In_ LPCWSTR pwszMachine);
41 
42 typedef
43 DWORD
44 (WINAPI *PNS_CONTEXT_DUMP_FN)(
45     _In_ LPCWSTR pwszRouter,
46     _In_ LPWSTR *ppwcArguments,
47     _In_ DWORD dwArgCount,
48     _In_ LPCVOID pvData);
49 
50 typedef
51 BOOL
52 (WINAPI *PNS_OSVERSIONCHECK)(
53     _In_ UINT CIMOSType,
54     _In_ UINT CIMOSProductSuite,
55     _In_ LPCWSTR CIMOSVersion,
56     _In_ LPCWSTR CIMOSBuildNumber,
57     _In_ LPCWSTR CIMServicePackMajorVersion,
58     _In_ LPCWSTR CIMServicePackMinorVersion,
59     _In_ UINT uiReserved,
60     _In_ DWORD dwReserved);
61 
62 typedef
63 DWORD
64 (WINAPI *PFN_HANDLE_CMD)(
65     _In_ LPCWSTR pwszMachine,
66     _In_ LPWSTR *ppwcArguments,
67     _In_ DWORD dwCurrentIndex,
68     _In_ DWORD dwArgCount,
69     _In_ DWORD dwFlags,
70     _In_ LPCVOID pvData,
71     _Out_ BOOL *pbDone);
72 
73 
74 typedef struct _CMD_ENTRY
75 {
76     LPCWSTR pwszCmdToken;
77     PFN_HANDLE_CMD pfnCmdHandler;
78     DWORD dwShortCmdHelpToken;
79     DWORD dwCmdHlpToken;
80     DWORD dwFlags;
81     PNS_OSVERSIONCHECK pOsVersionCheck;
82 } CMD_ENTRY, *PCMD_ENTRY;
83 
84 typedef struct _CMD_GROUP_ENTRY
85 {
86     LPCWSTR pwszCmdGroupToken;
87     DWORD dwShortCmdHelpToken;
88     ULONG ulCmdGroupSize;
89     DWORD dwFlags;
90     PCMD_ENTRY pCmdGroup;
91     PNS_OSVERSIONCHECK pOsVersionCheck;
92 } CMD_GROUP_ENTRY, *PCMD_GROUP_ENTRY;
93 
94 typedef struct _NS_HELPER_ATTRIBUTES
95 {
96     union
97     {
98         struct
99         {
100             DWORD dwVersion;
101             DWORD dwReserved;
102         };
103         ULONGLONG _ullAlign;
104     };
105     GUID guidHelper;
106     PNS_HELPER_START_FN pfnStart;
107     PNS_HELPER_STOP_FN pfnStop;
108 } NS_HELPER_ATTRIBUTES, *PNS_HELPER_ATTRIBUTES;
109 
110 typedef struct _NS_CONTEXT_ATTRIBUTES
111 {
112     union
113     {
114         struct
115         {
116             DWORD dwVersion;
117             DWORD dwReserved;
118         };
119         ULONGLONG _ullAlign;
120     };
121     LPWSTR pwszContext;
122     GUID guidHelper;
123     DWORD dwFlags;
124     ULONG ulPriority;
125     ULONG ulNumTopCmds;
126     CMD_ENTRY *pTopCmds;
127     ULONG ulNumGroups;
128     CMD_GROUP_ENTRY *pCmdGroups;
129     PNS_CONTEXT_COMMIT_FN pfnCommitFn;
130     PNS_CONTEXT_DUMP_FN pfnDumpFn;
131     PNS_CONTEXT_CONNECT_FN pfnConnectFn;
132     PVOID pReserved;
133     PNS_OSVERSIONCHECK pfnOsVersionCheck;
134 } NS_CONTEXT_ATTRIBUTES, *PNS_CONTEXT_ATTRIBUTES;
135 
136 typedef struct _TAG_TYPE
137 {
138     LPCWSTR pwszTag;
139     DWORD dwRequired;
140     BOOL bPresent;
141 } TAG_TYPE, *PTAG_TYPE;
142 
143 typedef struct _TOKEN_VALUE
144 {
145     LPCWSTR pwszToken;
146     DWORD dwValue;
147 } TOKEN_VALUE, *PTOKEN_VALUE;
148 
149 DWORD
150 WINAPI
151 MatchEnumTag(
152     _In_ HANDLE hModule,
153     _In_ LPCWSTR pwcArg,
154     _In_ DWORD dwNumArg,
155     _In_ const TOKEN_VALUE *pEnumTable,
156     _Out_ PDWORD pdwValue);
157 
158 BOOL
159 WINAPI
160 MatchToken(
161     _In_ LPCWSTR pwszUserToken,
162     _In_ LPCWSTR pwszCmdToken);
163 
164 DWORD
165 WINAPI
166 PreprocessCommand(
167     _In_ HANDLE hModule,
168     _Inout_ LPWSTR *ppwcArguments,
169     _In_ DWORD dwCurrentIndex,
170     _In_ DWORD dwArgCount,
171     _Inout_ PTAG_TYPE pttTags,
172     _In_ DWORD dwTagCount,
173     _In_ DWORD dwMinArgs,
174     _In_ DWORD dwMaxArgs,
175     _Out_ DWORD *pdwTagType);
176 
177 DWORD
178 CDECL
179 PrintError(
180     _In_opt_ HANDLE hModule,
181     _In_ DWORD dwErrId,
182     ...);
183 
184 DWORD
185 CDECL
186 PrintMessageFromModule(
187     _In_ HANDLE hModule,
188     _In_ DWORD dwMsgId,
189     ...);
190 
191 DWORD
192 CDECL
193 PrintMessage(
194     _In_ LPCWSTR pwszMessage,
195     ...);
196 
197 DWORD
198 WINAPI
199 RegisterContext(
200     _In_ const NS_CONTEXT_ATTRIBUTES *pChildContext);
201 
202 DWORD
203 WINAPI
204 RegisterHelper(
205     _In_ const GUID *pguidParentContext,
206     _In_ const NS_HELPER_ATTRIBUTES *pfnRegisterSubContext);
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* _NETSH_H_ */
213