ReactOS  0.4.13-dev-257-gfabbd7c
ndis.h
Go to the documentation of this file.
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 
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 {
70 
71 typedef enum _NET_PNP_EVENT_CODE {
87 
88 typedef struct _NET_PNP_EVENT {
90  PVOID Buffer;
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 
320 
321 typedef struct _REFERENCE {
326 
327 /* NDIS base types */
328 
329 typedef struct _NDIS_SPIN_LOCK {
333 
334 typedef struct _NDIS_EVENT {
337 
339 
342 
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 {
600  UCHAR cacheLine[16];
602 
603 typedef struct _NDIS_RW_LOCK {
604  __MINGW_EXTENSION union {
605  __MINGW_EXTENSION struct {
607  PVOID Context;
608  };
609  UCHAR Reserved[16];
610  };
611  __MINGW_EXTENSION union {
614  __MINGW_EXTENSION struct {
618  };
619  };
621 
622 typedef struct _LOCK_STATE {
624  KIRQL OldIrql;
626 
627 #endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
628 
629 /* Timer */
630 
633 _Function_class_(NDIS_TIMER_FUNCTION)
634 typedef VOID
635 (NTAPI NDIS_TIMER_FUNCTION)(
636  _In_ PVOID SystemSpecific1,
640 typedef NDIS_TIMER_FUNCTION *PNDIS_TIMER_FUNCTION;
641 
642 typedef struct _NDIS_TIMER {
646 
647 /* Hardware */
648 
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 
720 
721 typedef struct _NDIS_PACKET_PRIVATE {
733 
734 typedef struct _NDIS_PACKET {
736  __MINGW_EXTENSION union {
737  __MINGW_EXTENSION struct {
740  };
741  __MINGW_EXTENSION struct {
744  };
745  __MINGW_EXTENSION struct {
746  UCHAR MacReserved[4 * sizeof(PVOID)];
747  };
748  };
752 
753 typedef struct _NDIS_PACKET_STACK {
757 
758 #endif /* NDIS_LEGACY_DRIVER */
759 
760 typedef enum _NDIS_CLASS_ID {
765 } NDIS_CLASS_ID;
766 
773 
774 #if NDIS_LEGACY_DRIVER
775 typedef struct _NDIS_PACKET_OOB_DATA {
776  __MINGW_EXTENSION union {
779  };
786 #endif
787 
788 /* Request types used by NdisRequest */
789 typedef enum _NDIS_REQUEST_TYPE {
802 #if NDIS_SUPPORT_NDIS6
803  NdisRequestMethod,
804 #endif
806 
807 #if NDIS_LEGACY_DRIVER
808 typedef struct _NDIS_REQUEST {
809  UCHAR MacReserved[4 * sizeof(PVOID)];
811  union _DATA {
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
836 #endif /* NDIS_LEGACY_DRIVER */
837 
838 /* Wide Area Networks definitions */
839 
840 #if NDIS_LEGACY_DRIVER
841 typedef struct _NDIS_WAN_PACKET {
856 #endif
857 
858 /* DMA channel information */
859 
860 typedef struct _NDIS_DMA_DESCRIPTION {
869 
870 typedef struct _NDIS_DMA_BLOCK {
877 
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 {
892 
897 
898 /* Possible hardware architecture */
899 typedef enum _NDIS_INTERFACE_TYPE {
919 
920 #define NdisInterruptLevelSensitive LevelSensitive
921 #define NdisInterruptLatched Latched
922 
924 
925 typedef enum _NDIS_PARAMETER_TYPE {
932 
933 typedef struct _BINARY_DATA {
936 } BINARY_DATA;
937 
940  union {
944  } ParameterData;
946 
948 
953 
954 typedef struct _NDIS_WAN_LINE_DOWN {
958 
959 typedef struct _NDIS_WAN_LINE_UP {
971 
972 typedef NTSTATUS
975  _Out_ HANDLE *TdiHandle);
976 
977 typedef NTSTATUS
979  _In_ PUNICODE_STRING UpperComponent,
980  _In_ PUNICODE_STRING LowerComponent,
981  _In_ PUNICODE_STRING BindList,
982  _In_ PVOID ReconfigBuffer,
983  _In_ UINT ReconfigBufferSize,
985 
986 typedef struct _OID_LIST OID_LIST, *POID_LIST;
987 
988 /* PnP state */
998 
1006 #if NDIS_SUPPORT_NDIS6
1007  NdisDevicePnPEventFilterListChanged,
1008 #endif /* NDIS_SUPPORT_NDIS6 */
1011 
1012 /* Power profiles */
1013 typedef enum _NDIS_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 
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 {
1055 
1056 typedef struct _CO_SPECIFIC_PARAMETERS {
1061 
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 {
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 {
1098 
1099 typedef struct _CO_SAP {
1103 } CO_SAP, *PCO_SAP;
1104 
1105 #if NDIS_LEGACY_DRIVER
1106 typedef struct _NDIS_IPSEC_PACKET_INFO {
1107  __MINGW_EXTENSION union {
1108  struct {
1111  } Transmit;
1112  struct {
1117  } Receive;
1118  };
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 {
1151 
1152 typedef struct _NDIS_MAC_LINE_DOWN {
1155 
1156 typedef struct _NDIS_MAC_LINE_UP {
1164 
1165 typedef struct _NDIS_PACKET_8021Q_INFO {
1166  __MINGW_EXTENSION union {
1167  struct {
1172  } TagHeader;
1174  };
1176 
1192 
1193 #if NDIS_LEGACY_DRIVER
1194 
1195 typedef struct _NDIS_PACKET_EXTENSION {
1198 
1199 typedef enum _NDIS_TASK {
1204 } NDIS_TASK, *PNDIS_TASK;
1205 
1206 typedef enum _NDIS_ENCAPSULATION {
1214 
1217  struct {
1220  } Flags;
1223 
1231 
1232 typedef struct _NDIS_TASK_OFFLOAD {
1240 
1242  struct {
1248  } V4Transmit;
1249  struct {
1252  ULONG TcpChecksum:1;
1253  ULONG UdpChecksum:1;
1254  ULONG IpChecksum:1;
1255  } V4Receive;
1256  struct {
1259  ULONG TcpChecksum:1;
1260  ULONG UdpChecksum:1;
1261  } V6Transmit;
1262  struct {
1265  ULONG TcpChecksum:1;
1266  ULONG UdpChecksum:1;
1267  } V6Receive;
1269 
1270 #define NDIS_TASK_TCP_LARGE_SEND_V0 0
1271 
1279 
1280 typedef struct _NDIS_TASK_IPSEC {
1281  struct {
1286  } Supported;
1287  struct {
1294  } V4AH;
1295  struct {
1297  ULONG RESERVED:1;
1300  ULONG Transport:1;
1301  ULONG Tunnel:1;
1302  ULONG Send:1;
1303  ULONG Receive:1;
1304  } V4ESP;
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 {
1381  PVOID Caller;
1382  PVOID CallersCaller;
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 
1403  __MINGW_EXTENSION union {
1404  struct {
1410  } Transmit;
1411  struct {
1419  } Receive;
1421  };
1423 
1424 typedef struct _NDIS_WAN_CO_FRAGMENT {
1427 
1428 typedef struct _NDIS_WAN_FRAGMENT {
1432 
1433 typedef struct _WAN_CO_LINKPARAMS {
1438 
1439 typedef struct _NDIS_WAN_GET_STATS {
1456 
1457 /* Call Manager */
1458 
1459 typedef VOID
1462  IN NDIS_HANDLE CallMgrVcContext,
1464 
1465 typedef NDIS_STATUS
1467  IN NDIS_HANDLE CallMgrVcContext,
1471 
1472 typedef NDIS_STATUS
1475 
1476 typedef NDIS_STATUS
1478  IN NDIS_HANDLE CallMgrVcContext,
1480  IN PVOID CloseData OPTIONAL,
1481  IN UINT Size OPTIONAL);
1482 
1483 typedef NDIS_STATUS
1486 
1487 typedef VOID
1490  IN NDIS_HANDLE CallMgrVcContext);
1491 
1492 typedef NDIS_STATUS
1495  IN PVOID CloseData OPTIONAL,
1496  IN UINT Size OPTIONAL);
1497 
1498 typedef VOID
1501  IN NDIS_HANDLE CallMgrVcContext,
1503 
1504 typedef NDIS_STATUS
1506  IN NDIS_HANDLE CallMgrVcContext,
1510 
1511 typedef NDIS_STATUS
1513  IN NDIS_HANDLE CallMgrVcContext,
1515 
1516 typedef NDIS_STATUS
1518  IN NDIS_HANDLE CallMgrBindingContext,
1522 
1523 typedef NDIS_STATUS
1526  IN PCO_SAP Sap,
1529 
1530 typedef NDIS_STATUS
1535 
1536 typedef NDIS_STATUS
1539 
1540 #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
1541 
1542 /* Prototypes for NDIS 5.0 protocol characteristics */
1543 
1545 typedef VOID
1546 (NTAPI *CO_SEND_COMPLETE_HANDLER)(
1550 
1552 typedef VOID
1553 (NTAPI *CO_STATUS_HANDLER)(
1559 
1561 typedef UINT
1562 (NTAPI *CO_RECEIVE_PACKET_HANDLER)(
1566 
1568 typedef NDIS_STATUS
1569 (NTAPI *CO_REQUEST_HANDLER)(
1574 
1576 typedef VOID
1577 (NTAPI *CO_REQUEST_COMPLETE_HANDLER)(
1583 
1603  CO_REQUEST_HANDLER CmRequestHandler;
1604  CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1606 
1607 
1608 
1609 /* Call Manager clients */
1610 
1615 
1616 typedef VOID
1620 
1621 typedef VOID
1625  IN PCO_SAP Sap,
1627 
1628 typedef VOID
1632 
1633 typedef VOID
1639 
1640 typedef VOID
1645 
1646 typedef VOID
1651 
1652 typedef VOID
1658 
1659 typedef VOID
1663 
1664 typedef NDIS_STATUS
1669 
1670 typedef VOID
1674 
1675 typedef VOID
1677  IN NDIS_STATUS CloseStatus,
1679  IN PVOID CloseData OPTIONAL,
1680  IN UINT Size OPTIONAL);
1681 
1682 typedef VOID
1684  IN NDIS_STATUS DropStatus,
1686  IN PVOID CloseData OPTIONAL,
1687  IN UINT Size OPTIONAL);
1688 
1689 typedef VOID
1692 
1693 
1701  CO_REQUEST_HANDLER ClRequestHandler;
1702  CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1718 
1719 
1720 /* NDIS protocol structures */
1721 
1722 /* Prototypes for NDIS 3.0 protocol characteristics */
1723 
1724 typedef VOID
1729 
1730 typedef VOID
1734 
1735 typedef VOID
1739 
1740 typedef VOID
1745 
1746 typedef VOID
1752 
1753 typedef VOID
1756 
1757 typedef VOID
1762 
1763 typedef VOID
1768 
1769 typedef VOID
1774  _In_ UINT BytesTransferred);
1775 
1776 typedef VOID
1778  VOID);
1779 
1780 typedef NDIS_STATUS
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
1792  _In_ NDIS_HANDLE NdisLinkHandle,
1793  _In_ PUCHAR Packet,
1795 
1796 typedef VOID
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 
1834 
1835 
1836 /* Prototypes for NDIS 4.0 protocol characteristics */
1837 
1838 typedef INT
1842 
1843 typedef VOID
1846  IN NDIS_HANDLE BindContext,
1848  IN PVOID SystemSpecific1,
1850 
1851 typedef VOID
1855  IN NDIS_HANDLE UnbindContext);
1856 
1857 typedef NDIS_STATUS
1861 
1862 typedef VOID
1864  VOID);
1865 
1866 /* Protocol characteristics for NDIS 4.0 protocols */
1867 
1872  __MINGW_EXTENSION union {
1875  };
1878  __MINGW_EXTENSION union {
1881  };
1882  __MINGW_EXTENSION union {
1885  };
1888  __MINGW_EXTENSION union {
1891  };
1902 
1903 typedef VOID
1904 (NTAPI PROTCOL_CO_AF_REGISTER_NOTIFY)(
1907 typedef PROTCOL_CO_AF_REGISTER_NOTIFY *CO_AF_REGISTER_NOTIFY_HANDLER;
1908 
1909 #if NDIS_LEGACY_PROTOCOL
1910 
1912 #ifdef __cplusplus
1913  NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars;
1914 #else
1916 #endif
1918  CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
1919  CO_STATUS_HANDLER CoStatusHandler;
1920  CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
1923 
1924 #if (defined(NDIS50) || defined(NDIS51))
1926 #else
1928 #endif
1929 
1931 
1932 #endif /* NDIS_LEGACY_PROTOCOL */
1933 
1934 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
1935 
1936 typedef BOOLEAN
1938  _In_ NDIS_HANDLE MiniportAdapterContext);
1939 
1940 typedef VOID
1942  _In_ NDIS_HANDLE MiniportAdapterContext);
1943 
1944 typedef VOID
1946  _In_ NDIS_HANDLE MiniportAdapterContext);
1947 
1948 typedef VOID
1950  _In_ NDIS_HANDLE MiniportAdapterContext);
1951 
1952 typedef VOID
1954  _In_ NDIS_HANDLE MiniportAdapterContext);
1955 
1956 typedef NDIS_STATUS
1960  _In_ PNDIS_MEDIUM MediumArray,
1962  _In_ NDIS_HANDLE MiniportAdapterContext,
1964 
1965 typedef VOID
1967  _Out_ PBOOLEAN InterruptRecognized,
1968  _Out_ PBOOLEAN QueueMiniportHandleInterrupt,
1969  _In_ NDIS_HANDLE MiniportAdapterContext);
1970 
1971 typedef NDIS_STATUS
1973  _In_ NDIS_HANDLE MiniportAdapterContext,
1974  _In_ NDIS_OID Oid,
1975  _In_ PVOID InformationBuffer,
1976  _In_ ULONG InformationBufferLength,
1978  _Out_ PULONG BytesNeeded);
1979 
1980 typedef NDIS_STATUS
1983  _In_ NDIS_HANDLE MiniportAdapterContext,
1985 
1986 typedef NDIS_STATUS
1988  _Out_ PBOOLEAN AddressingReset,
1989  _In_ NDIS_HANDLE MiniportAdapterContext);
1990 
1991 typedef NDIS_STATUS
1993  _In_ NDIS_HANDLE MiniportAdapterContext,
1995  _In_ UINT Flags);
1996 
1997 typedef NDIS_STATUS
1999  _In_ NDIS_HANDLE MiniportAdapterContext,
2000  _In_ NDIS_HANDLE NdisLinkHandle,
2002 
2003 typedef NDIS_STATUS
2005  _In_ NDIS_HANDLE MiniportAdapterContext,
2006  _In_ NDIS_OID Oid,
2007  _In_ PVOID InformationBuffer,
2008  _In_ ULONG InformationBufferLength,
2010  _Out_ PULONG BytesNeeded);
2011 
2012 typedef NDIS_STATUS
2015  _Out_ PUINT BytesTransferred,
2016  _In_ NDIS_HANDLE MiniportAdapterContext,
2017  _In_ NDIS_HANDLE MiniportReceiveContext,
2019  _In_ UINT BytesToTransfer);
2020 
2021 typedef NDIS_STATUS
2023 
2024 typedef VOID
2026  _In_ PVOID ShutdownContext);
2027 
2028 typedef VOID
2030  _In_ NDIS_HANDLE MiniportAdapterContext,
2032 
2033 typedef VOID
2035  _In_ NDIS_HANDLE MiniportAdapterContext,
2038 
2039 typedef VOID
2041  _In_ NDIS_HANDLE MiniportAdapterContext,
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 
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 
2092 
2093 /* Extensions for NDIS 5.0 miniports */
2094 
2096 _Function_class_(MINIPORT_CO_CREATE_VC)
2097 typedef NDIS_STATUS
2098 (NTAPI MINIPORT_CO_CREATE_VC)(
2099  _In_ NDIS_HANDLE MiniportAdapterContext,
2102 typedef MINIPORT_CO_CREATE_VC *W_CO_CREATE_VC_HANDLER;
2103 
2105 _Function_class_(MINIPORT_CO_DELETE_VC)
2106 typedef NDIS_STATUS
2107 (NTAPI MINIPORT_CO_DELETE_VC)(
2109 typedef MINIPORT_CO_DELETE_VC *W_CO_DELETE_VC_HANDLER;
2110 
2112 _Function_class_(MINIPORT_CO_ACTIVATE_VC)
2113 typedef NDIS_STATUS
2114 (NTAPI MINIPORT_CO_ACTIVATE_VC)(
2117 typedef MINIPORT_CO_ACTIVATE_VC *W_CO_ACTIVATE_VC_HANDLER;
2118 
2120 _Function_class_(MINIPORT_CO_DEACTIVATE_VC)
2121 typedef NDIS_STATUS
2122 (NTAPI MINIPORT_CO_DEACTIVATE_VC)(
2124 typedef MINIPORT_CO_DEACTIVATE_VC *W_CO_DEACTIVATE_VC_HANDLER;
2125 
2126 typedef VOID
2131 
2132 typedef NDIS_STATUS
2134  _In_ NDIS_HANDLE MiniportAdapterContext,
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 
2165 
2166 /* Extensions for NDIS 5.1 miniports */
2167 
2168 typedef VOID
2170  _In_ NDIS_HANDLE MiniportAdapterContext,
2171  _In_ PVOID CancelId);
2172 
2173 typedef VOID
2175  _In_ NDIS_HANDLE MiniportAdapterContext,
2176  _In_ NDIS_DEVICE_PNP_EVENT PnPEvent,
2177  _In_ PVOID InformationBuffer,
2178  _In_ ULONG InformationBufferLength);
2179 
2180 typedef VOID
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 
2213 
2214 #if defined(NDIS51_MINIPORT)
2215 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2218 #elif defined(NDIS50_MINIPORT)
2219 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2222 #elif defined(NDIS40_MINIPORT)
2223 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2226 #else /* NDIS30 */
2230 #endif
2231 
2246 
2247 /* Structures available only to full MAC drivers */
2248 
2249 typedef BOOLEAN
2251  IN PVOID InterruptContext);
2252 
2253 typedef VOID
2255  IN PVOID SystemSpecific1,
2256  IN PVOID InterruptContext,
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;
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 {
2279 
2280 typedef struct _NDIS_INTERRUPT {
2291 
2292 
2293 typedef enum _NDIS_WORK_ITEM_TYPE {
2304 
2305 #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
2306 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
2307 
2313 
2314 struct _NDIS_WORK_ITEM;
2315 typedef VOID (NTAPI *NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
2316 
2317 typedef struct _NDIS_WORK_ITEM {
2319  NDIS_PROC Routine;
2322 
2323 typedef struct _NDIS_BIND_PATHS {
2327 
2328 
2329 typedef VOID
2332 
2333 typedef VOID
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
2347 
2348 typedef VOID
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
2362  _In_ NDIS_HANDLE Miniport,
2365 
2366 typedef VOID
2369 
2370 typedef VOID
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
2383  _In_ NDIS_HANDLE NdisLinkContext);
2384 
2385 typedef VOID
2389  _In_ NDIS_HANDLE NdisLinkContext,
2390  _In_ PUCHAR Packet,
2392 
2393 typedef VOID
2395  IN PNDIS_MINIPORT_BLOCK Miniport,
2396  IN NDIS_WORK_ITEM_TYPE WorkItemType,
2397  OUT PVOID *WorkItemContext);
2398 
2399 typedef NDIS_STATUS
2401  IN PNDIS_MINIPORT_BLOCK Miniport,
2402  IN NDIS_WORK_ITEM_TYPE WorkItemType,
2403  IN PVOID WorkItemContext);
2404 
2405 typedef NDIS_STATUS
2407  IN PNDIS_MINIPORT_BLOCK Miniport,
2408  IN NDIS_WORK_ITEM_TYPE WorkItemType,
2409  IN PVOID WorkItemContext);
2410 
2411 typedef VOID
2415 
2416 typedef VOID
2420  _In_ BOOLEAN AddressingReset);
2421 
2422 typedef VOID
2427 
2428 typedef VOID
2431 
2432 typedef BOOLEAN
2434  _In_ PNDIS_MINIPORT_BLOCK Miniport);
2435 
2436 typedef VOID
2438  _In_ NDIS_HANDLE MiniportHandle,
2442 
2443 typedef VOID
2446 
2447 typedef VOID
2452  _In_ UINT BytesTransferred);
2453 
2456  _In_ PVOID Packet,
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 {
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 
2543  FILTERDBS_S
2590 #if defined(NDIS_WRAPPER)
2591  PNDIS_MINIPORT_BLOCK NextGlobalMiniport;
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;
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;
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;
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
2694  _In_ NDIS_HANDLE MacBindingHandle,
2695  _In_ NDIS_HANDLE LinkHandle,
2696  _In_ PVOID Packet);
2697 
2698 typedef VOID
2700  _In_ NDIS_HANDLE MiniportAdapterContext,
2703 
2704 typedef NDIS_STATUS
2708 
2709 typedef NDIS_STATUS
2712  _In_ NDIS_HANDLE MacReceiveContext,
2714  _In_ UINT BytesToTransfer,
2716  _Out_ PUINT BytesTransferred);
2717 
2718 typedef NDIS_STATUS
2721 
2722 typedef NDIS_STATUS
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 {
2791 
2793 {
2794 #ifdef __cplusplus
2795  NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
2796 #else
2798 #endif
2799 };
2800 
2801 #include <xfilter.h>
2802 
2803 #define NDIS_M_MAX_LOOKAHEAD 526
2804 
2806 NDISAPI
2807 VOID
2808 NTAPI
2813 
2815 NDISAPI
2816 VOID
2817 NTAPI
2821 
2823 NDISAPI
2824 VOID
2825 NTAPI
2826 NdisSetTimer(
2829 
2830 NDISAPI
2831 VOID
2832 NTAPI
2834  _In_ PNDIS_TIMER NdisTimer,
2835  _In_ UINT MillisecondsPeriod);
2836 
2838 NDISAPI
2839 VOID
2840 NTAPI
2842  _In_ PNDIS_TIMER NdisTimer,
2845 
2847 NDISAPI
2848 PVOID
2849 NTAPI
2851  _In_ PNDIS_STRING NdisRoutineName);
2852 
2854 NDISAPI
2855 UINT
2856 NTAPI
2858 
2859 #if NDIS_LEGACY_DRIVER
2860 
2862 NDISAPI
2863 VOID
2864 NTAPI
2871 
2873 NDISAPI
2874 VOID
2875 NTAPI
2880 
2882 NDISAPI
2883 VOID
2884 NTAPI
2887 
2888 /*
2889 NDISAPI
2890 VOID
2891 NTAPI
2892 NdisFreeBuffer(
2893  IN PNDIS_BUFFER Buffer);
2894 */
2895 #define NdisFreeBuffer IoFreeMdl
2896 
2898 NDISAPI
2899 VOID
2900 NTAPI
2906 
2908 NDISAPI
2909 VOID
2910 NTAPI
2917 
2919 NDISAPI
2920 VOID
2921 NTAPI
2923  _In_ NDIS_HANDLE PacketPoolHandle,
2925 
2927 NDISAPI
2928 UINT
2929 NTAPI
2932 
2934 NDISAPI
2935 UINT
2936 NTAPI
2938  _In_ UINT ProtocolReservedSize);
2939 
2941 NDISAPI
2943 NTAPI
2946 
2948 NDISAPI
2950 NTAPI
2954 
2956 NDISAPI
2957 VOID
2958 NTAPI
2961 
2963 NDISAPI
2964 VOID
2965 NTAPI
2968 
2970 NDISAPI
2971 VOID
2972 NTAPI
2975 
2977 NDISAPI
2978 VOID
2979 NTAPI
2982 
2984 NDISAPI
2985 VOID
2986 NTAPI
2991 
2993 NDISAPI
2994 VOID
2995 NTAPI
3000 
3002 NDISAPI
3003 VOID
3004 NTAPI
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
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
3153 
3154 NDISAPI
3155 VOID
3156 NTAPI
3160 
3162 NDISAPI
3163 VOID
3164 NTAPI
3172 
3173 NDISAPI
3174 VOID
3175 NTAPI
3184 
3186 __drv_preferredFunction("NdisAllocateMemoryWithTag", "Obsolete")
3187 NDISAPI
3189 NTAPI
3193  _In_ UINT Length,
3194  _In_ UINT MemoryFlags,
3196 
3197 #define NdisInitializeWorkItem(_WI_, _R_, _C_) { \
3198  (_WI_)->Context = _C_; \
3199  (_WI_)->Routine = _R_; \
3200 }
3201 
3203 NDISAPI
3205 NTAPI
3208 
3210 NDISAPI
3211 VOID
3212 NTAPI
3217  _In_ ULONG Code);
3218 
3219 #endif /* NDIS_LEGACY_DRIVER */
3220 
3222 NDISAPI
3223 VOID
3224 NTAPI
3225 NdisOpenFile(
3231 
3233 NDISAPI
3234 VOID
3235 NTAPI
3238 
3240 NDISAPI
3241 VOID
3242 NTAPI
3243 NdisMapFile(
3247 
3249 NDISAPI
3250 VOID
3251 NTAPI
3254 
3256 NDISAPI
3257 ULONG
3258 NTAPI
3260 
3261 #define NdisFlushBuffer(Buffer,WriteToDevice) \
3262  KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE)
3263 
3265 NDISAPI
3266 VOID
3267 NTAPI
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
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
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
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))
3748 NDISAPI
3749 VOID
3750 NTAPI
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
3762  IN ULONG Tag);
3763 
3764 NDISAPI
3765 VOID
3766 NTAPI
3769  IN ULONG SharedMemoryAddress,
3770  OUT PUCHAR Buffer,
3771  IN ULONG Length);
3772 
3773 NDISAPI
3774 VOID
3775 NTAPI
3778  IN ULONG SharedMemoryAddress,
3779  IN PUCHAR Buffer,
3780  IN ULONG Length);
3781 
3783 NDISAPI
3784 VOID
3785 NTAPI
3794 
3796 NDISAPI
3798 NTAPI
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
3818  IN NDIS_HANDLE NdisAdapterHandle,
3819  IN ULONG Length,
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
3931  IN PUCHAR Block,
3933  );
3934 
3935 /* Configuration routines */
3936 
3937 #if NDIS_LEGACY_DRIVER
3939 _Success_(*Status >= 0)
3940 NDISAPI
3941 VOID
3942 NTAPI
3947 #endif
3948 
3950 _Success_(*Status >= 0)
3951 NDISAPI
3952 VOID
3953 NTAPI
3960 
3961 NDISAPI
3962 VOID
3963 NTAPI
3969 
3970 NDISAPI
3971 VOID
3972 NTAPI
3978  OUT PUINT NumberOfFunctions);
3979 
3980 #if NDIS_LEGACY_MINIPORT
3981 
3983 NDISAPI
3984 ULONG
3985 NTAPI
3987  _In_ NDIS_HANDLE NdisAdapterHandle,
3989  _In_ ULONG Offset,
3991  _In_ ULONG Length);
3992 
3994 NDISAPI
3995 ULONG
3996 NTAPI
3998  _In_ NDIS_HANDLE NdisAdapterHandle,
4000  _In_ ULONG Offset,
4002  _In_ ULONG Length);
4003 
4005 NDISAPI
4006 ULONG
4007 NTAPI
4009  _In_ NDIS_HANDLE NdisAdapterHandle,
4010  _In_ ULONG Offset,
4012  _In_ ULONG Length);
4013 
4015 NDISAPI
4016 ULONG
4017 NTAPI
4019  _In_ NDIS_HANDLE NdisAdapterHandle,
4020  _In_ ULONG Offset,
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
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) = *(Register)
4260 
4261 /*
4262  * VOID
4263  * NdisReadRegisterUlong(
4264  * IN PULONG Register,
4265  * OUT PULONG Data);
4266  */
4267 #define NdisReadRegisterUlong(Register, Data) \
4268  *(Data) = *(Register)
4269 
4270 /*
4271  * VOID
4272  * NdisReadRegisterUshort(
4273  * IN PUSHORT Register,
4274  * OUT PUSHORT Data);
4275  */
4276 #define NdisReadRegisterUshort(Register, Data) \
4277  *(Data) = *(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 
4401 NDISAPI
4402 VOID
4403 NTAPI
4406 
4408 _Success_(*Status >= 0)
4409 NDISAPI
4410 VOID
4411 NTAPI
4418 
4420 _Success_(*Status >= 0)
4421 NDISAPI
4422 VOID
4423 NTAPI
4429 
4431 NDISAPI
4432 VOID
4433 __cdecl
4435  _In_ NDIS_HANDLE NdisAdapterHandle,
4438  ...);
4439 
4441 NDISAPI
4442 VOID
4443 NTAPI
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
4466 NDISAPI
4467 CCHAR
4468 NTAPI
4470 #endif
4471 
4472 NDISAPI
4473 VOID
4474 NTAPI
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 
4500 NDISAPI
4501 VOID
4502 NTAPI
4505  _In_ ULONG Length,
4509 
4510 NDISAPI
4511 VOID
4512 NTAPI
4516  IN NDIS_HANDLE NdisLinkContext,
4517  IN PUCHAR PacketBuffer,
4518  IN UINT PacketSize);
4519 
4520 NDISAPI
4521 VOID
4522 NTAPI
4525  IN NDIS_HANDLE NdisLinkContext);
4526 
4527 NDISAPI
4528 VOID
4529 NTAPI
4534 
4535 NDISAPI
4537 NTAPI
4539  IN NDIS_HANDLE NdisMacHandle,
4540  IN NDIS_HANDLE NdisWrapperHandle,
4543  OUT PNDIS_RESOURCE_LIST *AssignedResources);
4544 
4545 
4546 /* NDIS 5.0 extensions */
4547 
4549 NDISAPI
4551 NTAPI
4556  _In_ ULONG Tag);
4557 
4559 NDISAPI
4560 VOID
4561 NTAPI
4563  _Out_ PULONG pIdleCount,
4565  _Out_ PULONG pIndex);
4566 
4567 #if NDIS_LEGACY_DRIVER
4568 NDISAPI
4569 VOID
4570 NTAPI
4572  OUT PULONG pSystemUpTime);
4573 #endif
4574 
4575 #if NDIS_SUPPORT_60_COMPATIBLE_API
4576