1 /*
2 * ndis.h
3 *
4 * Network Device Interface Specification definitions
5 *
6 * This file is part of the ReactOS DDK package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * DEFINES: i386 - Target platform is i386
22 * NDIS_WRAPPER - Define only for NDIS library
23 * NDIS_MINIPORT_DRIVER - Define only for NDIS miniport drivers
24 * NDIS40 - Use NDIS 4.0 structures by default
25 * NDIS50 - Use NDIS 5.0 structures by default
26 * NDIS51 - Use NDIS 5.1 structures by default
27 * NDIS40_MINIPORT - Building NDIS 4.0 miniport driver
28 * NDIS50_MINIPORT - Building NDIS 5.0 miniport driver
29 * NDIS51_MINIPORT - Building NDIS 5.1 miniport driver
30 */
31
32 #ifndef _NDIS_
33 #define _NDIS_
34
35 #ifndef NDIS_WDM
36 #define NDIS_WDM 0
37 #endif
38
39 #include "ntddk.h"
40 #include "netpnp.h"
41 #include "ntstatus.h"
42 #include "netevent.h"
43 #include <qos.h>
44
45 typedef _Return_type_success_(return >= 0) int NDIS_STATUS, *PNDIS_STATUS;
46
47 #include "ntddndis.h"
48
49 #if !defined(_WINDEF_H)
50 typedef unsigned int UINT, *PUINT;
51 #endif
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 __drv_Mode_impl(NDIS_INCLUDED)
58
59 #ifndef __NET_PNP__
60 #define __NET_PNP__
61
62 typedef enum _NET_DEVICE_POWER_STATE {
63 NetDeviceStateUnspecified = 0,
64 NetDeviceStateD0,
65 NetDeviceStateD1,
66 NetDeviceStateD2,
67 NetDeviceStateD3,
68 NetDeviceStateMaximum
69 } NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE;
70
71 typedef enum _NET_PNP_EVENT_CODE {
72 NetEventSetPower,
73 NetEventQueryPower,
74 NetEventQueryRemoveDevice,
75 NetEventCancelRemoveDevice,
76 NetEventReconfigure,
77 NetEventBindList,
78 NetEventBindsComplete,
79 NetEventPnPCapabilities,
80 NetEventPause,
81 NetEventRestart,
82 NetEventPortActivation,
83 NetEventPortDeactivation,
84 NetEventIMReEnableDevice,
85 NetEventMaximum
86 } NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE;
87
88 typedef struct _NET_PNP_EVENT {
89 NET_PNP_EVENT_CODE NetEvent;
90 PVOID Buffer;
91 ULONG BufferLength;
92 ULONG_PTR NdisReserved[4];
93 ULONG_PTR TransportReserved[4];
94 ULONG_PTR TdiReserved[4];
95 ULONG_PTR TdiClientReserved[4];
96 } NET_PNP_EVENT, *PNET_PNP_EVENT;
97
98 #endif /* __NET_PNP__ */
99
100 #if !defined(NDIS_WRAPPER)
101
102 #if (defined(NDIS_MINIPORT_MAJOR_VERSION) || \
103 (defined(NDIS_MINIPORT_MINOR_VERSION)) || \
104 (defined(NDIS_PROTOCOL_MAJOR_VERSION)) || \
105 (defined(NDIS_PROTOCOL_MINOR_VERSION)) || \
106 (defined(NDIS_FILTER_MAJOR_VERSION)) || \
107 (defined(NDIS_FILTER_MINOR_VERSION)))
108 #error "Driver should not redefine NDIS reserved macros"
109 #endif
110
111 #if defined(NDIS_MINIPORT_DRIVER)
112
113 #if defined(NDIS620_MINIPORT)
114 #define NDIS_MINIPORT_MAJOR_VERSION 6
115 #define NDIS_MINIPORT_MINOR_VERSION 20
116 #elif defined(NDIS61_MINIPORT)
117 #define NDIS_MINIPORT_MAJOR_VERSION 6
118 #define NDIS_MINIPORT_MINOR_VERSION 1
119 #elif defined(NDIS60_MINIPORT)
120 #define NDIS_MINIPORT_MAJOR_VERSION 6
121 #define NDIS_MINIPORT_MINOR_VERSION 0
122 #elif defined(NDIS51_MINIPORT)
123 #define NDIS_MINIPORT_MAJOR_VERSION 5
124 #define NDIS_MINIPORT_MINOR_VERSION 1
125 #elif defined(NDIS50_MINIPORT)
126 #define NDIS_MINIPORT_MAJOR_VERSION 5
127 #define NDIS_MINIPORT_MINOR_VERSION 0
128 #else
129 #error "Only NDIS miniport drivers with version >= 5 are supported"
130 #endif
131
132 #if ((NDIS_MINIPORT_MAJOR_VERSION == 6) && \
133 (NDIS_MINIPORT_MINOR_VERSION != 20) && \
134 (NDIS_MINIPORT_MINOR_VERSION != 1) && \
135 (NDIS_MINIPORT_MINOR_VERSION != 0))
136 #error "Invalid miniport major/minor version combination"
137 #elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \
138 (NDIS_MINIPORT_MINOR_VERSION != 1) && \
139 (NDIS_MINIPORT_MINOR_VERSION != 0))
140 #error "Invalid miniport major/minor version combination"
141 #endif
142
143 #if (NDIS_MINIPORT_MAJOR_VERSION == 6) && \
144 ((NDIS_MINIPORT_MINOR_VERSION == 20 && NTDDI_VERSION < NTDDI_WIN7) || \
145 (NDIS_MINIPORT_MINOR_VERSION == 1 && NTDDI_VERSION < NTDDI_VISTA) || \
146 (NDIS_MINIPORT_MINOR_VERSION == 0 && NTDDI_VERSION < NTDDI_VISTA))
147 #error "Wrong NDIS/DDI version"
148 #elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \
149 (((NDIS_MINIPORT_MINOR_VERSION == 1) && (NTDDI_VERSION < NTDDI_WINXP)) || \
150 ((NDIS_MINIPORT_MINOR_VERSION == 0) && (NTDDI_VERSION < NTDDI_WIN2K))))
151 #error "Wrong NDIS/DDI version"
152 #endif
153
154
155 #endif /* defined(NDIS_MINIPORT_DRIVER) */
156
157 #if defined(NDIS30)
158 #error "Only NDIS Protocol drivers version 4 or later are supported"
159 #endif
160
161 #if defined(NDIS620)
162 #define NDIS_PROTOCOL_MAJOR_VERSION 6
163 #define NDIS_PROTOCOL_MINOR_VERSION 20
164 #define NDIS_FILTER_MAJOR_VERSION 6
165 #define NDIS_FILTER_MINOR_VERSION 20
166 #elif defined(NDIS61)
167 #define NDIS_PROTOCOL_MAJOR_VERSION 6
168 #define NDIS_PROTOCOL_MINOR_VERSION 1
169 #define NDIS_FILTER_MAJOR_VERSION 6
170 #define NDIS_FILTER_MINOR_VERSION 1
171 #elif defined(NDIS60)
172 #define NDIS_PROTOCOL_MAJOR_VERSION 6
173 #define NDIS_PROTOCOL_MINOR_VERSION 0
174 #define NDIS_FILTER_MAJOR_VERSION 6
175 #define NDIS_FILTER_MINOR_VERSION 0
176 #elif defined(NDIS51)
177 #define NDIS_PROTOCOL_MAJOR_VERSION 5
178 #define NDIS_PROTOCOL_MINOR_VERSION 1
179 #elif defined(NDIS50)
180 #define NDIS_PROTOCOL_MAJOR_VERSION 5
181 #define NDIS_PROTOCOL_MINOR_VERSION 0
182 #elif defined(NDIS40)
183 #define NDIS_PROTOCOL_MAJOR_VERSION 4
184 #define NDIS_PROTOCOL_MINOR_VERSION 0
185 #endif
186
187 #if !defined(NDIS_MINIPORT_DRIVER) && !defined(NDIS_PROTOCOL_MAJOR_VERSION)
188 #define NDIS40
189 #define NDIS_PROTOCOL_MAJOR_VERSION 4
190 #define NDIS_PROTOCOL_MINOR_VERSION 0
191 #endif
192
193 #if defined(NDIS_FILTER_MAJOR_VERSION)
194
195 #if ((NDIS_FILTER_MAJOR_VERSION == 6) && \
196 (NDIS_FILTER_MINOR_VERSION != 20) && \
197 (NDIS_FILTER_MINOR_VERSION != 1) && \
198 (NDIS_FILTER_MINOR_VERSION != 0))
199 #error "Invalid Filter version"
200 #endif
201
202 #endif /* defined(NDIS_FILTER_MAJOR_VERSION) */
203
204
205 #if defined(NDIS_PROTOCOL_MAJOR_VERSION)
206
207 #if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && \
208 (NDIS_PROTOCOL_MINOR_VERSION != 20) && \
209 (NDIS_PROTOCOL_MINOR_VERSION != 1) && \
210 (NDIS_PROTOCOL_MINOR_VERSION != 0))
211 #error "Invalid Protocol version"
212 #elif ((NDIS_PROTOCOL_MAJOR_VERSION == 5) && \
213 (NDIS_PROTOCOL_MINOR_VERSION != 1) && (NDIS_PROTOCOL_MINOR_VERSION != 0))
214 #error "Invalid Protocol version"
215 #elif ((NDIS_PROTOCOL_MAJOR_VERSION == 4) && (NDIS_PROTOCOL_MINOR_VERSION != 0))
216 #error "Invalid Protocol major/minor version"
217 #endif
218
219 #if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && (NTDDI_VERSION < NTDDI_VISTA))
220 #error "Wrong NDIS/DDI version"
221 #endif
222
223 #endif /* defined(NDIS_PROTOCOL_MAJOR_VERSION) */
224
225 #endif /* !defined(NDIS_WRAPPER) */
226
227 #if !defined(NDIS_LEGACY_MINIPORT)
228
229 #if ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER)
230 #define NDIS_LEGACY_MINIPORT 1
231 #else
232 #define NDIS_LEGACY_MINIPORT 0
233 #endif
234
235 #endif /* !defined(NDIS_LEGACY_MINIPORT) */
236
237 #if !defined(NDIS_LEGACY_PROTOCOL)
238
239 #if ((defined(NDIS_PROTOCOL_MAJOR_VERSION) && (NDIS_PROTOCOL_MAJOR_VERSION < 6)) || NDIS_WRAPPER)
240 #define NDIS_LEGACY_PROTOCOL 1
241 #else
242 #define NDIS_LEGACY_PROTOCOL 0
243 #endif
244
245 #endif /* !defined(NDIS_LEGACY_PROTOCOL) */
246
247 #if !defined(NDIS_LEGACY_DRIVER)
248
249 #if (NDIS_LEGACY_MINIPORT || NDIS_LEGACY_PROTOCOL || NDIS_WRAPPER)
250 #define NDIS_LEGACY_DRIVER 1
251 #else
252 #define NDIS_LEGACY_DRIVER 0
253 #endif
254
255 #endif /* !defined(NDIS_LEGACY_DRIVER) */
256
257 #if !defined(NDIS_SUPPORT_NDIS6)
258
259 #if ((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) || \
260 (defined (NDIS60)) || NDIS_WRAPPER)
261 #define NDIS_SUPPORT_NDIS6 1
262 #else
263 #define NDIS_SUPPORT_NDIS6 0
264 #endif
265
266 #endif /* !defined(NDIS_SUPPORT_NDIS6) */
267
268 #if !defined(NDIS_SUPPORT_NDIS61)
269 #if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
270 (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 1))) || \
271 (defined (NDIS61)) || NDIS_WRAPPER)
272 #define NDIS_SUPPORT_NDIS61 1
273 #else
274 #define NDIS_SUPPORT_NDIS61 0
275 #endif
276 #endif /* !defined(NDIS_SUPPORT_NDIS61) */
277
278 #if !defined(NDIS_SUPPORT_NDIS620)
279
280 #if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
281 (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 20))) || \
282 (defined (NDIS620)) || NDIS_WRAPPER)
283 #define NDIS_SUPPORT_NDIS620 1
284 #else
285 #define NDIS_SUPPORT_NDIS620 0
286 #endif
287
288 #endif /* !defined(NDIS_SUPPORT_NDIS620) */
289
290 #if (NDIS_SUPPORT_NDIS620)
291 #undef NDIS_SUPPORT_NDIS61
292 #define NDIS_SUPPORT_NDIS61 1
293 #endif
294
295 #if (NDIS_SUPPORT_NDIS61)
296 #undef NDIS_SUPPORT_NDIS6
297 #define NDIS_SUPPORT_NDIS6 1
298 #endif
299
300 #if defined(NDIS61_MINIPORT) || defined(NDIS60_MINIPORT) || defined(NDIS61) || \
301 defined(NDIS60) || defined(NDIS_WRAPPER) || defined(NDIS_LEGACY_DRIVER)
302 #define NDIS_SUPPORT_60_COMPATIBLE_API 1
303 #else
304 #define NDIS_SUPPORT_60_COMPATIBLE_API 0
305 #endif
306
307 #if defined(NDIS_WRAPPER)
308 #define NDISAPI
309 #else
310 #define NDISAPI DECLSPEC_IMPORT
311 #endif
312
313 typedef PVOID QUEUED_CLOSE; //FIXME : Doesn't exist in public headers
314
315 typedef struct _X_FILTER FDDI_FILTER, *PFDDI_FILTER;
316 typedef struct _X_FILTER TR_FILTER, *PTR_FILTER;
317 typedef struct _X_FILTER NULL_FILTER, *PNULL_FILTER;
318
319 typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
320
321 typedef struct _REFERENCE {
322 KSPIN_LOCK SpinLock;
323 USHORT ReferenceCount;
324 BOOLEAN Closing;
325 } REFERENCE, *PREFERENCE;
326
327 /* NDIS base types */
328
329 typedef struct _NDIS_SPIN_LOCK {
330 KSPIN_LOCK SpinLock;
331 KIRQL OldIrql;
332 } NDIS_SPIN_LOCK, *PNDIS_SPIN_LOCK;
333
334 typedef struct _NDIS_EVENT {
335 KEVENT Event;
336 } NDIS_EVENT, *PNDIS_EVENT;
337
338 typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
339
340 typedef ANSI_STRING NDIS_ANSI_STRING, *PNDIS_ANSI_STRING;
341 typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
342
343 typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
344
345 /* NDIS_STATUS constants */
346 #define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
347 #define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
348 #define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
349 #define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
350 #define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
351 #define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
352 #define NDIS_STATUS_INDICATION_REQUIRED ((NDIS_STATUS)STATUS_NDIS_INDICATION_REQUIRED)
353 #define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L)
354 #define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L)
355 #define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L)
356 #define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L)
357 #define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L)
358 #define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L)
359 #define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L)
360 #define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL)
361 #define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL)
362 #define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL)
363 #define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL)
364 #define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL)
365 #define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL)
366 #define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L)
367 #define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L)
368 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L)
369 #define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
370 #define NDIS_STATUS_LINK_SPEED_CHANGE ((NDIS_STATUS)0x40010013L)
371 #define NDIS_STATUS_WAN_GET_STATS ((NDIS_STATUS)0x40010014L)
372 #define NDIS_STATUS_WAN_CO_FRAGMENT ((NDIS_STATUS)0x40010015L)
373 #define NDIS_STATUS_WAN_CO_LINKPARAMS ((NDIS_STATUS)0x40010016L)
374 #if NDIS_SUPPORT_NDIS6
375 #define NDIS_STATUS_LINK_STATE ((NDIS_STATUS)0x40010017L)
376 #define NDIS_STATUS_NETWORK_CHANGE ((NDIS_STATUS)0x40010018L)
377 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX ((NDIS_STATUS)0x40010019L)
378 #define NDIS_STATUS_PORT_STATE ((NDIS_STATUS)0x40010022L)
379 #define NDIS_STATUS_OPER_STATUS ((NDIS_STATUS)0x40010023L)
380 #define NDIS_STATUS_PACKET_FILTER ((NDIS_STATUS)0x40010024L)
381 #endif /* NDIS_SUPPORT_NDIS6 */
382 #define NDIS_STATUS_WAN_CO_MTULINKPARAMS ((NDIS_STATUS)0x40010025L)
383
384 #if NDIS_SUPPORT_NDIS6
385
386 #define NDIS_STATUS_IP_OPER_STATUS ((NDIS_STATUS)0x40010026L)
387
388 #define NDIS_STATUS_OFFLOAD_PAUSE ((NDIS_STATUS)0x40020001L)
389 #define NDIS_STATUS_UPLOAD_ALL ((NDIS_STATUS)0x40020002L)
390 #define NDIS_STATUS_OFFLOAD_RESUME ((NDIS_STATUS)0x40020003L)
391 #define NDIS_STATUS_OFFLOAD_PARTIAL_SUCCESS ((NDIS_STATUS)0x40020004L)
392 #define NDIS_STATUS_OFFLOAD_STATE_INVALID ((NDIS_STATUS)0x40020005L)
393 #define NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG ((NDIS_STATUS)0x40020006L)
394 #define NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x40020007L)
395 #define NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE ((NDIS_STATUS)0x40020008L)
396 #define NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x4002000BL)
397
398 #if (NDIS_SUPPORT_NDIS61)
399 #define NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG ((NDIS_STATUS)0x4002000CL)
400 #endif
401
402 #if (NDIS_SUPPORT_NDIS620)
403 #define NDIS_STATUS_RECEIVE_QUEUE_STATE ((NDIS_STATUS)0x4002000DL)
404 #endif
405
406 #define NDIS_STATUS_OFFLOAD_IM_RESERVED1 ((NDIS_STATUS)0x40020100L)
407 #define NDIS_STATUS_OFFLOAD_IM_RESERVED2 ((NDIS_STATUS)0x40020101L)
408 #define NDIS_STATUS_OFFLOAD_IM_RESERVED3 ((NDIS_STATUS)0x40020102L)
409
410 #define NDIS_STATUS_DOT11_SCAN_CONFIRM ((NDIS_STATUS)0x40030000L)
411 #define NDIS_STATUS_DOT11_MPDU_MAX_LENGTH_CHANGED ((NDIS_STATUS)0x40030001L)
412 #define NDIS_STATUS_DOT11_ASSOCIATION_START ((NDIS_STATUS)0x40030002L)
413 #define NDIS_STATUS_DOT11_ASSOCIATION_COMPLETION ((NDIS_STATUS)0x40030003L)
414 #define NDIS_STATUS_DOT11_CONNECTION_START ((NDIS_STATUS)0x40030004L)
415 #define NDIS_STATUS_DOT11_CONNECTION_COMPLETION ((NDIS_STATUS)0x40030005L)
416 #define NDIS_STATUS_DOT11_ROAMING_START ((NDIS_STATUS)0x40030006L)
417 #define NDIS_STATUS_DOT11_ROAMING_COMPLETION ((NDIS_STATUS)0x40030007L)
418 #define NDIS_STATUS_DOT11_DISASSOCIATION ((NDIS_STATUS)0x40030008L)
419 #define NDIS_STATUS_DOT11_TKIPMIC_FAILURE ((NDIS_STATUS)0x40030009L)
420 #define NDIS_STATUS_DOT11_PMKID_CANDIDATE_LIST ((NDIS_STATUS)0x4003000AL)
421 #define NDIS_STATUS_DOT11_PHY_STATE_CHANGED ((NDIS_STATUS)0x4003000BL)
422 #define NDIS_STATUS_DOT11_LINK_QUALITY ((NDIS_STATUS)0x4003000CL)
423 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_STARTED ((NDIS_STATUS)0x4003000DL)
424 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_REQUEST_RECEIVED ((NDIS_STATUS)0x4003000EL)
425 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_COMPLETION ((NDIS_STATUS)0x4003000FL)
426 #define NDIS_STATUS_DOT11_STOP_AP ((NDIS_STATUS)0x40030010L)
427 #define NDIS_STATUS_DOT11_PHY_FREQUENCY_ADOPTED ((NDIS_STATUS)0x40030011L)
428 #define NDIS_STATUS_DOT11_CAN_SUSTAIN_AP ((NDIS_STATUS)0x40030012L)
429
430 #define NDIS_STATUS_WWAN_DEVICE_CAPS ((NDIS_STATUS)0x40041000)
431 #define NDIS_STATUS_WWAN_READY_INFO ((NDIS_STATUS)0x40041001)
432 #define NDIS_STATUS_WWAN_RADIO_STATE ((NDIS_STATUS)0x40041002)
433 #define NDIS_STATUS_WWAN_PIN_INFO ((NDIS_STATUS)0x40041003)
434 #define NDIS_STATUS_WWAN_PIN_LIST ((NDIS_STATUS)0x40041004)
435 #define NDIS_STATUS_WWAN_HOME_PROVIDER ((NDIS_STATUS)0x40041005)
436 #define NDIS_STATUS_WWAN_PREFERRED_PROVIDERS ((NDIS_STATUS)0x40041006)
437 #define NDIS_STATUS_WWAN_VISIBLE_PROVIDERS ((NDIS_STATUS)0x40041007)
438 #define NDIS_STATUS_WWAN_REGISTER_STATE ((NDIS_STATUS)0x40041008)
439 #define NDIS_STATUS_WWAN_PACKET_SERVICE ((NDIS_STATUS)0x40041009)
440 #define NDIS_STATUS_WWAN_SIGNAL_STATE ((NDIS_STATUS)0x4004100a)
441 #define NDIS_STATUS_WWAN_CONTEXT_STATE ((NDIS_STATUS)0x4004100b)
442 #define NDIS_STATUS_WWAN_PROVISIONED_CONTEXTS ((NDIS_STATUS)0x4004100c)
443 #define NDIS_STATUS_WWAN_SERVICE_ACTIVATION ((NDIS_STATUS)0x4004100d)
444 #define NDIS_STATUS_WWAN_SMS_CONFIGURATION ((NDIS_STATUS)0x4004100e)
445 #define NDIS_STATUS_WWAN_SMS_RECEIVE ((NDIS_STATUS)0x4004100f)
446 #define NDIS_STATUS_WWAN_SMS_SEND ((NDIS_STATUS)0x40041010)
447 #define NDIS_STATUS_WWAN_SMS_DELETE ((NDIS_STATUS)0x40041011)
448 #define NDIS_STATUS_WWAN_SMS_STATUS ((NDIS_STATUS)0x40041012)
449 #define NDIS_STATUS_WWAN_DNS_ADDRESS ((NDIS_STATUS)0x40041013)
450
451 #define NDIS_STATUS_WWAN_VENDOR_SPECIFIC ((NDIS_STATUS)0x40043000)
452
453 #endif /* NDIS_SUPPORT_NDIS6 */
454
455 #if (NDIS_SUPPORT_NDIS620)
456 #define NDIS_STATUS_PM_WOL_PATTERN_REJECTED ((NDIS_STATUS)0x40030051L)
457 #define NDIS_STATUS_PM_OFFLOAD_REJECTED ((NDIS_STATUS)0x40030052L)
458 #define NDIS_STATUS_PM_CAPABILITIES_CHANGE ((NDIS_STATUS)0x40030053L)
459 #endif
460
461 #define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L)
462 #define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L)
463 #define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L)
464 #define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW)
465 #define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
466 #define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
467 #define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
468 #define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
469 #define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
470 #define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
471 #define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
472 #define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
473 #define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
474 #define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
475 #define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
476 #define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
477 #define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
478 #define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
479 #define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
480 #define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
481 #define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
482 #define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
483 #define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
484 #define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
485 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
486 #define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
487 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
488 #define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
489 #define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
490 #define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
491 #define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
492 #define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
493 #define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
494 #define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
495 #define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
496 #define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
497
498 #define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
499 #define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
500 #define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
501 #define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
502 #define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L)
503 #define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L)
504 #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L)
505 #define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L)
506 #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L)
507 #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L)
508
509 #define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L)
510 #define NDIS_STATUS_INVALID_DEVICE_REQUEST ((NDIS_STATUS)STATUS_INVALID_DEVICE_REQUEST)
511 #define NDIS_STATUS_NETWORK_UNREACHABLE ((NDIS_STATUS)STATUS_NETWORK_UNREACHABLE)
512 #define NDIS_STATUS_HOST_UNREACHABLE ((NDIS_STATUS)STATUS_HOST_UNREACHABLE)
513
514 #if NDIS_SUPPORT_NDIS6
515
516 #define NDIS_STATUS_SEND_ABORTED ((NDIS_STATUS)STATUS_NDIS_REQUEST_ABORTED)
517 #define NDIS_STATUS_PAUSED ((NDIS_STATUS)STATUS_NDIS_PAUSED)
518 #define NDIS_STATUS_INTERFACE_NOT_FOUND ((NDIS_STATUS)STATUS_NDIS_INTERFACE_NOT_FOUND)
519 #define NDIS_STATUS_INVALID_PARAMETER ((NDIS_STATUS)STATUS_INVALID_PARAMETER)
520 #define NDIS_STATUS_UNSUPPORTED_REVISION ((NDIS_STATUS)STATUS_NDIS_UNSUPPORTED_REVISION)
521 #define NDIS_STATUS_INVALID_PORT ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT)
522 #define NDIS_STATUS_INVALID_PORT_STATE ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT_STATE)
523 #define NDIS_STATUS_INVALID_STATE ((NDIS_STATUS)STATUS_INVALID_DEVICE_STATE)
524 #define NDIS_STATUS_MEDIA_DISCONNECTED ((NDIS_STATUS)STATUS_NDIS_MEDIA_DISCONNECTED)
525 #define NDIS_STATUS_LOW_POWER_STATE ((NDIS_STATUS)STATUS_NDIS_LOW_POWER_STATE)
526 #define NDIS_STATUS_DOT11_AUTO_CONFIG_ENABLED ((NDIS_STATUS)STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED)
527 #define NDIS_STATUS_DOT11_MEDIA_IN_USE ((NDIS_STATUS)STATUS_NDIS_DOT11_MEDIA_IN_USE)
528 #define NDIS_STATUS_DOT11_POWER_STATE_INVALID ((NDIS_STATUS)STATUS_NDIS_DOT11_POWER_STATE_INVALID)
529 #define NDIS_STATUS_UPLOAD_IN_PROGRESS ((NDIS_STATUS)0xC0231001L)
530 #define NDIS_STATUS_REQUEST_UPLOAD ((NDIS_STATUS)0xC0231002L)
531 #define NDIS_STATUS_UPLOAD_REQUESTED ((NDIS_STATUS)0xC0231003L)
532 #define NDIS_STATUS_OFFLOAD_TCP_ENTRIES ((NDIS_STATUS)0xC0231004L)
533 #define NDIS_STATUS_OFFLOAD_PATH_ENTRIES ((NDIS_STATUS)0xC0231005L)
534 #define NDIS_STATUS_OFFLOAD_NEIGHBOR_ENTRIES ((NDIS_STATUS)0xC0231006L)
535 #define NDIS_STATUS_OFFLOAD_IP_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231007L)
536 #define NDIS_STATUS_OFFLOAD_HW_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231008L)
537 #define NDIS_STATUS_OFFLOAD_VLAN_ENTRIES ((NDIS_STATUS)0xC0231009L)
538 #define NDIS_STATUS_OFFLOAD_TCP_XMIT_BUFFER ((NDIS_STATUS)0xC023100AL)
539 #define NDIS_STATUS_OFFLOAD_TCP_RCV_BUFFER ((NDIS_STATUS)0xC023100BL)
540 #define NDIS_STATUS_OFFLOAD_TCP_RCV_WINDOW ((NDIS_STATUS)0xC023100CL)
541 #define NDIS_STATUS_OFFLOAD_VLAN_MISMATCH ((NDIS_STATUS)0xC023100DL)
542 #define NDIS_STATUS_OFFLOAD_DATA_NOT_ACCEPTED ((NDIS_STATUS)0xC023100EL)
543 #define NDIS_STATUS_OFFLOAD_POLICY ((NDIS_STATUS)0xC023100FL)
544 #define NDIS_STATUS_OFFLOAD_DATA_PARTIALLY_ACCEPTED ((NDIS_STATUS)0xC0231010L)
545 #define NDIS_STATUS_OFFLOAD_REQUEST_RESET ((NDIS_STATUS)0xC0231011L)
546
547 #if NDIS_SUPPORT_NDIS620
548 #define NDIS_STATUS_PM_WOL_PATTERN_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL)
549 #define NDIS_STATUS_PM_PROTOCOL_OFFLOAD_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL)
550 #endif
551
552 #endif /* NDIS_SUPPORT_NDIS6 */
553
554 #if (NDIS_SUPPORT_NDIS620)
555 #define NDIS_STATUS_OFFLOAD_CONNECTION_REJECTED ((NDIS_STATUS)STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED)
556 #endif
557
558 /* NDIS error codes for error logging */
559
560 #define NDIS_ERROR_CODE ULONG
561
562 #define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT
563 #define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE
564 #define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE
565 #define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND
566 #define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT
567 #define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE
568 #define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION
569 #define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT
570 #define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS
571 #define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION
572 #define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER
573 #define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER
574 #define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS
575 #define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL
576 #define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED
577
578 /* Memory allocation flags. Used by Ndis[Allocate|Free]Memory */
579 #define NDIS_MEMORY_CONTIGUOUS 0x00000001
580 #define NDIS_MEMORY_NONCACHED 0x00000002
581
582 /* NIC attribute flags. Used by NdisMSetAttributes(Ex) */
583 #define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
584 #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
585 #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
586 #define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
587 #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
588 #define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
589 #define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
590 #define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
591 #define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
592 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
593
594 /* Lock */
595
596 #if NDIS_SUPPORT_60_COMPATIBLE_API
597
598 typedef union _NDIS_RW_LOCK_REFCOUNT {
599 UINT RefCount;
600 UCHAR cacheLine[16];
601 } NDIS_RW_LOCK_REFCOUNT;
602
603 typedef struct _NDIS_RW_LOCK {
604 __MINGW_EXTENSION union {
605 __MINGW_EXTENSION struct {
606 KSPIN_LOCK SpinLock;
607 PVOID Context;
608 };
609 UCHAR Reserved[16];
610 };
611 __MINGW_EXTENSION union {
612 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
613 ULONG RefCountEx[sizeof(NDIS_RW_LOCK_REFCOUNT)/sizeof(ULONG) * MAXIMUM_PROCESSORS];
614 __MINGW_EXTENSION struct {
615 KSPIN_LOCK RefCountLock;
616 volatile ULONG SharedRefCount;
617 volatile BOOLEAN WriterWaiting;
618 };
619 };
620 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
621
622 typedef struct _LOCK_STATE {
623 USHORT LockState;
624 KIRQL OldIrql;
625 } LOCK_STATE, *PLOCK_STATE;
626
627 #endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
628
629 /* Timer */
630
631 _IRQL_requires_(DISPATCH_LEVEL)
632 _IRQL_requires_same_
633 _Function_class_(NDIS_TIMER_FUNCTION)
634 typedef VOID
635 (NTAPI NDIS_TIMER_FUNCTION)(
636 _In_ PVOID SystemSpecific1,
637 _In_ PVOID FunctionContext,
638 _In_ PVOID SystemSpecific2,
639 _In_ PVOID SystemSpecific3);
640 typedef NDIS_TIMER_FUNCTION *PNDIS_TIMER_FUNCTION;
641
642 typedef struct _NDIS_TIMER {
643 KTIMER Timer;
644 KDPC Dpc;
645 } NDIS_TIMER, *PNDIS_TIMER;
646
647 /* Hardware */
648
649 typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
650 typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
651 typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
652 typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
653
654 /* Flag bits */
655 #define READABLE_LOCAL_CLOCK 0x00000001
656 #define CLOCK_NETWORK_DERIVED 0x00000002
657 #define CLOCK_PRECISION 0x00000004
658 #define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
659 #define TIMED_SEND_CAPABLE 0x00000010
660 #define TIME_STAMP_CAPABLE 0x00000020
661
662 /* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
663 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
664 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
665 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
666 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
667 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
668 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
669 #define NDIS_PACKET_TYPE_SMT 0x00000040
670 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
671 #define NDIS_PACKET_TYPE_GROUP 0x00001000
672 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
673 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
674 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
675
676 /* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
677 #define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
678 #define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
679 #define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
680
681 /* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
682 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
683 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
684 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
685 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
686 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
687 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
688 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
689 #define NDIS_MAC_OPTION_RESERVED 0x80000000
690
691 #define NDIS_GUID_TO_OID 0x00000001
692 #define NDIS_GUID_TO_STATUS 0x00000002
693 #define NDIS_GUID_ANSI_STRING 0x00000004
694 #define NDIS_GUID_UNICODE_STRING 0x00000008
695 #define NDIS_GUID_ARRAY 0x00000010
696
697 #if NDIS_LEGACY_DRIVER
698
699 /* NDIS_PACKET_PRIVATE.Flags constants */
700 #define fPACKET_WRAPPER_RESERVED 0x3f
701 #define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
702 #define fPACKET_ALLOCATED_BY_NDIS 0x80
703
704 #define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000f
705 #define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
706 #define NDIS_FLAGS_RESERVED2 0x00000020
707 #define NDIS_FLAGS_RESERVED3 0x00000040
708 #define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
709 #define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
710 #define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
711 #define NDIS_FLAGS_RESERVED4 0x00000400
712 #define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
713 #define NDIS_FLAGS_SENT_AT_DPC 0x00001000
714 #define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
715 #define NDIS_FLAGS_USES_ORIGINAL_PACKET 0x00004000
716 #define NDIS_FLAGS_PADDED 0x00010000
717 #define NDIS_FLAGS_XLATE_AT_TOP 0x00020000
718
719 typedef NDIS_HANDLE PNDIS_PACKET_POOL;
720
721 typedef struct _NDIS_PACKET_PRIVATE {
722 UINT PhysicalCount;
723 UINT TotalLength;
724 PNDIS_BUFFER Head;
725 PNDIS_BUFFER Tail;
726 PNDIS_PACKET_POOL Pool;
727 UINT Count;
728 ULONG Flags;
729 BOOLEAN ValidCounts;
730 UCHAR NdisPacketFlags;
731 USHORT NdisPacketOobOffset;
732 } NDIS_PACKET_PRIVATE, *PNDIS_PACKET_PRIVATE;
733
734 typedef struct _NDIS_PACKET {
735 NDIS_PACKET_PRIVATE Private;
736 __MINGW_EXTENSION union {
737 __MINGW_EXTENSION struct {
738 UCHAR MiniportReserved[2 * sizeof(PVOID)];
739 UCHAR WrapperReserved[2 * sizeof(PVOID)];
740 };
741 __MINGW_EXTENSION struct {
742 UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
743 UCHAR WrapperReservedEx[sizeof(PVOID)];
744 };
745 __MINGW_EXTENSION struct {
746 UCHAR MacReserved[4 * sizeof(PVOID)];
747 };
748 };
749 ULONG_PTR Reserved[2];
750 UCHAR ProtocolReserved[1];
751 } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
752
753 typedef struct _NDIS_PACKET_STACK {
754 ULONG_PTR IMReserved[2];
755 ULONG_PTR NdisReserved[4];
756 } NDIS_PACKET_STACK, *PNDIS_PACKET_STACK;
757
758 #endif /* NDIS_LEGACY_DRIVER */
759
760 typedef enum _NDIS_CLASS_ID {
761 NdisClass802_3Priority,
762 NdisClassWirelessWanMbxMailbox,
763 NdisClassIrdaPacketInfo,
764 NdisClassAtmAALInfo
765 } NDIS_CLASS_ID;
766
767 typedef struct _MEDIA_SPECIFIC_INFORMATION {
768 UINT NextEntryOffset;
769 NDIS_CLASS_ID ClassId;
770 UINT Size;
771 UCHAR ClassInformation[1];
772 } MEDIA_SPECIFIC_INFORMATION, *PMEDIA_SPECIFIC_INFORMATION;
773
774 #if NDIS_LEGACY_DRIVER
775 typedef struct _NDIS_PACKET_OOB_DATA {
776 __MINGW_EXTENSION union {
777 ULONGLONG TimeToSend;
778 ULONGLONG TimeSent;
779 };
780 ULONGLONG TimeReceived;
781 UINT HeaderSize;
782 UINT SizeMediaSpecificInfo;
783 PVOID MediaSpecificInformation;
784 NDIS_STATUS Status;
785 } NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
786 #endif
787
788 /* Request types used by NdisRequest */
789 typedef enum _NDIS_REQUEST_TYPE {
790 NdisRequestQueryInformation,
791 NdisRequestSetInformation,
792 NdisRequestQueryStatistics,
793 NdisRequestOpen,
794 NdisRequestClose,
795 NdisRequestSend,
796 NdisRequestTransferData,
797 NdisRequestReset,
798 NdisRequestGeneric1,
799 NdisRequestGeneric2,
800 NdisRequestGeneric3,
801 NdisRequestGeneric4,
802 #if NDIS_SUPPORT_NDIS6
803 NdisRequestMethod,
804 #endif
805 } NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE;
806
807 #if NDIS_LEGACY_DRIVER
808 typedef struct _NDIS_REQUEST {
809 UCHAR MacReserved[4 * sizeof(PVOID)];
810 NDIS_REQUEST_TYPE RequestType;
811 union _DATA {
812 struct QUERY_INFORMATION {
813 NDIS_OID Oid;
814 PVOID InformationBuffer;
815 UINT InformationBufferLength;
816 UINT BytesWritten;
817 UINT BytesNeeded;
818 } QUERY_INFORMATION;
819 struct SET_INFORMATION {
820 NDIS_OID Oid;
821 PVOID InformationBuffer;
822 UINT InformationBufferLength;
823 UINT BytesRead;
824 UINT BytesNeeded;
825 } SET_INFORMATION;
826 } DATA;
827 #if (defined(NDIS50) || defined(NDIS51) || defined(NDIS50_MINIPORT) || defined(NDIS51_MINIPORT))
828 UCHAR NdisReserved[9 * sizeof(PVOID)];
829 __MINGW_EXTENSION union {
830 UCHAR CallMgrReserved[2 * sizeof(PVOID)];
831 UCHAR ProtocolReserved[2 * sizeof(PVOID)];
832 };
833 UCHAR MiniportReserved[2 * sizeof(PVOID)];
834 #endif
835 } NDIS_REQUEST, *PNDIS_REQUEST;
836 #endif /* NDIS_LEGACY_DRIVER */
837
838 /* Wide Area Networks definitions */
839
840 #if NDIS_LEGACY_DRIVER
841 typedef struct _NDIS_WAN_PACKET {
842 LIST_ENTRY WanPacketQueue;
843 PUCHAR CurrentBuffer;
844 ULONG CurrentLength;
845 PUCHAR StartBuffer;
846 PUCHAR EndBuffer;
847 PVOID ProtocolReserved1;
848 PVOID ProtocolReserved2;
849 PVOID ProtocolReserved3;
850 PVOID ProtocolReserved4;
851 PVOID MacReserved1;
852 PVOID MacReserved2;
853 PVOID MacReserved3;
854 PVOID MacReserved4;
855 } NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
856 #endif
857
858 /* DMA channel information */
859
860 typedef struct _NDIS_DMA_DESCRIPTION {
861 BOOLEAN DemandMode;
862 BOOLEAN AutoInitialize;
863 BOOLEAN DmaChannelSpecified;
864 DMA_WIDTH DmaWidth;
865 DMA_SPEED DmaSpeed;
866 ULONG DmaPort;
867 ULONG DmaChannel;
868 } NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION;
869
870 typedef struct _NDIS_DMA_BLOCK {
871 PVOID MapRegisterBase;
872 KEVENT AllocationEvent;
873 PADAPTER_OBJECT SystemAdapterObject;
874 PVOID Miniport;
875 BOOLEAN InProgress;
876 } NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK;
877
878 typedef UCHAR NDIS_DMA_SIZE;
879
880 #define NDIS_DMA_24BITS ((NDIS_DMA_SIZE)0)
881 #define NDIS_DMA_32BITS ((NDIS_DMA_SIZE)1)
882 #define NDIS_DMA_64BITS ((NDIS_DMA_SIZE)2)
883
884 typedef enum _NDIS_PROCESSOR_TYPE {
885 NdisProcessorX86,
886 NdisProcessorMips,
887 NdisProcessorAlpha,
888 NdisProcessorPpc,
889 NdisProcessorAmd64,
890 NdisProcessorIA64
891 } NDIS_PROCESSOR_TYPE, *PNDIS_PROCESSOR_TYPE;
892
893 typedef enum _NDIS_ENVIRONMENT_TYPE {
894 NdisEnvironmentWindows,
895 NdisEnvironmentWindowsNt
896 } NDIS_ENVIRONMENT_TYPE, *PNDIS_ENVIRONMENT_TYPE;
897
898 /* Possible hardware architecture */
899 typedef enum _NDIS_INTERFACE_TYPE {
900 NdisInterfaceInternal = Internal,
901 NdisInterfaceIsa = Isa,
902 NdisInterfaceEisa = Eisa,
903 NdisInterfaceMca = MicroChannel,
904 NdisInterfaceTurboChannel = TurboChannel,
905 NdisInterfacePci = PCIBus,
906 NdisInterfacePcMcia = PCMCIABus,
907 NdisInterfaceCBus = CBus,
908 NdisInterfaceMPIBus = MPIBus,
909 NdisInterfaceMPSABus = MPSABus,
910 NdisInterfaceProcessorInternal = ProcessorInternal,
911 NdisInterfaceInternalPowerBus = InternalPowerBus,
912 NdisInterfacePNPISABus = PNPISABus,
913 NdisInterfacePNPBus = PNPBus,
914 NdisInterfaceUSB,
915 NdisInterfaceIrda,
916 NdisInterface1394,
917 NdisMaximumInterfaceType
918 } NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
919
920 #define NdisInterruptLevelSensitive LevelSensitive
921 #define NdisInterruptLatched Latched
922
923 typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
924
925 typedef enum _NDIS_PARAMETER_TYPE {
926 NdisParameterInteger,
927 NdisParameterHexInteger,
928 NdisParameterString,
929 NdisParameterMultiString,
930 NdisParameterBinary
931 } NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
932
933 typedef struct _BINARY_DATA {
934 USHORT Length;
935 _Field_size_bytes_(Length) PVOID Buffer;
936 } BINARY_DATA;
937
938 typedef struct _NDIS_CONFIGURATION_PARAMETER {
939 NDIS_PARAMETER_TYPE ParameterType;
940 union {
941 ULONG IntegerData;
942 NDIS_STRING StringData;
943 BINARY_DATA BinaryData;
944 } ParameterData;
945 } NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
946
947 typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
948
949 typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT {
950 NDIS_PHYSICAL_ADDRESS PhysicalAddress;
951 UINT Length;
952 } NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
953
954 typedef struct _NDIS_WAN_LINE_DOWN {
955 UCHAR RemoteAddress[6];
956 UCHAR LocalAddress[6];
957 } NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN;
958
959 typedef struct _NDIS_WAN_LINE_UP {
960 ULONG LinkSpeed;
961 ULONG MaximumTotalSize;
962 NDIS_WAN_QUALITY Quality;
963 USHORT SendWindow;
964 UCHAR RemoteAddress[6];
965 OUT UCHAR LocalAddress[6];
966 ULONG ProtocolBufferLength;
967 PUCHAR ProtocolBuffer;
968 USHORT ProtocolType;
969 NDIS_STRING DeviceName;
970 } NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP;
971
972 typedef NTSTATUS
973 (NTAPI *TDI_REGISTER_CALLBACK)(
974 _In_ PUNICODE_STRING DeviceName,
975 _Out_ HANDLE *TdiHandle);
976
977 typedef NTSTATUS
978 (NTAPI *TDI_PNP_HANDLER)(
979 _In_ PUNICODE_STRING UpperComponent,
980 _In_ PUNICODE_STRING LowerComponent,
981 _In_ PUNICODE_STRING BindList,
982 _In_ PVOID ReconfigBuffer,
983 _In_ UINT ReconfigBufferSize,
984 _In_ UINT Operation);
985
986 typedef struct _OID_LIST OID_LIST, *POID_LIST;
987
988 /* PnP state */
989 typedef enum _NDIS_PNP_DEVICE_STATE {
990 NdisPnPDeviceAdded,
991 NdisPnPDeviceStarted,
992 NdisPnPDeviceQueryStopped,
993 NdisPnPDeviceStopped,
994 NdisPnPDeviceQueryRemoved,
995 NdisPnPDeviceRemoved,
996 NdisPnPDeviceSurpriseRemoved
997 } NDIS_PNP_DEVICE_STATE;
998
999 typedef enum _NDIS_DEVICE_PNP_EVENT {
1000 NdisDevicePnPEventQueryRemoved,
1001 NdisDevicePnPEventRemoved,
1002 NdisDevicePnPEventSurpriseRemoved,
1003 NdisDevicePnPEventQueryStopped,
1004 NdisDevicePnPEventStopped,
1005 NdisDevicePnPEventPowerProfileChanged,
1006 #if NDIS_SUPPORT_NDIS6
1007 NdisDevicePnPEventFilterListChanged,
1008 #endif /* NDIS_SUPPORT_NDIS6 */
1009 NdisDevicePnPEventMaximum
1010 } NDIS_DEVICE_PNP_EVENT, *PNDIS_DEVICE_PNP_EVENT;
1011
1012 /* Power profiles */
1013 typedef enum _NDIS_POWER_PROFILE {
1014 NdisPowerProfileBattery,
1015 NdisPowerProfileAcOnLine
1016 } NDIS_POWER_PROFILE, *PNDIS_POWER_PROFILE;
1017
1018 #define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
1019 #define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
1020 #define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
1021 #define NDIS_DEVICE_DISABLE_PM 0x00000008
1022 #define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
1023 #define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
1024 #define NDIS_DEVICE_RESERVED 0x00000040
1025 #define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET 0x00000080
1026 #define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
1027
1028 /* Protocol types supported by NDIS */
1029 #define NDIS_PROTOCOL_ID_DEFAULT 0x00
1030 #define NDIS_PROTOCOL_ID_TCP_IP 0x02
1031 #define NDIS_PROTOCOL_ID_IPX 0x06
1032 #define NDIS_PROTOCOL_ID_NBF 0x07
1033 #define NDIS_PROTOCOL_ID_MAX 0x0F
1034 #define NDIS_PROTOCOL_ID_MASK 0x0F
1035
1036 typedef ULONG NDIS_AF, *PNDIS_AF;
1037
1038 #define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1)
1039 #define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2)
1040 #define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3)
1041 #define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4)
1042 #define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5)
1043 #define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6)
1044 #define CO_ADDRESS_FAMILY_INFINIBAND ((NDIS_AF)0x7)
1045 #define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800)
1046 #define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801)
1047
1048 #define CO_ADDRESS_FAMILY_PROXY 0x80000000
1049
1050 typedef struct _CO_ADDRESS_FAMILY {
1051 NDIS_AF AddressFamily;
1052 ULONG MajorVersion;
1053 ULONG MinorVersion;
1054 } CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
1055
1056 typedef struct _CO_SPECIFIC_PARAMETERS {
1057 ULONG ParamType;
1058 ULONG Length;
1059 UCHAR Parameters[1];
1060 } CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
1061
1062 typedef struct _CO_CALL_MANAGER_PARAMETERS {
1063 FLOWSPEC Transmit;
1064 FLOWSPEC Receive;
1065 CO_SPECIFIC_PARAMETERS CallMgrSpecific;
1066 } CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
1067
1068 /* CO_MEDIA_PARAMETERS.Flags constants */
1069 #define RECEIVE_TIME_INDICATION 0x00000001
1070 #define USE_TIME_STAMPS 0x00000002
1071 #define TRANSMIT_VC 0x00000004
1072 #define RECEIVE_VC 0x00000008
1073 #define INDICATE_ERRED_PACKETS 0x00000010
1074 #define INDICATE_END_OF_TX 0x00000020
1075 #define RESERVE_RESOURCES_VC 0x00000040
1076 #define ROUND_DOWN_FLOW 0x00000080
1077 #define ROUND_UP_FLOW 0x00000100
1078
1079 typedef struct _CO_MEDIA_PARAMETERS {
1080 ULONG Flags;
1081 ULONG ReceivePriority;
1082 ULONG ReceiveSizeHint;
1083 CO_SPECIFIC_PARAMETERS MediaSpecific;
1084 } CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
1085
1086 /* CO_CALL_PARAMETERS.Flags constants */
1087 #define PERMANENT_VC 0x00000001
1088 #define CALL_PARAMETERS_CHANGED 0x00000002
1089 #define QUERY_CALL_PARAMETERS 0x00000004
1090 #define BROADCAST_VC 0x00000008
1091 #define MULTIPOINT_VC 0x00000010
1092
1093 typedef struct _CO_CALL_PARAMETERS {
1094 ULONG Flags;
1095 PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
1096 PCO_MEDIA_PARAMETERS MediaParameters;
1097 } CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
1098
1099 typedef struct _CO_SAP {
1100 ULONG SapType;
1101 ULONG SapLength;
1102 UCHAR Sap[1];
1103 } CO_SAP, *PCO_SAP;
1104
1105 #if NDIS_LEGACY_DRIVER
1106 typedef struct _NDIS_IPSEC_PACKET_INFO {
1107 __MINGW_EXTENSION union {
1108 struct {
1109 NDIS_HANDLE OffloadHandle;
1110 NDIS_HANDLE NextOffloadHandle;
1111 } Transmit;
1112 struct {
1113 ULONG SA_DELETE_REQ:1;
1114 ULONG CRYPTO_DONE:1;
1115 ULONG NEXT_CRYPTO_DONE:1;
1116 ULONG CryptoStatus;
1117 } Receive;
1118 };
1119 } NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
1120 #endif
1121
1122 #if (NDIS_SUPPORT_NDIS6 || NDIS60)
1123 typedef struct _NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO {
1124 __MINGW_EXTENSION union {
1125 struct {
1126 NDIS_HANDLE OffloadHandle;
1127 } Transmit;
1128 struct {
1129 USHORT SaDeleteReq:1;
1130 USHORT CryptoDone:1;
1131 USHORT NextCryptoDone:1;
1132 USHORT Pad:13;
1133 USHORT CryptoStatus;
1134 } Receive;
1135 };
1136 } NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO;
1137 #endif
1138
1139 /* NDIS_MAC_FRAGMENT.Errors constants */
1140 #define WAN_ERROR_CRC 0x00000001
1141 #define WAN_ERROR_FRAMING 0x00000002
1142 #define WAN_ERROR_HARDWAREOVERRUN 0x00000004
1143 #define WAN_ERROR_BUFFEROVERRUN 0x00000008
1144 #define WAN_ERROR_TIMEOUT 0x00000010
1145 #define WAN_ERROR_ALIGNMENT 0x00000020
1146
1147 typedef struct _NDIS_MAC_FRAGMENT {
1148 NDIS_HANDLE NdisLinkContext;
1149 ULONG Errors;
1150 } NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
1151
1152 typedef struct _NDIS_MAC_LINE_DOWN {
1153 NDIS_HANDLE NdisLinkContext;
1154 } NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
1155
1156 typedef struct _NDIS_MAC_LINE_UP {
1157 ULONG LinkSpeed;
1158 NDIS_WAN_QUALITY Quality;
1159 USHORT SendWindow;
1160 NDIS_HANDLE ConnectionWrapperID;
1161 NDIS_HANDLE NdisLinkHandle;
1162 NDIS_HANDLE NdisLinkContext;
1163 } NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
1164
1165 typedef struct _NDIS_PACKET_8021Q_INFO {
1166 __MINGW_EXTENSION union {
1167 struct {
1168 UINT32 UserPriority:3;
1169 UINT32 CanonicalFormatId:1;
1170 UINT32 VlanId:12;
1171 UINT32 Reserved:16;
1172 } TagHeader;
1173 PVOID Value;
1174 };
1175 } NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO;
1176
1177 typedef enum _NDIS_PER_PACKET_INFO {
1178 TcpIpChecksumPacketInfo,
1179 IpSecPacketInfo,
1180 TcpLargeSendPacketInfo,
1181 ClassificationHandlePacketInfo,
1182 NdisReserved,
1183 ScatterGatherListPacketInfo,
1184 Ieee8021QInfo,
1185 OriginalPacketInfo,
1186 PacketCancelId,
1187 OriginalNetBufferList,
1188 CachedNetBufferList,
1189 ShortPacketPaddingInfo,
1190 MaxPerPacketInfo
1191 } NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO;
1192
1193 #if NDIS_LEGACY_DRIVER
1194
1195 typedef struct _NDIS_PACKET_EXTENSION {
1196 PVOID NdisPacketInfo[MaxPerPacketInfo];
1197 } NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;
1198
1199 typedef enum _NDIS_TASK {
1200 TcpIpChecksumNdisTask,
1201 IpSecNdisTask,
1202 TcpLargeSendNdisTask,
1203 MaxNdisTask
1204 } NDIS_TASK, *PNDIS_TASK;
1205
1206 typedef enum _NDIS_ENCAPSULATION {
1207 UNSPECIFIED_Encapsulation,
1208 NULL_Encapsulation,
1209 IEEE_802_3_Encapsulation,
1210 IEEE_802_5_Encapsulation,
1211 LLC_SNAP_ROUTED_Encapsulation,
1212 LLC_SNAP_BRIDGED_Encapsulation
1213 } NDIS_ENCAPSULATION;
1214
1215 typedef struct _NDIS_ENCAPSULATION_FORMAT {
1216 NDIS_ENCAPSULATION Encapsulation;
1217 struct {
1218 ULONG FixedHeaderSize:1;
1219 ULONG Reserved:31;
1220 } Flags;
1221 ULONG EncapsulationHeaderSize;
1222 } NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
1223
1224 typedef struct _NDIS_TASK_OFFLOAD_HEADER {
1225 ULONG Version;
1226 ULONG Size;
1227 ULONG Reserved;
1228 ULONG OffsetFirstTask;
1229 NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
1230 } NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
1231
1232 typedef struct _NDIS_TASK_OFFLOAD {
1233 ULONG Version;
1234 ULONG Size;
1235 NDIS_TASK Task;
1236 ULONG OffsetNextTask;
1237 ULONG TaskBufferLength;
1238 UCHAR TaskBuffer[1];
1239 } NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
1240
1241 typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
1242 struct {
1243 ULONG IpOptionsSupported:1;
1244 ULONG TcpOptionsSupported:1;
1245 ULONG TcpChecksum:1;
1246 ULONG UdpChecksum:1;
1247 ULONG IpChecksum:1;
1248 } V4Transmit;
1249 struct {
1250 ULONG IpOptionsSupported:1;
1251 ULONG TcpOptionsSupported:1;
1252 ULONG TcpChecksum:1;
1253 ULONG UdpChecksum:1;
1254 ULONG IpChecksum:1;
1255 } V4Receive;
1256 struct {
1257 ULONG IpOptionsSupported:1;
1258 ULONG TcpOptionsSupported:1;
1259 ULONG TcpChecksum:1;
1260 ULONG UdpChecksum:1;
1261 } V6Transmit;
1262 struct {
1263 ULONG IpOptionsSupported:1;
1264 ULONG TcpOptionsSupported:1;
1265 ULONG TcpChecksum:1;
1266 ULONG UdpChecksum:1;
1267 } V6Receive;
1268 } NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
1269
1270 #define NDIS_TASK_TCP_LARGE_SEND_V0 0
1271
1272 typedef struct _NDIS_TASK_TCP_LARGE_SEND {
1273 ULONG Version;
1274 ULONG MaxOffLoadSize;
1275 ULONG MinSegmentCount;
1276 BOOLEAN TcpOptions;
1277 BOOLEAN IpOptions;
1278 } NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
1279
1280 typedef struct _NDIS_TASK_IPSEC {
1281 struct {
1282 ULONG AH_ESP_COMBINED;
1283 ULONG TRANSPORT_TUNNEL_COMBINED;
1284 ULONG V4_OPTIONS;
1285 ULONG RESERVED;
1286 } Supported;
1287 struct {
1288 ULONG MD5:1;
1289 ULONG SHA_1:1;
1290 ULONG Transport:1;
1291 ULONG Tunnel:1;
1292 ULONG Send:1;
1293 ULONG Receive:1;
1294 } V4AH;
1295 struct {
1296 ULONG DES:1;
1297 ULONG RESERVED:1;
1298 ULONG TRIPLE_DES:1;
1299 ULONG NULL_ESP:1;
1300 ULONG Transport:1;
1301 ULONG Tunnel:1;
1302 ULONG Send:1;
1303 ULONG Receive:1;
1304 } V4ESP;
1305 } NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
1306
1307 #endif /* NDIS_LEGACY_DRIVER */
1308
1309 #define IPSEC_TPT_UDPESP_ENCAPTYPE_IKE 0x00000001
1310 #define IPSEC_TUN_UDPESP_ENCAPTYPE_IKE 0x00000002
1311 #define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_IKE 0x00000004
1312 #define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_IKE 0x00000008
1313 #define IPSEC_TPT_UDPESP_ENCAPTYPE_OTHER 0x00000010
1314 #define IPSEC_TUN_UDPESP_ENCAPTYPE_OTHER 0x00000020
1315 #define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_OTHER 0x00000040
1316 #define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_OTHER 0x00000080
1317
1318 #if NDIS_LEGACY_DRIVER
1319
1320 /*
1321 * PNDIS_PACKET
1322 * NDIS_GET_ORIGINAL_PACKET(
1323 * IN PNDIS_PACKET Packet);
1324 */
1325 #define NDIS_GET_ORIGINAL_PACKET(Packet) \
1326 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
1327
1328 /*
1329 * PVOID
1330 * NDIS_GET_PACKET_CANCEL_ID(
1331 * IN PNDIS_PACKET Packet);
1332 */
1333 #define NDIS_GET_PACKET_CANCEL_ID(Packet) \
1334 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
1335
1336 /*
1337 * PNDIS_PACKET_EXTENSION
1338 * NDIS_PACKET_EXTENSION_FROM_PACKET(
1339 * IN PNDIS_PACKET Packet);
1340 */
1341 #define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
1342 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
1343 + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
1344
1345 /*
1346 * PVOID
1347 * NDIS_PER_PACKET_INFO_FROM_PACKET(
1348 * IN OUT PNDIS_PACKET Packet,
1349 * IN NDIS_PER_PACKET_INFO InfoType);
1350 */
1351 #define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
1352 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
1353 + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
1354
1355 /*
1356 * VOID
1357 * NDIS_SET_ORIGINAL_PACKET(
1358 * IN OUT PNDIS_PACKET Packet,
1359 * IN PNDIS_PACKET OriginalPacket);
1360 */
1361 #define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
1362 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
1363
1364 /*
1365 * VOID
1366 * NDIS_SET_PACKET_CANCEL_ID(
1367 * IN PNDIS_PACKET Packet
1368 * IN ULONG_PTR CancelId);
1369 */
1370 #define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
1371 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
1372
1373 #define NdisSetPacketCancelId(_Packet, _CancelId) NDIS_SET_PACKET_CANCEL_ID(_Packet, _CancelId)
1374 #define NdisGetPacketCancelId(_Packet) NDIS_GET_PACKET_CANCEL_ID(_Packet)
1375
1376 #endif /* NDIS_LEGACY_DRIVER */
1377
1378 #if NDIS_SUPPORT_NDIS6
1379 typedef struct _NDIS_GENERIC_OBJECT {
1380 NDIS_OBJECT_HEADER Header;
1381 PVOID Caller;
1382 PVOID CallersCaller;
1383 PDRIVER_OBJECT DriverObject;
1384 } NDIS_GENERIC_OBJECT, *PNDIS_GENERIC_OBJECT;
1385 #endif
1386
1387 /* NDIS_TASK_OFFLOAD_HEADER.Version constants */
1388 #define NDIS_TASK_OFFLOAD_VERSION 1
1389
1390 #define MAX_HASHES 4
1391 #define TRUNCATED_HASH_LEN 12
1392
1393 #define CRYPTO_SUCCESS 0
1394 #define CRYPTO_GENERIC_ERROR 1
1395 #define CRYPTO_TRANSPORT_AH_AUTH_FAILED 2
1396 #define CRYPTO_TRANSPORT_ESP_AUTH_FAILED 3
1397 #define CRYPTO_TUNNEL_AH_AUTH_FAILED 4
1398 #define CRYPTO_TUNNEL_ESP_AUTH_FAILED 5
1399 #define CRYPTO_INVALID_PACKET_SYNTAX 6
1400 #define CRYPTO_INVALID_PROTOCOL 7
1401
1402 typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
1403 __MINGW_EXTENSION union {
1404 struct {
1405 ULONG NdisPacketChecksumV4:1;
1406 ULONG NdisPacketChecksumV6:1;
1407 ULONG NdisPacketTcpChecksum:1;
1408 ULONG NdisPacketUdpChecksum:1;
1409 ULONG NdisPacketIpChecksum:1;
1410 } Transmit;
1411 struct {
1412 ULONG NdisPacketTcpChecksumFailed:1;
1413 ULONG NdisPacketUdpChecksumFailed:1;
1414 ULONG NdisPacketIpChecksumFailed:1;
1415 ULONG NdisPacketTcpChecksumSucceeded:1;
1416 ULONG NdisPacketUdpChecksumSucceeded:1;
1417 ULONG NdisPacketIpChecksumSucceeded:1;
1418 ULONG NdisPacketLoopback:1;
1419 } Receive;
1420 ULONG Value;
1421 };
1422 } NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
1423
1424 typedef struct _NDIS_WAN_CO_FRAGMENT {
1425 ULONG Errors;
1426 } NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
1427
1428 typedef struct _NDIS_WAN_FRAGMENT {
1429 UCHAR RemoteAddress[6];
1430 UCHAR LocalAddress[6];
1431 } NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
1432
1433 typedef struct _WAN_CO_LINKPARAMS {
1434 ULONG TransmitSpeed;
1435 ULONG ReceiveSpeed;
1436 ULONG SendWindow;
1437 } WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
1438
1439 typedef struct _NDIS_WAN_GET_STATS {
1440 UCHAR LocalAddress[6];
1441 ULONG BytesSent;
1442 ULONG BytesRcvd;
1443 ULONG FramesSent;
1444 ULONG FramesRcvd;
1445 ULONG CRCErrors;
1446 ULONG TimeoutErrors;
1447 ULONG AlignmentErrors;
1448 ULONG SerialOverrunErrors;
1449 ULONG FramingErrors;
1450 ULONG BufferOverrunErrors;
1451 ULONG BytesTransmittedUncompressed;
1452 ULONG BytesReceivedUncompressed;
1453 ULONG BytesTransmittedCompressed;
1454 ULONG BytesReceivedCompressed;
1455 } NDIS_WAN_GET_STATS, *PNDIS_WAN_GET_STATS;
1456
1457 /* Call Manager */
1458
1459 typedef VOID
1460 (NTAPI *CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1461 IN NDIS_STATUS Status,
1462 IN NDIS_HANDLE CallMgrVcContext,
1463 IN PCO_CALL_PARAMETERS CallParameters);
1464
1465 typedef NDIS_STATUS
1466 (NTAPI *CM_ADD_PARTY_HANDLER)(
1467 IN NDIS_HANDLE CallMgrVcContext,
1468 IN OUT PCO_CALL_PARAMETERS CallParameters,
1469 IN NDIS_HANDLE NdisPartyHandle,
1470 OUT PNDIS_HANDLE CallMgrPartyContext);
1471
1472 typedef NDIS_STATUS
1473 (NTAPI *CM_CLOSE_AF_HANDLER)(
1474 IN NDIS_HANDLE CallMgrAfContext);
1475
1476 typedef NDIS_STATUS
1477 (NTAPI *CM_CLOSE_CALL_HANDLER)(
1478 IN NDIS_HANDLE CallMgrVcContext,
1479 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
1480 IN PVOID CloseData OPTIONAL,
1481 IN UINT Size OPTIONAL);
1482
1483 typedef NDIS_STATUS
1484 (NTAPI *CM_DEREG_SAP_HANDLER)(
1485 IN NDIS_HANDLE CallMgrSapContext);
1486
1487 typedef VOID
1488 (NTAPI *CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1489 IN NDIS_STATUS Status,
1490 IN NDIS_HANDLE CallMgrVcContext);
1491
1492 typedef NDIS_STATUS
1493 (NTAPI *CM_DROP_PARTY_HANDLER)(
1494 IN NDIS_HANDLE CallMgrPartyContext,
1495 IN PVOID CloseData OPTIONAL,
1496 IN UINT Size OPTIONAL);
1497
1498 typedef VOID
1499 (NTAPI *CM_INCOMING_CALL_COMPLETE_HANDLER)(
1500 IN NDIS_STATUS Status,
1501 IN NDIS_HANDLE CallMgrVcContext,
1502 IN PCO_CALL_PARAMETERS CallParameters);
1503
1504 typedef NDIS_STATUS
1505 (NTAPI *CM_MAKE_CALL_HANDLER)(
1506 IN NDIS_HANDLE CallMgrVcContext,
1507 IN OUT PCO_CALL_PARAMETERS CallParameters,
1508 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1509 OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL);
1510
1511 typedef NDIS_STATUS
1512 (NTAPI *CM_MODIFY_CALL_QOS_HANDLER)(
1513 IN NDIS_HANDLE CallMgrVcContext,
1514 IN PCO_CALL_PARAMETERS CallParameters);
1515
1516 typedef NDIS_STATUS
1517 (NTAPI *CM_OPEN_AF_HANDLER)(
1518 IN NDIS_HANDLE CallMgrBindingContext,
1519 IN PCO_ADDRESS_FAMILY AddressFamily,
1520 IN NDIS_HANDLE NdisAfHandle,
1521 OUT PNDIS_HANDLE CallMgrAfContext);
1522
1523 typedef NDIS_STATUS
1524 (NTAPI *CM_REG_SAP_HANDLER)(
1525 IN NDIS_HANDLE CallMgrAfContext,
1526 IN PCO_SAP Sap,
1527 IN NDIS_HANDLE NdisSapHandle,
1528 OUT PNDIS_HANDLE CallMgrSapContext);
1529
1530 typedef NDIS_STATUS
1531 (NTAPI *CO_CREATE_VC_HANDLER)(
1532 IN NDIS_HANDLE ProtocolAfContext,
1533 IN NDIS_HANDLE NdisVcHandle,
1534 OUT PNDIS_HANDLE ProtocolVcContext);
1535
1536 typedef NDIS_STATUS
1537 (NTAPI *CO_DELETE_VC_HANDLER)(
1538 IN NDIS_HANDLE ProtocolVcContext);
1539
1540 #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
1541
1542 /* Prototypes for NDIS 5.0 protocol characteristics */
1543
1544 _IRQL_requires_(PASSIVE_LEVEL)
1545 typedef VOID
1546 (NTAPI *CO_SEND_COMPLETE_HANDLER)(
1547 _In_ NDIS_STATUS Status,
1548 _In_ NDIS_HANDLE ProtocolVcContext,
1549 _In_ PNDIS_PACKET Packet);
1550
1551 _IRQL_requires_max_(DISPATCH_LEVEL)
1552 typedef VOID
1553 (NTAPI *CO_STATUS_HANDLER)(
1554 _In_ NDIS_HANDLE ProtocolBindingContext,
1555 _In_opt_ NDIS_HANDLE ProtocolVcContext,
1556 _In_ NDIS_STATUS GeneralStatus,
1557 _In_ PVOID StatusBuffer,
1558 _In_ UINT StatusBufferSize);
1559
1560 _IRQL_requires_max_(DISPATCH_LEVEL)
1561 typedef UINT
1562 (NTAPI *CO_RECEIVE_PACKET_HANDLER)(
1563 _In_ NDIS_HANDLE ProtocolBindingContext,
1564 _In_ NDIS_HANDLE ProtocolVcContext,
1565 _In_ PNDIS_PACKET Packet);
1566
1567 _IRQL_requires_max_(DISPATCH_LEVEL)
1568 typedef NDIS_STATUS
1569 (NTAPI *CO_REQUEST_HANDLER)(
1570 _In_ NDIS_HANDLE ProtocolAfContext,
1571 _In_opt_ NDIS_HANDLE ProtocolVcContext,
1572 _In_opt_ NDIS_HANDLE ProtocolPartyContext,
1573 _Inout_ PNDIS_REQUEST NdisRequest);
1574
1575 _IRQL_requires_max_(DISPATCH_LEVEL)
1576 typedef VOID
1577 (NTAPI *CO_REQUEST_COMPLETE_HANDLER)(
1578 _In_ NDIS_STATUS Status,
1579 _In_opt_ NDIS_HANDLE ProtocolAfContext,
1580 _In_opt_ NDIS_HANDLE ProtocolVcContext,
1581 _In_opt_ NDIS_HANDLE ProtocolPartyContext,
1582 _In_ PNDIS_REQUEST NdisRequest);
1583
1584 typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
1585 UCHAR MajorVersion;
1586 UCHAR MinorVersion;
1587 USHORT Filler;
1588 UINT Reserved;
1589 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1590 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1591 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1592 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1593 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1594 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1595 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1596 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1597 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1598 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1599 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1600 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1601 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1602 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1603 CO_REQUEST_HANDLER CmRequestHandler;
1604 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1605 } NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1606
1607
1608
1609 /* Call Manager clients */
1610
1611 typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1612 IN NDIS_STATUS Status,
1613 IN NDIS_HANDLE ProtocolAfContext,
1614 IN NDIS_HANDLE NdisAfHandle);
1615
1616 typedef VOID
1617 (NTAPI *CL_CLOSE_AF_COMPLETE_HANDLER)(
1618 IN NDIS_STATUS Status,
1619 IN NDIS_HANDLE ProtocolAfContext);
1620
1621 typedef VOID
1622 (NTAPI *CL_REG_SAP_COMPLETE_HANDLER)(
1623 IN NDIS_STATUS Status,
1624 IN NDIS_HANDLE ProtocolSapContext,
1625 IN PCO_SAP Sap,
1626 IN NDIS_HANDLE NdisSapHandle);
1627
1628 typedef VOID
1629 (NTAPI *CL_DEREG_SAP_COMPLETE_HANDLER)(
1630 IN NDIS_STATUS Status,
1631 IN NDIS_HANDLE ProtocolSapContext);
1632
1633 typedef VOID
1634 (NTAPI *CL_MAKE_CALL_COMPLETE_HANDLER)(
1635 IN NDIS_STATUS Status,
1636 IN NDIS_HANDLE ProtocolVcContext,
1637 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1638 IN PCO_CALL_PARAMETERS CallParameters);
1639
1640 typedef VOID
1641 (NTAPI *CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1642 IN NDIS_STATUS Status,
1643 IN NDIS_HANDLE ProtocolVcContext,
1644 IN PCO_CALL_PARAMETERS CallParameters);
1645
1646 typedef VOID
1647 (NTAPI *CL_CLOSE_CALL_COMPLETE_HANDLER)(
1648 IN NDIS_STATUS Status,
1649 IN NDIS_HANDLE ProtocolVcContext,
1650 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
1651
1652 typedef VOID
1653 (NTAPI *CL_ADD_PARTY_COMPLETE_HANDLER)(
1654 IN NDIS_STATUS Status,
1655 IN NDIS_HANDLE ProtocolPartyContext,
1656 IN NDIS_HANDLE NdisPartyHandle,
1657 IN PCO_CALL_PARAMETERS CallParameters);
1658
1659 typedef VOID
1660 (NTAPI *CL_DROP_PARTY_COMPLETE_HANDLER)(
1661 IN NDIS_STATUS Status,
1662 IN NDIS_HANDLE ProtocolPartyContext);
1663
1664 typedef NDIS_STATUS
1665 (NTAPI *CL_INCOMING_CALL_HANDLER)(
1666 IN NDIS_HANDLE ProtocolSapContext,
1667 IN NDIS_HANDLE ProtocolVcContext,
1668 IN OUT PCO_CALL_PARAMETERS CallParameters);
1669
1670 typedef VOID
1671 (NTAPI *CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1672 IN NDIS_HANDLE ProtocolVcContext,
1673 IN PCO_CALL_PARAMETERS CallParameters);
1674
1675 typedef VOID
1676 (NTAPI *CL_INCOMING_CLOSE_CALL_HANDLER)(
1677 IN NDIS_STATUS CloseStatus,
1678 IN NDIS_HANDLE ProtocolVcContext,
1679 IN PVOID CloseData OPTIONAL,
1680 IN UINT Size OPTIONAL);
1681
1682 typedef VOID
1683 (NTAPI *CL_INCOMING_DROP_PARTY_HANDLER)(
1684 IN NDIS_STATUS DropStatus,
1685 IN NDIS_HANDLE ProtocolPartyContext,
1686 IN PVOID CloseData OPTIONAL,
1687 IN UINT Size OPTIONAL);
1688
1689 typedef VOID
1690 (NTAPI *CL_CALL_CONNECTED_HANDLER)(
1691 IN NDIS_HANDLE ProtocolVcContext);
1692
1693
1694 typedef struct _NDIS_CLIENT_CHARACTERISTICS {
1695 UCHAR MajorVersion;
1696 UCHAR MinorVersion;
1697 USHORT Filler;
1698 UINT Reserved;
1699 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1700 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1701 CO_REQUEST_HANDLER ClRequestHandler;
1702 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1703 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1704 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1705 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1706 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1707 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1708 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1709 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1710 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1711 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1712 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1713 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1714 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1715 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1716 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1717 } NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1718
1719
1720 /* NDIS protocol structures */
1721
1722 /* Prototypes for NDIS 3.0 protocol characteristics */
1723
1724 typedef VOID
1725 (NTAPI *OPEN_ADAPTER_COMPLETE_HANDLER)(
1726 _In_ NDIS_HANDLE ProtocolBindingContext,
1727 _In_ NDIS_STATUS Status,
1728 _In_ NDIS_STATUS OpenErrorStatus);
1729
1730 typedef VOID
1731 (NTAPI *CLOSE_ADAPTER_COMPLETE_HANDLER)(
1732 _In_ NDIS_HANDLE ProtocolBindingContext,
1733 _In_ NDIS_STATUS Status);
1734
1735 typedef VOID
1736 (NTAPI *RESET_COMPLETE_HANDLER)(
1737 _In_ NDIS_HANDLE ProtocolBindingContext,
1738 _In_ NDIS_STATUS Status);
1739
1740 typedef VOID
1741 (NTAPI *REQUEST_COMPLETE_HANDLER)(
1742 _In_ NDIS_HANDLE ProtocolBindingContext,
1743 _In_ PNDIS_REQUEST NdisRequest,
1744 _In_ NDIS_STATUS Status);
1745
1746 typedef VOID
1747 (NTAPI *STATUS_HANDLER)(
1748 _In_ NDIS_HANDLE ProtocolBindingContext,
1749 _In_ NDIS_STATUS GeneralStatus,
1750 _In_ PVOID StatusBuffer,
1751 _In_ UINT StatusBufferSize);
1752
1753 typedef VOID
1754 (NTAPI *STATUS_COMPLETE_HANDLER)(
1755 _In_ NDIS_HANDLE ProtocolBindingContext);
1756
1757 typedef VOID
1758 (NTAPI *SEND_COMPLETE_HANDLER)(
1759 _In_ NDIS_HANDLE ProtocolBindingContext,
1760 _In_ PNDIS_PACKET Packet,
1761 _In_ NDIS_STATUS Status);
1762
1763 typedef VOID
1764 (NTAPI *WAN_SEND_COMPLETE_HANDLER)(
1765 _In_ NDIS_HANDLE ProtocolBindingContext,
1766 _In_ PNDIS_WAN_PACKET Packet,
1767 _In_ NDIS_STATUS Status);
1768
1769 typedef VOID
1770 (NTAPI *TRANSFER_DATA_COMPLETE_HANDLER)(
1771 _In_ NDIS_HANDLE ProtocolBindingContext,
1772 _In_ PNDIS_PACKET Packet,
1773 _In_ NDIS_STATUS Status,
1774 _In_ UINT BytesTransferred);
1775
1776 typedef VOID
1777 (NTAPI *WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1778 VOID);
1779
1780 typedef NDIS_STATUS
1781 (NTAPI *RECEIVE_HANDLER)(
1782 _In_ NDIS_HANDLE ProtocolBindingContext,
1783 _In_ NDIS_HANDLE MacReceiveContext,
1784 _In_ PVOID HeaderBuffer,
1785 _In_ UINT HeaderBufferSize,
1786 _In_ PVOID LookAheadBuffer,
1787 _In_ UINT LookaheadBufferSize,
1788 _In_ UINT PacketSize);
1789
1790 typedef NDIS_STATUS
1791 (NTAPI *WAN_RECEIVE_HANDLER)(
1792 _In_ NDIS_HANDLE NdisLinkHandle,
1793 _In_ PUCHAR Packet,
1794 _In_ ULONG PacketSize);
1795
1796 typedef VOID
1797 (NTAPI *RECEIVE_COMPLETE_HANDLER)(
1798 _In_ NDIS_HANDLE ProtocolBindingContext);
1799
1800 /* Protocol characteristics for NDIS 3.0 protocols */
1801
1802 #define NDIS30_PROTOCOL_CHARACTERISTICS_S \
1803 UCHAR MajorNdisVersion; \
1804 UCHAR MinorNdisVersion; \
1805 USHORT Filler; \
1806 _ANONYMOUS_UNION union { \
1807 UINT Reserved; \
1808 UINT Flags; \
1809 } DUMMYUNIONNAME; \
1810 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1811 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1812 _ANONYMOUS_UNION union { \
1813 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1814 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1815 } DUMMYUNIONNAME2; \
1816 _ANONYMOUS_UNION union { \
1817 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1818 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1819 } DUMMYUNIONNAME3; \
1820 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1821 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1822 _ANONYMOUS_UNION union { \
1823 RECEIVE_HANDLER ReceiveHandler; \
1824 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1825 } DUMMYUNIONNAME4; \
1826 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1827 STATUS_HANDLER StatusHandler; \
1828 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1829 NDIS_STRING Name;
1830
1831 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
1832 NDIS30_PROTOCOL_CHARACTERISTICS_S
1833 } NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
1834
1835
1836 /* Prototypes for NDIS 4.0 protocol characteristics */
1837
1838 typedef INT
1839 (NTAPI *RECEIVE_PACKET_HANDLER)(
1840 IN NDIS_HANDLE ProtocolBindingContext,
1841 IN PNDIS_PACKET Packet);
1842
1843 typedef VOID
1844 (NTAPI *BIND_HANDLER)(
1845 OUT PNDIS_STATUS Status,
1846 IN NDIS_HANDLE BindContext,
1847 IN PNDIS_STRING DeviceName,
1848 IN PVOID SystemSpecific1,
1849 IN PVOID SystemSpecific2);
1850
1851 typedef VOID
1852 (NTAPI *UNBIND_HANDLER)(
1853 OUT PNDIS_STATUS Status,
1854 IN NDIS_HANDLE ProtocolBindingContext,
1855 IN NDIS_HANDLE UnbindContext);
1856
1857 typedef NDIS_STATUS
1858 (NTAPI *PNP_EVENT_HANDLER)(
1859 IN NDIS_HANDLE ProtocolBindingContext,
1860 IN PNET_PNP_EVENT NetPnPEvent);
1861
1862 typedef VOID
1863 (NTAPI *UNLOAD_PROTOCOL_HANDLER)(
1864 VOID);
1865
1866 /* Protocol characteristics for NDIS 4.0 protocols */
1867
1868 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
1869 UCHAR MajorNdisVersion;
1870 UCHAR MinorNdisVersion;
1871 USHORT Filler;
1872 __MINGW_EXTENSION union {
1873 UINT Reserved;
1874 UINT Flags;
1875 };
1876 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler;
1877 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler;
1878 __MINGW_EXTENSION union {
1879 SEND_COMPLETE_HANDLER SendCompleteHandler;
1880 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
1881 };
1882 __MINGW_EXTENSION union {
1883 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
1884 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler;
1885 };
1886 RESET_COMPLETE_HANDLER ResetCompleteHandler;
1887 REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
1888 __MINGW_EXTENSION union {
1889 RECEIVE_HANDLER ReceiveHandler;
1890 WAN_RECEIVE_HANDLER WanReceiveHandler;
1891 };
1892 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
1893 STATUS_HANDLER StatusHandler;
1894 STATUS_COMPLETE_HANDLER StatusCompleteHandler;
1895 NDIS_STRING Name;
1896 RECEIVE_PACKET_HANDLER ReceivePacketHandler;
1897 BIND_HANDLER BindAdapterHandler;
1898 UNBIND_HANDLER UnbindAdapterHandler;
1899 PNP_EVENT_HANDLER PnPEventHandler;
1900 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1901 } NDIS40_PROTOCOL_CHARACTERISTICS;
1902
1903 typedef VOID
1904 (NTAPI PROTCOL_CO_AF_REGISTER_NOTIFY)(
1905 IN NDIS_HANDLE ProtocolBindingContext,
1906 IN PCO_ADDRESS_FAMILY AddressFamily);
1907 typedef PROTCOL_CO_AF_REGISTER_NOTIFY *CO_AF_REGISTER_NOTIFY_HANDLER;
1908
1909 #if NDIS_LEGACY_PROTOCOL
1910
1911 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
1912 #ifdef __cplusplus
1913 NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars;
1914 #else
1915 NDIS40_PROTOCOL_CHARACTERISTICS;
1916 #endif
1917 PVOID ReservedHandlers[4];
1918 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
1919 CO_STATUS_HANDLER CoStatusHandler;
1920 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
1921 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1922 } NDIS50_PROTOCOL_CHARACTERISTICS;
1923
1924 #if (defined(NDIS50) || defined(NDIS51))
1925 typedef NDIS50_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
1926 #else
1927 typedef NDIS40_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
1928 #endif
1929
1930 typedef NDIS_PROTOCOL_CHARACTERISTICS *PNDIS_PROTOCOL_CHARACTERISTICS;
1931
1932 #endif /* NDIS_LEGACY_PROTOCOL */
1933
1934 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
1935
1936 typedef BOOLEAN
1937 (NTAPI *W_CHECK_FOR_HANG_HANDLER)(
1938 _In_ NDIS_HANDLE MiniportAdapterContext);
1939
1940 typedef VOID
1941 (NTAPI *W_DISABLE_INTERRUPT_HANDLER)(
1942 _In_ NDIS_HANDLE MiniportAdapterContext);
1943
1944 typedef VOID
1945 (NTAPI *W_ENABLE_INTERRUPT_HANDLER)(
1946 _In_ NDIS_HANDLE MiniportAdapterContext);
1947
1948 typedef VOID
1949 (NTAPI *W_HALT_HANDLER)(
1950 _In_ NDIS_HANDLE MiniportAdapterContext);
1951
1952 typedef VOID
1953 (NTAPI *W_HANDLE_INTERRUPT_HANDLER)(
1954 _In_ NDIS_HANDLE MiniportAdapterContext);
1955
1956 typedef NDIS_STATUS
1957 (NTAPI *W_INITIALIZE_HANDLER)(
1958 _Out_ PNDIS_STATUS OpenErrorStatus,
1959 _Out_ PUINT SelectedMediumIndex,
1960 _In_ PNDIS_MEDIUM MediumArray,
1961 _In_ UINT MediumArraySize,
1962 _In_ NDIS_HANDLE MiniportAdapterContext,
1963 _In_ NDIS_HANDLE WrapperConfigurationContext);
1964
1965 typedef VOID
1966 (NTAPI *W_ISR_HANDLER)(
1967 _Out_ PBOOLEAN InterruptRecognized,
1968 _Out_ PBOOLEAN QueueMiniportHandleInterrupt,
1969 _In_ NDIS_HANDLE MiniportAdapterContext);
1970
1971 typedef NDIS_STATUS
1972 (NTAPI *W_QUERY_INFORMATION_HANDLER)(
1973 _In_ NDIS_HANDLE MiniportAdapterContext,
1974 _In_ NDIS_OID Oid,
1975 _In_ PVOID InformationBuffer,
1976 _In_ ULONG InformationBufferLength,
1977 _Out_ PULONG BytesWritten,
1978 _Out_ PULONG BytesNeeded);
1979
1980 typedef NDIS_STATUS
1981 (NTAPI *W_RECONFIGURE_HANDLER)(
1982 _Out_ PNDIS_STATUS OpenErrorStatus,
1983 _In_ NDIS_HANDLE MiniportAdapterContext,
1984 _In_ NDIS_HANDLE WrapperConfigurationContext);
1985
1986 typedef NDIS_STATUS
1987 (NTAPI *W_RESET_HANDLER)(
1988 _Out_ PBOOLEAN AddressingReset,
1989 _In_ NDIS_HANDLE MiniportAdapterContext);
1990
1991 typedef NDIS_STATUS
1992 (NTAPI *W_SEND_HANDLER)(
1993 _In_ NDIS_HANDLE MiniportAdapterContext,
1994 _In_ PNDIS_PACKET Packet,
1995 _In_ UINT Flags);
1996
1997 typedef NDIS_STATUS
1998 (NTAPI *WM_SEND_HANDLER)(
1999 _In_ NDIS_HANDLE MiniportAdapterContext,
2000 _In_ NDIS_HANDLE NdisLinkHandle,
2001 _In_ PNDIS_WAN_PACKET Packet);
2002
2003 typedef NDIS_STATUS
2004 (NTAPI *W_SET_INFORMATION_HANDLER)(
2005 _In_ NDIS_HANDLE MiniportAdapterContext,
2006 _In_ NDIS_OID Oid,
2007 _In_ PVOID InformationBuffer,
2008 _In_ ULONG InformationBufferLength,
2009 _Out_ PULONG BytesRead,
2010 _Out_ PULONG BytesNeeded);
2011
2012 typedef NDIS_STATUS
2013 (NTAPI *W_TRANSFER_DATA_HANDLER)(
2014 _Out_ PNDIS_PACKET Packet,
2015 _Out_ PUINT BytesTransferred,
2016 _In_ NDIS_HANDLE MiniportAdapterContext,
2017 _In_ NDIS_HANDLE MiniportReceiveContext,
2018 _In_ UINT ByteOffset,
2019 _In_ UINT BytesToTransfer);
2020
2021 typedef NDIS_STATUS
2022 (NTAPI *WM_TRANSFER_DATA_HANDLER)(VOID);
2023
2024 typedef VOID
2025 (NTAPI *ADAPTER_SHUTDOWN_HANDLER)(
2026 _In_ PVOID ShutdownContext);
2027
2028 typedef VOID
2029 (NTAPI *W_RETURN_PACKET_HANDLER)(
2030 _In_ NDIS_HANDLE MiniportAdapterContext,
2031 _In_ PNDIS_PACKET Packet);
2032
2033 typedef VOID
2034 (NTAPI *W_SEND_PACKETS_HANDLER)(
2035 _In_ NDIS_HANDLE MiniportAdapterContext,
2036 _In_ PPNDIS_PACKET PacketArray,
2037 _In_ UINT NumberOfPackets);
2038
2039 typedef VOID
2040 (NTAPI *W_ALLOCATE_COMPLETE_HANDLER)(
2041 _In_ NDIS_HANDLE MiniportAdapterContext,
2042 _In_ PVOID VirtualAddress,
2043 _In_ PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
2044 _In_ ULONG Length,
2045 _In_ PVOID Context);
2046
2047 /* NDIS structures available only to miniport drivers */
2048
2049 #define NDIS30_MINIPORT_CHARACTERISTICS_S \
2050 UCHAR MajorNdisVersion; \
2051 UCHAR MinorNdisVersion; \
2052 UINT Reserved; \
2053 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
2054 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
2055 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
2056 W_HALT_HANDLER HaltHandler; \
2057 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
2058 W_INITIALIZE_HANDLER InitializeHandler; \
2059 W_ISR_HANDLER ISRHandler; \
2060 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
2061 W_RECONFIGURE_HANDLER ReconfigureHandler; \
2062 W_RESET_HANDLER ResetHandler; \
2063 W_SEND_HANDLER SendHandler; \
2064 W_SET_INFORMATION_HANDLER SetInformationHandler; \
2065 W_TRANSFER_DATA_HANDLER TransferDataHandler;
2066
2067 typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
2068 NDIS30_MINIPORT_CHARACTERISTICS_S
2069 } NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
2070
2071 #ifdef __cplusplus
2072
2073 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
2074 NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars; \
2075 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
2076 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
2077 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
2078
2079 #else /* !__cplusplus */
2080
2081 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
2082 NDIS30_MINIPORT_CHARACTERISTICS_S \
2083 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
2084 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
2085 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
2086
2087 #endif /* !__cplusplus */
2088
2089 typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
2090 NDIS40_MINIPORT_CHARACTERISTICS_S
2091 } NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
2092
2093 /* Extensions for NDIS 5.0 miniports */
2094
2095 _IRQL_requires_max_(DISPATCH_LEVEL)
2096 _Function_class_(MINIPORT_CO_CREATE_VC)
2097 typedef NDIS_STATUS
2098 (NTAPI MINIPORT_CO_CREATE_VC)(
2099 _In_ NDIS_HANDLE MiniportAdapterContext,
2100 _In_ NDIS_HANDLE NdisVcHandle,
2101 _Out_ PNDIS_HANDLE MiniportVcContext);
2102 typedef MINIPORT_CO_CREATE_VC *W_CO_CREATE_VC_HANDLER;
2103
2104 _IRQL_requires_max_(DISPATCH_LEVEL)
2105 _Function_class_(MINIPORT_CO_DELETE_VC)
2106 typedef NDIS_STATUS
2107 (NTAPI MINIPORT_CO_DELETE_VC)(
2108 _In_ NDIS_HANDLE MiniportVcContext);
2109 typedef MINIPORT_CO_DELETE_VC *W_CO_DELETE_VC_HANDLER;
2110
2111 _IRQL_requires_max_(DISPATCH_LEVEL)
2112 _Function_class_(MINIPORT_CO_ACTIVATE_VC)
2113 typedef NDIS_STATUS
2114 (NTAPI MINIPORT_CO_ACTIVATE_VC)(
2115 _In_ NDIS_HANDLE MiniportVcContext,
2116 _Inout_ PCO_CALL_PARAMETERS CallParameters);
2117 typedef MINIPORT_CO_ACTIVATE_VC *W_CO_ACTIVATE_VC_HANDLER;
2118
2119 _IRQL_requires_max_(DISPATCH_LEVEL)
2120 _Function_class_(MINIPORT_CO_DEACTIVATE_VC)
2121 typedef NDIS_STATUS
2122 (NTAPI MINIPORT_CO_DEACTIVATE_VC)(
2123 _In_ NDIS_HANDLE MiniportVcContext);
2124 typedef MINIPORT_CO_DEACTIVATE_VC *W_CO_DEACTIVATE_VC_HANDLER;
2125
2126 typedef VOID
2127 (NTAPI *W_CO_SEND_PACKETS_HANDLER)(
2128 _In_ NDIS_HANDLE MiniportVcContext,
2129 _In_ PPNDIS_PACKET PacketArray,
2130 _In_ UINT NumberOfPackets);
2131
2132 typedef NDIS_STATUS
2133 (NTAPI *W_CO_REQUEST_HANDLER)(
2134 _In_ NDIS_HANDLE MiniportAdapterContext,
2135 _In_opt_ NDIS_HANDLE MiniportVcContext,
2136 _Inout_ PNDIS_REQUEST NdisRequest);
2137
2138 #ifdef __cplusplus
2139
2140 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
2141 NDIS40_MINIPORT_CHARACTERISTICS Ndis40Chars; \
2142 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
2143 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
2144 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
2145 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
2146 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
2147 W_CO_REQUEST_HANDLER CoRequestHandler;
2148
2149 #else /* !__cplusplus */
2150
2151 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
2152 NDIS40_MINIPORT_CHARACTERISTICS_S \
2153 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
2154 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
2155 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
2156 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
2157 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
2158 W_CO_REQUEST_HANDLER CoRequestHandler;
2159
2160 #endif /* !__cplusplus */
2161
2162 typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
2163 NDIS50_MINIPORT_CHARACTERISTICS_S
2164 } NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
2165
2166 /* Extensions for NDIS 5.1 miniports */
2167
2168 typedef VOID
2169 (NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)(
2170 _In_ NDIS_HANDLE MiniportAdapterContext,
2171 _In_ PVOID CancelId);
2172
2173 typedef VOID
2174 (NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)(
2175 _In_ NDIS_HANDLE MiniportAdapterContext,
2176 _In_ NDIS_DEVICE_PNP_EVENT PnPEvent,
2177 _In_ PVOID InformationBuffer,
2178 _In_ ULONG InformationBufferLength);
2179
2180 typedef VOID
2181 (NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)(
2182 _In_ PVOID ShutdownContext);
2183
2184 #ifdef __cplusplus
2185
2186 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
2187 NDIS50_MINIPORT_CHARACTERISTICS Ndis50Chars; \
2188 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2189 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
2190 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler; \
2191 PVOID Reserved1; \
2192 PVOID Reserved2; \
2193 PVOID Reserved3; \
2194 PVOID Reserved4;
2195
2196 #else
2197
2198 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
2199 NDIS50_MINIPORT_CHARACTERISTICS_S \
2200 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2201 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
2202 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler; \
2203 PVOID Reserved1; \
2204 PVOID Reserved2; \
2205 PVOID Reserved3; \
2206 PVOID Reserved4;
2207
2208 #endif
2209
2210 typedef struct _NDIS51_MINIPORT_CHARACTERISTICS {
2211 NDIS51_MINIPORT_CHARACTERISTICS_S
2212 } NDIS51_MINIPORT_CHARACTERISTICS, *PSNDIS51_MINIPORT_CHARACTERISTICS;
2213
2214 #if defined(NDIS51_MINIPORT)
2215 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2216 NDIS51_MINIPORT_CHARACTERISTICS_S
2217 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2218 #elif defined(NDIS50_MINIPORT)
2219 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2220 NDIS50_MINIPORT_CHARACTERISTICS_S
2221 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2222 #elif defined(NDIS40_MINIPORT)
2223 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2224 NDIS40_MINIPORT_CHARACTERISTICS_S
2225 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2226 #else /* NDIS30 */
2227 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2228 NDIS30_MINIPORT_CHARACTERISTICS_S
2229 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2230 #endif
2231
2232 typedef struct _NDIS_MINIPORT_INTERRUPT {
2233 PKINTERRUPT InterruptObject;
2234 KSPIN_LOCK DpcCountLock;
2235 PVOID Reserved;
2236 W_ISR_HANDLER MiniportIsr;
2237 W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
2238 KDPC InterruptDpc;
2239 PNDIS_MINIPORT_BLOCK Miniport;
2240 UCHAR DpcCount;
2241 BOOLEAN Filler1;
2242 KEVENT DpcsCompletedEvent;
2243 BOOLEAN SharedInterrupt;
2244 BOOLEAN IsrRequested;
2245 } NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
2246
2247 /* Structures available only to full MAC drivers */
2248
2249 typedef BOOLEAN
2250 (NTAPI *PNDIS_INTERRUPT_SERVICE)(
2251 IN PVOID InterruptContext);
2252
2253 typedef VOID
2254 (NTAPI *PNDIS_DEFERRED_PROCESSING)(
2255 IN PVOID SystemSpecific1,
2256 IN PVOID InterruptContext,
2257 IN PVOID SystemSpecific2,
2258 IN PVOID SystemSpecific3);
2259
2260 typedef struct _NDIS_WRAPPER_HANDLE NDIS_WRAPPER_HANDLE, *PNDIS_WRAPPER_HANDLE;
2261 typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
2262 typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
2263 typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
2264 typedef struct _NDIS_OFFLOAD NDIS_OFFLOAD, *PNDIS_OFFLOAD;
2265 typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
2266 typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER;
2267 #if NDIS_SUPPORT_NDIS6
2268 typedef USHORT NET_FRAME_TYPE, *PNET_FRAME_TYPE;
2269 #endif
2270
2271 typedef struct _NDIS_MINIPORT_TIMER {
2272 KTIMER Timer;
2273 KDPC Dpc;
2274 PNDIS_TIMER_FUNCTION MiniportTimerFunction;
2275 PVOID MiniportTimerContext;
2276 PNDIS_MINIPORT_BLOCK Miniport;
2277 struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
2278 } NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
2279
2280 typedef struct _NDIS_INTERRUPT {
2281 PKINTERRUPT InterruptObject;
2282 KSPIN_LOCK DpcCountLock;
2283 PNDIS_INTERRUPT_SERVICE MacIsr;
2284 PNDIS_DEFERRED_PROCESSING MacDpc;
2285 KDPC InterruptDpc;
2286 PVOID InterruptContext;
2287 UCHAR DpcCount;
2288 BOOLEAN Removing;
2289 KEVENT DpcsCompletedEvent;
2290 } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
2291
2292
2293 typedef enum _NDIS_WORK_ITEM_TYPE {
2294 NdisWorkItemRequest,
2295 NdisWorkItemSend,
2296 NdisWorkItemReturnPackets,
2297 NdisWorkItemResetRequested,
2298 NdisWorkItemResetInProgress,
2299 NdisWorkItemHalt,
2300 NdisWorkItemSendLoopback,
2301 NdisWorkItemMiniportCallback,
2302 NdisMaxWorkItems
2303 } NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
2304
2305 #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
2306 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
2307
2308 typedef struct _NDIS_MINIPORT_WORK_ITEM {
2309 SINGLE_LIST_ENTRY Link;
2310 NDIS_WORK_ITEM_TYPE WorkItemType;
2311 PVOID WorkItemContext;
2312 } NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
2313
2314 struct _NDIS_WORK_ITEM;
2315 typedef VOID (NTAPI *NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
2316
2317 typedef struct _NDIS_WORK_ITEM {
2318 PVOID Context;
2319 NDIS_PROC Routine;
2320 UCHAR WrapperReserved[8*sizeof(PVOID)];
2321 } NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
2322
2323 typedef struct _NDIS_BIND_PATHS {
2324 UINT Number;
2325 NDIS_STRING Paths[1];
2326 } NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
2327
2328
2329 typedef VOID
2330 (NTAPI *ETH_RCV_COMPLETE_HANDLER)(
2331 _In_ PETH_FILTER Filter);
2332
2333 typedef VOID
2334 (NTAPI *ETH_RCV_INDICATE_HANDLER)(
2335 _In_ PETH_FILTER Filter,
2336 _In_ NDIS_HANDLE MacReceiveContext,
2337 _In_ PCHAR Address,
2338 _In_ PVOID HeaderBuffer,
2339 _In_ UINT HeaderBufferSize,
2340 _In_ PVOID LookaheadBuffer,
2341 _In_ UINT LookaheadBufferSize,
2342 _In_ UINT PacketSize);
2343
2344 typedef VOID
2345 (NTAPI *FDDI_RCV_COMPLETE_HANDLER)(
2346 IN PFDDI_FILTER Filter);
2347
2348 typedef VOID
2349 (NTAPI *FDDI_RCV_INDICATE_HANDLER)(
2350 IN PFDDI_FILTER Filter,
2351 IN NDIS_HANDLE MacReceiveContext,
2352 IN PCHAR Address,
2353 IN UINT AddressLength,
2354 IN PVOID HeaderBuffer,
2355 IN UINT HeaderBufferSize,
2356 IN PVOID LookaheadBuffer,
2357 IN UINT LookaheadBufferSize,
2358 IN UINT PacketSize);
2359
2360 typedef VOID
2361 (NTAPI *FILTER_PACKET_INDICATION_HANDLER)(
2362 _In_ NDIS_HANDLE Miniport,
2363 _In_ PPNDIS_PACKET PacketArray,
2364 _In_ UINT NumberOfPackets);
2365
2366 typedef VOID
2367 (NTAPI *TR_RCV_COMPLETE_HANDLER)(
2368 _In_ PTR_FILTER Filter);
2369
2370 typedef VOID
2371 (NTAPI *TR_RCV_INDICATE_HANDLER)(
2372 _In_ PTR_FILTER Filter,
2373 _In_ NDIS_HANDLE MacReceiveContext,
2374 _In_ PVOID HeaderBuffer,
2375 _In_ UINT HeaderBufferSize,
2376 _In_ PVOID LookaheadBuffer,
2377 _In_ UINT LookaheadBufferSize,
2378 _In_ UINT PacketSize);
2379
2380 typedef VOID
2381 (NTAPI *WAN_RCV_COMPLETE_HANDLER)(
2382 _In_ NDIS_HANDLE MiniportAdapterHandle,
2383 _In_ NDIS_HANDLE NdisLinkContext);
2384
2385 typedef VOID
2386 (NTAPI *WAN_RCV_HANDLER)(
2387 _Out_ PNDIS_STATUS Status,
2388 _In_ NDIS_HANDLE MiniportAdapterHandle,
2389 _In_ NDIS_HANDLE NdisLinkContext,
2390 _In_ PUCHAR Packet,
2391 _In_ ULONG PacketSize);
2392
2393 typedef VOID
2394 (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
2395 IN PNDIS_MINIPORT_BLOCK Miniport,
2396 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2397 OUT PVOID *WorkItemContext);
2398
2399 typedef NDIS_STATUS
2400 (FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
2401 IN PNDIS_MINIPORT_BLOCK Miniport,
2402 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2403 IN PVOID WorkItemContext);
2404
2405 typedef NDIS_STATUS
2406 (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
2407 IN PNDIS_MINIPORT_BLOCK Miniport,
2408 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2409 IN PVOID WorkItemContext);
2410
2411 typedef VOID
2412 (NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)(
2413 _In_ NDIS_HANDLE MiniportAdapterHandle,
2414 _In_ NDIS_STATUS Status);
2415
2416 typedef VOID
2417 (NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)(
2418 _In_ NDIS_HANDLE MiniportAdapterHandle,
2419 _In_ NDIS_STATUS Status,
2420 _In_ BOOLEAN AddressingReset);
2421
2422 typedef VOID
2423 (NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)(
2424 _In_ NDIS_HANDLE MiniportAdapterHandle,
2425 _In_ PNDIS_PACKET Packet,
2426 _In_ NDIS_STATUS Status);
2427
2428 typedef VOID
2429 (NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)(
2430 _In_ NDIS_HANDLE MiniportAdapterHandle);
2431
2432 typedef BOOLEAN
2433 (FASTCALL *NDIS_M_START_SENDS)(
2434 _In_ PNDIS_MINIPORT_BLOCK Miniport);
2435
2436 typedef VOID
2437 (NTAPI *NDIS_M_STATUS_HANDLER)(
2438 _In_ NDIS_HANDLE MiniportHandle,
2439 _In_ NDIS_STATUS GeneralStatus,
2440 _In_ PVOID StatusBuffer,
2441 _In_ UINT StatusBufferSize);
2442
2443 typedef VOID
2444 (NTAPI *NDIS_M_STS_COMPLETE_HANDLER)(
2445 _In_ NDIS_HANDLE MiniportAdapterHandle);
2446
2447 typedef VOID
2448 (NTAPI *NDIS_M_TD_COMPLETE_HANDLER)(
2449 _In_ NDIS_HANDLE MiniportAdapterHandle,
2450 _In_ PNDIS_PACKET Packet,
2451 _In_ NDIS_STATUS Status,
2452 _In_ UINT BytesTransferred);
2453
2454 typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
2455 _In_ NDIS_HANDLE MiniportAdapterHandle,
2456 _In_ PVOID Packet,
2457 _In_ NDIS_STATUS Status);
2458
2459
2460 #if ARCNET
2461
2462 #define ARC_SEND_BUFFERS 8
2463 #define ARC_HEADER_SIZE 4
2464
2465 typedef struct _NDIS_ARC_BUF {
2466 NDIS_HANDLE ArcnetBufferPool;
2467 PUCHAR ArcnetLookaheadBuffer;
2468 UINT NumFree;
2469 ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
2470 } NDIS_ARC_BUF, *PNDIS_ARC_BUF;
2471
2472 #endif /* ARCNET */
2473
2474 typedef struct _NDIS_LOG {
2475 PNDIS_MINIPORT_BLOCK Miniport;
2476 KSPIN_LOCK LogLock;
2477 PIRP Irp;
2478 UINT TotalSize;
2479 UINT CurrentSize;
2480 UINT InPtr;
2481 UINT OutPtr;
2482 UCHAR LogBuf[1];
2483 } NDIS_LOG, *PNDIS_LOG;
2484
2485 #if ARCNET
2486 #define FILTERDBS_ARCNET_S \
2487 PARC_FILTER ArcDB;
2488 #else /* !ARCNET */
2489 #define FILTERDBS_ARCNET_S \
2490 PVOID XXXDB;
2491 #endif /* !ARCNET */
2492
2493 #define FILTERDBS_S \
2494 _ANONYMOUS_UNION union { \
2495 PETH_FILTER EthDB; \
2496 PNULL_FILTER NullDB; \
2497 } DUMMYUNIONNAME; \
2498 PTR_FILTER TrDB; \
2499 PFDDI_FILTER FddiDB; \
2500 FILTERDBS_ARCNET_S
2501
2502 typedef struct _FILTERDBS {
2503 FILTERDBS_S
2504 } FILTERDBS, *PFILTERDBS;
2505
2506 struct _NDIS_MINIPORT_BLOCK {
2507 NDIS_OBJECT_HEADER Header;
2508 PNDIS_MINIPORT_BLOCK NextMiniport;
2509 PNDIS_M_DRIVER_BLOCK DriverHandle;
2510 NDIS_HANDLE MiniportAdapterContext;
2511 UNICODE_STRING MiniportName;
2512 PNDIS_BIND_PATHS BindPaths;
2513 NDIS_HANDLE OpenQueue;
2514 REFERENCE ShortRef;
2515 NDIS_HANDLE DeviceContext;
2516 UCHAR Padding1;
2517 UCHAR LockAcquired;
2518 UCHAR PmodeOpens;
2519 UCHAR AssignedProcessor;
2520 KSPIN_LOCK Lock;
2521 PNDIS_REQUEST MediaRequest;
2522 PNDIS_MINIPORT_INTERRUPT Interrupt;
2523 ULONG Flags;
2524 ULONG PnPFlags;
2525 LIST_ENTRY PacketList;
2526 PNDIS_PACKET FirstPendingPacket;
2527 PNDIS_PACKET ReturnPacketsQueue;
2528 ULONG RequestBuffer;
2529 PVOID SetMCastBuffer;
2530 PNDIS_MINIPORT_BLOCK PrimaryMiniport;
2531 PVOID WrapperContext;
2532 PVOID BusDataContext;
2533 ULONG PnPCapabilities;
2534 PCM_RESOURCE_LIST Resources;
2535 NDIS_TIMER WakeUpDpcTimer;
2536 UNICODE_STRING BaseName;
2537 UNICODE_STRING SymbolicLinkName;
2538 ULONG CheckForHangSeconds;
2539 USHORT CFHangTicks;
2540 USHORT CFHangCurrentTick;
2541 NDIS_STATUS ResetStatus;
2542 NDIS_HANDLE ResetOpen;
2543 FILTERDBS_S
2544 FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler;
2545 NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler;
2546 NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler;
2547 NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler;
2548 NDIS_MEDIUM MediaType;
2549 ULONG BusNumber;
2550 NDIS_INTERFACE_TYPE BusType;
2551 NDIS_INTERFACE_TYPE AdapterType;
2552 PDEVICE_OBJECT DeviceObject;
2553 PDEVICE_OBJECT PhysicalDeviceObject;
2554 PDEVICE_OBJECT NextDeviceObject;
2555 PMAP_REGISTER_ENTRY MapRegisters;
2556 PNDIS_AF_LIST CallMgrAfList;
2557 PVOID MiniportThread;
2558 PVOID SetInfoBuf;
2559 USHORT SetInfoBufLen;
2560 USHORT MaxSendPackets;
2561 NDIS_STATUS FakeStatus;
2562 PVOID LockHandler;
2563 PUNICODE_STRING pAdapterInstanceName;
2564 PNDIS_MINIPORT_TIMER TimerQueue;
2565 UINT MacOptions;
2566 PNDIS_REQUEST PendingRequest;
2567 UINT MaximumLongAddresses;
2568 UINT MaximumShortAddresses;
2569 UINT CurrentLookahead;
2570 UINT MaximumLookahead;
2571 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
2572 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
2573 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
2574 W_SEND_PACKETS_HANDLER SendPacketsHandler;
2575 NDIS_M_START_SENDS DeferredSendHandler;
2576 ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler;
2577 TR_RCV_INDICATE_HANDLER TrRxIndicateHandler;
2578 FDDI_RCV_INDICATE_HANDLER FddiRxIndicateHandler;
2579 ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler;
2580 TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler;
2581 FDDI_RCV_COMPLETE_HANDLER FddiRxCompleteHandler;
2582 NDIS_M_STATUS_HANDLER StatusHandler;
2583 NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler;
2584 NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler;
2585 NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler;
2586 NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler;
2587 NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
2588 WAN_RCV_HANDLER WanRcvHandler;
2589 WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler;
2590 #if defined(NDIS_WRAPPER)
2591 PNDIS_MINIPORT_BLOCK NextGlobalMiniport;
2592 SINGLE_LIST_ENTRY WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
2593 SINGLE_LIST_ENTRY SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
2594 UCHAR SendFlags;
2595 UCHAR TrResetRing;
2596 UCHAR ArcnetAddress;
2597 UCHAR XState;
2598 _ANONYMOUS_UNION union {
2599 #if ARCNET
2600 PNDIS_ARC_BUF ArcBuf;
2601 #endif
2602 PVOID BusInterface;
2603 } DUMMYUNIONNAME;
2604 PNDIS_LOG Log;
2605 ULONG SlotNumber;
2606 PCM_RESOURCE_LIST AllocatedResources;
2607 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
2608 SINGLE_LIST_ENTRY PatternList;
2609 NDIS_PNP_CAPABILITIES PMCapabilities;
2610 DEVICE_CAPABILITIES DeviceCaps;
2611 ULONG WakeUpEnable;
2612 DEVICE_POWER_STATE CurrentDevicePowerState;
2613 PIRP pIrpWaitWake;
2614 SYSTEM_POWER_STATE WaitWakeSystemState;
2615 LARGE_INTEGER VcIndex;
2616 KSPIN_LOCK VcCountLock;
2617 LIST_ENTRY WmiEnabledVcs;
2618 PNDIS_GUID pNdisGuidMap;
2619 PNDIS_GUID pCustomGuidMap;
2620 USHORT VcCount;
2621 USHORT cNdisGuidMap;
2622 USHORT cCustomGuidMap;
2623 USHORT CurrentMapRegister;
2624 PKEVENT AllocationEvent;
2625 USHORT BaseMapRegistersNeeded;
2626 USHORT SGMapRegistersNeeded;
2627 ULONG MaximumPhysicalMapping;
2628 NDIS_TIMER MediaDisconnectTimer;
2629 USHORT MediaDisconnectTimeOut;
2630 USHORT InstanceNumber;
2631 NDIS_EVENT OpenReadyEvent;
2632 NDIS_PNP_DEVICE_STATE PnPDeviceState;
2633 NDIS_PNP_DEVICE_STATE OldPnPDeviceState;
2634 PGET_SET_DEVICE_DATA SetBusData;
2635 PGET_SET_DEVICE_DATA GetBusData;
2636 KDPC DeferredDpc;
2637 #if 0
2638 /* FIXME: */
2639 NDIS_STATS NdisStats;
2640 #else
2641 ULONG NdisStats;
2642 #endif
2643 PNDIS_PACKET IndicatedPacket[MAXIMUM_PROCESSORS];
2644 PKEVENT RemoveReadyEvent;
2645 PKEVENT AllOpensClosedEvent;
2646 PKEVENT AllRequestsCompletedEvent;
2647 ULONG InitTimeMs;
2648 NDIS_MINIPORT_WORK_ITEM WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
2649 PDMA_ADAPTER SystemAdapterObject;
2650 ULONG DriverVerifyFlags;
2651 POID_LIST OidList;
2652 USHORT InternalResetCount;
2653 USHORT MiniportResetCount;
2654 USHORT MediaSenseConnectCount;
2655 USHORT MediaSenseDisconnectCount;
2656 PNDIS_PACKET *xPackets;
2657 ULONG UserModeOpenReferences;
2658 _ANONYMOUS_UNION union {
2659 PVOID SavedSendHandler;
2660 PVOID SavedWanSendHandler;
2661 } DUMMYUNIONNAME2;
2662 PVOID SavedSendPacketsHandler;
2663 PVOID SavedCancelSendPacketsHandler;
2664 W_SEND_PACKETS_HANDLER WSendPacketsHandler;
2665 ULONG MiniportAttributes;
2666 PDMA_ADAPTER SavedSystemAdapterObject;
2667 USHORT NumOpens;
2668 USHORT CFHangXTicks;
2669 ULONG RequestCount;
2670 ULONG IndicatedPacketsCount;
2671 ULONG PhysicalMediumType;
2672 PNDIS_REQUEST LastRequest;
2673 LONG DmaAdapterRefCount;
2674 PVOID FakeMac;
2675 ULONG LockDbg;
2676 ULONG LockDbgX;
2677 PVOID LockThread;
2678 ULONG InfoFlags;
2679 KSPIN_LOCK TimerQueueLock;
2680 PKEVENT ResetCompletedEvent;
2681 PKEVENT QueuedBindingCompletedEvent;
2682 PKEVENT DmaResourcesReleasedEvent;
2683 FILTER_PACKET_INDICATION_HANDLER SavedPacketIndicateHandler;
2684 ULONG RegisteredInterrupts;
2685 PNPAGED_LOOKASIDE_LIST SGListLookasideList;
2686 ULONG ScatterGatherListSize;
2687 #endif /* _NDIS_ */
2688 };
2689
2690 #if NDIS_LEGACY_DRIVER
2691
2692 typedef NDIS_STATUS
2693 (NTAPI *WAN_SEND_HANDLER)(
2694 _In_ NDIS_HANDLE MacBindingHandle,
2695 _In_ NDIS_HANDLE LinkHandle,
2696 _In_ PVOID Packet);
2697
2698 typedef VOID
2699 (NTAPI *SEND_PACKETS_HANDLER)(
2700 _In_ NDIS_HANDLE MiniportAdapterContext,
2701 _In_ PPNDIS_PACKET PacketArray,
2702 _In_ UINT NumberOfPackets);
2703
2704 typedef NDIS_STATUS
2705 (NTAPI *SEND_HANDLER)(
2706 _In_ NDIS_HANDLE NdisBindingHandle,
2707 _In_ PNDIS_PACKET Packet);
2708
2709 typedef NDIS_STATUS
2710 (NTAPI *TRANSFER_DATA_HANDLER)(
2711 _In_ NDIS_HANDLE NdisBindingHandle,
2712 _In_ NDIS_HANDLE MacReceiveContext,
2713 _In_ UINT ByteOffset,
2714 _In_ UINT BytesToTransfer,
2715 _Out_ PNDIS_PACKET Packet,
2716 _Out_ PUINT BytesTransferred);
2717
2718 typedef NDIS_STATUS
2719 (NTAPI *RESET_HANDLER)(
2720 _In_ NDIS_HANDLE NdisBindingHandle);
2721
2722 typedef NDIS_STATUS
2723 (NTAPI *REQUEST_HANDLER)(
2724 _In_ NDIS_HANDLE NdisBindingHandle,
2725 _In_ PNDIS_REQUEST NdisRequest);
2726
2727 #endif /* NDIS_LEGACY_DRIVER */
2728
2729 #if defined(NDIS_WRAPPER)
2730 #define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S \
2731 ULONG Flags; \
2732 ULONG References; \
2733 KSPIN_LOCK SpinLock; \
2734 NDIS_HANDLE FilterHandle; \
2735 ULONG ProtocolOptions; \
2736 USHORT CurrentLookahead; \
2737 USHORT ConnectDampTicks; \
2738 USHORT DisconnectDampTicks; \
2739 W_SEND_HANDLER WSendHandler; \
2740 W_TRANSFER_DATA_HANDLER WTransferDataHandler; \
2741 W_SEND_PACKETS_HANDLER WSendPacketsHandler; \
2742 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2743 ULONG WakeUpEnable; \
2744 PKEVENT CloseCompleteEvent; \
2745 QUEUED_CLOSE QC; \
2746 ULONG AfReferences; \
2747 PNDIS_OPEN_BLOCK NextGlobalOpen;
2748 #else
2749 #define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
2750 #endif
2751
2752 #define NDIS_COMMON_OPEN_BLOCK_S \
2753 PVOID MacHandle; \
2754 NDIS_HANDLE BindingHandle; \
2755 PNDIS_MINIPORT_BLOCK MiniportHandle; \
2756 PNDIS_PROTOCOL_BLOCK ProtocolHandle; \
2757 NDIS_HANDLE ProtocolBindingContext; \
2758 PNDIS_OPEN_BLOCK MiniportNextOpen; \
2759 PNDIS_OPEN_BLOCK ProtocolNextOpen; \
2760 NDIS_HANDLE MiniportAdapterContext; \
2761 BOOLEAN Reserved1; \
2762 BOOLEAN Reserved2; \
2763 BOOLEAN Reserved3; \
2764 BOOLEAN Reserved4; \
2765 PNDIS_STRING BindDeviceName; \
2766 KSPIN_LOCK Reserved5; \
2767 PNDIS_STRING RootDeviceName; \
2768 _ANONYMOUS_UNION union { \
2769 SEND_HANDLER SendHandler; \
2770 WAN_SEND_HANDLER WanSendHandler; \
2771 } DUMMYUNIONNAME; \
2772 TRANSFER_DATA_HANDLER TransferDataHandler; \
2773 SEND_COMPLETE_HANDLER SendCompleteHandler; \
2774 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
2775 RECEIVE_HANDLER ReceiveHandler; \
2776 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
2777 WAN_RECEIVE_HANDLER WanReceiveHandler; \
2778 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
2779 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
2780 SEND_PACKETS_HANDLER SendPacketsHandler; \
2781 RESET_HANDLER ResetHandler; \
2782 REQUEST_HANDLER RequestHandler; \
2783 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
2784 STATUS_HANDLER StatusHandler; \
2785 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
2786 NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
2787
2788 typedef struct _NDIS_COMMON_OPEN_BLOCK {
2789 NDIS_COMMON_OPEN_BLOCK_S
2790 } NDIS_COMMON_OPEN_BLOCK;
2791
2792 struct _NDIS_OPEN_BLOCK
2793 {
2794 #ifdef __cplusplus
2795 NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
2796 #else
2797 NDIS_COMMON_OPEN_BLOCK_S
2798 #endif
2799 };
2800
2801 #include <xfilter.h>
2802
2803 #define NDIS_M_MAX_LOOKAHEAD 526
2804
2805 _IRQL_requires_max_(DISPATCH_LEVEL)
2806 NDISAPI
2807 VOID
2808 NTAPI
2809 NdisInitializeTimer(
2810 _Inout_ PNDIS_TIMER Timer,
2811 _In_ PNDIS_TIMER_FUNCTION TimerFunction,
2812 _In_opt_ _Points_to_data_ PVOID FunctionContext);
2813
2814 _IRQL_requires_max_(DISPATCH_LEVEL)
2815 NDISAPI
2816 VOID
2817 NTAPI
2818 NdisCancelTimer(
2819 _In_ PNDIS_TIMER Timer,
2820 _Out_ _At_(*TimerCancelled, _Must_inspect_result_) PBOOLEAN TimerCancelled);
2821
2822 _IRQL_requires_max_(DISPATCH_LEVEL)
2823 NDISAPI
2824 VOID
2825 NTAPI
2826 NdisSetTimer(
2827 _In_ PNDIS_TIMER Timer,
2828 _In_ UINT MillisecondsToDelay);
2829
2830 NDISAPI
2831 VOID
2832 NTAPI
2833 NdisSetPeriodicTimer(
2834 _In_ PNDIS_TIMER NdisTimer,
2835 _In_ UINT MillisecondsPeriod);
2836
2837 _IRQL_requires_max_(DISPATCH_LEVEL)
2838 NDISAPI
2839 VOID
2840 NTAPI
2841 NdisSetTimerEx(
2842 _In_ PNDIS_TIMER NdisTimer,
2843 _In_ UINT MillisecondsToDelay,
2844 _In_ PVOID FunctionContext);
2845
2846 _IRQL_requires_(PASSIVE_LEVEL)
2847 NDISAPI
2848 PVOID
2849 NTAPI
2850 NdisGetRoutineAddress(
2851 _In_ PNDIS_STRING NdisRoutineName);
2852
2853 _IRQL_requires_max_(DISPATCH_LEVEL)
2854 NDISAPI
2855 UINT
2856 NTAPI
2857 NdisGetVersion(VOID);
2858
2859 #if NDIS_LEGACY_DRIVER
2860
2861 _IRQL_requires_max_(DISPATCH_LEVEL)
2862 NDISAPI
2863 VOID
2864 NTAPI
2865 NdisAllocateBuffer(
2866 _Out_ PNDIS_STATUS Status,
2867 _Out_ PNDIS_BUFFER *Buffer,
2868 _In_opt_ NDIS_HANDLE PoolHandle,
2869 _In_reads_bytes_(Length) PVOID VirtualAddress,
2870 _In_ UINT Length);
2871
2872 _IRQL_requires_max_(DISPATCH_LEVEL)
2873 NDISAPI
2874 VOID
2875 NTAPI
2876 NdisAllocateBufferPool(
2877 _Out_ PNDIS_STATUS Status,
2878 _Out_ PNDIS_HANDLE PoolHandle,
2879 _In_ UINT NumberOfDescriptors);
2880
2881 _IRQL_requires_max_(DISPATCH_LEVEL)
2882 NDISAPI
2883 VOID
2884 NTAPI
2885 NdisFreeBufferPool(
2886 _In_ NDIS_HANDLE PoolHandle);
2887
2888 /*
2889 NDISAPI
2890 VOID
2891 NTAPI
2892 NdisFreeBuffer(
2893 IN PNDIS_BUFFER Buffer);
2894 */
2895 #define NdisFreeBuffer IoFreeMdl
2896
2897 _IRQL_requires_max_(DISPATCH_LEVEL)
2898 NDISAPI
2899 VOID
2900 NTAPI
2901 NdisAllocatePacketPool(
2902 _Out_ PNDIS_STATUS Status,
2903 _Out_ PNDIS_HANDLE PoolHandle,
2904 _In_ UINT NumberOfDescriptors,
2905 _In_ UINT ProtocolReservedLength);
2906
2907 _IRQL_requires_max_(DISPATCH_LEVEL)
2908 NDISAPI
2909 VOID
2910 NTAPI
2911 NdisAllocatePacketPoolEx(
2912 _Out_ PNDIS_STATUS Status,
2913 _Out_ PNDIS_HANDLE PoolHandle,
2914 _In_ UINT NumberOfDescriptors,
2915 _In_ UINT NumberOfOverflowDescriptors,
2916 _In_ UINT ProtocolReservedLength);
2917
2918 _IRQL_requires_max_(DISPATCH_LEVEL)
2919 NDISAPI
2920 VOID
2921 NTAPI
2922 NdisSetPacketPoolProtocolId(
2923 _In_ NDIS_HANDLE PacketPoolHandle,
2924 _In_ UINT ProtocolId);
2925
2926 _IRQL_requires_max_(DISPATCH_LEVEL)
2927 NDISAPI
2928 UINT
2929 NTAPI
2930 NdisPacketPoolUsage(
2931 _In_ NDIS_HANDLE PoolHandle);
2932
2933 _IRQL_requires_max_(DISPATCH_LEVEL)
2934 NDISAPI
2935 UINT
2936 NTAPI
2937 NdisPacketSize(
2938 _In_ UINT ProtocolReservedSize);
2939
2940 _IRQL_requires_max_(DISPATCH_LEVEL)
2941 NDISAPI
2942 NDIS_HANDLE
2943 NTAPI
2944 NdisGetPoolFromPacket(
2945 _In_ PNDIS_PACKET Packet);
2946
2947 _IRQL_requires_max_(DISPATCH_LEVEL)
2948 NDISAPI
2949 PNDIS_PACKET_STACK
2950 NTAPI
2951 NdisIMGetCurrentPacketStack(
2952 _In_ PNDIS_PACKET Packet,
2953 _Out_ BOOLEAN *StacksRemaining);
2954
2955 _IRQL_requires_max_(DISPATCH_LEVEL)
2956 NDISAPI
2957 VOID
2958 NTAPI
2959 NdisFreePacketPool(
2960 _In_ NDIS_HANDLE PoolHandle);
2961
2962 _IRQL_requires_max_(DISPATCH_LEVEL)
2963 NDISAPI
2964 VOID
2965 NTAPI
2966 NdisFreePacket(
2967 _In_ PNDIS_PACKET Packet);
2968
2969 _IRQL_requires_(DISPATCH_LEVEL)
2970 NDISAPI
2971 VOID
2972 NTAPI
2973 NdisDprFreePacket(
2974 _In_ PNDIS_PACKET Packet);
2975
2976 _IRQL_requires_(DISPATCH_LEVEL)
2977 NDISAPI
2978 VOID
2979 NTAPI
2980 NdisDprFreePacketNonInterlocked(
2981 _In_ PNDIS_PACKET Packet);
2982
2983 _IRQL_requires_max_(DISPATCH_LEVEL)
2984 NDISAPI
2985 VOID
2986 NTAPI
2987 NdisAllocatePacket(
2988 _Out_ PNDIS_STATUS Status,
2989 _Out_ PNDIS_PACKET *Packet,
2990 _In_ NDIS_HANDLE PoolHandle);
2991
2992 _IRQL_requires_(DISPATCH_LEVEL)
2993 NDISAPI
2994 VOID
2995 NTAPI
2996 NdisDprAllocatePacket(
2997 _Out_ PNDIS_STATUS Status,
2998 _Out_ PNDIS_PACKET *Packet,
2999 _In_ NDIS_HANDLE PoolHandle);
3000
3001 _IRQL_requires_(DISPATCH_LEVEL)
3002 NDISAPI
3003 VOID
3004 NTAPI
3005 NdisDprAllocatePacketNonInterlocked(
3006 _Out_ PNDIS_STATUS Status,
3007 _Out_ PNDIS_PACKET *Packet,
3008 _In_ NDIS_HANDLE PoolHandle);
3009
3010 /*
3011 * VOID
3012 * NdisReinitializePacket(
3013 * IN OUT PNDIS_PACKET Packet);
3014 */
3015 #define NdisReinitializePacket(Packet) { \
3016 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
3017 (Packet)->Private.ValidCounts = FALSE; \
3018 }
3019
3020 /*
3021 NDISAPI
3022 VOID
3023 NTAPI
3024 NdisQueryBuffer(
3025 IN PNDIS_BUFFER Buffer,
3026 OUT PVOID *VirtualAddress OPTIONAL,
3027 OUT PUINT Length);
3028 */
3029 #define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length) { \
3030 if (ARGUMENT_PRESENT(_VirtualAddress)) { \
3031 *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdl(_Buffer); \
3032 } \
3033 *(_Length) = MmGetMdlByteCount(_Buffer); \
3034 }
3035
3036 NDISAPI
3037 VOID
3038 NTAPI
3039 NdisGetFirstBufferFromPacket(
3040 IN PNDIS_PACKET _Packet,
3041 OUT PNDIS_BUFFER *_FirstBuffer,
3042 OUT PVOID *_FirstBufferVA,
3043 OUT PUINT _FirstBufferLength,
3044 OUT PUINT _TotalBufferLength);
3045
3046 /*
3047 * VOID
3048 * NdisGetFirstBufferFromPacketSafe(
3049 * IN PNDIS_PACKET _Packet,
3050 * OUT PNDIS_BUFFER * _FirstBuffer,
3051 * OUT PVOID * _FirstBufferVA,
3052 * OUT PUINT _FirstBufferLength,
3053 * OUT PUINT _TotalBufferLength),
3054 * IN MM_PAGE_PRIORITY _Priority)
3055 */
3056 #define NdisGetFirstBufferFromPacketSafe(_Packet, \
3057 _FirstBuffer, \
3058 _FirstBufferVA, \
3059 _FirstBufferLength, \
3060 _TotalBufferLength, \
3061 _Priority) \
3062 { \
3063 PNDIS_BUFFER _Buffer; \
3064 \
3065 _Buffer = (_Packet)->Private.Head; \
3066 *(_FirstBuffer) = _Buffer; \
3067 if (_Buffer != NULL) { \
3068 *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
3069 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
3070 _Buffer = _Buffer->Next; \
3071 *(_TotalBufferLength) = *(_FirstBufferLength); \
3072 while (_Buffer != NULL) { \
3073 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
3074 _Buffer = _Buffer->Next; \
3075 } \
3076 } \
3077 else { \
3078 *(_FirstBufferVA) = 0; \
3079 *(_FirstBufferLength) = 0; \
3080 *(_TotalBufferLength) = 0; \
3081 } \
3082 }
3083
3084 /*
3085 * VOID
3086 * NdisRecalculatePacketCounts(
3087 * IN OUT PNDIS_PACKET Packet);
3088 */
3089 #define NdisRecalculatePacketCounts(Packet) { \
3090 PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
3091 if (_Buffer != NULL) { \
3092 while (_Buffer->Next != NULL) { \
3093 _Buffer = _Buffer->Next; \
3094 } \
3095 (Packet)->Private.Tail = _Buffer; \
3096 } \
3097 (Packet)->Private.ValidCounts = FALSE; \
3098 }
3099
3100 /*
3101 * VOID
3102 * NdisChainBufferAtFront(
3103 * IN OUT PNDIS_PACKET Packet,
3104 * IN OUT PNDIS_BUFFER Buffer)
3105 */
3106 #define NdisChainBufferAtFront(Packet, \
3107 Buffer) \
3108 { \
3109 PNDIS_BUFFER _NdisBuffer = (Buffer); \
3110 \
3111 while (_NdisBuffer->Next != NULL) \
3112 _NdisBuffer = _NdisBuffer->Next; \
3113 \
3114 if ((Packet)->Private.Head == NULL) \
3115 (Packet)->Private.Tail = _NdisBuffer; \
3116 \
3117 _NdisBuffer->Next = (Packet)->Private.Head; \
3118 (Packet)->Private.Head = (Buffer); \
3119 (Packet)->Private.ValidCounts = FALSE; \
3120 }
3121
3122 /*
3123 * VOID
3124 * NdisChainBufferAtBack(
3125 * IN OUT PNDIS_PACKET Packet,
3126 * IN OUT PNDIS_BUFFER Buffer)
3127 */
3128 #define NdisChainBufferAtBack(Packet, \
3129 Buffer) \
3130 { \
3131 PNDIS_BUFFER _NdisBuffer = (Buffer); \
3132 \
3133 while (_NdisBuffer->Next != NULL) \
3134 _NdisBuffer = _NdisBuffer->Next; \
3135 \
3136 _NdisBuffer->Next = NULL; \
3137 \
3138 if ((Packet)->Private.Head != NULL) \
3139 (Packet)->Private.Tail->Next = (Buffer); \
3140 else \
3141 (Packet)->Private.Head = (Buffer); \
3142 \
3143 (Packet)->Private.Tail = _NdisBuffer; \
3144 (Packet)->Private.ValidCounts = FALSE; \
3145 }
3146
3147 NDISAPI
3148 VOID
3149 NTAPI
3150 NdisUnchainBufferAtFront(
3151 IN OUT PNDIS_PACKET Packet,
3152 OUT PNDIS_BUFFER *Buffer);
3153
3154 NDISAPI
3155 VOID
3156 NTAPI
3157 NdisUnchainBufferAtBack(
3158 IN OUT PNDIS_PACKET Packet,
3159 OUT PNDIS_BUFFER *Buffer);
3160
3161 _IRQL_requires_max_(DISPATCH_LEVEL)
3162 NDISAPI
3163 VOID
3164 NTAPI
3165 NdisCopyFromPacketToPacket(
3166 _In_ PNDIS_PACKET Destination,
3167 _In_ UINT DestinationOffset,
3168 _In_ UINT BytesToCopy,
3169 _In_ PNDIS_PACKET Source,
3170 _In_ UINT SourceOffset,
3171 _Out_ PUINT BytesCopied);
3172
3173 NDISAPI
3174 VOID
3175 NTAPI
3176 NdisCopyFromPacketToPacketSafe(
3177 IN PNDIS_PACKET Destination,
3178 IN UINT DestinationOffset,
3179 IN UINT BytesToCopy,
3180 IN PNDIS_PACKET Source,
3181 IN UINT SourceOffset,
3182 OUT PUINT BytesCopied,
3183 IN MM_PAGE_PRIORITY Priority);
3184
3185 _IRQL_requires_max_(DISPATCH_LEVEL)
3186 __drv_preferredFunction("NdisAllocateMemoryWithTag", "Obsolete")
3187 NDISAPI
3188 NDIS_STATUS
3189 NTAPI
3190 NdisAllocateMemory(
3191 _At_(*VirtualAddress, __drv_allocatesMem(Mem)) _Outptr_result_bytebuffer_(Length)
3192 PVOID *VirtualAddress,
3193 _In_ UINT Length,
3194 _In_ UINT MemoryFlags,
3195 _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
3196
3197 #define NdisInitializeWorkItem(_WI_, _R_, _C_) { \
3198 (_WI_)->Context = _C_; \
3199 (_WI_)->Routine = _R_; \
3200 }
3201
3202 _IRQL_requires_max_(DISPATCH_LEVEL)
3203 NDISAPI
3204 NDIS_STATUS
3205 NTAPI
3206 NdisScheduleWorkItem(
3207 _In_ __drv_aliasesMem PNDIS_WORK_ITEM WorkItem);
3208
3209 _IRQL_requires_max_(DISPATCH_LEVEL)
3210 NDISAPI
3211 VOID
3212 NTAPI
3213 NdisSetPacketStatus(
3214 _In_ PNDIS_PACKET Packet,
3215 _In_ NDIS_STATUS Status,
3216 _In_ NDIS_HANDLE Handle,
3217 _In_ ULONG Code);
3218
3219 #endif /* NDIS_LEGACY_DRIVER */
3220
3221 _IRQL_requires_(PASSIVE_LEVEL)
3222 NDISAPI
3223 VOID
3224 NTAPI
3225 NdisOpenFile(
3226 _Out_ PNDIS_STATUS Status,
3227 _Out_ PNDIS_HANDLE FileHandle,
3228 _Out_ PUINT FileLength,
3229 _In_ PNDIS_STRING FileName,
3230 _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
3231
3232 _IRQL_requires_(PASSIVE_LEVEL)
3233 NDISAPI
3234 VOID
3235 NTAPI
3236 NdisCloseFile(
3237 _In_ NDIS_HANDLE FileHandle);
3238
3239 _IRQL_requires_max_(DISPATCH_LEVEL)
3240 NDISAPI
3241 VOID
3242 NTAPI
3243 NdisMapFile(
3244 _Out_ PNDIS_STATUS Status,
3245 _Out_ PVOID *MappedBuffer,
3246 _In_ NDIS_HANDLE FileHandle);
3247
3248 _IRQL_requires_(PASSIVE_LEVEL)
3249 NDISAPI
3250 VOID
3251 NTAPI
3252 NdisUnmapFile(
3253 _In_ NDIS_HANDLE FileHandle);
3254
3255 _IRQL_requires_max_(DISPATCH_LEVEL)
3256 NDISAPI
3257 ULONG
3258 NTAPI
3259 NdisGetSharedDataAlignment(VOID);
3260
3261 #define NdisFlushBuffer(Buffer,WriteToDevice) \
3262 KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE)
3263
3264 _IRQL_requires_max_(DISPATCH_LEVEL)
3265 NDISAPI
3266 VOID
3267 NTAPI
3268 NdisCopyBuffer(
3269 _Out_ PNDIS_STATUS Status,
3270 _Out_ PNDIS_BUFFER *Buffer,
3271 _In_ NDIS_HANDLE PoolHandle,
3272 _In_ PVOID MemoryDescriptor,
3273 _In_ UINT Offset,
3274 _In_ UINT Length);
3275
3276 /*
3277 * VOID
3278 * NdisCopyLookaheadData(
3279 * IN PVOID Destination,
3280 * IN PVOID Source,
3281 * IN ULONG Length,
3282 * IN ULONG ReceiveFlags);
3283 */
3284
3285 #if defined(_M_IX86) || defined(_M_AMD64)
3286 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
3287 RtlCopyMemory(Destination, Source, Length)
3288 #else
3289 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
3290 { \
3291 if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
3292 { \
3293 RtlCopyMemory(Destination, Source, Length); \
3294 } \
3295 else \
3296 { \
3297 PUCHAR _Src = (PUCHAR)(Source); \
3298 PUCHAR _Dest = (PUCHAR)(Destination); \
3299 PUCHAR _End = _Dest + (Length); \
3300 while (_Dest < _End) \
3301 *_Dest++ = *_Src++; \
3302 } \
3303 }
3304 #endif
3305
3306 /*
3307 NDISAPI
3308 VOID
3309 NTAPI
3310 NdisAdjustBufferLength(
3311 IN PNDIS_BUFFER Buffer,
3312 IN UINT Length);
3313 */
3314 #define NdisAdjustBufferLength(Buffer, Length) \
3315 (((Buffer)->ByteCount) = (Length))
3316
3317 #if NDIS_SUPPORT_NDIS6
3318 #define NdisAdjustMdlLength(_Mdl, _Length) \
3319 (((_Mdl)->ByteCount) = (_Length))
3320 #endif
3321
3322 /*
3323 NDISAPI
3324 ULONG
3325 NTAPI
3326 NdisBufferLength(
3327 IN PNDIS_BUFFER Buffer);
3328 */
3329 #define NdisBufferLength MmGetMdlByteCount
3330
3331 /*
3332 NDISAPI
3333 PVOID
3334 NTAPI
3335 NdisBufferVirtualAddress(
3336 IN PNDIS_BUFFER Buffer);
3337 */
3338 #define NdisBufferVirtualAddress MmGetSystemAddressForMdl
3339
3340 #define NdisBufferVirtualAddressSafe MmGetSystemAddressForMdlSafe
3341
3342 NDISAPI
3343 ULONG
3344 NTAPI
3345 NDIS_BUFFER_TO_SPAN_PAGES(
3346 IN PNDIS_BUFFER Buffer);
3347
3348 /*
3349 NDISAPI
3350 VOID
3351 NTAPI
3352 NdisGetBufferPhysicalArraySize(
3353 IN PNDIS_BUFFER Buffer,
3354 OUT PUINT ArraySize);
3355 */
3356 #define NdisGetBufferPhysicalArraySize(Buffer, ArraySize) \
3357 (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer))
3358
3359 /*
3360 NDISAPI
3361 VOID
3362 NTAPI
3363 NdisQueryBufferOffset(
3364 IN PNDIS_BUFFER Buffer,
3365 OUT PUINT Offset,
3366 OUT PUINT Length);
3367 */
3368 #define NdisQueryBufferOffset(_Buffer, _Offset, _Length) { \
3369 *(_Offset) = MmGetMdlByteOffset(_Buffer); \
3370 *(_Length) = MmGetMdlByteCount(_Buffer); \
3371 }
3372
3373 /*
3374 * PVOID
3375 * NDIS_BUFFER_LINKAGE(
3376 * IN PNDIS_BUFFER Buffer);
3377 */
3378 #define NDIS_BUFFER_LINKAGE(Buffer) (Buffer)->Next
3379
3380 /*
3381 * VOID
3382 * NdisGetNextBuffer(
3383 * IN PNDIS_BUFFER CurrentBuffer,
3384 * OUT PNDIS_BUFFER * NextBuffer)
3385 */
3386 #define NdisGetNextBuffer(CurrentBuffer, \
3387 NextBuffer) \
3388 { \
3389 *(NextBuffer) = (CurrentBuffer)->Next; \
3390 }
3391
3392 #if NDIS_LEGACY_DRIVER
3393
3394 #define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head)
3395 #define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail)
3396 #define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts)
3397
3398 /*
3399 * UINT
3400 * NdisGetPacketFlags(
3401 * IN PNDIS_PACKET Packet);
3402 */
3403 #define NdisGetPacketFlags(Packet) (Packet)->Private.Flags
3404
3405 /*
3406 * ULONG
3407 * NDIS_GET_PACKET_PROTOCOL_TYPE(
3408 * IN PNDIS_PACKET Packet);
3409 */
3410 #define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
3411 ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
3412
3413 /*
3414 * PNDIS_PACKET_OOB_DATA
3415 * NDIS_OOB_DATA_FROM_PACKET(
3416 * IN PNDIS_PACKET Packet);
3417 */
3418 #define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
3419 (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3420 (_Packet)->Private.NdisPacketOobOffset)
3421
3422 /*
3423 * ULONG
3424 * NDIS_GET_PACKET_HEADER_SIZE(
3425 * IN PNDIS_PACKET Packet);
3426 */
3427 #define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
3428 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3429 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
3430
3431 /*
3432 * NDIS_STATUS
3433 * NDIS_GET_PACKET_STATUS(
3434 * IN PNDIS_PACKET Packet);
3435 */
3436 #define NDIS_GET_PACKET_STATUS(_Packet) \
3437 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3438 (_Packet)->Private.NdisPacketOobOffset))->Status
3439
3440 /*
3441 * ULONGLONG
3442 * NDIS_GET_PACKET_TIME_TO_SEND(
3443 * IN PNDIS_PACKET Packet);
3444 */
3445 #define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
3446 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3447 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
3448
3449 /*
3450 * ULONGLONG
3451 * NDIS_GET_PACKET_TIME_SENT(
3452 * IN PNDIS_PACKET Packet);
3453 */
3454 #define NDIS_GET_PACKET_TIME_SENT(_Packet) \
3455 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3456 (_Packet)->Private.NdisPacketOobOffset))->TimeSent
3457
3458 /*
3459 * ULONGLONG
3460 * NDIS_GET_PACKET_TIME_RECEIVED(
3461 * IN PNDIS_PACKET Packet);
3462 */
3463 #define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
3464 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3465 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
3466
3467 /*
3468 * VOID
3469 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
3470 * IN PNDIS_PACKET Packet,
3471 * IN PPVOID pMediaSpecificInfo,
3472 * IN PUINT pSizeMediaSpecificInfo);
3473 */
3474 #define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
3475 _pMediaSpecificInfo, \
3476 _pSizeMediaSpecificInfo) \
3477 { \
3478 if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
3479 !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
3480 { \
3481 *(_pMediaSpecificInfo) = NULL; \
3482 *(_pSizeMediaSpecificInfo) = 0; \
3483 } \
3484 else \
3485 { \
3486 *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3487 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
3488 *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3489 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
3490 } \
3491 }
3492
3493 /*
3494 * VOID
3495 * NDIS_SET_PACKET_HEADER_SIZE(
3496 * IN PNDIS_PACKET Packet,
3497 * IN UINT HdrSize);
3498 */
3499 #define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
3500 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3501 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
3502
3503 /*
3504 * VOID
3505 * NDIS_SET_PACKET_STATUS(
3506 * IN PNDIS_PACKET Packet,
3507 * IN NDIS_STATUS Status);
3508 */
3509 #define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
3510 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3511 (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
3512
3513 /*
3514 * VOID
3515 * NDIS_SET_PACKET_TIME_TO_SEND(
3516 * IN PNDIS_PACKET Packet,
3517 * IN ULONGLONG TimeToSend);
3518 */
3519 #define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
3520 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3521 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
3522
3523 /*
3524 * VOID
3525 * NDIS_SET_PACKET_TIME_SENT(
3526 * IN PNDIS_PACKET Packet,
3527 * IN ULONGLONG TimeSent);
3528 */
3529 #define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
3530 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3531 (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
3532
3533 /*
3534 * VOID
3535 * NDIS_SET_PACKET_TIME_RECEIVED(
3536 * IN PNDIS_PACKET Packet,
3537 * IN ULONGLONG TimeReceived);
3538 */
3539 #define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
3540 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3541 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
3542
3543 /*
3544 * VOID
3545 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
3546 * IN PNDIS_PACKET Packet,
3547 * IN PVOID MediaSpecificInfo,
3548 * IN UINT SizeMediaSpecificInfo);
3549 */
3550 #define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
3551 _MediaSpecificInfo, \
3552 _SizeMediaSpecificInfo) \
3553 { \
3554 if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
3555 { \
3556 (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
3557 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3558 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
3559 (_MediaSpecificInfo); \
3560 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3561 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
3562 (_SizeMediaSpecificInfo); \
3563 } \
3564 }
3565
3566 /*
3567 * VOID
3568 * NdisSetPacketFlags(
3569 * IN PNDIS_PACKET Packet,
3570 * IN UINT Flags);
3571 */
3572 #define NdisSetPacketFlags(Packet, Flags) (Packet)->Private.Flags |= (Flags)
3573
3574 /*
3575 * VOID
3576 * NdisClearPacketFlags(
3577 * IN PNDIS_PACKET Packet,
3578 * IN UINT Flags);
3579 */
3580 #define NdisClearPacketFlags(Packet, Flags) (Packet)->Private.Flags &= ~(Flags)
3581
3582 /*
3583 * VOID
3584 * NdisQueryPacket(
3585 * IN PNDIS_PACKET Packet,
3586 * OUT PUINT PhysicalBufferCount OPTIONAL,
3587 * OUT PUINT BufferCount OPTIONAL,
3588 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3589 * OUT PUINT TotalPacketLength OPTIONAL);
3590 */
3591 static __inline
3592 VOID
NdisQueryPacket(IN PNDIS_PACKET Packet,OUT PUINT PhysicalBufferCount OPTIONAL,OUT PUINT BufferCount OPTIONAL,OUT PNDIS_BUFFER * FirstBuffer OPTIONAL,OUT PUINT TotalPacketLength OPTIONAL)3593 NdisQueryPacket(
3594 IN PNDIS_PACKET Packet,
3595 OUT PUINT PhysicalBufferCount OPTIONAL,
3596 OUT PUINT BufferCount OPTIONAL,
3597 OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3598 OUT PUINT TotalPacketLength OPTIONAL)
3599 {
3600 if (FirstBuffer)
3601 *FirstBuffer = Packet->Private.Head;
3602 if (TotalPacketLength || BufferCount || PhysicalBufferCount) {
3603 if (!Packet->Private.ValidCounts) {
3604 UINT Offset;
3605 UINT PacketLength;
3606 PNDIS_BUFFER NdisBuffer;
3607 UINT _PhysicalBufferCount = 0;
3608 UINT _TotalPacketLength = 0;
3609 UINT Count = 0;
3610
3611 for (NdisBuffer = Packet->Private.Head;
3612 NdisBuffer != (PNDIS_BUFFER)NULL;
3613 NdisBuffer = NdisBuffer->Next) {
3614 _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
3615 NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
3616 _TotalPacketLength += PacketLength;
3617 Count++;
3618 }
3619 Packet->Private.PhysicalCount = _PhysicalBufferCount;
3620 Packet->Private.TotalLength = _TotalPacketLength;
3621 Packet->Private.Count = Count;
3622 Packet->Private.ValidCounts = TRUE;
3623 }
3624
3625 if (PhysicalBufferCount)
3626 *PhysicalBufferCount = Packet->Private.PhysicalCount;
3627
3628 if (BufferCount)
3629 *BufferCount = Packet->Private.Count;
3630
3631 if (TotalPacketLength)
3632 *TotalPacketLength = Packet->Private.TotalLength;
3633 }
3634 }
3635
3636 /*
3637 * VOID
3638 * NdisQueryPacketLength(
3639 * IN PNDIS_PACKET Packet,
3640 * OUT PUINT PhysicalBufferCount OPTIONAL,
3641 * OUT PUINT BufferCount OPTIONAL,
3642 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3643 * OUT PUINT TotalPacketLength OPTIONAL);
3644 */
3645 #define NdisQueryPacketLength(_Packet, \
3646 _TotalPacketLength) \
3647 { \
3648 if (!(_Packet)->Private.ValidCounts) { \
3649 NdisQueryPacket(_Packet, NULL, NULL, NULL, _TotalPacketLength); \
3650 } \
3651 else *(_TotalPacketLength) = (_Packet)->Private.TotalLength; \
3652 }
3653
3654 #endif /* NDIS_LEGACY_DRIVER */
3655
3656 /* Memory management routines */
3657
3658 /*
3659 NDISAPI
3660 VOID
3661 NTAPI
3662 NdisCreateLookaheadBufferFromSharedMemory(
3663 IN PVOID pSharedMemory,
3664 IN UINT LookaheadLength,
3665 OUT PVOID *pLookaheadBuffer);
3666 */
3667 #define NdisCreateLookaheadBufferFromSharedMemory(_S, _L, _B) ((*(_B)) = (_S))
3668
3669 NDISAPI
3670 VOID
3671 NTAPI
3672 NdisDestroyLookaheadBufferFromSharedMemory(
3673 IN PVOID pLookaheadBuffer);
3674
3675 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
3676
3677 /*
3678 * VOID
3679 * NdisMoveMappedMemory(
3680 * OUT PVOID Destination,
3681 * IN PVOID Source,
3682 * IN ULONG Length);
3683 */
3684 #define NdisMoveMappedMemory(Destination, Source, Length) \
3685 RtlCopyMemory(Destination, Source, Length)
3686
3687 /*
3688 * VOID
3689 * NdisZeroMappedMemory(
3690 * IN PVOID Destination,
3691 * IN ULONG Length);
3692 */
3693 #define NdisZeroMappedMemory(Destination, Length) \
3694 RtlZeroMemory(Destination, Length)
3695
3696 #else
3697
3698 #define NdisMoveMappedMemory(Destination, Source, Length) \
3699 { \
3700 PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
3701 while (_Dest < _End) \
3702 *_Dest++ = _Src++; \
3703 }
3704
3705 #define NdisZeroMappedMemory(Destination, Length) \
3706 { \
3707 PUCHAR _Dest = Destination, _End = _Dest + Length; \
3708 while (_Dest < _End) \
3709 *_Dest++ = 0; \
3710 }
3711
3712 #endif /* _M_IX86 or _M_AMD64 */
3713
3714 /*
3715 * VOID
3716 * NdisMoveFromMappedMemory(
3717 * OUT PVOID Destination,
3718 * IN PVOID Source,
3719 * IN ULONG Length);
3720 */
3721 #define NdisMoveFromMappedMemory(Destination, Source, Length) \
3722 NdisMoveMappedMemory(Destination, Source, Length)
3723
3724 /*
3725 * VOID
3726 * NdisMoveToMappedMemory(
3727 * OUT PVOID Destination,
3728 * IN PVOID Source,
3729 * IN ULONG Length);
3730 */
3731 #define NdisMoveToMappedMemory(Destination, Source, Length) \
3732 NdisMoveMappedMemory(Destination, Source, Length)
3733
3734 /*
3735 * VOID
3736 * NdisMUpdateSharedMemory(
3737 * IN NDIS_HANDLE MiniportAdapterHandle,
3738 * IN ULONG Length,
3739 * IN PVOID VirtualAddress,
3740 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3741 */
3742 #define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
3743 NdisUpdateSharedMemory(_H, _L, _V, _P)
3744
3745 _When_(MemoryFlags==0, _IRQL_requires_max_(DISPATCH_LEVEL))
3746 _When_(MemoryFlags==NDIS_MEMORY_CONTIGUOUS, _IRQL_requires_(PASSIVE_LEVEL))
3747 _When_(MemoryFlags==NDIS_MEMORY_NONCACHED, _IRQL_requires_max_(APC_LEVEL))
3748 NDISAPI
3749 VOID
3750 NTAPI
3751 NdisFreeMemory(
3752 _In_reads_bytes_(Length) __drv_freesMem(Mem) PVOID VirtualAddress,
3753 _In_ UINT Length,
3754 _In_ _Pre_satisfies_(MemoryFlags == 0 || MemoryFlags == NDIS_MEMORY_NONCACHED || MemoryFlags == NDIS_MEMORY_CONTIGUOUS)
3755 UINT MemoryFlags);
3756
3757 NDISAPI
3758 VOID
3759 NTAPI
3760 NdisFreeMemoryWithTag(
3761 IN PVOID VirtualAddress,
3762 IN ULONG Tag);
3763
3764 NDISAPI
3765 VOID
3766 NTAPI
3767 NdisImmediateReadSharedMemory(
3768 IN NDIS_HANDLE WrapperConfigurationContext,
3769 IN ULONG SharedMemoryAddress,
3770 OUT PUCHAR Buffer,
3771 IN ULONG Length);
3772
3773 NDISAPI
3774 VOID
3775 NTAPI
3776 NdisImmediateWriteSharedMemory(
3777 IN NDIS_HANDLE WrapperConfigurationContext,
3778 IN ULONG SharedMemoryAddress,
3779 IN PUCHAR Buffer,
3780 IN ULONG Length);
3781
3782 _IRQL_requires_(PASSIVE_LEVEL)
3783 NDISAPI
3784 VOID
3785 NTAPI
3786 NdisMAllocateSharedMemory(
3787 _In_ NDIS_HANDLE MiniportAdapterHandle,
3788 _In_ ULONG Length,
3789 _In_ BOOLEAN Cached,
3790 _Outptr_result_bytebuffer_(Length) _At_(*VirtualAddress, _Must_inspect_result_)
3791 PVOID *VirtualAddress,
3792 _Out_ _At_(*PhysicalAddress, _Must_inspect_result_)
3793 PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
3794
3795 _IRQL_requires_max_(DISPATCH_LEVEL)
3796 NDISAPI
3797 NDIS_STATUS
3798 NTAPI
3799 NdisMAllocateSharedMemoryAsync(
3800 _In_ NDIS_HANDLE MiniportAdapterHandle,
3801 _In_ ULONG Length,
3802 _In_ BOOLEAN Cached,
3803 _In_ PVOID Context);
3804
3805 #if defined(NDIS50)
3806
3807 #define NdisUpdateSharedMemory(NdisAdapterHandle, \
3808 Length, \
3809 VirtualAddress, \
3810 PhysicalAddress)
3811
3812 #else
3813
3814 NDISAPI
3815 VOID
3816 NTAPI
3817 NdisUpdateSharedMemory(
3818 IN NDIS_HANDLE NdisAdapterHandle,
3819 IN ULONG Length,
3820 IN PVOID VirtualAddress,
3821 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3822
3823 #endif /* defined(NDIS50) */
3824
3825 /*
3826 * ULONG
3827 * NdisGetPhysicalAddressHigh(
3828 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3829 */
3830 #define NdisGetPhysicalAddressHigh(PhysicalAddress) \
3831 ((PhysicalAddress).HighPart)
3832
3833 /*
3834 * VOID
3835 * NdisSetPhysicalAddressHigh(
3836 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
3837 * IN ULONG Value);
3838 */
3839 #define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
3840 ((PhysicalAddress).HighPart) = (Value)
3841
3842 /*
3843 * ULONG
3844 * NdisGetPhysicalAddressLow(
3845 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3846 */
3847 #define NdisGetPhysicalAddressLow(PhysicalAddress) \
3848 ((PhysicalAddress).LowPart)
3849
3850
3851 /*
3852 * VOID
3853 * NdisSetPhysicalAddressLow(
3854 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
3855 * IN ULONG Value);
3856 */
3857 #define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
3858 ((PhysicalAddress).LowPart) = (Value)
3859
3860 /*
3861 * VOID
3862 * NDIS_PHYSICAL_ADDRESS_CONST(
3863 * IN ULONG Low,
3864 * IN LONG High);
3865 */
3866 #define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
3867 { {(ULONG)(Low), (LONG)(High)} }
3868
3869 /*
3870 * ULONG
3871 * NdisEqualMemory(
3872 * IN CONST VOID *Source1,
3873 * IN CONST VOID *Source2,
3874 * IN ULONG Length);
3875 */
3876 #define NdisEqualMemory(Source1, Source2, Length) \
3877 RtlEqualMemory(Source1, Source2, Length)
3878
3879 /*
3880 * VOID
3881 * NdisFillMemory(
3882 * IN PVOID Destination,
3883 * IN ULONG Length,
3884 * IN UCHAR Fill);
3885 */
3886 #define NdisFillMemory(Destination, Length, Fill) \
3887 RtlFillMemory(Destination, Length, Fill)
3888
3889 /*
3890 * VOID
3891 * NdisMoveMemory(
3892 * OUT PVOID Destination,
3893 * IN PVOID Source,
3894 * IN ULONG Length);
3895 */
3896 #define NdisMoveMemory(Destination, Source, Length) \
3897 RtlCopyMemory(Destination, Source, Length)
3898
3899
3900 /*
3901 * VOID
3902 * NdisRetrieveUlong(
3903 * IN PULONG DestinationAddress,
3904 * IN PULONG SourceAddress);
3905 */
3906 #define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
3907 RtlRetrieveUlong(DestinationAddress, SourceAddress)
3908
3909
3910 /*
3911 * VOID
3912 * NdisStoreUlong(
3913 * IN PULONG DestinationAddress,
3914 * IN ULONG Value);
3915 */
3916 #define NdisStoreUlong(DestinationAddress, Value) \
3917 RtlStoreUlong(DestinationAddress, Value)
3918
3919
3920 /*
3921 * VOID
3922 * NdisZeroMemory(
3923 * IN PVOID Destination,
3924 * IN ULONG Length)
3925 */
3926 #define NdisZeroMemory(Destination, Length) \
3927 RtlZeroMemory(Destination, Length)
3928
3929 typedef VOID
3930 (NTAPI *NDIS_BLOCK_INITIALIZER) (
3931 IN PUCHAR Block,
3932 IN SIZE_T NumberOfBytes
3933 );
3934
3935 /* Configuration routines */
3936
3937 #if NDIS_LEGACY_DRIVER
3938 _IRQL_requires_(PASSIVE_LEVEL)
3939 _Success_(*Status >= 0)
3940 NDISAPI
3941 VOID
3942 NTAPI
3943 NdisOpenConfiguration(
3944 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
3945 _Out_ PNDIS_HANDLE ConfigurationHandle,
3946 _In_ NDIS_HANDLE WrapperConfigurationContext);
3947 #endif
3948
3949 _IRQL_requires_(PASSIVE_LEVEL)
3950 _Success_(*Status >= 0)
3951 NDISAPI
3952 VOID
3953 NTAPI
3954 NdisReadNetworkAddress(
3955 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
3956 _Outptr_result_bytebuffer_to_(*NetworkAddressLength, *NetworkAddressLength)
3957 PVOID *NetworkAddress,
3958 _Out_ PUINT NetworkAddressLength,
3959 _In_ NDIS_HANDLE ConfigurationHandle);
3960
3961 NDISAPI
3962 VOID
3963 NTAPI
3964 NdisReadEisaSlotInformation(
3965 OUT PNDIS_STATUS Status,
3966 IN NDIS_HANDLE WrapperConfigurationContext,
3967 OUT PUINT SlotNumber,
3968 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData);
3969
3970 NDISAPI
3971 VOID
3972 NTAPI
3973 NdisReadEisaSlotInformationEx(
3974 OUT PNDIS_STATUS Status,
3975 IN NDIS_HANDLE WrapperConfigurationContext,
3976 OUT PUINT SlotNumber,
3977 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
3978 OUT PUINT NumberOfFunctions);
3979
3980 #if NDIS_LEGACY_MINIPORT
3981
3982 _IRQL_requires_max_(DISPATCH_LEVEL)
3983 NDISAPI
3984 ULONG
3985 NTAPI
3986 NdisReadPciSlotInformation(
3987 _In_ NDIS_HANDLE NdisAdapterHandle,
3988 _In_ ULONG SlotNumber,
3989 _In_ ULONG Offset,
3990 _Out_writes_bytes_(Length) PVOID Buffer,
3991 _In_ ULONG Length);
3992
3993 _IRQL_requires_max_(DISPATCH_LEVEL)
3994 NDISAPI
3995 ULONG
3996 NTAPI
3997 NdisWritePciSlotInformation(
3998 _In_ NDIS_HANDLE NdisAdapterHandle,
3999 _In_ ULONG SlotNumber,
4000 _In_ ULONG Offset,
4001 _In_reads_bytes_(Length) PVOID Buffer,
4002 _In_ ULONG Length);
4003
4004 _IRQL_requires_max_(DISPATCH_LEVEL)
4005 NDISAPI
4006 ULONG
4007 NTAPI
4008 NdisReadPcmciaAttributeMemory(
4009 _In_ NDIS_HANDLE NdisAdapterHandle,
4010 _In_ ULONG Offset,
4011 _Out_writes_bytes_(Length) PVOID Buffer,
4012 _In_ ULONG Length);
4013
4014 _IRQL_requires_max_(DISPATCH_LEVEL)
4015 NDISAPI
4016 ULONG
4017 NTAPI
4018 NdisWritePcmciaAttributeMemory(
4019 _In_ NDIS_HANDLE NdisAdapterHandle,
4020 _In_ ULONG Offset,
4021 _In_reads_bytes_(Length) PVOID Buffer,
4022 _In_ ULONG Length);
4023
4024 #endif /* NDIS_LEGACY_MINIPORT */
4025
4026 /* String management routines */
4027
4028 /*
4029 NDISAPI
4030 NDIS_STATUS
4031 NTAPI
4032 NdisAnsiStringToUnicodeString(
4033 IN OUT PNDIS_STRING DestinationString,
4034 IN PNDIS_ANSI_STRING SourceString);
4035 */
4036 #define NdisAnsiStringToUnicodeString(_us, _as) RtlAnsiStringToUnicodeString(_us, _as, FALSE)
4037
4038 /*
4039 * BOOLEAN
4040 * NdisEqualString(
4041 * IN PNDIS_STRING String1,
4042 * IN PNDIS_STRING String2,
4043 * IN BOOLEAN CaseInsensitive);
4044 */
4045 #define NdisEqualString RtlEqualString
4046
4047 #define NdisEqualUnicodeString RtlEqualUnicodeString
4048
4049 /*
4050 NDISAPI
4051 VOID
4052 NTAPI
4053 NdisInitAnsiString(
4054 IN OUT PNDIS_ANSI_STRING DestinationString,
4055 IN PCSTR SourceString);
4056 */
4057 #define NdisInitAnsiString RtlInitString
4058
4059 NDISAPI
4060 VOID
4061 NTAPI
4062 NdisInitUnicodeString(
4063 IN OUT PNDIS_STRING DestinationString,
4064 IN PCWSTR SourceString);
4065
4066 /*
4067 NDISAPI
4068 NDIS_STATUS
4069 NTAPI
4070 NdisUnicodeStringToAnsiString(
4071 IN OUT PNDIS_ANSI_STRING DestinationString,
4072 IN PNDIS_STRING SourceString);
4073 */
4074 #define NdisUnicodeStringToAnsiString(_as, _us) RtlUnicodeStringToAnsiString(_as, _us, FALSE)
4075
4076 #define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
4077 #define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
4078
4079 /* Spin lock reoutines */
4080
4081 /*
4082 NDISAPI
4083 VOID
4084 NTAPI
4085 NdisAllocateSpinLock(
4086 IN PNDIS_SPIN_LOCK SpinLock);
4087 */
4088 #define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock)
4089
4090 /*
4091 NDISAPI
4092 VOID
4093 NTAPI
4094 NdisFreeSpinLock(
4095 IN PNDIS_SPIN_LOCK SpinLock);
4096 */
4097 #define NdisFreeSpinLock(_SpinLock)
4098
4099 /*
4100 NDISAPI
4101 VOID
4102 NTAPI
4103 NdisAcquireSpinLock(
4104 IN PNDIS_SPIN_LOCK SpinLock);
4105 */
4106 #define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
4107
4108 /*
4109 NDISAPI
4110 VOID
4111 NTAPI
4112 NdisReleaseSpinLock(
4113 IN PNDIS_SPIN_LOCK SpinLock);
4114 */
4115 #define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql)
4116
4117 /*
4118 NDISAPI
4119 VOID
4120 NTAPI
4121 NdisDprAcquireSpinLock(
4122 IN PNDIS_SPIN_LOCK SpinLock);
4123 */
4124 #define NdisDprAcquireSpinLock(_SpinLock) KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock)
4125
4126 /*
4127 NDISAPI
4128 VOID
4129 NTAPI
4130 NdisDprReleaseSpinLock(
4131 IN PNDIS_SPIN_LOCK SpinLock);
4132 */
4133 #define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
4134
4135 /* I/O routines */
4136
4137 /*
4138 * VOID
4139 * NdisRawReadPortBufferUchar(
4140 * IN ULONG Port,
4141 * OUT PUCHAR Buffer,
4142 * IN ULONG Length);
4143 */
4144 #define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
4145 READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
4146
4147 /*
4148 * VOID
4149 * NdisRawReadPortBufferUlong(
4150 * IN ULONG Port,
4151 * OUT PULONG Buffer,
4152 * IN ULONG Length);
4153 */
4154 #define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
4155 READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
4156
4157 /*
4158 * VOID
4159 * NdisRawReadPortBufferUshort(
4160 * IN ULONG Port,
4161 * OUT PUSHORT Buffer,
4162 * IN ULONG Length);
4163 */
4164 #define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
4165 READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
4166
4167 /*
4168 * VOID
4169 * NdisRawReadPortUchar(
4170 * IN ULONG Port,
4171 * OUT PUCHAR Data);
4172 */
4173 #define NdisRawReadPortUchar(Port, Data) \
4174 *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
4175
4176 /*
4177 * VOID
4178 * NdisRawReadPortUlong(
4179 * IN ULONG Port,
4180 * OUT PULONG Data);
4181 */
4182 #define NdisRawReadPortUlong(Port, Data) \
4183 *(Data) = READ_PORT_ULONG((PULONG)(Port))
4184
4185 /*
4186 * VOID
4187 * NdisRawReadPortUshort(
4188 * IN ULONG Port,
4189 * OUT PUSHORT Data);
4190 */
4191 #define NdisRawReadPortUshort(Port, Data) \
4192 *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
4193
4194 /*
4195 * VOID
4196 * NdisRawWritePortBufferUchar(
4197 * IN ULONG Port,
4198 * IN PUCHAR Buffer,
4199 * IN ULONG Length);
4200 */
4201 #define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
4202 WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
4203
4204 /*
4205 * VOID
4206 * NdisRawWritePortBufferUlong(
4207 * IN ULONG Port,
4208 * IN PULONG Buffer,
4209 * IN ULONG Length);
4210 */
4211 #define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
4212 WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
4213
4214 /*
4215 * VOID
4216 * NdisRawWritePortBufferUshort(
4217 * IN ULONG Port,
4218 * IN PUSHORT Buffer,
4219 * IN ULONG Length);
4220 */
4221 #define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
4222 WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
4223
4224 /*
4225 * VOID
4226 * NdisRawWritePortUchar(
4227 * IN ULONG Port,
4228 * IN UCHAR Data);
4229 */
4230 #define NdisRawWritePortUchar(Port, Data) \
4231 WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
4232
4233 /*
4234 * VOID
4235 * NdisRawWritePortUlong(
4236 * IN ULONG Port,
4237 * IN ULONG Data);
4238 */
4239 #define NdisRawWritePortUlong(Port, Data) \
4240 WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
4241
4242 /*
4243 * VOID
4244 * NdisRawWritePortUshort(
4245 * IN ULONG Port,
4246 * IN USHORT Data);
4247 */
4248 #define NdisRawWritePortUshort(Port, Data) \
4249 WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
4250
4251
4252 /*
4253 * VOID
4254 * NdisReadRegisterUchar(
4255 * IN PUCHAR Register,
4256 * OUT PUCHAR Data);
4257 */
4258 #define NdisReadRegisterUchar(Register, Data) \
4259 *(Data) = *((volatile UCHAR * const) (Register))
4260
4261 /*
4262 * VOID
4263 * NdisReadRegisterUlong(
4264 * IN PULONG Register,
4265 * OUT PULONG Data);
4266 */
4267 #define NdisReadRegisterUlong(Register, Data) \
4268 *(Data) = *((volatile ULONG * const) (Register))
4269
4270 /*
4271 * VOID
4272 * NdisReadRegisterUshort(
4273 * IN PUSHORT Register,
4274 * OUT PUSHORT Data);
4275 */
4276 #define NdisReadRegisterUshort(Register, Data) \
4277 *(Data) = *((volatile USHORT * const) (Register))
4278
4279 /*
4280 * VOID
4281 * NdisReadRegisterUchar(
4282 * IN PUCHAR Register,
4283 * IN UCHAR Data);
4284 */
4285 #define NdisWriteRegisterUchar(Register, Data) \
4286 WRITE_REGISTER_UCHAR((Register), (Data))
4287
4288 /*
4289 * VOID
4290 * NdisReadRegisterUlong(
4291 * IN PULONG Register,
4292 * IN ULONG Data);
4293 */
4294 #define NdisWriteRegisterUlong(Register, Data) \
4295 WRITE_REGISTER_ULONG((Register), (Data))
4296
4297 /*
4298 * VOID
4299 * NdisReadRegisterUshort(
4300 * IN PUSHORT Register,
4301 * IN USHORT Data);
4302 */
4303 #define NdisWriteRegisterUshort(Register, Data) \
4304 WRITE_REGISTER_USHORT((Register), (Data))
4305
4306
4307 /* Linked lists */
4308
4309 /*
4310 * VOID
4311 * NdisInitializeListHead(
4312 * IN PLIST_ENTRY ListHead);
4313 */
4314 #define NdisInitializeListHead InitializeListHead
4315
4316 /*
4317 * PLIST_ENTRY
4318 * NdisInterlockedInsertHeadList(
4319 * IN PLIST_ENTRY ListHead,
4320 * IN PLIST_ENTRY ListEntry,
4321 * IN PNDIS_SPIN_LOCK SpinLock);
4322 */
4323 #define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
4324 ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
4325
4326 /*
4327 * PLIST_ENTRY
4328 * NdisInterlockedInsertTailList(
4329 * IN PLIST_ENTRY ListHead,
4330 * IN PLIST_ENTRY ListEntry,
4331 * IN PNDIS_SPIN_LOCK SpinLock);
4332 */
4333 #define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
4334 ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
4335
4336 /*
4337 * PLIST_ENTRY
4338 * NdisInterlockedRemoveHeadList(
4339 * IN PLIST_ENTRY ListHead,
4340 * IN PNDIS_SPIN_LOCK SpinLock);
4341 */
4342 #define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
4343 ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
4344
4345 /*
4346 * VOID
4347 * NdisInitializeSListHead(
4348 * IN PSLIST_HEADER SListHead);
4349 */
4350 #define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
4351
4352 /*
4353 * USHORT NdisQueryDepthSList(
4354 * IN PSLIST_HEADER SListHead);
4355 */
4356 #define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
4357
4358 #define NdisInterlockedPushEntryList(ListHead, ListEntry, Lock) \
4359 ExInterlockedPushEntryList(ListHead, ListEntry, &(Lock)->SpinLock)
4360
4361 #define NdisInterlockedPopEntryList(ListHead, Lock) \
4362 ExInterlockedPopEntryList(ListHead, &(Lock)->SpinLock)
4363
4364 /* Non-paged lookaside lists */
4365
4366 #define NdisInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D) \
4367 ExInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D)
4368 #define NdisDeleteNPagedLookasideList(_L) ExDeleteNPagedLookasideList(_L)
4369 #define NdisAllocateFromNPagedLookasideList(_L) ExAllocateFromNPagedLookasideList(_L)
4370 #define NdisFreeToNPagedLookasideList(_L, _E) ExFreeToNPagedLookasideList(_L, _E)
4371
4372 /* Interlocked routines */
4373
4374 /*
4375 * LONG
4376 * NdisInterlockedDecrement(
4377 * IN PLONG Addend);
4378 */
4379 #define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
4380
4381 /*
4382 * LONG
4383 * NdisInterlockedIncrement(
4384 * IN PLONG Addend);
4385 */
4386 #define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
4387
4388 /*
4389 * VOID
4390 * NdisInterlockedAddUlong(
4391 * IN PULONG Addend,
4392 * IN ULONG Increment,
4393 * IN PNDIS_SPIN_LOCK SpinLock);
4394 */
4395 #define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
4396 ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
4397
4398 /* Miscellaneous routines */
4399
4400 _IRQL_requires_(PASSIVE_LEVEL)
4401 NDISAPI
4402 VOID
4403 NTAPI
4404 NdisCloseConfiguration(
4405 _In_ __drv_freesMem(mem) NDIS_HANDLE ConfigurationHandle);
4406
4407 _IRQL_requires_(PASSIVE_LEVEL)
4408 _Success_(*Status >= 0)
4409 NDISAPI
4410 VOID
4411 NTAPI
4412 NdisReadConfiguration(
4413 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
4414 _Out_ PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
4415 _In_ NDIS_HANDLE ConfigurationHandle,
4416 _In_ PNDIS_STRING Keyword,
4417 _In_ NDIS_PARAMETER_TYPE ParameterType);
4418
4419 _IRQL_requires_(PASSIVE_LEVEL)
4420 _Success_(*Status >= 0)
4421 NDISAPI
4422 VOID
4423 NTAPI
4424 NdisWriteConfiguration(
4425 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
4426 _In_ NDIS_HANDLE WrapperConfigurationContext,
4427 _In_ PNDIS_STRING Keyword,
4428 _In_ PNDIS_CONFIGURATION_PARAMETER ParameterValue);
4429
4430 _IRQL_requires_max_(DISPATCH_LEVEL)
4431 NDISAPI
4432 VOID
4433 __cdecl
4434 NdisWriteErrorLogEntry(
4435 _In_ NDIS_HANDLE NdisAdapterHandle,
4436 _In_ NDIS_ERROR_CODE ErrorCode,
4437 _In_ ULONG NumberOfErrorValues,
4438 ...);
4439
4440 _IRQL_requires_(PASSIVE_LEVEL)
4441 NDISAPI
4442 VOID
4443 NTAPI
4444 NdisInitializeString(
4445 _Out_ _At_(Destination->Buffer, __drv_allocatesMem(Mem)) PNDIS_STRING Destination,
4446 _In_opt_z_ PUCHAR Source);
4447
4448 /*
4449 * VOID
4450 * NdisStallExecution(
4451 * IN UINT MicrosecondsToStall)
4452 */
4453 #define NdisStallExecution KeStallExecutionProcessor
4454
4455 /*
4456 NDISAPI
4457 VOID
4458 NTAPI
4459 NdisGetCurrentSystemTime(
4460 IN PLARGE_INTEGER pSystemTime);
4461 */
4462 #define NdisGetCurrentSystemTime KeQuerySystemTime
4463
4464 #if NDIS_SUPPORT_60_COMPATIBLE_API
4465 _IRQL_requires_(PASSIVE_LEVEL)
4466 NDISAPI
4467 CCHAR
4468 NTAPI
4469 NdisSystemProcessorCount(VOID);
4470 #endif
4471
4472 NDISAPI
4473 VOID
4474 NTAPI
4475 NdisGetCurrentProcessorCpuUsage(
4476 OUT PULONG pCpuUsage);
4477
4478 /* NDIS helper macros */
4479
4480 /*
4481 * VOID
4482 * NDIS_INIT_FUNCTION(FunctionName)
4483 */
4484 #define NDIS_INIT_FUNCTION(FunctionName) \
4485 alloc_text(INIT, FunctionName)
4486
4487 /*
4488 * VOID
4489 * NDIS_PAGABLE_FUNCTION(FunctionName)
4490 */
4491 #define NDIS_PAGEABLE_FUNCTION(FunctionName) \
4492 alloc_text(PAGE, FunctionName)
4493
4494 #define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
4495
4496
4497 /* NDIS 4.0 extensions */
4498
4499 _IRQL_requires_max_(DISPATCH_LEVEL)
4500 NDISAPI
4501 VOID
4502 NTAPI
4503 NdisMFreeSharedMemory(
4504 _In_ NDIS_HANDLE MiniportAdapterHandle,
4505 _In_ ULONG Length,
4506 _In_ BOOLEAN Cached,
4507 _In_reads_bytes_(Length) PVOID VirtualAddress,
4508 _In_ NDIS_PHYSICAL_ADDRESS PhysicalAddress);
4509
4510 NDISAPI
4511 VOID
4512 NTAPI
4513 NdisMWanIndicateReceive(
4514 OUT PNDIS_STATUS Status,
4515 IN NDIS_HANDLE MiniportAdapterHandle,
4516 IN NDIS_HANDLE NdisLinkContext,
4517 IN PUCHAR PacketBuffer,
4518 IN UINT PacketSize);
4519
4520 NDISAPI
4521 VOID
4522 NTAPI
4523 NdisMWanIndicateReceiveComplete(
4524 IN NDIS_HANDLE MiniportAdapterHandle,
4525 IN NDIS_HANDLE NdisLinkContext);
4526
4527 NDISAPI
4528 VOID
4529 NTAPI
4530 NdisMWanSendComplete(
4531 IN NDIS_HANDLE MiniportAdapterHandle,
4532 IN PNDIS_WAN_PACKET Packet,
4533 IN NDIS_STATUS Status);
4534
4535 NDISAPI
4536 NDIS_STATUS
4537 NTAPI
4538 NdisPciAssignResources(
4539 IN NDIS_HANDLE NdisMacHandle,
4540 IN NDIS_HANDLE NdisWrapperHandle,
4541 IN NDIS_HANDLE WrapperConfigurationContext,
4542 IN ULONG SlotNumber,
4543 OUT PNDIS_RESOURCE_LIST *AssignedResources);
4544
4545
4546 /* NDIS 5.0 extensions */
4547
4548 _IRQL_requires_max_(DISPATCH_LEVEL)
4549 NDISAPI
4550 NDIS_STATUS
4551 NTAPI
4552 NdisAllocateMemoryWithTag(
4553 _At_(*VirtualAddress, __drv_allocatesMem(Mem)) _Outptr_result_bytebuffer_(Length)
4554 PVOID *VirtualAddress,
4555 _In_ UINT Length,
4556 _In_ ULONG Tag);
4557
4558 _IRQL_requires_max_(DISPATCH_LEVEL)
4559 NDISAPI
4560 VOID
4561 NTAPI
4562 NdisGetCurrentProcessorCounts(
4563 _Out_ PULONG pIdleCount,
4564 _Out_ PULONG pKernelAndUser,
4565 _Out_ PULONG pIndex);
4566
4567 #if NDIS_LEGACY_DRIVER
4568 NDISAPI
4569 VOID
4570 NTAPI
4571 NdisGetSystemUpTime(
4572 OUT PULONG pSystemUpTime);
4573 #endif
4574
4575 #if NDIS_SUPPORT_60_COMPATIBLE_API
4576
4577 _IRQL_requires_max_(DISPATCH_LEVEL)
4578 _IRQL_raises_(DISPATCH_LEVEL)
4579 _When_(fWrite, _Acquires_exclusive_lock_(*Lock))
4580 _When_(!fWrite, _Acquires_shared_lock_(*Lock))
4581 NDISAPI
4582 VOID
4583 NTAPI
4584 NdisAcquireReadWriteLock(
4585 _Inout_ PNDIS_RW_LOCK Lock,
4586 _In_ BOOLEAN fWrite,
4587 _Out_ _IRQL_saves_ PLOCK_STATE LockState);
4588
4589 _IRQL_requires_max_(DISPATCH_LEVEL)
4590 NDISAPI
4591 VOID
4592 NTAPI
4593 NdisInitializeReadWriteLock(
4594 _Out_ PNDIS_RW_LOCK Lock);
4595
4596 _IRQL_requires_(DISPATCH_LEVEL)
4597 _Requires_lock_held_(*Lock)
4598 _Releases_lock_(*Lock)
4599 NDISAPI
4600 VOID
4601 NTAPI
4602 NdisReleaseReadWriteLock(
4603 _Inout_ PNDIS_RW_LOCK Lock,
4604 _In_ _IRQL_restores_ PLOCK_STATE LockState);
4605
4606 #if NDIS_SUPPORT_NDIS6
4607
4608 NDISAPI
4609 VOID
4610 NTAPI
4611 NdisDprAcquireReadWriteLock(
4612 IN PNDIS_RW_LOCK Lock,
4613 IN BOOLEAN fWrite,
4614 IN PLOCK_STATE LockState);
4615
4616 NDISAPI
4617 VOID
4618 NTAPI
4619 NdisDprReleaseReadWriteLock(
4620 IN PNDIS_RW_LOCK Lock,
4621 IN PLOCK_STATE LockState);
4622
4623 #endif /* NDIS_SUPPORT_NDIS6 */
4624
4625 #endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
4626
4627 _IRQL_requires_(PASSIVE_LEVEL)
4628 NDISAPI
4629 NDIS_STATUS
4630 NTAPI
4631 NdisMDeregisterDevice(
4632 _In_ NDIS_HANDLE NdisDeviceHandle);
4633
4634 _IRQL_requires_(PASSIVE_LEVEL)
4635 NDISAPI
4636 VOID
4637 NTAPI
4638 NdisMGetDeviceProperty(
4639 _In_ NDIS_HANDLE MiniportAdapterHandle,
4640 _Inout_opt_ PDEVICE_OBJECT *PhysicalDeviceObject,
4641 _Inout_opt_ PDEVICE_OBJECT *FunctionalDeviceObject,
4642 _Inout_opt_ PDEVICE_OBJECT *NextDeviceObject,
4643 _Inout_opt_ PCM_RESOURCE_LIST *AllocatedResources,
4644 _Inout_opt_ PCM_RESOURCE_LIST *AllocatedResourcesTranslated);
4645
4646 _IRQL_requires_(PASSIVE_LEVEL)
4647 NDISAPI
4648 NDIS_STATUS
4649 NTAPI
4650 NdisMInitializeScatterGatherDma(
4651 _In_ NDIS_HANDLE MiniportAdapterHandle,
4652 _In_ BOOLEAN Dma64BitAddresses,
4653 _In_ ULONG MaximumPhysicalMapping);
4654
4655 _IRQL_requires_max_(DISPATCH_LEVEL)
4656 NDISAPI
4657 NDIS_STATUS
4658 NTAPI
4659 NdisMPromoteMiniport(
4660 _In_ NDIS_HANDLE MiniportAdapterHandle);
4661
4662 _IRQL_requires_(PASSIVE_LEVEL)
4663 NDISAPI
4664 NDIS_STATUS
4665 NTAPI
4666 NdisMQueryAdapterInstanceName(
4667 _Out_ PNDIS_STRING AdapterInstanceName,
4668 _In_ NDIS_HANDLE MiniportAdapterHandle);
4669
4670 _IRQL_requires_(PASSIVE_LEVEL)
4671 NDISAPI
4672 NDIS_STATUS
4673 NTAPI
4674 NdisMRegisterDevice(
4675 _In_ NDIS_HANDLE NdisWrapperHandle,
4676 _In_ PNDIS_STRING DeviceName,
4677 _In_ PNDIS_STRING SymbolicName,
4678 _In_reads_(IRP_MJ_PNP) PDRIVER_DISPATCH *MajorFunctions,
4679 _Out_ PDEVICE_OBJECT *pDeviceObject,
4680 _Out_ NDIS_HANDLE *NdisDeviceHandle);
4681
4682 _IRQL_requires_(PASSIVE_LEVEL)
4683 NDISAPI
4684 VOID
4685 NTAPI
4686 NdisMRegisterUnloadHandler(
4687 _In_ NDIS_HANDLE NdisWrapperHandle,
4688 _In_ PDRIVER_UNLOAD UnloadHandler);
4689
4690 _IRQL_requires_max_(DISPATCH_LEVEL)
4691 NDISAPI
4692 NDIS_STATUS
4693 NTAPI
4694 NdisMRemoveMiniport(
4695 _In_ NDIS_HANDLE MiniportAdapterHandle);
4696
4697 _IRQL_requires_(PASSIVE_LEVEL)
4698 NDISAPI
4699 NDIS_STATUS
4700 NTAPI
4701 NdisMSetMiniportSecondary(
4702 _In_ NDIS_HANDLE MiniportAdapterHandle,
4703 _In_ NDIS_HANDLE PrimaryMiniportAdapterHandle);
4704
4705 _IRQL_requires_max_(APC_LEVEL)
4706 _Success_(*Status >= 0)
4707 NDISAPI
4708 VOID
4709 NTAPI
4710 NdisOpenConfigurationKeyByIndex(
4711 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
4712 _In_ NDIS_HANDLE ConfigurationHandle,
4713 _In_ ULONG Index,
4714 _Out_ PNDIS_STRING KeyName,
4715 _Out_ PNDIS_HANDLE KeyHandle);
4716
4717 _IRQL_requires_max_(APC_LEVEL)
4718 _Success_(*Status >= 0)
4719 NDISAPI
4720 VOID
4721 NTAPI
4722 NdisOpenConfigurationKeyByName(
4723 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
4724 _In_ NDIS_HANDLE ConfigurationHandle,
4725 _In_ PNDIS_STRING SubKeyName,
4726 _Out_ PNDIS_HANDLE SubKeyHandle);
4727
4728 _Must_inspect_result_
4729 _IRQL_requires_max_(DISPATCH_LEVEL)
4730 NDISAPI
4731 NDIS_STATUS
4732 NTAPI
4733 NdisQueryAdapterInstanceName(
4734 _Out_ PNDIS_STRING AdapterInstanceName,
4735 _In_ NDIS_HANDLE NdisBindingHandle);
4736
4737 _Must_inspect_result_
4738 NDISAPI
4739 NDIS_STATUS
4740 NTAPI
4741 NdisQueryBindInstanceName(
4742 _Out_ PNDIS_STRING pAdapterInstanceName,
4743 _In_ NDIS_HANDLE BindingContext);
4744
4745 _IRQL_requires_max_(DISPATCH_LEVEL)
4746 NDISAPI
4747 NDIS_STATUS
4748 NTAPI
4749 NdisWriteEventLogEntry(
4750 _In_ _Points_to_data_ PVOID LogHandle,
4751 _In_ NDIS_STATUS EventCode,
4752 _In_ ULONG UniqueEventValue,
4753 _In_ USHORT NumStrings,
4754 _In_opt_ PVOID StringsList,
4755 _In_ ULONG DataSize,
4756 _In_reads_bytes_opt_(DataSize) PVOID Data);
4757
4758 /* Connectionless services */
4759
4760 _Must_inspect_result_
4761 _IRQL_requires_max_(DISPATCH_LEVEL)
4762 NDISAPI
4763 NDIS_STATUS
4764 NTAPI
4765 NdisClAddParty(
4766 _In_ NDIS_HANDLE NdisVcHandle,
4767 _In_ NDIS_HANDLE ProtocolPartyContext,
4768 _In_ PCO_CALL_PARAMETERS CallParameters,
4769 _Out_ PNDIS_HANDLE NdisPartyHandle);
4770
4771 _Must_inspect_result_
4772 _IRQL_requires_max_(DISPATCH_LEVEL)
4773 NDISAPI
4774 NDIS_STATUS
4775 NTAPI
4776 NdisClCloseAddressFamily(
4777 _In_ NDIS_HANDLE NdisAfHandle);
4778
4779 _Must_inspect_result_
4780 _IRQL_requires_max_(DISPATCH_LEVEL)
4781 NDISAPI
4782 NDIS_STATUS
4783 NTAPI
4784 NdisClCloseCall(
4785 _In_ NDIS_HANDLE NdisVcHandle,
4786 _In_opt_ NDIS_HANDLE NdisPartyHandle,
4787 _In_reads_bytes_opt_(Size) PVOID Buffer,
4788 _In_ UINT Size);
4789
4790 _Must_inspect_result_
4791 _IRQL_requires_max_(DISPATCH_LEVEL)
4792 NDISAPI
4793 NDIS_STATUS
4794 NTAPI
4795 NdisClDeregisterSap(
4796 _In_ NDIS_HANDLE NdisSapHandle);
4797
4798 _Must_inspect_result_
4799 _IRQL_requires_max_(DISPATCH_LEVEL)
4800 NDISAPI
4801 NDIS_STATUS
4802 NTAPI
4803 NdisClDropParty(
4804 _In_ NDIS_HANDLE NdisPartyHandle,
4805 _In_reads_bytes_opt_(Size) PVOID Buffer,
4806 _In_opt_ UINT Size);
4807
4808 _IRQL_requires_max_(DISPATCH_LEVEL)
4809 NDISAPI
4810 VOID
4811 NTAPI
4812 NdisClIncomingCallComplete(
4813 _In_ NDIS_STATUS Status,
4814 _In_ NDIS_HANDLE NdisVcHandle,
4815 _In_ PCO_CALL_PARAMETERS CallParameters);
4816
4817 _Must_inspect_result_
4818 _IRQL_requires_max_(DISPATCH_LEVEL)
4819 NDISAPI
4820 NDIS_STATUS
4821 NTAPI
4822 NdisClMakeCall(
4823 _In_ NDIS_HANDLE NdisVcHandle,
4824 _Inout_ PCO_CALL_PARAMETERS CallParameters,
4825 _In_opt_ NDIS_HANDLE ProtocolPartyContext,
4826 _Out_opt_ PNDIS_HANDLE NdisPartyHandle);
4827
4828 _Must_inspect_result_
4829 _IRQL_requires_max_(DISPATCH_LEVEL)
4830 NDISAPI
4831 NDIS_STATUS
4832 NTAPI
4833 NdisClModifyCallQoS(
4834 _In_ NDIS_HANDLE NdisVcHandle,
4835 _In_ PCO_CALL_PARAMETERS CallParameters);
4836
4837 _Must_inspect_result_
4838 _IRQL_requires_(PASSIVE_LEVEL)
4839 NDISAPI
4840 NDIS_STATUS
4841 NTAPI
4842 NdisClOpenAddressFamily(
4843 _In_ NDIS_HANDLE NdisBindingHandle,
4844 _In_ PCO_ADDRESS_FAMILY AddressFamily,
4845 _In_ NDIS_HANDLE ProtocolAfContext,
4846 _In_ PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
4847 _In_ UINT SizeOfClCharacteristics,
4848 _Out_ PNDIS_HANDLE NdisAfHandle);
4849
4850 _Must_inspect_result_
4851 _IRQL_requires_max_(DISPATCH_LEVEL)
4852 NDISAPI
4853 NDIS_STATUS
4854 NTAPI
4855 NdisClRegisterSap(
4856 _In_ NDIS_HANDLE NdisAfHandle,
4857 _In_ NDIS_HANDLE ProtocolSapContext,
4858 _In_ PCO_SAP Sap,
4859 _Out_ PNDIS_HANDLE NdisSapHandle);
4860
4861
4862 /* Call Manager services */
4863
4864 _Must_inspect_result_
4865 _IRQL_requires_max_(DISPATCH_LEVEL)
4866 NDISAPI
4867 NDIS_STATUS
4868 NTAPI
4869 NdisCmActivateVc(
4870 _In_ NDIS_HANDLE NdisVcHandle,
4871 _Inout_ PCO_CALL_PARAMETERS CallParameters);
4872
4873 _IRQL_requires_max_(DISPATCH_LEVEL)
4874 NDISAPI
4875 VOID
4876 NTAPI
4877 NdisCmAddPartyComplete(
4878 _In_ NDIS_STATUS Status,
4879 _In_ NDIS_HANDLE NdisPartyHandle,
4880 _In_opt_ NDIS_HANDLE CallMgrPartyContext,
4881 _In_ PCO_CALL_PARAMETERS CallParameters);
4882
4883 _IRQL_requires_max_(DISPATCH_LEVEL)
4884 NDISAPI
4885 VOID
4886 NTAPI
4887 NdisCmCloseAddressFamilyComplete(
4888 _In_ NDIS_STATUS Status,
4889 _In_ NDIS_HANDLE NdisAfHandle);
4890
4891 _IRQL_requires_max_(DISPATCH_LEVEL)
4892 NDISAPI
4893 VOID
4894 NTAPI
4895 NdisCmCloseCallComplete(
4896 _In_ NDIS_STATUS Status,
4897 _In_ NDIS_HANDLE NdisVcHandle,
4898 _In_opt_ NDIS_HANDLE NdisPartyHandle);
4899
4900 _Must_inspect_result_
4901 _IRQL_requires_max_(DISPATCH_LEVEL)
4902 NDISAPI
4903 NDIS_STATUS
4904 NTAPI
4905 NdisCmDeactivateVc(
4906 _In_ NDIS_HANDLE NdisVcHandle);
4907
4908 _IRQL_requires_max_(DISPATCH_LEVEL)
4909 NDISAPI
4910 VOID
4911 NTAPI
4912 NdisCmDeregisterSapComplete(
4913 _In_ NDIS_STATUS Status,
4914 _In_ NDIS_HANDLE NdisSapHandle);
4915
4916 _IRQL_requires_max_(DISPATCH_LEVEL)
4917 NDISAPI
4918 VOID
4919 NTAPI
4920 NdisCmDispatchCallConnected(
4921 _In_ NDIS_HANDLE NdisVcHandle);
4922
4923 _Must_inspect_result_
4924 _IRQL_requires_max_(DISPATCH_LEVEL)
4925 NDISAPI
4926 NDIS_STATUS
4927 NTAPI
4928 NdisCmDispatchIncomingCall(
4929 _In_ NDIS_HANDLE NdisSapHandle,
4930 _In_ NDIS_HANDLE NdisVcHandle,
4931 _In_ PCO_CALL_PARAMETERS CallParameters);
4932
4933 _IRQL_requires_max_(DISPATCH_LEVEL)
4934 NDISAPI
4935 VOID
4936 NTAPI
4937 NdisCmDispatchIncomingCallQoSChange(
4938 _In_ NDIS_HANDLE NdisVcHandle,
4939 _In_ PCO_CALL_PARAMETERS CallParameters);
4940
4941 _IRQL_requires_max_(DISPATCH_LEVEL)
4942 NDISAPI
4943 VOID
4944 NTAPI
4945 NdisCmDispatchIncomingCloseCall(
4946 _In_ NDIS_STATUS CloseStatus,
4947 _In_ NDIS_HANDLE NdisVcHandle,
4948 _In_reads_bytes_opt_(Size) PVOID Buffer,
4949 _In_ UINT Size);
4950
4951 _IRQL_requires_max_(DISPATCH_LEVEL)
4952 NDISAPI
4953 VOID
4954 NTAPI
4955 NdisCmDispatchIncomingDropParty(
4956 _In_ NDIS_STATUS DropStatus,
4957 _In_ NDIS_HANDLE NdisPartyHandle,
4958 _In_reads_bytes_opt_(Size) PVOID Buffer,
4959 _In_ UINT Size);
4960
4961 _IRQL_requires_max_(DISPATCH_LEVEL)
4962 NDISAPI
4963 VOID
4964 NTAPI
4965 NdisCmDropPartyComplete(
4966 _In_ NDIS_STATUS Status,
4967 _In_ NDIS_HANDLE NdisPartyHandle);
4968
4969 _IRQL_requires_max_(DISPATCH_LEVEL)
4970 NDISAPI
4971 VOID
4972 NTAPI
4973 NdisCmMakeCallComplete(
4974 _In_ NDIS_STATUS Status,
4975 _In_ NDIS_HANDLE NdisVcHandle,
4976 _In_opt_ NDIS_HANDLE NdisPartyHandle,
4977 _In_opt_ NDIS_HANDLE CallMgrPartyContext,
4978 _In_ PCO_CALL_PARAMETERS CallParameters);
4979
4980 _IRQL_requires_max_(DISPATCH_LEVEL)
4981 NDISAPI
4982 VOID
4983 NTAPI
4984 NdisCmModifyCallQoSComplete(
4985 _In_ NDIS_STATUS Status,
4986 _In_ NDIS_HANDLE NdisVcHandle,
4987 _In_ PCO_CALL_PARAMETERS CallParameters);
4988
4989 _IRQL_requires_max_(DISPATCH_LEVEL)
4990 NDISAPI
4991 VOID
4992 NTAPI
4993 NdisCmOpenAddressFamilyComplete(
4994 _In_ NDIS_STATUS Status,
4995 _In_ NDIS_HANDLE NdisAfHandle,
4996 _In_ NDIS_HANDLE CallMgrAfContext);
4997
4998 _Must_inspect_result_
4999 _IRQL_requires_(PASSIVE_LEVEL)
5000 NDISAPI
5001 NDIS_STATUS
5002 NTAPI
5003 NdisCmRegisterAddressFamily(
5004 _In_ NDIS_HANDLE NdisBindingHandle,
5005 _In_ PCO_ADDRESS_FAMILY AddressFamily,
5006 _In_ PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
5007 _In_ UINT SizeOfCmCharacteristics);
5008
5009 _IRQL_requires_max_(DISPATCH_LEVEL)
5010 NDISAPI
5011 VOID
5012 NTAPI
5013 NdisCmRegisterSapComplete(
5014 _In_ NDIS_STATUS Status,
5015 _In_ NDIS_HANDLE NdisSapHandle,
5016 _In_ NDIS_HANDLE CallMgrSapContext);
5017
5018 _IRQL_requires_max_(DISPATCH_LEVEL)
5019 NDISAPI
5020 NDIS_STATUS
5021 NTAPI
5022 NdisMCmActivateVc(
5023 _In_ NDIS_HANDLE NdisVcHandle,
5024 _In_ PCO_CALL_PARAMETERS CallParameters);
5025
5026 _IRQL_requires_max_(DISPATCH_LEVEL)
5027 NDISAPI
5028 NDIS_STATUS
5029 NTAPI
5030 NdisMCmCreateVc(
5031 _In_ NDIS_HANDLE MiniportAdapterHandle,
5032 _In_ NDIS_HANDLE NdisAfHandle,
5033 _In_ NDIS_HANDLE MiniportVcContext,
5034 _Out_ PNDIS_HANDLE NdisVcHandle);
5035
5036 _IRQL_requires_max_(DISPATCH_LEVEL)
5037 NDISAPI
5038 NDIS_STATUS
5039 NTAPI
5040 NdisMCmDeactivateVc(
5041 _In_ NDIS_HANDLE NdisVcHandle);
5042
5043 _IRQL_requires_max_(DISPATCH_LEVEL)
5044 NDISAPI
5045 NDIS_STATUS
5046 NTAPI
5047 NdisMCmDeleteVc(
5048 _In_ NDIS_HANDLE NdisVcHandle);
5049
5050 NDISAPI
5051 NDIS_STATUS
5052 NTAPI
5053 NdisMCmRegisterAddressFamily(
5054 IN NDIS_HANDLE MiniportAdapterHandle,
5055 IN PCO_ADDRESS_FAMILY AddressFamily,
5056 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
5057 IN UINT SizeOfCmCharacteristics);
5058
5059 _IRQL_requires_max_(DISPATCH_LEVEL)
5060 NDISAPI
5061 NDIS_STATUS
5062 NTAPI
5063 NdisMCmRequest(
5064 _In_ NDIS_HANDLE NdisAfHandle,
5065 _In_opt_ NDIS_HANDLE NdisVcHandle,
5066 _In_opt_ NDIS_HANDLE NdisPartyHandle,
5067 _Inout_ PNDIS_REQUEST NdisRequest);
5068
5069
5070 /* Connection-oriented services */
5071
5072 _Must_inspect_result_
5073 _IRQL_requires_max_(DISPATCH_LEVEL)
5074 NDISAPI
5075 NDIS_STATUS
5076 NTAPI
5077 NdisCoCreateVc(
5078 _In_ NDIS_HANDLE NdisBindingHandle,
5079 _In_opt_ NDIS_HANDLE NdisAfHandle ,
5080 _In_ NDIS_HANDLE ProtocolVcContext,
5081 _Inout_ PNDIS_HANDLE NdisVcHandle);
5082
5083 _Must_inspect_result_
5084 _IRQL_requires_max_(DISPATCH_LEVEL)
5085 NDISAPI
5086 NDIS_STATUS
5087 NTAPI
5088 NdisCoDeleteVc(
5089 _In_ NDIS_HANDLE NdisVcHandle);
5090
5091 _Must_inspect_result_
5092 _IRQL_requires_max_(DISPATCH_LEVEL)
5093 NDISAPI
5094 NDIS_STATUS
5095 NTAPI
5096 NdisCoRequest(
5097 _In_ NDIS_HANDLE NdisBindingHandle,
5098 _In_opt_ NDIS_HANDLE NdisAfHandle,
5099 _In_opt_ NDIS_HANDLE NdisVcHandle,
5100 _In_opt_ NDIS_HANDLE NdisPartyHandle,
5101 _Inout_ PNDIS_REQUEST NdisRequest);
5102
5103 _IRQL_requires_max_(DISPATCH_LEVEL)
5104 NDISAPI
5105 VOID
5106 NTAPI
5107 NdisCoRequestComplete(
5108 _In_ NDIS_STATUS Status,
5109 _In_ NDIS_HANDLE NdisAfHandle,
5110 _In_opt_ NDIS_HANDLE NdisVcHandle,
5111 _In_opt_ NDIS_HANDLE NdisPartyHandle,
5112 _In_ PNDIS_REQUEST NdisRequest);
5113
5114 _IRQL_requires_max_(DISPATCH_LEVEL)
5115 NDISAPI
5116 VOID
5117 NTAPI
5118 NdisCoSendPackets(
5119 _In_ NDIS_HANDLE NdisVcHandle,
5120 _In_ PPNDIS_PACKET PacketArray,
5121 _In_ UINT NumberOfPackets);
5122
5123 _IRQL_requires_max_(DISPATCH_LEVEL)
5124 NDISAPI
5125 VOID
5126 NTAPI
5127 NdisMCoActivateVcComplete(
5128 _In_ NDIS_STATUS Status,
5129 _In_ NDIS_HANDLE NdisVcHandle,
5130 _In_ PCO_CALL_PARAMETERS CallParameters);
5131
5132 _IRQL_requires_max_(DISPATCH_LEVEL)
5133 NDISAPI
5134 VOID
5135 NTAPI
5136 NdisMCoDeactivateVcComplete(
5137 _In_ NDIS_STATUS Status,
5138 _In_ NDIS_HANDLE NdisVcHandle);
5139
5140 _IRQL_requires_(DISPATCH_LEVEL)
5141 NDISAPI
5142 VOID
5143 NTAPI
5144 NdisMCoIndicateReceivePacket(
5145 _In_ NDIS_HANDLE NdisVcHandle,
5146 _In_ PPNDIS_PACKET PacketArray,
5147 _In_ UINT NumberOfPackets);
5148
5149 _IRQL_requires_max_(DISPATCH_LEVEL)
5150 NDISAPI
5151 VOID
5152 NTAPI
5153 NdisMCoIndicateStatus(
5154 _In_ NDIS_HANDLE MiniportAdapterHandle,
5155 _In_opt_ NDIS_HANDLE NdisVcHandle,
5156 _In_ NDIS_STATUS GeneralStatus,
5157 _In_reads_bytes_opt_(StatusBufferSize) PVOID StatusBuffer,
5158 _In_ ULONG StatusBufferSize);
5159
5160 _IRQL_requires_(DISPATCH_LEVEL)
5161 NDISAPI
5162 VOID
5163 NTAPI
5164 NdisMCoReceiveComplete(
5165 _In_ NDIS_HANDLE MiniportAdapterHandle);
5166
5167 _IRQL_requires_max_(DISPATCH_LEVEL)
5168 NDISAPI
5169 VOID
5170 NTAPI
5171 NdisMCoRequestComplete(
5172 _In_ NDIS_STATUS Status,
5173 _In_ NDIS_HANDLE MiniportAdapterHandle,
5174 _In_ PNDIS_REQUEST Request);
5175
5176 _IRQL_requires_(DISPATCH_LEVEL)
5177 NDISAPI
5178 VOID
5179 NTAPI
5180 NdisMCoSendComplete(
5181 _In_ NDIS_STATUS Status,
5182 _In_ NDIS_HANDLE NdisVcHandle,
5183 _In_ PNDIS_PACKET Packet);
5184
5185
5186 /* NDIS 5.0 extensions for intermediate drivers */
5187
5188 _IRQL_requires_(PASSIVE_LEVEL)
5189 NDISAPI
5190 VOID
5191 NTAPI
5192 NdisIMAssociateMiniport(
5193 _In_ NDIS_HANDLE DriverHandle,
5194 _In_ NDIS_HANDLE ProtocolHandle);
5195
5196 _IRQL_requires_(PASSIVE_LEVEL)
5197 NDISAPI
5198 NDIS_STATUS
5199 NTAPI
5200 NdisIMCancelInitializeDeviceInstance(
5201 _In_ NDIS_HANDLE DriverHandle,
5202 _In_ PNDIS_STRING DeviceInstance);
5203
5204 NDISAPI
5205 VOID
5206 NTAPI
5207 NdisIMCopySendCompletePerPacketInfo(
5208 IN PNDIS_PACKET DstPacket,
5209 IN PNDIS_PACKET SrcPacket);
5210
5211 NDISAPI
5212 VOID
5213 NTAPI
5214 NdisIMCopySendPerPacketInfo(
5215 IN PNDIS_PACKET DstPacket,
5216 IN PNDIS_PACKET SrcPacket);
5217
5218 _IRQL_requires_(PASSIVE_LEVEL)
5219 NDISAPI
5220 VOID
5221 NTAPI
5222 NdisIMDeregisterLayeredMiniport(
5223 _In_ NDIS_HANDLE DriverHandle);
5224
5225 _IRQL_requires_max_(APC_LEVEL)
5226 NDISAPI
5227 NDIS_HANDLE
5228 NTAPI
5229 NdisIMGetBindingContext(
5230 _In_ NDIS_HANDLE NdisBindingHandle);
5231
5232 _IRQL_requires_max_(DISPATCH_LEVEL)
5233 NDISAPI
5234 NDIS_HANDLE
5235 NTAPI
5236 NdisIMGetDeviceContext(
5237 _In_ NDIS_HANDLE MiniportAdapterHandle);
5238
5239 _IRQL_requires_(PASSIVE_LEVEL)
5240 NDISAPI
5241 NDIS_STATUS
5242 NTAPI
5243 NdisIMInitializeDeviceInstanceEx(
5244 _In_ NDIS_HANDLE DriverHandle,
5245 _In_ PNDIS_STRING DriverInstance,
5246 _In_opt_ NDIS_HANDLE DeviceContext);
5247
5248 /*
5249 NDISAPI
5250 PSINGLE_LIST_ENTRY
5251 NTAPI
5252 NdisInterlockedPopEntrySList(
5253 IN PSLIST_HEADER ListHead,
5254 IN PKSPIN_LOCK Lock);
5255 */
5256 #define NdisInterlockedPopEntrySList(SListHead, Lock) \
5257 ExInterlockedPopEntrySList(SListHead, &(Lock)->SpinLock)
5258
5259 /*
5260 NDISAPI
5261 PSINGLE_LIST_ENTRY
5262 NTAPI
5263 NdisInterlockedPushEntrySList(
5264 IN PSLIST_HEADER ListHead,
5265 IN PSINGLE_LIST_ENTRY ListEntry,
5266 IN PKSPIN_LOCK Lock);
5267 */
5268 #define NdisInterlockedPushEntrySList(SListHead, SListEntry, Lock) \
5269 ExInterlockedPushEntrySList(SListHead, SListEntry, &(Lock)->SpinLock)
5270
5271 #define NdisInterlockedFlushSList(SListHead) ExInterlockedFlushSList(SListHead)
5272
5273 /*
5274 NDISAPI
5275 VOID
5276 NTAPI
5277 NdisQueryBufferSafe(
5278 IN PNDIS_BUFFER Buffer,
5279 OUT PVOID *VirtualAddress OPTIONAL,
5280 OUT PUINT Length,
5281 IN UINT Priority);
5282 */
5283 #define NdisQueryBufferSafe(_Buffer, _VirtualAddress, _Length, _Priority) { \
5284 if (ARGUMENT_PRESENT(_VirtualAddress)) { \
5285 *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
5286 } \
5287 *(_Length) = MmGetMdlByteCount(_Buffer); \
5288 }
5289
5290 /* Routines for NDIS miniport drivers */
5291
5292 #if NDIS_SUPPORT_NDIS6
5293
5294 NDISAPI
5295 PNDIS_GENERIC_OBJECT
5296 NTAPI
5297 NdisAllocateGenericObject(
5298 PDRIVER_OBJECT DriverObject OPTIONAL,
5299 ULONG Tag,
5300 USHORT Size);
5301
5302 NDISAPI
5303 VOID
5304 NTAPI
5305 NdisFreeGenericObject(
5306 IN PNDIS_GENERIC_OBJECT NdisObject);
5307
5308 #endif /* NDIS_SUPPORT_NDIS6 */
5309
5310 NDISAPI
5311 VOID
5312 NTAPI
5313 NdisInitializeWrapper(
5314 OUT PNDIS_HANDLE NdisWrapperHandle,
5315 IN PVOID SystemSpecific1,
5316 IN PVOID SystemSpecific2,
5317 IN PVOID SystemSpecific3);
5318
5319 _Must_inspect_result_
5320 _IRQL_requires_(PASSIVE_LEVEL)
5321 __drv_preferredFunction("NdisMInitializeScatterGatherDma", "See details in NdisMAllocateMapRegisters documentation")
5322 NDISAPI
5323 NDIS_STATUS
5324 NTAPI
5325 NdisMAllocateMapRegisters(
5326 _In_ NDIS_HANDLE MiniportAdapterHandle,
5327 _In_ UINT DmaChannel,
5328 _In_ NDIS_DMA_SIZE DmaSize,
5329 _In_ ULONG PhysicalMapRegistersNeeded,
5330 _In_ ULONG MaximumPhysicalMapping);
5331
5332 /*
5333 * VOID
5334 * NdisMArcIndicateReceive(
5335 * IN NDIS_HANDLE MiniportAdapterHandle,
5336 * IN PUCHAR HeaderBuffer,
5337 * IN PUCHAR DataBuffer,
5338 * IN UINT Length);
5339 */
5340 #define NdisMArcIndicateReceive(MiniportAdapterHandle, \
5341 HeaderBuffer, \
5342 DataBuffer, \
5343 Length) \
5344 { \
5345 ArcFilterDprIndicateReceive( \
5346 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->ArcDB), \
5347 (HeaderBuffer), \
5348 (DataBuffer), \
5349 (Length)); \
5350 }
5351
5352 /*
5353 * VOID
5354 * NdisMArcIndicateReceiveComplete(
5355 * IN NDIS_HANDLE MiniportAdapterHandle);
5356 */
5357 #define NdisMArcIndicateReceiveComplete(MiniportAdapterHandle) \
5358 { \
5359 if (((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->EthDB) \
5360 { \
5361 NdisMEthIndicateReceiveComplete(_H); \
5362 } \
5363 \
5364 ArcFilterDprIndicateReceiveComplete( \
5365 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->ArcDB); \
5366 }
5367
5368 _IRQL_requires_(PASSIVE_LEVEL)
5369 NDISAPI
5370 VOID
5371 NTAPI
5372 NdisMCloseLog(
5373 _In_ NDIS_HANDLE LogHandle);
5374
5375 _IRQL_requires_(PASSIVE_LEVEL)
5376 NDISAPI
5377 NDIS_STATUS
5378 NTAPI
5379 NdisMCreateLog(
5380 _In_ NDIS_HANDLE MiniportAdapterHandle,
5381 _In_ UINT Size,
5382 _Out_ PNDIS_HANDLE LogHandle);
5383
5384 NDISAPI
5385 VOID
5386 NTAPI
5387 NdisMDeregisterAdapterShutdownHandler(
5388 _In_ NDIS_HANDLE MiniportHandle);
5389
5390 #if NDIS_LEGACY_MINIPORT
5391
5392 _IRQL_requires_(PASSIVE_LEVEL)
5393 NDISAPI
5394 VOID
5395 NTAPI
5396 NdisMDeregisterInterrupt(
5397 _In_ PNDIS_MINIPORT_INTERRUPT Interrupt);
5398
5399 _IRQL_requires_(PASSIVE_LEVEL)
5400 NDISAPI
5401 VOID
5402 NTAPI
5403 NdisMRegisterAdapterShutdownHandler(
5404 _In_ NDIS_HANDLE MiniportHandle,
5405 _In_ PVOID ShutdownContext,
5406 _In_ ADAPTER_SHUTDOWN_HANDLER ShutdownHandler);
5407
5408 NDISAPI
5409 NDIS_STATUS
5410 NTAPI
5411 NdisMRegisterInterrupt(
5412 OUT PNDIS_MINIPORT_INTERRUPT Interrupt,
5413 IN NDIS_HANDLE MiniportAdapterHandle,
5414 IN UINT InterruptVector,
5415 IN UINT InterruptLevel,
5416 IN BOOLEAN RequestIsr,
5417 IN BOOLEAN SharedInterrupt,
5418 IN NDIS_INTERRUPT_MODE InterruptMode);
5419
5420 NDISAPI
5421 NDIS_STATUS
5422 NTAPI
5423 NdisMRegisterMiniport(
5424 IN NDIS_HANDLE NdisWrapperHandle,
5425 IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
5426 IN UINT CharacteristicsLength);
5427
5428 NDISAPI
5429 BOOLEAN
5430 NTAPI
5431 NdisMSynchronizeWithInterrupt(
5432 IN PNDIS_MINIPORT_INTERRUPT Interrupt,
5433 IN PVOID SynchronizeFunction,
5434 IN PVOID SynchronizeContext);
5435 #endif /* NDIS_LEGACY_MINIPORT */
5436
5437 _IRQL_requires_(PASSIVE_LEVEL)
5438 NDISAPI
5439 VOID
5440 NTAPI
5441 NdisMDeregisterIoPortRange(
5442 _In_ NDIS_HANDLE MiniportAdapterHandle,
5443 _In_ UINT InitialPort,
5444 _In_ UINT NumberOfPorts,
5445 _In_ PVOID PortOffset);
5446
5447 /*
5448 * VOID
5449 * NdisMEthIndicateReceive(
5450 * IN NDIS_HANDLE MiniportAdapterHandle,
5451 * IN NDIS_HANDLE MiniportReceiveContext,
5452 * IN PVOID HeaderBuffer,
5453 * IN UINT HeaderBufferSize,
5454 * IN PVOID LookaheadBuffer,
5455 * IN UINT LookaheadBufferSize,
5456 * IN UINT PacketSize);
5457 */
5458 #define NdisMEthIndicateReceive(MiniportAdapterHandle, \
5459 MiniportReceiveContext, \
5460 HeaderBuffer, \
5461 HeaderBufferSize, \
5462 LookaheadBuffer, \
5463 LookaheadBufferSize, \
5464 PacketSize) \
5465 { \
5466 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxIndicateHandler)( \
5467 ((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthDB, \
5468 (MiniportReceiveContext), \
5469 (HeaderBuffer), \
5470 (HeaderBuffer), \
5471 (HeaderBufferSize), \
5472 (LookaheadBuffer), \
5473 (LookaheadBufferSize), \
5474 (PacketSize)); \
5475 }
5476
5477 /*
5478 * VOID
5479 * NdisMEthIndicateReceiveComplete(
5480 * IN NDIS_HANDLE MiniportAdapterHandle);
5481 */
5482 #define NdisMEthIndicateReceiveComplete(MiniportAdapterHandle) \
5483 { \
5484 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxCompleteHandler)( \
5485 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->EthDB); \
5486 }
5487
5488 /*
5489 * VOID
5490 * NdisMFddiIndicateReceive(
5491 * IN NDIS_HANDLE MiniportAdapterHandle,
5492 * IN NDIS_HANDLE MiniportReceiveContext,
5493 * IN PVOID HeaderBuffer,
5494 * IN UINT HeaderBufferSize,
5495 * IN PVOID LookaheadBuffer,
5496 * IN UINT LookaheadBufferSize,
5497 * IN UINT PacketSize);
5498 */
5499 #define NdisMFddiIndicateReceive(MiniportAdapterHandle, \
5500 MiniportReceiveContext, \
5501 HeaderBuffer, \
5502 HeaderBufferSize, \
5503 LookaheadBuffer, \
5504 LookaheadBufferSize, \
5505 PacketSize) \
5506 { \
5507 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxIndicateHandler)( \
5508 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiDB), \
5509 (MiniportReceiveContext), \
5510 (PUCHAR)(HeaderBuffer) + 1, \
5511 (((*(PUCHAR*)(HeaderBuffer)) & 0x40) ? \
5512 FDDI_LENGTH_OF_LONG_ADDRESS : \
5513 FDDI_LENGTH_OF_SHORT_ADDRESS), \
5514 (HeaderBuffer), \
5515 (HeaderBufferSize), \
5516 (LookaheadBuffer), \
5517 (LookaheadBufferSize), \
5518 (PacketSize)); \
5519 }
5520
5521
5522
5523 /*
5524 * VOID
5525 * NdisMFddiIndicateReceiveComplete(
5526 * IN NDIS_HANDLE MiniportAdapterHandle);
5527 */
5528 #define NdisMFddiIndicateReceiveComplete(MiniportAdapterHandle) \
5529 { \
5530 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxCompleteHandler)( \
5531 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FddiDB); \
5532 }
5533
5534 _IRQL_requires_max_(DISPATCH_LEVEL)
5535 NDISAPI
5536 VOID
5537 NTAPI
5538 NdisMFlushLog(
5539 _In_ NDIS_HANDLE LogHandle);
5540
5541 _IRQL_requires_(PASSIVE_LEVEL)
5542 NDISAPI
5543 VOID
5544 NTAPI
5545 NdisMFreeMapRegisters(
5546 _In_ NDIS_HANDLE MiniportAdapterHandle);
5547
5548 /*
5549 * VOID
5550 * EXPORT
5551 * NdisMIndicateReceivePacket(
5552 * IN NDIS_HANDLE MiniportAdapterHandle,
5553 * IN PPNDIS_PACKET ReceivePackets,
5554 * IN UINT NumberOfPackets);
5555 */
5556 #define NdisMIndicateReceivePacket(MiniportAdapterHandle, \
5557 ReceivePackets, NumberOfPackets) \
5558 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->PacketIndicateHandler)( \
5559 MiniportAdapterHandle, ReceivePackets, NumberOfPackets)
5560
5561 /*
5562 * VOID
5563 * NdisMIndicateStatus(
5564 * IN NDIS_HANDLE MiniportAdapterHandle,
5565 * IN NDIS_STATUS GeneralStatus,
5566 * IN PVOID StatusBuffer,
5567 * IN UINT StatusBufferSize);
5568 */
5569
5570 #define NdisMIndicateStatus(MiniportAdapterHandle, \
5571 GeneralStatus, StatusBuffer, StatusBufferSize) \
5572 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->StatusHandler)( \
5573 MiniportAdapterHandle, GeneralStatus, StatusBuffer, StatusBufferSize)
5574
5575 /*
5576 * VOID
5577 * NdisMIndicateStatusComplete(
5578 * IN NDIS_HANDLE MiniportAdapterHandle);
5579 */
5580 #define NdisMIndicateStatusComplete(MiniportAdapterHandle) \
5581 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->StatusCompleteHandler)( \
5582 MiniportAdapterHandle)
5583
5584 /*
5585 * VOID
5586 * NdisMInitializeWrapper(
5587 * OUT PNDIS_HANDLE NdisWrapperHandle,
5588 * IN PVOID SystemSpecific1,
5589 * IN PVOID SystemSpecific2,
5590 * IN PVOID SystemSpecific3);
5591 */
5592 #define NdisMInitializeWrapper(NdisWrapperHandle, \
5593 SystemSpecific1, \
5594 SystemSpecific2, \
5595 SystemSpecific3) \
5596 NdisInitializeWrapper((NdisWrapperHandle), \
5597 (SystemSpecific1), \
5598 (SystemSpecific2), \
5599 (SystemSpecific3))
5600
5601 _Must_inspect_result_
5602 _IRQL_requires_(PASSIVE_LEVEL)
5603 NDISAPI
5604 NDIS_STATUS
5605 NTAPI
5606 NdisMMapIoSpace(
5607 _Outptr_result_bytebuffer_(Length) PVOID *VirtualAddress,
5608 _In_ NDIS_HANDLE MiniportAdapterHandle,
5609 _In_ NDIS_PHYSICAL_ADDRESS PhysicalAddress,
5610 _In_ UINT Length);
5611
5612 /*
5613 * VOID
5614 * NdisMQueryInformationComplete(
5615 * IN NDIS_HANDLE MiniportAdapterHandle,
5616 * IN NDIS_STATUS Status);
5617 */
5618 #define NdisMQueryInformationComplete(MiniportAdapterHandle, Status) \
5619 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->QueryCompleteHandler)(MiniportAdapterHandle, Status)
5620
5621 _Must_inspect_result_
5622 _IRQL_requires_(PASSIVE_LEVEL)
5623 NDISAPI
5624 NDIS_STATUS
5625 NTAPI
5626 NdisMRegisterIoPortRange(
5627 _Out_ PVOID *PortOffset,
5628 _In_ NDIS_HANDLE MiniportAdapterHandle,
5629 _In_ UINT InitialPort,
5630 _In_ UINT NumberOfPorts);
5631
5632 NDISAPI
5633 VOID
5634 NTAPI
5635 NdisMSetTimer(
5636 IN PNDIS_MINIPORT_TIMER Timer,
5637 IN UINT MillisecondsToDelay);
5638
5639 _IRQL_requires_max_(DISPATCH_LEVEL)
5640 NDISAPI
5641 VOID
5642 NTAPI
5643 NdisMInitializeTimer(
5644 _Inout_ PNDIS_MINIPORT_TIMER Timer,
5645 _In_ NDIS_HANDLE MiniportAdapterHandle,
5646 _In_ PNDIS_TIMER_FUNCTION TimerFunction,
5647 _In_ PVOID FunctionContext);
5648
5649 _IRQL_requires_max_(DISPATCH_LEVEL)
5650 NDISAPI
5651 VOID
5652 NTAPI
5653 NdisMSetPeriodicTimer(
5654 _In_ PNDIS_MINIPORT_TIMER Timer,
5655 _In_ UINT MillisecondPeriod);
5656
5657 _IRQL_requires_max_(DISPATCH_LEVEL)
5658 NDISAPI
5659 VOID
5660 NTAPI
5661 NdisMCancelTimer(
5662 _In_ PNDIS_MINIPORT_TIMER Timer,
5663 _Out_ _At_(*TimerCancelled, _Must_inspect_result_) PBOOLEAN TimerCancelled);
5664
5665 #if !defined(NDIS_WRAPPER)
5666
5667 /*
5668 * VOID
5669 * NdisMResetComplete(
5670 * IN NDIS_HANDLE MiniportAdapterHandle,
5671 * IN NDIS_STATUS Status,
5672 * IN BOOLEAN AddressingReset);
5673 */
5674 #define NdisMResetComplete(MiniportAdapterHandle, \
5675 Status, \
5676 AddressingReset) \
5677 { \
5678 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->ResetCompleteHandler)( \
5679 MiniportAdapterHandle, Status, AddressingReset); \
5680 }
5681
5682 /*
5683 * VOID
5684 * NdisMSendComplete(
5685 * IN NDIS_HANDLE MiniportAdapterHandle,
5686 * IN PNDIS_PACKET Packet,
5687 * IN NDIS_STATUS Status);
5688 */
5689 #define NdisMSendComplete(MiniportAdapterHandle, \
5690 Packet, \
5691 Status) \
5692 { \
5693 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendCompleteHandler)( \
5694 MiniportAdapterHandle, Packet, Status); \
5695 }
5696
5697 /*
5698 * VOID
5699 * NdisMSendResourcesAvailable(
5700 * IN NDIS_HANDLE MiniportAdapterHandle);
5701 */
5702 #define NdisMSendResourcesAvailable(MiniportAdapterHandle) \
5703 { \
5704 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendResourcesHandler)( \
5705 MiniportAdapterHandle); \
5706 }
5707
5708 /*
5709 * VOID
5710 * NdisMTransferDataComplete(
5711 * IN NDIS_HANDLE MiniportAdapterHandle,
5712 * IN PNDIS_PACKET Packet,
5713 * IN NDIS_STATUS Status,
5714 * IN UINT BytesTransferred);
5715 */
5716 #define NdisMTransferDataComplete(MiniportAdapterHandle, \
5717 Packet, \
5718 Status, \
5719 BytesTransferred) \
5720 { \
5721 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TDCompleteHandler)( \
5722 MiniportAdapterHandle, Packet, Status, BytesTransferred) \
5723 }
5724
5725 #endif /* !_NDIS_ */
5726
5727
5728 /*
5729 * VOID
5730 * NdisMSetAttributes(
5731 * IN NDIS_HANDLE MiniportAdapterHandle,
5732 * IN NDIS_HANDLE MiniportAdapterContext,
5733 * IN BOOLEAN BusMaster,
5734 * IN NDIS_INTERFACE_TYPE AdapterType);
5735 */
5736 #define NdisMSetAttributes(MiniportAdapterHandle, \
5737 MiniportAdapterContext, \
5738 BusMaster, \
5739 AdapterType) \
5740 NdisMSetAttributesEx(MiniportAdapterHandle, \
5741 MiniportAdapterContext, \
5742 0, \
5743 (BusMaster) ? NDIS_ATTRIBUTE_BUS_MASTER : 0, \
5744 AdapterType)
5745
5746 NDISAPI
5747 VOID
5748 NTAPI
5749 NdisMSetAttributesEx(
5750 IN NDIS_HANDLE MiniportAdapterHandle,
5751 IN NDIS_HANDLE MiniportAdapterContext,
5752 IN UINT CheckForHangTimeInSeconds OPTIONAL,
5753 IN ULONG AttributeFlags,
5754 IN NDIS_INTERFACE_TYPE AdapterType);
5755
5756 /*
5757 * VOID
5758 * NdisMSetInformationComplete(
5759 * IN NDIS_HANDLE MiniportAdapterHandle,
5760 * IN NDIS_STATUS Status);
5761 */
5762 #define NdisMSetInformationComplete(MiniportAdapterHandle, \
5763 Status) \
5764 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SetCompleteHandler)( \
5765 MiniportAdapterHandle, Status)
5766
5767 _IRQL_requires_max_(APC_LEVEL)
5768 NDISAPI
5769 VOID
5770 NTAPI
5771 NdisMSleep(
5772 _In_ ULONG MicrosecondsToSleep);
5773
5774 /*
5775 * VOID
5776 * NdisMTrIndicateReceive(
5777 * IN NDIS_HANDLE MiniportAdapterHandle,
5778 * IN NDIS_HANDLE MiniportReceiveContext,
5779 * IN PVOID HeaderBuffer,
5780 * IN UINT HeaderBufferSize,
5781 * IN PVOID LookaheadBuffer,
5782 * IN UINT LookaheadBufferSize,
5783 * IN UINT PacketSize);
5784 */
5785 #define NdisMTrIndicateReceive(MiniportAdapterHandle, \
5786 MiniportReceiveContext, \
5787 HeaderBuffer, \
5788 HeaderBufferSize, \
5789 LookaheadBuffer, \
5790 LookaheadBufferSize, \
5791 PacketSize) \
5792 { \
5793 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxIndicateHandler)( \
5794 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrDB), \
5795 (MiniportReceiveContext), \
5796 (HeaderBuffer), \
5797 (HeaderBuffer), \
5798 (HeaderBufferSize), \
5799 (LookaheadBuffer), \
5800 (LookaheadBufferSize), \
5801 (PacketSize)); \
5802 }
5803
5804 /*
5805 * VOID
5806 * NdisMTrIndicateReceiveComplete(
5807 * IN NDIS_HANDLE MiniportAdapterHandle);
5808 */
5809 #define NdisMTrIndicateReceiveComplete(MiniportAdapterHandle) \
5810 { \
5811 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxCompleteHandler)( \
5812 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->TrDB); \
5813 }
5814
5815 _IRQL_requires_max_(DISPATCH_LEVEL)
5816 NDISAPI
5817 NDIS_STATUS
5818 NTAPI
5819 NdisMWriteLogData(
5820 _In_ NDIS_HANDLE LogHandle,
5821 _In_reads_bytes_(LogBufferSize) PVOID LogBuffer,
5822 _In_ UINT LogBufferSize);
5823
5824 _IRQL_requires_(PASSIVE_LEVEL)
5825 NDISAPI
5826 VOID
5827 NTAPI
5828 NdisMQueryAdapterResources(
5829 _Out_ PNDIS_STATUS Status,
5830 _In_ NDIS_HANDLE WrapperConfigurationContext,
5831 _Out_ PNDIS_RESOURCE_LIST ResourceList,
5832 _Inout_ PUINT BufferSize);
5833
5834 _IRQL_requires_(PASSIVE_LEVEL)
5835 NDISAPI
5836 VOID
5837 NTAPI
5838 NdisTerminateWrapper(
5839 _In_ NDIS_HANDLE NdisWrapperHandle,
5840 _In_opt_ PVOID SystemSpecific);
5841
5842 _IRQL_requires_(PASSIVE_LEVEL)
5843 NDISAPI
5844 VOID
5845 NTAPI
5846 NdisMUnmapIoSpace(
5847 _In_ NDIS_HANDLE MiniportAdapterHandle,
5848 _In_reads_bytes_(Length) PVOID VirtualAddress,
5849 _In_ UINT Length);
5850
5851 /* Event functions */
5852
5853 _IRQL_requires_max_(DISPATCH_LEVEL)
5854 NDISAPI
5855 VOID
5856 NTAPI
5857 NdisInitializeEvent(
5858 _Out_ PNDIS_EVENT Event);
5859
5860 _IRQL_requires_max_(DISPATCH_LEVEL)
5861 NDISAPI
5862 VOID
5863 NTAPI
5864 NdisSetEvent(
5865 _In_ PNDIS_EVENT Event);
5866
5867 _IRQL_requires_max_(DISPATCH_LEVEL)
5868 NDISAPI
5869 VOID
5870 NTAPI
5871 NdisResetEvent(
5872 _In_ PNDIS_EVENT Event);
5873
5874 _When_(MsToWait != 0, _Check_return_)
5875 _IRQL_requires_(PASSIVE_LEVEL)
5876 NDISAPI
5877 BOOLEAN
5878 NTAPI
5879 NdisWaitEvent(
5880 _In_ PNDIS_EVENT Event,
5881 _In_ UINT MsToWait);
5882
5883 /* NDIS intermediate miniport structures */
5884
5885 typedef VOID (NTAPI *W_MINIPORT_CALLBACK)(
5886 IN NDIS_HANDLE MiniportAdapterContext,
5887 IN PVOID CallbackContext);
5888
5889 /* Routines for intermediate miniport drivers */
5890
5891 _IRQL_requires_(PASSIVE_LEVEL)
5892 NDISAPI
5893 NDIS_STATUS
5894 NTAPI
5895 NdisIMDeInitializeDeviceInstance(
5896 _In_ NDIS_HANDLE NdisMiniportHandle);
5897
5898 /*
5899 * NDIS_STATUS
5900 * NdisIMInitializeDeviceInstance(
5901 * IN NDIS_HANDLE DriverHandle,
5902 * IN PNDIS_STRING DeviceInstance);
5903 */
5904 #define NdisIMInitializeDeviceInstance(DriverHandle, DeviceInstance) \
5905 NdisIMInitializeDeviceInstanceEx(DriverHandle, DeviceInstance, NULL)
5906
5907 /* Functions obsoleted by NDIS 5.0 */
5908
5909 NDISAPI
5910 VOID
5911 NTAPI
5912 NdisFreeDmaChannel(
5913 IN PNDIS_HANDLE NdisDmaHandle);
5914
5915 NDISAPI
5916 VOID
5917 NTAPI
5918 NdisSetupDmaTransfer(
5919 OUT PNDIS_STATUS Status,
5920 IN PNDIS_HANDLE NdisDmaHandle,
5921 IN PNDIS_BUFFER Buffer,
5922 IN ULONG Offset,
5923 IN ULONG Length,
5924 IN BOOLEAN WriteToDevice);
5925
5926 /*
5927 NDISAPI
5928 NTSTATUS
5929 NTAPI
5930 NdisUpcaseUnicodeString(
5931 OUT PUNICODE_STRING DestinationString,
5932 IN PUNICODE_STRING SourceString);
5933 */
5934 #define NdisUpcaseUnicodeString(_d, _s) RtlUpcaseUnicodeString(_d, _s, FALSE)
5935
5936
5937 /* Routines for NDIS protocol drivers */
5938
5939 #if NDIS_LEGACY_PROTOCOL
5940
5941 NDISAPI
5942 NDIS_STATUS
5943 NTAPI
5944 NdisIMRegisterLayeredMiniport(
5945 _In_ NDIS_HANDLE NdisWrapperHandle,
5946 _In_ PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
5947 _In_ UINT CharacteristicsLength,
5948 _Out_ PNDIS_HANDLE DriverHandle);
5949
5950 NDISAPI
5951 VOID
5952 NTAPI
5953 NdisTransferData(
5954 OUT PNDIS_STATUS Status,
5955 IN NDIS_HANDLE NdisBindingHandle,
5956 IN NDIS_HANDLE MacReceiveContext,
5957 IN UINT ByteOffset,
5958 IN UINT BytesToTransfer,
5959 IN OUT PNDIS_PACKET Packet,
5960 OUT PUINT BytesTransferred);
5961
5962 NDISAPI
5963 VOID
5964 NTAPI
5965 NdisSend(
5966 OUT PNDIS_STATUS Status,
5967 IN NDIS_HANDLE NdisBindingHandle,
5968 IN PNDIS_PACKET Packet);
5969
5970 NDISAPI
5971 VOID
5972 NTAPI
5973 NdisSendPackets(
5974 IN NDIS_HANDLE NdisBindingHandle,
5975 IN PPNDIS_PACKET PacketArray,
5976 IN UINT NumberOfPackets);
5977
5978 _IRQL_requires_max_(DISPATCH_LEVEL)
5979 NDISAPI
5980 VOID
5981 NTAPI
5982 NdisRequest(
5983 _Out_ PNDIS_STATUS Status,
5984 _In_ NDIS_HANDLE NdisBindingHandle,
5985 _In_ PNDIS_REQUEST NdisRequest);
5986
5987 _IRQL_requires_max_(DISPATCH_LEVEL)
5988 NDISAPI
5989 VOID
5990 NTAPI
5991 NdisReset(
5992 _Out_ PNDIS_STATUS Status,
5993 _In_ NDIS_HANDLE NdisBindingHandle);
5994
5995 _IRQL_requires_max_(DISPATCH_LEVEL)
5996 NDISAPI
5997 VOID
5998 NTAPI
5999 NdisDeregisterProtocol(
6000 _Out_ PNDIS_STATUS Status,
6001 _In_ NDIS_HANDLE NdisProtocolHandle);
6002
6003 _IRQL_requires_(PASSIVE_LEVEL)
6004 NDISAPI
6005 VOID
6006 NTAPI
6007 NdisOpenAdapter(
6008 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
6009 _Out_ PNDIS_STATUS OpenErrorStatus,
6010 _Out_ PNDIS_HANDLE NdisBindingHandle,
6011 _Out_ PUINT SelectedMediumIndex,
6012 _In_reads_(MediumArraySize) PNDIS_MEDIUM MediumArray,
6013 _In_ UINT MediumArraySize,
6014 _In_ NDIS_HANDLE NdisProtocolHandle,
6015 _In_ NDIS_HANDLE ProtocolBindingContext,
6016 _In_ PNDIS_STRING AdapterName,
6017 _In_ UINT OpenOptions,
6018 _In_opt_ PSTRING AddressingInformation);
6019
6020 _IRQL_requires_(PASSIVE_LEVEL)
6021 NDISAPI
6022 VOID
6023 NTAPI
6024 NdisCloseAdapter(
6025 _Out_ PNDIS_STATUS Status,
6026 _In_ NDIS_HANDLE NdisBindingHandle);
6027
6028 _IRQL_requires_(PASSIVE_LEVEL)
6029 NDISAPI
6030 VOID
6031 NTAPI
6032 NdisCompleteBindAdapter(
6033 _In_ NDIS_HANDLE BindAdapterContext,
6034 _In_ NDIS_STATUS Status,
6035 _In_ NDIS_STATUS OpenStatus);
6036
6037 _IRQL_requires_(PASSIVE_LEVEL)
6038 NDISAPI
6039 VOID
6040 NTAPI
6041 NdisCompleteUnbindAdapter(
6042 _In_ NDIS_HANDLE UnbindAdapterContext,
6043 _In_ NDIS_STATUS Status);
6044
6045 NDISAPI
6046 VOID
6047 NTAPI
6048 NdisSetProtocolFilter(
6049 _At_(*Status, _Must_inspect_result_) _Out_ PNDIS_STATUS Status,
6050 _In_ NDIS_HANDLE NdisBindingHandle,
6051 _In_ RECEIVE_HANDLER ReceiveHandler,
6052 _In_ RECEIVE_PACKET_HANDLER ReceivePacketHandler,
6053 _In_ NDIS_MEDIUM Medium,
6054 _In_ UINT Offset,
6055 _In_ UINT Size,
6056 _In_ PUCHAR Pattern);
6057
6058 _IRQL_requires_max_(DISPATCH_LEVEL)
6059 NDISAPI
6060 VOID
6061 NTAPI
6062 NdisGetDriverHandle(
6063 _In_ PNDIS_HANDLE NdisBindingHandle,
6064 _Out_ PNDIS_HANDLE NdisDriverHandle);
6065
6066 _IRQL_requires_(PASSIVE_LEVEL)
6067 NDISAPI
6068 VOID
6069 NTAPI
6070 NdisOpenProtocolConfiguration(
6071 _Out_ PNDIS_STATUS Status,
6072 _Out_ PNDIS_HANDLE ConfigurationHandle,
6073 _In_ PNDIS_STRING ProtocolSection);
6074
6075 _IRQL_requires_(PASSIVE_LEVEL)
6076 NDISAPI
6077 VOID
6078 NTAPI
6079 NdisCompletePnPEvent(
6080 _In_ NDIS_STATUS Status,
6081 _In_ NDIS_HANDLE NdisBindingHandle,
6082 _In_ PNET_PNP_EVENT NetPnPEvent);
6083
6084 /*
6085 * VOID
6086 * NdisSetSendFlags(
6087 * IN PNDIS_PACKET Packet,
6088 * IN UINT Flags);
6089 */
6090 #define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
6091
6092 #define NdisQuerySendFlags(_Packet,_Flags) *(_Flags) = (_Packet)->Private.Flags
6093
6094 _IRQL_requires_max_(DISPATCH_LEVEL)
6095 NDISAPI
6096 VOID
6097 NTAPI
6098 NdisReturnPackets(
6099 _In_reads_(NumberOfPackets) PNDIS_PACKET *PacketsToReturn,
6100 _In_ UINT NumberOfPackets);
6101
6102 _Must_inspect_result_
6103 _IRQL_requires_max_(DISPATCH_LEVEL)
6104 NDISAPI
6105 PNDIS_PACKET
6106 NTAPI
6107 NdisGetReceivedPacket(
6108 _In_ PNDIS_HANDLE NdisBindingHandle,
6109 _In_ PNDIS_HANDLE MacContext);
6110
6111 _IRQL_requires_max_(DISPATCH_LEVEL)
6112 NDISAPI
6113 VOID
6114 NTAPI
6115 NdisCancelSendPackets(
6116 _In_ NDIS_HANDLE NdisBindingHandle,
6117 _In_ _Points_to_data_ PVOID CancelId);
6118
6119 _Must_inspect_result_
6120 _IRQL_requires_max_(DISPATCH_LEVEL)
6121 NDISAPI
6122 NDIS_STATUS
6123 NTAPI
6124 NdisQueryPendingIOCount(
6125 _In_ _Points_to_data_ PVOID NdisBindingHandle,
6126 _Out_ PULONG IoCount);
6127
6128 _IRQL_requires_(PASSIVE_LEVEL)
6129 NDISAPI
6130 VOID
6131 NTAPI
6132 NdisRegisterProtocol(
6133 _Out_ PNDIS_STATUS Status,
6134 _Out_ PNDIS_HANDLE NdisProtocolHandle,
6135 _In_ PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics,
6136 _In_ UINT CharacteristicsLength);
6137
6138 #endif /* NDIS_LEGACY_PROTOCOL */
6139
6140 _IRQL_requires_max_(DISPATCH_LEVEL)
6141 NDISAPI
6142 UCHAR
6143 NTAPI
6144 NdisGeneratePartialCancelId(VOID);
6145
6146 _IRQL_requires_(PASSIVE_LEVEL)
6147 NDISAPI
6148 VOID
6149 NTAPI
6150 NdisReEnumerateProtocolBindings(
6151 _In_ NDIS_HANDLE NdisProtocolHandle);
6152
6153 NDISAPI
6154 VOID
6155 NTAPI
6156 NdisRegisterTdiCallBack(
6157 _In_ TDI_REGISTER_CALLBACK RegisterCallback,
6158 _In_ TDI_PNP_HANDLER PnPHandler);
6159
6160 NDISAPI
6161 VOID
6162 NTAPI
6163 NdisDeregisterTdiCallBack(VOID);
6164
6165 /* Obsoleted in Windows XP */
6166
6167 /* Prototypes for NDIS_MAC_CHARACTERISTICS */
6168
6169 typedef NDIS_STATUS (*OPEN_ADAPTER_HANDLER)(
6170 OUT PNDIS_STATUS OpenErrorStatus,
6171 OUT NDIS_HANDLE *MacBindingHandle,
6172 OUT PUINT SelectedMediumIndex,
6173 IN PNDIS_MEDIUM MediumArray,
6174 IN UINT MediumArraySize,
6175 IN NDIS_HANDLE NdisBindingContext,
6176 IN NDIS_HANDLE MacAdapterContext,
6177 IN UINT OpenOptions,
6178 IN PSTRING AddressingInformation OPTIONAL);
6179
6180 typedef NDIS_STATUS (NTAPI *CLOSE_ADAPTER_HANDLER)(
6181 IN NDIS_HANDLE MacBindingHandle);
6182
6183 typedef NDIS_STATUS (NTAPI *WAN_TRANSFER_DATA_HANDLER)(
6184 VOID);
6185
6186 typedef NDIS_STATUS (NTAPI *QUERY_GLOBAL_STATISTICS_HANDLER)(
6187 IN NDIS_HANDLE MacAdapterContext,
6188 IN PNDIS_REQUEST NdisRequest);
6189
6190 typedef VOID (NTAPI *UNLOAD_MAC_HANDLER)(
6191 IN NDIS_HANDLE MacMacContext);
6192
6193 typedef NDIS_STATUS (NTAPI *ADD_ADAPTER_HANDLER)(
6194 IN NDIS_HANDLE MacMacContext,
6195 IN NDIS_HANDLE WrapperConfigurationContext,
6196 IN PNDIS_STRING AdapterName);
6197
6198 typedef VOID (*REMOVE_ADAPTER_HANDLER)(
6199 IN NDIS_HANDLE MacAdapterContext);
6200
6201 typedef struct _NDIS_MAC_CHARACTERISTICS {
6202 UCHAR MajorNdisVersion;
6203 UCHAR MinorNdisVersion;
6204 USHORT Filler;
6205 UINT Reserved;
6206 OPEN_ADAPTER_HANDLER OpenAdapterHandler;
6207 CLOSE_ADAPTER_HANDLER CloseAdapterHandler;
6208 SEND_HANDLER SendHandler;
6209 TRANSFER_DATA_HANDLER TransferDataHandler;
6210 RESET_HANDLER ResetHandler;
6211 REQUEST_HANDLER RequestHandler;
6212 QUERY_GLOBAL_STATISTICS_HANDLER QueryGlobalStatisticsHandler;
6213 UNLOAD_MAC_HANDLER UnloadMacHandler;
6214 ADD_ADAPTER_HANDLER AddAdapterHandler;
6215 REMOVE_ADAPTER_HANDLER RemoveAdapterHandler;
6216 NDIS_STRING Name;
6217 } NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS;
6218
6219 typedef NDIS_MAC_CHARACTERISTICS NDIS_WAN_MAC_CHARACTERISTICS;
6220 typedef NDIS_WAN_MAC_CHARACTERISTICS *PNDIS_WAN_MAC_CHARACTERISTICS;
6221
6222 #ifdef __cplusplus
6223 }
6224 #endif
6225
6226 #endif /* _NDIS_ */
6227
6228 /* EOF */
6229