[NDIS]
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 23 Jul 2010 15:51:54 +0000 (15:51 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 23 Jul 2010 15:51:54 +0000 (15:51 +0000)
- Guard several definitions against NDIS_SUPPORT_60_COMPATIBLE_API.
- __GNU_EXTENSION -> __MINGW_EXTENSION conversions.
- Group some related definitions.
- Update NDIS_RW_LOCK.
- Improve NDIS_TIMER_FUNCTION.
- Add several missing Ndis* function declarations.
- Guard several definitions against NDIS_LEGACY_DRIVER and NDIS_LEGACY_MINIPORT.
- Convert some function declarations into macros.

svn path=/trunk/; revision=48211

reactos/include/ddk/ndis.h

index e58e5db..afc55c1 100644 (file)
@@ -595,45 +595,54 @@ typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
 #define NDIS_ATTRIBUTE_NOT_CO_NDIS              0x00000100
 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS    0x00000200
 
 #define NDIS_ATTRIBUTE_NOT_CO_NDIS              0x00000100
 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS    0x00000200
 
-
 /* Lock */
 
 /* Lock */
 
+#if NDIS_SUPPORT_60_COMPATIBLE_API
+
 typedef union _NDIS_RW_LOCK_REFCOUNT {
 typedef union _NDIS_RW_LOCK_REFCOUNT {
-  UINT  RefCount;
-  UCHAR  cacheLine[16];
+  UINT RefCount;
+  UCHAR cacheLine[16];
 } NDIS_RW_LOCK_REFCOUNT;
 
 typedef struct _NDIS_RW_LOCK {
 } NDIS_RW_LOCK_REFCOUNT;
 
 typedef struct _NDIS_RW_LOCK {
-  __GNU_EXTENSION union {
-    __GNU_EXTENSION struct {
-      KSPIN_LOCK  SpinLock;
-      PVOID  Context;
+  __MINGW_EXTENSION union {
+    __MINGW_EXTENSION struct {
+      KSPIN_LOCK SpinLock;
+      PVOID Context;
+    };
+    UCHAR Reserved[16];
+  };
+  __MINGW_EXTENSION union {
+    NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS]; 
+    ULONG RefCountEx[sizeof(NDIS_RW_LOCK_REFCOUNT)/sizeof(ULONG) * MAXIMUM_PROCESSORS];
+    __MINGW_EXTENSION struct {
+      KSPIN_LOCK RefCountLock;
+      volatile ULONG SharedRefCount;
+      volatile BOOLEAN WriterWaiting;
     };
     };
-    UCHAR  Reserved[16];
   };
   };
-
-  NDIS_RW_LOCK_REFCOUNT  RefCount[MAXIMUM_PROCESSORS];
 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
 
 typedef struct _LOCK_STATE {
 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
 
 typedef struct _LOCK_STATE {
-  USHORT  LockState;
-  KIRQL  OldIrql;
+  USHORT LockState;
+  KIRQL OldIrql;
 } LOCK_STATE, *PLOCK_STATE;
 
 } LOCK_STATE, *PLOCK_STATE;
 
-
+#endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
 
 /* Timer */
 
 typedef VOID
 
 /* Timer */
 
 typedef VOID
-(NTAPI *PNDIS_TIMER_FUNCTION)(
-       IN PVOID  SystemSpecific1,
-       IN PVOID  FunctionContext,
-       IN PVOID  SystemSpecific2,
-       IN PVOID  SystemSpecific3);
+(NTAPI NDIS_TIMER_FUNCTION)(
+  IN PVOID SystemSpecific1,
+  IN PVOID FunctionContext,
+  IN PVOID SystemSpecific2,
+  IN PVOID SystemSpecific3);
+typedef NDIS_TIMER_FUNCTION *PNDIS_TIMER_FUNCTION;
 
 typedef struct _NDIS_TIMER {
 
 typedef struct _NDIS_TIMER {
-  KTIMER  Timer;
-  KDPC  Dpc;
+  KTIMER Timer;
+  KDPC Dpc;
 } NDIS_TIMER, *PNDIS_TIMER;
 
 /* Hardware */
 } NDIS_TIMER, *PNDIS_TIMER;
 
 /* Hardware */
@@ -1941,2995 +1950,3212 @@ typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
 #endif
 
 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
 #endif
 
+#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
 
 
+/* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
 
 
-/* Buffer management routines */
+typedef BOOLEAN
+(NTAPI *W_CHECK_FOR_HANG_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisAllocateBuffer(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_BUFFER  *Buffer,
-  IN NDIS_HANDLE  PoolHandle,
-  IN PVOID  VirtualAddress,
-  IN UINT  Length);
+typedef VOID
+(NTAPI *W_DISABLE_INTERRUPT_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
+typedef VOID
+(NTAPI *W_ENABLE_INTERRUPT_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisAllocateBufferPool(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_HANDLE  PoolHandle,
-  IN UINT  NumberOfDescriptors);
+typedef VOID
+(NTAPI *W_HALT_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisAllocatePacket(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_PACKET  *Packet,
-  IN NDIS_HANDLE  PoolHandle);
+typedef VOID
+(NTAPI *W_HANDLE_INTERRUPT_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisAllocatePacketPool(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_HANDLE  PoolHandle,
-  IN UINT  NumberOfDescriptors,
-  IN UINT  ProtocolReservedLength);
+typedef NDIS_STATUS
+(NTAPI *W_INITIALIZE_HANDLER)(
+  OUT PNDIS_STATUS  OpenErrorStatus,
+  OUT PUINT  SelectedMediumIndex,
+  IN PNDIS_MEDIUM  MediumArray,
+  IN UINT  MediumArraySize,
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE  WrapperConfigurationContext);
 
 
-#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
+typedef VOID
+(NTAPI *W_ISR_HANDLER)(
+  OUT PBOOLEAN  InterruptRecognized,
+  OUT PBOOLEAN  QueueMiniportHandleInterrupt,
+  IN   NDIS_HANDLE  MiniportAdapterContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCopyBuffer(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_BUFFER  *Buffer,
-  IN NDIS_HANDLE  PoolHandle,
-  IN PVOID  MemoryDescriptor,
-  IN UINT  Offset,
-  IN UINT  Length);
+typedef NDIS_STATUS
+(NTAPI *W_QUERY_INFORMATION_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_OID  Oid,
+  IN PVOID  InformationBuffer,
+  IN ULONG  InformationBufferLength,
+  OUT PULONG  BytesWritten,
+  OUT PULONG  BytesNeeded);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCopyFromPacketToPacket(
-  IN PNDIS_PACKET  Destination,
-  IN UINT  DestinationOffset,
-  IN UINT  BytesToCopy,
-  IN PNDIS_PACKET  Source,
-  IN UINT  SourceOffset,
-  OUT PUINT  BytesCopied);
+typedef NDIS_STATUS
+(NTAPI *W_RECONFIGURE_HANDLER)(
+  OUT PNDIS_STATUS  OpenErrorStatus,
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE       WrapperConfigurationContext);
 
 
-/*
- * VOID
- * NdisCopyLookaheadData(
- *   IN PVOID Destination,
- *   IN PVOID Source,
- *   IN ULONG Length,
- *   IN ULONG ReceiveFlags);
- */
+typedef NDIS_STATUS
+(NTAPI *W_RESET_HANDLER)(
+  OUT PBOOLEAN  AddressingReset,
+  IN NDIS_HANDLE  MiniportAdapterContext);
 
 
-#if defined(_M_IX86) || defined(_M_AMD64)
-#define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
-  RtlCopyMemory(Destination, Source, Length)
-#else
-#define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
-  { \
-    if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
-    { \
-      RtlCopyMemory(_Destination, _Source, _Length); \
-    } \
-    else \
-    { \
-      PUCHAR _Src = (PUCHAR)(Source); \
-      PUCHAR _Dest = (PUCHAR)(Destination); \
-      PUCHAR _End = _Dest + (Length); \
-      while (_Dest < _End) \
-        *_Dest++ = *_Src++; \
-    } \
-  }
-#endif
+typedef NDIS_STATUS
+(NTAPI *W_SEND_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN PNDIS_PACKET  Packet,
+  IN UINT  Flags);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisDprAllocatePacket(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_PACKET  *Packet,
-  IN NDIS_HANDLE  PoolHandle);
+typedef NDIS_STATUS
+(NTAPI *WM_SEND_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE  NdisLinkHandle,
+  IN PNDIS_WAN_PACKET  Packet);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisDprAllocatePacketNonInterlocked(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_PACKET  *Packet,
-  IN NDIS_HANDLE  PoolHandle);
+typedef NDIS_STATUS
+(NTAPI *W_SET_INFORMATION_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_OID  Oid,
+  IN PVOID  InformationBuffer,
+  IN ULONG  InformationBufferLength,
+  OUT PULONG  BytesRead,
+  OUT PULONG  BytesNeeded);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisDprFreePacket(
-  IN PNDIS_PACKET  Packet);
+typedef NDIS_STATUS
+(NTAPI *W_TRANSFER_DATA_HANDLER)(
+  OUT PNDIS_PACKET  Packet,
+  OUT PUINT  BytesTransferred,
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE  MiniportReceiveContext,
+  IN UINT  ByteOffset,
+  IN UINT  BytesToTransfer);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisDprFreePacketNonInterlocked(
-  IN PNDIS_PACKET  Packet);
+typedef NDIS_STATUS
+(NTAPI *WM_TRANSFER_DATA_HANDLER)(
+  VOID);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisFreeBufferPool(
-  IN NDIS_HANDLE  PoolHandle);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisFreePacket(
-  IN PNDIS_PACKET  Packet);
+/* NDIS structures available only to miniport drivers */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisFreePacketPool(
-  IN NDIS_HANDLE  PoolHandle);
+#define NDIS30_MINIPORT_CHARACTERISTICS_S \
+  UCHAR  MajorNdisVersion; \
+  UCHAR  MinorNdisVersion; \
+  UINT  Reserved; \
+  W_CHECK_FOR_HANG_HANDLER  CheckForHangHandler; \
+  W_DISABLE_INTERRUPT_HANDLER  DisableInterruptHandler; \
+  W_ENABLE_INTERRUPT_HANDLER  EnableInterruptHandler; \
+  W_HALT_HANDLER  HaltHandler; \
+  W_HANDLE_INTERRUPT_HANDLER  HandleInterruptHandler; \
+  W_INITIALIZE_HANDLER  InitializeHandler; \
+  W_ISR_HANDLER  ISRHandler; \
+  W_QUERY_INFORMATION_HANDLER  QueryInformationHandler; \
+  W_RECONFIGURE_HANDLER  ReconfigureHandler; \
+  W_RESET_HANDLER  ResetHandler; \
+  W_SEND_HANDLER  SendHandler; \
+  W_SET_INFORMATION_HANDLER  SetInformationHandler; \
+  W_TRANSFER_DATA_HANDLER  TransferDataHandler;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisReturnPackets(
-  IN PNDIS_PACKET  *PacketsToReturn,
-  IN UINT  NumberOfPackets);
+typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
+  NDIS30_MINIPORT_CHARACTERISTICS_S
+} NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisUnchainBufferAtBack(
-  IN OUT PNDIS_PACKET  Packet,
-  OUT PNDIS_BUFFER  *Buffer);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisUnchainBufferAtFront(
-  IN OUT PNDIS_PACKET  Packet,
-  OUT PNDIS_BUFFER  *Buffer);
+/* Extensions for NDIS 4.0 miniports */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisAdjustBufferLength(
-  IN PNDIS_BUFFER  Buffer,
-  IN UINT  Length);
+typedef VOID
+(NTAPI *W_SEND_PACKETS_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN PPNDIS_PACKET  PacketArray,
+  IN UINT  NumberOfPackets);
 
 
-NDISAPI
-ULONG
-NTAPI
-NdisBufferLength(
-  IN PNDIS_BUFFER  Buffer);
+typedef VOID
+(NTAPI *W_RETURN_PACKET_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN PNDIS_PACKET  Packet);
 
 
-NDISAPI
-PVOID
-NTAPI
-NdisBufferVirtualAddress(
-  IN PNDIS_BUFFER  Buffer);
+typedef VOID
+(NTAPI *W_ALLOCATE_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN PVOID  VirtualAddress,
+  IN PNDIS_PHYSICAL_ADDRESS  PhysicalAddress,
+  IN ULONG  Length,
+  IN PVOID  Context);
 
 
-NDISAPI
-ULONG
-NTAPI
-NDIS_BUFFER_TO_SPAN_PAGES(
-  IN PNDIS_BUFFER  Buffer);
+#ifdef __cplusplus
 
 
-NDISAPI
-VOID
-NTAPI
-NdisFreeBuffer(
-  IN PNDIS_BUFFER  Buffer);
+#define NDIS40_MINIPORT_CHARACTERISTICS_S \
+  NDIS30_MINIPORT_CHARACTERISTICS  Ndis30Chars; \
+  W_RETURN_PACKET_HANDLER  ReturnPacketHandler; \
+  W_SEND_PACKETS_HANDLER  SendPacketsHandler; \
+  W_ALLOCATE_COMPLETE_HANDLER  AllocateCompleteHandler;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisGetBufferPhysicalArraySize(
-  IN PNDIS_BUFFER  Buffer,
-  OUT PUINT  ArraySize);
+#else /* !__cplusplus */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisGetFirstBufferFromPacket(
-  IN PNDIS_PACKET  _Packet,
-  OUT PNDIS_BUFFER  *_FirstBuffer,
-  OUT PVOID  *_FirstBufferVA,
-  OUT PUINT  _FirstBufferLength,
-  OUT PUINT  _TotalBufferLength);
+#define NDIS40_MINIPORT_CHARACTERISTICS_S \
+  NDIS30_MINIPORT_CHARACTERISTICS_S \
+  W_RETURN_PACKET_HANDLER  ReturnPacketHandler; \
+  W_SEND_PACKETS_HANDLER  SendPacketsHandler; \
+  W_ALLOCATE_COMPLETE_HANDLER  AllocateCompleteHandler;
 
 
-/*
- * VOID
- * NdisGetFirstBufferFromPacketSafe(
- * IN PNDIS_PACKET  _Packet,
- * OUT PNDIS_BUFFER  * _FirstBuffer,
- * OUT PVOID  * _FirstBufferVA,
- * OUT PUINT  _FirstBufferLength,
- * OUT PUINT  _TotalBufferLength),
- * IN MM_PAGE_PRIORITY _Priority)
- */
-#define NdisGetFirstBufferFromPacketSafe(_Packet,         \
-                                     _FirstBuffer,        \
-                                     _FirstBufferVA,      \
-                                     _FirstBufferLength,  \
-                                     _TotalBufferLength,  \
-                                     _Priority)           \
-{                                                         \
-  PNDIS_BUFFER _Buffer;                                   \
-                                                          \
-  _Buffer         = (_Packet)->Private.Head;              \
-  *(_FirstBuffer) = _Buffer;                              \
-  if (_Buffer != NULL)                                    \
-    {                                                     \
-            *(_FirstBufferVA)     = MmGetSystemAddressForMdlSafe(_Buffer, _Priority);  \
-            *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer);         \
-            _Buffer = _Buffer->Next;                                    \
-                  *(_TotalBufferLength) = *(_FirstBufferLength);              \
-                  while (_Buffer != NULL) {                                   \
-                    *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer);      \
-                    _Buffer = _Buffer->Next;                                  \
-                  }                                                           \
-    }                             \
-  else                            \
-    {                             \
-      *(_FirstBufferVA) = 0;      \
-      *(_FirstBufferLength) = 0;  \
-      *(_TotalBufferLength) = 0;  \
-    } \
-}
+#endif /* !__cplusplus */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisQueryBuffer(
-  IN PNDIS_BUFFER  Buffer,
-  OUT PVOID  *VirtualAddress OPTIONAL,
-  OUT PUINT  Length);
+typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
+  NDIS40_MINIPORT_CHARACTERISTICS_S
+} NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisQueryBufferOffset(
-  IN PNDIS_BUFFER  Buffer,
-  OUT PUINT  Offset,
-  OUT PUINT  Length);
 
 
-/*
- * PVOID
- * NDIS_BUFFER_LINKAGE(
- *   IN PNDIS_BUFFER  Buffer);
- */
-#define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
+/* Extensions for NDIS 5.0 miniports */
 
 
+typedef NDIS_STATUS
+(NTAPI *W_CO_CREATE_VC_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE  NdisVcHandle,
+  OUT PNDIS_HANDLE  MiniportVcContext);
 
 
-/*
- * VOID
- * NdisChainBufferAtBack(
- *   IN OUT PNDIS_PACKET  Packet,
- *   IN OUT PNDIS_BUFFER  Buffer)
- */
-#define NdisChainBufferAtBack(Packet,           \
-                              Buffer)           \
-{                                               \
-       PNDIS_BUFFER NdisBuffer = (Buffer);           \
-                                                \
-       while (NdisBuffer->Next != NULL)              \
-   NdisBuffer = NdisBuffer->Next;               \
-                                                     \
-       NdisBuffer->Next = NULL;                      \
-                                                     \
-       if ((Packet)->Private.Head != NULL)           \
-    (Packet)->Private.Tail->Next = (Buffer);    \
-       else                                          \
-    (Packet)->Private.Head = (Buffer);          \
-                                                     \
-       (Packet)->Private.Tail = NdisBuffer;          \
-       (Packet)->Private.ValidCounts = FALSE;        \
-}
+typedef NDIS_STATUS
+(NTAPI *W_CO_DELETE_VC_HANDLER)(
+  IN NDIS_HANDLE  MiniportVcContext);
 
 
+typedef NDIS_STATUS
+(NTAPI *W_CO_ACTIVATE_VC_HANDLER)(
+  IN NDIS_HANDLE  MiniportVcContext,
+  IN OUT PCO_CALL_PARAMETERS  CallParameters);
 
 
-/*
- * VOID
- * NdisChainBufferAtFront(
- *   IN OUT PNDIS_PACKET  Packet,
- *   IN OUT PNDIS_BUFFER  Buffer)
- */
-#define NdisChainBufferAtFront(Packet,        \
-                               Buffer)        \
-{                                             \
-       PNDIS_BUFFER _NdisBuffer = (Buffer);        \
-                                              \
-  while (_NdisBuffer->Next != NULL)           \
-    _NdisBuffer = _NdisBuffer->Next;          \
-                                              \
-  if ((Packet)->Private.Head == NULL)         \
-    (Packet)->Private.Tail = _NdisBuffer;     \
-                                              \
-       _NdisBuffer->Next = (Packet)->Private.Head; \
-       (Packet)->Private.Head = (Buffer);          \
-       (Packet)->Private.ValidCounts = FALSE;      \
-}
+typedef NDIS_STATUS
+(NTAPI *W_CO_DEACTIVATE_VC_HANDLER)(
+  IN NDIS_HANDLE  MiniportVcContext);
 
 
+typedef VOID
+(NTAPI *W_CO_SEND_PACKETS_HANDLER)(
+  IN NDIS_HANDLE  MiniportVcContext,
+  IN PPNDIS_PACKET  PacketArray,
+  IN UINT  NumberOfPackets);
 
 
-/*
- * VOID
- * NdisGetNextBuffer(
- *   IN PNDIS_BUFFER  CurrentBuffer,
- *   OUT PNDIS_BUFFER  * NextBuffer)
- */
-#define NdisGetNextBuffer(CurrentBuffer,  \
-                          NextBuffer)     \
-{                                         \
-  *(NextBuffer) = (CurrentBuffer)->Next;  \
-}
+typedef NDIS_STATUS
+(NTAPI *W_CO_REQUEST_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_HANDLE  MiniportVcContext  OPTIONAL,
+  IN OUT PNDIS_REQUEST  NdisRequest);
 
 
-#if NDIS_LEGACY_DRIVER
+#ifdef __cplusplus
 
 
-#define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head)
-#define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail)
-#define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts)
+#define NDIS50_MINIPORT_CHARACTERISTICS_S \
+  NDIS40_MINIPORT_CHARACTERISTICS  Ndis40Chars; \
+  W_CO_CREATE_VC_HANDLER  CoCreateVcHandler; \
+  W_CO_DELETE_VC_HANDLER  CoDeleteVcHandler; \
+  W_CO_ACTIVATE_VC_HANDLER  CoActivateVcHandler; \
+  W_CO_DEACTIVATE_VC_HANDLER  CoDeactivateVcHandler; \
+  W_CO_SEND_PACKETS_HANDLER  CoSendPacketsHandler; \
+  W_CO_REQUEST_HANDLER  CoRequestHandler;
 
 
-/*
- * UINT
- * NdisGetPacketFlags(
- *   IN PNDIS_PACKET  Packet);
- */
-#define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
+#else /* !__cplusplus */
 
 
-/*
- * ULONG
- * NDIS_GET_PACKET_PROTOCOL_TYPE(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
-  ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
+#define NDIS50_MINIPORT_CHARACTERISTICS_S \
+  NDIS40_MINIPORT_CHARACTERISTICS_S \
+  W_CO_CREATE_VC_HANDLER  CoCreateVcHandler; \
+  W_CO_DELETE_VC_HANDLER  CoDeleteVcHandler; \
+  W_CO_ACTIVATE_VC_HANDLER  CoActivateVcHandler; \
+  W_CO_DEACTIVATE_VC_HANDLER  CoDeactivateVcHandler; \
+  W_CO_SEND_PACKETS_HANDLER  CoSendPacketsHandler; \
+  W_CO_REQUEST_HANDLER  CoRequestHandler;
 
 
-/*
- * PNDIS_PACKET_OOB_DATA
- * NDIS_OOB_DATA_FROM_PACKET(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_OOB_DATA_FROM_PACKET(_Packet)    \
-  (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
-  (_Packet)->Private.NdisPacketOobOffset)
+#endif /* !__cplusplus */
 
 
-/*
- * ULONG
- * NDIS_GET_PACKET_HEADER_SIZE(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_HEADER_SIZE(_Packet)   \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
-  (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
+typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
+   NDIS50_MINIPORT_CHARACTERISTICS_S
+} NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
 
 
-/*
- * NDIS_STATUS
- * NDIS_GET_PACKET_STATUS(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_STATUS(_Packet)        \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
-  (_Packet)->Private.NdisPacketOobOffset))->Status
 
 
-/*
- * ULONGLONG
- * NDIS_GET_PACKET_TIME_TO_SEND(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_TIME_TO_SEND(_Packet)   \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
+/* Extensions for NDIS 5.1 miniports */
 
 
-/*
- * ULONGLONG
- * NDIS_GET_PACKET_TIME_SENT(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_TIME_SENT(_Packet)      \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeSent
+typedef VOID
+(NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN PVOID  CancelId);
 
 
-/*
- * ULONGLONG
- * NDIS_GET_PACKET_TIME_RECEIVED(
- *   IN PNDIS_PACKET Packet);
- */
-#define NDIS_GET_PACKET_TIME_RECEIVED(_Packet)  \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
+typedef VOID
+(NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterContext,
+  IN NDIS_DEVICE_PNP_EVENT  PnPEvent,
+  IN PVOID  InformationBuffer,
+  IN ULONG  InformationBufferLength);
 
 
-/*
- * VOID
- * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
- *   IN PNDIS_PACKET Packet,
- *   IN PPVOID pMediaSpecificInfo,
- *   IN PUINT pSizeMediaSpecificInfo);
- */
-#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet,                                  \
-                                            _pMediaSpecificInfo,                      \
-                                            _pSizeMediaSpecificInfo)                  \
-{                                                                                     \
-  if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) ||            \
-      !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO))   \
-    {                                                                                 \
-      *(_pMediaSpecificInfo) = NULL;                                                  \
-      *(_pSizeMediaSpecificInfo) = 0;                                                 \
-    }                                                                                 \
-  else                                                                                \
-    {                                                                                 \
-      *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +           \
-        (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation;           \
-      *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +       \
-        (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo;              \
-    }                                                                                 \
-}
+typedef VOID
+(NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)(
+  IN PVOID  ShutdownContext);
 
 
-/*
- * VOID
- * NDIS_SET_PACKET_HEADER_SIZE(
- *   IN PNDIS_PACKET Packet,
- *   IN UINT HdrSize);
- */
-#define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize)              \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                      \
-  (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
+#ifdef __cplusplus
 
 
-/*
- * VOID
- * NDIS_SET_PACKET_STATUS(
- *   IN PNDIS_PACKET Packet,
- *   IN NDIS_STATUS Status);
- */
-#define NDIS_SET_PACKET_STATUS(_Packet, _Status)  \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +    \
-  (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
-
-/*
- * VOID
- * NDIS_SET_PACKET_TIME_TO_SEND(
- *   IN PNDIS_PACKET Packet,
- *   IN ULONGLONG TimeToSend);
- */
-#define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend)  \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +              \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
-
-/*
- * VOID
- * NDIS_SET_PACKET_TIME_SENT(
- *   IN PNDIS_PACKET Packet,
- *   IN ULONGLONG TimeSent);
- */
-#define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +        \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
+#define NDIS51_MINIPORT_CHARACTERISTICS_S \
+  NDIS50_MINIPORT_CHARACTERISTICS  Ndis50Chars; \
+  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
+  W_PNP_EVENT_NOTIFY_HANDLER  PnPEventNotifyHandler; \
+  W_MINIPORT_SHUTDOWN_HANDLER  AdapterShutdownHandler;
 
 
-/*
- * VOID
- * NDIS_SET_PACKET_TIME_RECEIVED(
- *   IN PNDIS_PACKET Packet,
- *   IN ULONGLONG TimeReceived);
- */
-#define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
-  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                \
-  (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
+#else
 
 
-/*
- * VOID
- * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
- *   IN PNDIS_PACKET Packet,
- *   IN PVOID MediaSpecificInfo,
- *   IN UINT SizeMediaSpecificInfo);
- */
-#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet,                      \
-                                            _MediaSpecificInfo,           \
-                                            _SizeMediaSpecificInfo)       \
-{                                                                         \
-  if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS)     \
-    {                                                                     \
-      (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
-      ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                        \
-        (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
-          (_MediaSpecificInfo);                                           \
-      ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                        \
-        (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
-          (_SizeMediaSpecificInfo);                                       \
-    }                                                                     \
-}
+#define NDIS51_MINIPORT_CHARACTERISTICS_S \
+  NDIS50_MINIPORT_CHARACTERISTICS_S \
+  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
+  W_PNP_EVENT_NOTIFY_HANDLER  PnPEventNotifyHandler; \
+  W_MINIPORT_SHUTDOWN_HANDLER  AdapterShutdownHandler;
 
 
-/*
- * VOID
- * NdisSetPacketFlags(
- *   IN PNDIS_PACKET  Packet,
- *   IN UINT  Flags);
- */
-#define NdisSetPacketFlags(Packet, Flags) (Packet)->Private.Flags |= (Flags)
+#endif
 
 
-/*
- * VOID
- * NdisClearPacketFlags(
- *   IN PNDIS_PACKET  Packet,
- *   IN UINT  Flags);
- */
-#define NdisClearPacketFlags(Packet, Flags) (Packet)->Private.Flags &= ~(Flags)
+typedef struct _NDIS51_MINIPORT_CHARACTERISTICS {
+   NDIS51_MINIPORT_CHARACTERISTICS_S
+} NDIS51_MINIPORT_CHARACTERISTICS, *PSNDIS51_MINIPORT_CHARACTERISTICS;
 
 
-#endif /* NDIS_LEGACY_DRIVER */
+#if defined(NDIS51_MINIPORT)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+  NDIS51_MINIPORT_CHARACTERISTICS_S
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#elif defined(NDIS50_MINIPORT)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+  NDIS50_MINIPORT_CHARACTERISTICS_S
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#elif defined(NDIS40_MINIPORT)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+  NDIS40_MINIPORT_CHARACTERISTICS_S
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#else /* NDIS30 */
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+  NDIS30_MINIPORT_CHARACTERISTICS_S
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#endif
 
 
-/*
- * VOID
- * NdisQueryPacket(
- *   IN PNDIS_PACKET  Packet,
- *   OUT PUINT  PhysicalBufferCount  OPTIONAL,
- *   OUT PUINT  BufferCount  OPTIONAL,
- *   OUT PNDIS_BUFFER  *FirstBuffer  OPTIONAL,
- *   OUT PUINT  TotalPacketLength  OPTIONAL);
- */
-static __inline
-VOID
-NdisQueryPacket(
-    IN PNDIS_PACKET  Packet,
-    OUT PUINT  PhysicalBufferCount  OPTIONAL,
-    OUT PUINT  BufferCount  OPTIONAL,
-    OUT PNDIS_BUFFER  *FirstBuffer  OPTIONAL,
-    OUT PUINT  TotalPacketLength  OPTIONAL)
-{
-    if (FirstBuffer)
-        *FirstBuffer = Packet->Private.Head;
-    if (TotalPacketLength || BufferCount || PhysicalBufferCount)
-    {
-        if (!Packet->Private.ValidCounts)
-        {
-            UINT Offset;
-            UINT PacketLength;
-            PNDIS_BUFFER NdisBuffer;
-            UINT PhysicalBufferCount = 0;
-            UINT TotalPacketLength = 0;
-            UINT Count = 0;
-
-            for (NdisBuffer = Packet->Private.Head;
-                 NdisBuffer != (PNDIS_BUFFER)NULL;
-                 NdisBuffer = NdisBuffer->Next)
-            {
-                PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
-                NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
-                TotalPacketLength += PacketLength;
-                Count++;
-            }
-            Packet->Private.PhysicalCount = PhysicalBufferCount;
-            Packet->Private.TotalLength = TotalPacketLength;
-            Packet->Private.Count = Count;
-            Packet->Private.ValidCounts = TRUE;
-        }
-
-        if (PhysicalBufferCount)
-            *PhysicalBufferCount = Packet->Private.PhysicalCount;
-
-        if (BufferCount)
-            *BufferCount = Packet->Private.Count;
-
-        if (TotalPacketLength)
-            *TotalPacketLength = Packet->Private.TotalLength;
-    }
-}
+/* Structures available only to full MAC drivers */
 
 
-/*
- * VOID
- * NdisQueryPacketLength(
- *   IN PNDIS_PACKET  Packet,
- *   OUT PUINT  PhysicalBufferCount  OPTIONAL,
- *   OUT PUINT  BufferCount  OPTIONAL,
- *   OUT PNDIS_BUFFER  *FirstBuffer  OPTIONAL,
- *   OUT PUINT  TotalPacketLength  OPTIONAL);
- */
-static __inline
-VOID
-NdisQueryPacketLength(
-    IN PNDIS_PACKET  Packet,
-    OUT PUINT  TotalPacketLength  OPTIONAL)
-{
-  if (!(Packet)->Private.ValidCounts)                                     \
-    NdisQueryPacket(Packet, NULL, NULL, NULL, TotalPacketLength);         \
-  else                                                                    \
-    *(TotalPacketLength) = (Packet)->Private.TotalLength;                 \
-}
+typedef BOOLEAN
+(NTAPI *PNDIS_INTERRUPT_SERVICE)(
+  IN PVOID  InterruptContext);
 
 
+typedef VOID
+(NTAPI *PNDIS_DEFERRED_PROCESSING)(
+  IN PVOID  SystemSpecific1,
+  IN PVOID  InterruptContext,
+  IN PVOID  SystemSpecific2,
+  IN PVOID  SystemSpecific3);
 
 
-/*
- * VOID
- * NdisRecalculatePacketCounts(
- *   IN OUT  PNDIS_PACKET  Packet);
- */
-#define NdisRecalculatePacketCounts(Packet)       \
-{                                                 \
-  PNDIS_BUFFER _Buffer = (Packet)->Private.Head;  \
-  if (_Buffer != NULL)                            \
-  {                                               \
-      while (_Buffer->Next != NULL)               \
-      {                                           \
-          _Buffer = _Buffer->Next;                \
-      }                                           \
-      (Packet)->Private.Tail = _Buffer;           \
-  }                                               \
-  (Packet)->Private.ValidCounts = FALSE;          \
-}
+typedef struct _NDIS_WRAPPER_HANDLE NDIS_WRAPPER_HANDLE, *PNDIS_WRAPPER_HANDLE;
+typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
+typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
+typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
+typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK,*PNDIS_MINIPORT_BLOCK;
+typedef struct _NDIS_OFFLOAD NDIS_OFFLOAD, *PNDIS_OFFLOAD;
+typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
+typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER;
+#if NDIS_SUPPORT_NDIS6
+typedef USHORT NET_FRAME_TYPE, *PNET_FRAME_TYPE;
+#endif
 
 
+typedef struct _NDIS_MINIPORT_INTERRUPT {
+  PKINTERRUPT  InterruptObject;
+  KSPIN_LOCK  DpcCountLock;
+  PVOID  MiniportIdField;
+  W_ISR_HANDLER  MiniportIsr;
+  W_HANDLE_INTERRUPT_HANDLER  MiniportDpc;
+  KDPC  InterruptDpc;
+  PNDIS_MINIPORT_BLOCK  Miniport;
+  UCHAR  DpcCount;
+  BOOLEAN  Filler1;
+  KEVENT  DpcsCompletedEvent;
+  BOOLEAN  SharedInterrupt;
+  BOOLEAN  IsrRequested;
+} NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
 
 
-/*
- * VOID
- * NdisReinitializePacket(
- *   IN OUT  PNDIS_PACKET  Packet);
- */
-#define NdisReinitializePacket(Packet)    \
-{                                               \
-       (Packet)->Private.Head = (PNDIS_BUFFER)NULL;  \
-       (Packet)->Private.ValidCounts = FALSE;        \
-}
+typedef struct _NDIS_MINIPORT_TIMER {
+  KTIMER  Timer;
+  KDPC  Dpc;
+  PNDIS_TIMER_FUNCTION  MiniportTimerFunction;
+  PVOID  MiniportTimerContext;
+  PNDIS_MINIPORT_BLOCK  Miniport;
+  struct _NDIS_MINIPORT_TIMER  *NextDeferredTimer;
+} NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
 
 
-/*
- * VOID
- * NdisSetSendFlags(
- *   IN PNDIS_PACKET  Packet,
- *   IN UINT  Flags);
- */
-#define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
+typedef struct _NDIS_INTERRUPT {
+  PKINTERRUPT  InterruptObject;
+  KSPIN_LOCK  DpcCountLock;
+  PNDIS_INTERRUPT_SERVICE  MacIsr;
+  PNDIS_DEFERRED_PROCESSING  MacDpc;
+  KDPC  InterruptDpc;
+  PVOID  InterruptContext;
+  UCHAR  DpcCount;
+  BOOLEAN       Removing;
+  KEVENT  DpcsCompletedEvent;
+} NDIS_INTERRUPT, *PNDIS_INTERRUPT;
 
 
 
 
+typedef enum _NDIS_WORK_ITEM_TYPE {
+  NdisWorkItemRequest,
+  NdisWorkItemSend,
+  NdisWorkItemReturnPackets,
+  NdisWorkItemResetRequested,
+  NdisWorkItemResetInProgress,
+  NdisWorkItemHalt,
+  NdisWorkItemSendLoopback,
+  NdisWorkItemMiniportCallback,
+  NdisMaxWorkItems
+} NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
 
 
-/* Memory management routines */
+#define        NUMBER_OF_WORK_ITEM_TYPES         NdisMaxWorkItems
+#define        NUMBER_OF_SINGLE_WORK_ITEMS       6
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCreateLookaheadBufferFromSharedMemory(
-  IN PVOID  pSharedMemory,
-  IN UINT  LookaheadLength,
-  OUT PVOID  *pLookaheadBuffer);
+typedef struct _NDIS_MINIPORT_WORK_ITEM {
+       SINGLE_LIST_ENTRY  Link;
+       NDIS_WORK_ITEM_TYPE  WorkItemType;
+       PVOID  WorkItemContext;
+} NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisDestroyLookaheadBufferFromSharedMemory(
-  IN PVOID  pLookaheadBuffer);
+struct _NDIS_WORK_ITEM;
+typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
 
 
-#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
+typedef struct _NDIS_WORK_ITEM {
+  PVOID Context;
+  NDIS_PROC Routine;
+  UCHAR WrapperReserved[8*sizeof(PVOID)];
+} NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
 
 
-/*
- * VOID
- * NdisMoveMappedMemory(
- *   OUT PVOID  Destination,
- *   IN PVOID  Source,
- *   IN ULONG  Length);
- */
-#define NdisMoveMappedMemory(Destination, Source, Length) \
-  RtlCopyMemory(Destination, Source, Length)
+typedef struct _NDIS_BIND_PATHS {
+       UINT  Number;
+       NDIS_STRING  Paths[1];
+} NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
 
 
-/*
- * VOID
- * NdisZeroMappedMemory(
- *   IN PVOID  Destination,
- *   IN ULONG  Length);
- */
-#define NdisZeroMappedMemory(Destination, Length) \
-  RtlZeroMemory(Destination, Length)
 
 
-#else
+typedef VOID
+(NTAPI *ETH_RCV_COMPLETE_HANDLER)(
+  IN PETH_FILTER  Filter);
 
 
-#define NdisMoveMappedMemory(Destination, Source, Length) \
-{ \
-  PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
-  while (_Dest < _End) \
-    *_Dest++ = _Src++; \
-}
+typedef VOID
+(NTAPI *ETH_RCV_INDICATE_HANDLER)(
+  IN PETH_FILTER  Filter,
+  IN NDIS_HANDLE  MacReceiveContext,
+  IN PCHAR  Address,
+  IN PVOID  HeaderBuffer,
+  IN UINT  HeaderBufferSize,
+  IN PVOID  LookaheadBuffer,
+  IN UINT  LookaheadBufferSize,
+  IN UINT  PacketSize);
 
 
-#define NdisZeroMappedMemory(Destination, Length) \
-{ \
-  PUCHAR _Dest = Destination, _End = _Dest + Length; \
-  while (_Dest < _End) \
-    *_Dest++ = 0; \
-}
+typedef VOID
+(NTAPI *FDDI_RCV_COMPLETE_HANDLER)(
+  IN PFDDI_FILTER  Filter);
 
 
-#endif /* _M_IX86 or _M_AMD64 */
+typedef VOID
+(NTAPI *FDDI_RCV_INDICATE_HANDLER)(
+  IN PFDDI_FILTER  Filter,
+  IN NDIS_HANDLE  MacReceiveContext,
+  IN PCHAR  Address,
+  IN UINT  AddressLength,
+  IN PVOID  HeaderBuffer,
+  IN UINT  HeaderBufferSize,
+  IN PVOID  LookaheadBuffer,
+  IN UINT  LookaheadBufferSize,
+  IN UINT  PacketSize);
 
 
-/*
- * VOID
- * NdisMoveFromMappedMemory(
- *   OUT PVOID  Destination,
- *   IN PVOID  Source,
- *   IN ULONG  Length);
- */
-#define NdisMoveFromMappedMemory(Destination, Source, Length) \
-  NdisMoveMappedMemory(Destination, Source, Length)
+typedef VOID
+(NTAPI *FILTER_PACKET_INDICATION_HANDLER)(
+  IN NDIS_HANDLE  Miniport,
+  IN PPNDIS_PACKET  PacketArray,
+  IN UINT  NumberOfPackets);
 
 
-/*
- * VOID
- * NdisMoveToMappedMemory(
- *   OUT PVOID  Destination,
- *   IN PVOID  Source,
- *   IN ULONG  Length);
- */
-#define NdisMoveToMappedMemory(Destination, Source, Length) \
-  NdisMoveMappedMemory(Destination, Source, Length)
+typedef VOID
+(NTAPI *TR_RCV_COMPLETE_HANDLER)(
+  IN PTR_FILTER  Filter);
 
 
-/*
- * VOID
- * NdisMUpdateSharedMemory(
- *   IN NDIS_HANDLE  MiniportAdapterHandle,
- *   IN ULONG  Length,
- *   IN PVOID  VirtualAddress,
- *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
- */
-#define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
-  NdisUpdateSharedMemory(_H, _L, _V, _P)
+typedef VOID
+(NTAPI *TR_RCV_INDICATE_HANDLER)(
+  IN PTR_FILTER  Filter,
+  IN NDIS_HANDLE  MacReceiveContext,
+  IN PVOID  HeaderBuffer,
+  IN UINT  HeaderBufferSize,
+  IN PVOID  LookaheadBuffer,
+  IN UINT  LookaheadBufferSize,
+  IN UINT  PacketSize);
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisAllocateMemory(
-  OUT  PVOID  *VirtualAddress,
-  IN UINT  Length,
-  IN UINT  MemoryFlags,
-  IN NDIS_PHYSICAL_ADDRESS  HighestAcceptableAddress);
+typedef VOID
+(NTAPI *WAN_RCV_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_HANDLE  NdisLinkContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisFreeMemory(
-  IN PVOID  VirtualAddress,
-  IN UINT  Length,
-  IN UINT  MemoryFlags);
+typedef VOID
+(NTAPI *WAN_RCV_HANDLER)(
+  OUT PNDIS_STATUS  Status,
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_HANDLE  NdisLinkContext,
+  IN PUCHAR  Packet,
+  IN ULONG  PacketSize);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisImmediateReadSharedMemory(
-  IN NDIS_HANDLE WrapperConfigurationContext,
-  IN ULONG       SharedMemoryAddress,
-  OUT PUCHAR      Buffer,
-  IN ULONG       Length);
+typedef VOID
+(FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
+  IN PNDIS_MINIPORT_BLOCK  Miniport,
+  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
+  OUT PVOID  *WorkItemContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisImmediateWriteSharedMemory(
-  IN NDIS_HANDLE WrapperConfigurationContext,
-  IN ULONG       SharedMemoryAddress,
-  IN PUCHAR      Buffer,
-  IN ULONG       Length);
+typedef NDIS_STATUS
+(FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
+  IN PNDIS_MINIPORT_BLOCK  Miniport,
+  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
+  IN PVOID  WorkItemContext);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisMAllocateSharedMemory(
-  IN   NDIS_HANDLE  MiniportAdapterHandle,
-  IN   ULONG  Length,
-  IN   BOOLEAN  Cached,
-  OUT   PVOID  *VirtualAddress,
-  OUT   PNDIS_PHYSICAL_ADDRESS  PhysicalAddress);
+typedef NDIS_STATUS
+(FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
+  IN PNDIS_MINIPORT_BLOCK  Miniport,
+  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
+  IN PVOID  WorkItemContext);
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMAllocateSharedMemoryAsync(
+typedef VOID
+(NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)(
   IN NDIS_HANDLE  MiniportAdapterHandle,
   IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN ULONG  Length,
-  IN BOOLEAN  Cached,
-  IN PVOID  Context);
+  IN NDIS_STATUS  Status);
 
 
-#if defined(NDIS50)
+typedef VOID
+(NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_STATUS  Status,
+  IN BOOLEAN  AddressingReset);
 
 
-#define NdisUpdateSharedMemory(NdisAdapterHandle, \
-                               Length,            \
-                               VirtualAddress,    \
-                               PhysicalAddress)
+typedef VOID
+(NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN PNDIS_PACKET  Packet,
+  IN NDIS_STATUS  Status);
 
 
-#else
+typedef VOID
+(NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisUpdateSharedMemory(
-  IN NDIS_HANDLE             NdisAdapterHandle,
-  IN ULONG                   Length,
-  IN PVOID                   VirtualAddress,
-  IN NDIS_PHYSICAL_ADDRESS   PhysicalAddress);
+typedef BOOLEAN
+(FASTCALL *NDIS_M_START_SENDS)(
+  IN PNDIS_MINIPORT_BLOCK  Miniport);
 
 
-#endif /* defined(NDIS50) */
+typedef VOID
+(NTAPI *NDIS_M_STATUS_HANDLER)(
+  IN NDIS_HANDLE  MiniportHandle,
+  IN NDIS_STATUS  GeneralStatus,
+  IN PVOID  StatusBuffer,
+  IN UINT  StatusBufferSize);
 
 
-/*
- * ULONG
- * NdisGetPhysicalAddressHigh(
- *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
- */
-#define NdisGetPhysicalAddressHigh(PhysicalAddress) \
-  ((PhysicalAddress).HighPart)
+typedef VOID
+(NTAPI *NDIS_M_STS_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-/*
- * VOID
- * NdisSetPhysicalAddressHigh(
- *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
- *   IN ULONG  Value);
- */
-#define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
-  ((PhysicalAddress).HighPart) = (Value)
+typedef VOID
+(NTAPI *NDIS_M_TD_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN PNDIS_PACKET  Packet,
+  IN NDIS_STATUS  Status,
+  IN UINT  BytesTransferred);
 
 
-/*
- * ULONG
- * NdisGetPhysicalAddressLow(
- *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
- */
-#define NdisGetPhysicalAddressLow(PhysicalAddress) \
-  ((PhysicalAddress).LowPart)
+typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN PVOID  Packet,
+  IN NDIS_STATUS  Status);
 
 
 
 
-/*
- * VOID
- * NdisSetPhysicalAddressLow(
- *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
- *   IN ULONG  Value);
- */
-#define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
-  ((PhysicalAddress).LowPart) = (Value)
+#if ARCNET
 
 
-/*
- * VOID
- * NDIS_PHYSICAL_ADDRESS_CONST(
- *   IN ULONG  Low,
- *   IN LONG  High);
- */
-#define NDIS_PHYSICAL_ADDRESS_CONST(Low, High)  \
-    { {(ULONG)(Low), (LONG)(High)} }
+#define ARC_SEND_BUFFERS                  8
+#define ARC_HEADER_SIZE                   4
 
 
-/*
- * ULONG
- * NdisEqualMemory(
- *  IN CONST VOID  *Source1,
- *  IN CONST VOID  *Source2,
- *  IN ULONG  Length);
- */
-#define NdisEqualMemory(Source1, Source2, Length) \
-  RtlEqualMemory(Source1, Source2, Length)
+typedef struct _NDIS_ARC_BUF {
+  NDIS_HANDLE  ArcnetBufferPool;
+  PUCHAR  ArcnetLookaheadBuffer;
+  UINT  NumFree;
+  ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
+} NDIS_ARC_BUF, *PNDIS_ARC_BUF;
 
 
-/*
- * VOID
- * NdisFillMemory(
- *   IN PVOID  Destination,
- *   IN ULONG  Length,
- *   IN UCHAR  Fill);
- */
-#define NdisFillMemory(Destination, Length, Fill) \
-  RtlFillMemory(Destination, Length, Fill)
+#endif /* ARCNET */
 
 
-/*
- * VOID
- * NdisMoveMemory(
- *   OUT  PVOID  Destination,
- *   IN PVOID  Source,
- *   IN ULONG  Length);
- */
-#define NdisMoveMemory(Destination, Source, Length) \
-  RtlCopyMemory(Destination, Source, Length)
+typedef struct _NDIS_LOG {
+  PNDIS_MINIPORT_BLOCK  Miniport;
+  KSPIN_LOCK  LogLock;
+  PIRP  Irp;
+  UINT  TotalSize;
+  UINT  CurrentSize;
+  UINT  InPtr;
+  UINT  OutPtr;
+  UCHAR  LogBuf[1];
+} NDIS_LOG, *PNDIS_LOG;
+
+#if ARCNET
+#define FILTERDBS_ARCNET_S \
+  PARC_FILTER  ArcDB;
+#else /* !ARCNET */
+#define FILTERDBS_ARCNET_S \
+  PVOID  XXXDB;
+#endif /* !ARCNET */
 
 
+#define FILTERDBS_S \
+  _ANONYMOUS_UNION union { \
+    PETH_FILTER  EthDB; \
+    PNULL_FILTER  NullDB; \
+  } DUMMYUNIONNAME; \
+  PTR_FILTER  TrDB; \
+  PFDDI_FILTER  FddiDB; \
+  FILTERDBS_ARCNET_S
 
 
-/*
- * VOID
- * NdisRetrieveUlong(
- *   IN PULONG  DestinationAddress,
- *   IN PULONG  SourceAddress);
- */
-#define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
-  RtlRetrieveUlong(DestinationAddress, SourceAddress)
+typedef struct _FILTERDBS {
+  FILTERDBS_S
+} FILTERDBS, *PFILTERDBS;
 
 
 
 
-/*
- * VOID
- * NdisStoreUlong(
- *   IN PULONG  DestinationAddress,
- *   IN ULONG  Value);
- */
-#define NdisStoreUlong(DestinationAddress, Value) \
-  RtlStoreUlong(DestinationAddress, Value)
+struct _NDIS_MINIPORT_BLOCK {
+  PVOID  Signature;
+  PNDIS_MINIPORT_BLOCK  NextMiniport;
+  PNDIS_M_DRIVER_BLOCK  DriverHandle;
+  NDIS_HANDLE  MiniportAdapterContext;
+  UNICODE_STRING  MiniportName;
+  PNDIS_BIND_PATHS  BindPaths;
+  NDIS_HANDLE  OpenQueue;
+  REFERENCE  ShortRef;
+  NDIS_HANDLE  DeviceContext;
+  UCHAR  Padding1;
+  UCHAR  LockAcquired;
+  UCHAR  PmodeOpens;
+  UCHAR  AssignedProcessor;
+  KSPIN_LOCK  Lock;
+  PNDIS_REQUEST  MediaRequest;
+  PNDIS_MINIPORT_INTERRUPT  Interrupt;
+  ULONG  Flags;
+  ULONG  PnPFlags;
+  LIST_ENTRY  PacketList;
+  PNDIS_PACKET  FirstPendingPacket;
+  PNDIS_PACKET  ReturnPacketsQueue;
+  ULONG  RequestBuffer;
+  PVOID  SetMCastBuffer;
+  PNDIS_MINIPORT_BLOCK  PrimaryMiniport;
+  PVOID  WrapperContext;
+  PVOID  BusDataContext;
+  ULONG  PnPCapabilities;
+  PCM_RESOURCE_LIST  Resources;
+  NDIS_TIMER  WakeUpDpcTimer;
+  UNICODE_STRING  BaseName;
+  UNICODE_STRING  SymbolicLinkName;
+  ULONG  CheckForHangSeconds;
+  USHORT  CFHangTicks;
+  USHORT  CFHangCurrentTick;
+  NDIS_STATUS  ResetStatus;
+  NDIS_HANDLE  ResetOpen;
+  FILTERDBS_S
+  FILTER_PACKET_INDICATION_HANDLER  PacketIndicateHandler;
+  NDIS_M_SEND_COMPLETE_HANDLER  SendCompleteHandler;
+  NDIS_M_SEND_RESOURCES_HANDLER  SendResourcesHandler;
+  NDIS_M_RESET_COMPLETE_HANDLER  ResetCompleteHandler;
+  NDIS_MEDIUM  MediaType;
+  ULONG  BusNumber;
+  NDIS_INTERFACE_TYPE  BusType;
+  NDIS_INTERFACE_TYPE  AdapterType;
+  PDEVICE_OBJECT  DeviceObject;
+  PDEVICE_OBJECT  PhysicalDeviceObject;
+  PDEVICE_OBJECT  NextDeviceObject;
+  PMAP_REGISTER_ENTRY  MapRegisters;
+  PNDIS_AF_LIST  CallMgrAfList;
+  PVOID  MiniportThread;
+  PVOID  SetInfoBuf;
+  USHORT  SetInfoBufLen;
+  USHORT  MaxSendPackets;
+  NDIS_STATUS  FakeStatus;
+  PVOID  LockHandler;
+  PUNICODE_STRING  pAdapterInstanceName;
+  PNDIS_MINIPORT_TIMER  TimerQueue;
+  UINT  MacOptions;
+  PNDIS_REQUEST  PendingRequest;
+  UINT  MaximumLongAddresses;
+  UINT  MaximumShortAddresses;
+  UINT  CurrentLookahead;
+  UINT  MaximumLookahead;
+  W_HANDLE_INTERRUPT_HANDLER  HandleInterruptHandler;
+  W_DISABLE_INTERRUPT_HANDLER  DisableInterruptHandler;
+  W_ENABLE_INTERRUPT_HANDLER  EnableInterruptHandler;
+  W_SEND_PACKETS_HANDLER  SendPacketsHandler;
+  NDIS_M_START_SENDS  DeferredSendHandler;
+  ETH_RCV_INDICATE_HANDLER  EthRxIndicateHandler;
+  TR_RCV_INDICATE_HANDLER  TrRxIndicateHandler;
+  FDDI_RCV_INDICATE_HANDLER  FddiRxIndicateHandler;
+  ETH_RCV_COMPLETE_HANDLER  EthRxCompleteHandler;
+  TR_RCV_COMPLETE_HANDLER  TrRxCompleteHandler;
+  FDDI_RCV_COMPLETE_HANDLER  FddiRxCompleteHandler;
+  NDIS_M_STATUS_HANDLER  StatusHandler;
+  NDIS_M_STS_COMPLETE_HANDLER  StatusCompleteHandler;
+  NDIS_M_TD_COMPLETE_HANDLER  TDCompleteHandler;
+  NDIS_M_REQ_COMPLETE_HANDLER  QueryCompleteHandler;
+  NDIS_M_REQ_COMPLETE_HANDLER  SetCompleteHandler;
+  NDIS_WM_SEND_COMPLETE_HANDLER  WanSendCompleteHandler;
+  WAN_RCV_HANDLER  WanRcvHandler;
+  WAN_RCV_COMPLETE_HANDLER  WanRcvCompleteHandler;
+#if defined(NDIS_WRAPPER)
+  PNDIS_MINIPORT_BLOCK  NextGlobalMiniport;
+  SINGLE_LIST_ENTRY  WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
+  SINGLE_LIST_ENTRY  SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
+  UCHAR  SendFlags;
+  UCHAR  TrResetRing;
+  UCHAR  ArcnetAddress;
+  UCHAR  XState;
+  _ANONYMOUS_UNION union {
+#if ARCNET
+    PNDIS_ARC_BUF  ArcBuf;
+#endif
+    PVOID  BusInterface;
+  } DUMMYUNIONNAME;
+  PNDIS_LOG  Log;
+  ULONG  SlotNumber;
+  PCM_RESOURCE_LIST  AllocatedResources;
+  PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
+  SINGLE_LIST_ENTRY  PatternList;
+  NDIS_PNP_CAPABILITIES  PMCapabilities;
+  DEVICE_CAPABILITIES  DeviceCaps;
+  ULONG  WakeUpEnable;
+  DEVICE_POWER_STATE  CurrentDevicePowerState;
+  PIRP  pIrpWaitWake;
+  SYSTEM_POWER_STATE  WaitWakeSystemState;
+  LARGE_INTEGER  VcIndex;
+  KSPIN_LOCK  VcCountLock;
+  LIST_ENTRY  WmiEnabledVcs;
+  PNDIS_GUID  pNdisGuidMap;
+  PNDIS_GUID  pCustomGuidMap;
+  USHORT  VcCount;
+  USHORT  cNdisGuidMap;
+  USHORT  cCustomGuidMap;
+  USHORT  CurrentMapRegister;
+  PKEVENT  AllocationEvent;
+  USHORT  BaseMapRegistersNeeded;
+  USHORT  SGMapRegistersNeeded;
+  ULONG  MaximumPhysicalMapping;
+  NDIS_TIMER  MediaDisconnectTimer;
+  USHORT  MediaDisconnectTimeOut;
+  USHORT  InstanceNumber;
+  NDIS_EVENT  OpenReadyEvent;
+  NDIS_PNP_DEVICE_STATE  PnPDeviceState;
+  NDIS_PNP_DEVICE_STATE  OldPnPDeviceState;
+  PGET_SET_DEVICE_DATA  SetBusData;
+  PGET_SET_DEVICE_DATA  GetBusData;
+  KDPC  DeferredDpc;
+#if 0
+  /* FIXME: */
+  NDIS_STATS  NdisStats;
+#else
+  ULONG  NdisStats;
+#endif
+  PNDIS_PACKET  IndicatedPacket[MAXIMUM_PROCESSORS];
+  PKEVENT  RemoveReadyEvent;
+  PKEVENT  AllOpensClosedEvent;
+  PKEVENT  AllRequestsCompletedEvent;
+  ULONG  InitTimeMs;
+  NDIS_MINIPORT_WORK_ITEM  WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
+  PDMA_ADAPTER  SystemAdapterObject;
+  ULONG  DriverVerifyFlags;
+  POID_LIST  OidList;
+  USHORT  InternalResetCount;
+  USHORT  MiniportResetCount;
+  USHORT  MediaSenseConnectCount;
+  USHORT  MediaSenseDisconnectCount;
+  PNDIS_PACKET  *xPackets;
+  ULONG  UserModeOpenReferences;
+  _ANONYMOUS_UNION union {
+    PVOID  SavedSendHandler;
+    PVOID  SavedWanSendHandler;
+  } DUMMYUNIONNAME2;
+  PVOID  SavedSendPacketsHandler;
+  PVOID  SavedCancelSendPacketsHandler;
+  W_SEND_PACKETS_HANDLER  WSendPacketsHandler;
+  ULONG  MiniportAttributes;
+  PDMA_ADAPTER  SavedSystemAdapterObject;
+  USHORT  NumOpens;
+  USHORT  CFHangXTicks;
+  ULONG  RequestCount;
+  ULONG  IndicatedPacketsCount;
+  ULONG  PhysicalMediumType;
+  PNDIS_REQUEST  LastRequest;
+  LONG  DmaAdapterRefCount;
+  PVOID  FakeMac;
+  ULONG  LockDbg;
+  ULONG  LockDbgX;
+  PVOID  LockThread;
+  ULONG  InfoFlags;
+  KSPIN_LOCK  TimerQueueLock;
+  PKEVENT  ResetCompletedEvent;
+  PKEVENT  QueuedBindingCompletedEvent;
+  PKEVENT  DmaResourcesReleasedEvent;
+  FILTER_PACKET_INDICATION_HANDLER  SavedPacketIndicateHandler;
+  ULONG  RegisteredInterrupts;
+  PNPAGED_LOOKASIDE_LIST  SGListLookasideList;
+  ULONG  ScatterGatherListSize;
+#endif /* _NDIS_ */
+};
 
 
+#if NDIS_LEGACY_DRIVER
 
 
-/*
- * VOID
- * NdisZeroMemory(
- *   IN PVOID  Destination,
- *   IN ULONG  Length)
- */
-#define NdisZeroMemory(Destination, Length) \
-  RtlZeroMemory(Destination, Length)
+typedef NDIS_STATUS
+(NTAPI *WAN_SEND_HANDLER)(
+  IN NDIS_HANDLE MacBindingHandle,
+  IN NDIS_HANDLE LinkHandle,
+  IN PVOID Packet);
 
 typedef VOID
 
 typedef VOID
-(NTAPI *NDIS_BLOCK_INITIALIZER) (
-    IN  PUCHAR  Block,
-    IN  SIZE_T  NumberOfBytes
-    );
+(NTAPI *SEND_PACKETS_HANDLER)(
+  IN NDIS_HANDLE MiniportAdapterContext,
+  IN PPNDIS_PACKET PacketArray,
+  IN UINT NumberOfPackets);
 
 
-/* Configuration routines */
+typedef NDIS_STATUS
+(NTAPI *SEND_HANDLER)(
+  IN NDIS_HANDLE NdisBindingHandle,
+  IN PNDIS_PACKET Packet);
+
+typedef NDIS_STATUS
+(NTAPI *TRANSFER_DATA_HANDLER)(
+  IN NDIS_HANDLE NdisBindingHandle,
+  IN NDIS_HANDLE MacReceiveContext,
+  IN UINT ByteOffset,
+  IN UINT BytesToTransfer,
+  OUT PNDIS_PACKET Packet,
+  OUT PUINT BytesTransferred);
+
+typedef NDIS_STATUS
+(NTAPI *RESET_HANDLER)(
+  IN NDIS_HANDLE NdisBindingHandle);
+
+typedef NDIS_STATUS
+(NTAPI *REQUEST_HANDLER)(
+  IN NDIS_HANDLE NdisBindingHandle,
+  IN PNDIS_REQUEST NdisRequest);
+
+#endif /* NDIS_LEGACY_DRIVER */
+
+#if defined(NDIS_WRAPPER)
+#define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S \
+  ULONG  Flags; \
+  ULONG  References; \
+  KSPIN_LOCK  SpinLock; \
+  NDIS_HANDLE  FilterHandle; \
+  ULONG  ProtocolOptions; \
+  USHORT  CurrentLookahead; \
+  USHORT  ConnectDampTicks; \
+  USHORT  DisconnectDampTicks; \
+  W_SEND_HANDLER  WSendHandler; \
+  W_TRANSFER_DATA_HANDLER  WTransferDataHandler; \
+  W_SEND_PACKETS_HANDLER  WSendPacketsHandler; \
+  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
+  ULONG  WakeUpEnable; \
+  PKEVENT  CloseCompleteEvent; \
+  QUEUED_CLOSE  QC; \
+  ULONG  AfReferences; \
+  PNDIS_OPEN_BLOCK  NextGlobalOpen;
+#else
+#define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
+#endif
+
+#define NDIS_COMMON_OPEN_BLOCK_S \
+  PVOID  MacHandle; \
+  NDIS_HANDLE  BindingHandle; \
+  PNDIS_MINIPORT_BLOCK  MiniportHandle; \
+  PNDIS_PROTOCOL_BLOCK  ProtocolHandle; \
+  NDIS_HANDLE  ProtocolBindingContext; \
+  PNDIS_OPEN_BLOCK  MiniportNextOpen; \
+  PNDIS_OPEN_BLOCK  ProtocolNextOpen; \
+  NDIS_HANDLE  MiniportAdapterContext; \
+  BOOLEAN  Reserved1; \
+  BOOLEAN  Reserved2; \
+  BOOLEAN  Reserved3; \
+  BOOLEAN  Reserved4; \
+  PNDIS_STRING  BindDeviceName; \
+  KSPIN_LOCK  Reserved5; \
+  PNDIS_STRING  RootDeviceName; \
+  _ANONYMOUS_UNION union { \
+    SEND_HANDLER  SendHandler; \
+    WAN_SEND_HANDLER  WanSendHandler; \
+  } DUMMYUNIONNAME; \
+  TRANSFER_DATA_HANDLER  TransferDataHandler; \
+  SEND_COMPLETE_HANDLER  SendCompleteHandler; \
+  TRANSFER_DATA_COMPLETE_HANDLER  TransferDataCompleteHandler; \
+  RECEIVE_HANDLER  ReceiveHandler; \
+  RECEIVE_COMPLETE_HANDLER  ReceiveCompleteHandler; \
+  WAN_RECEIVE_HANDLER  WanReceiveHandler; \
+  REQUEST_COMPLETE_HANDLER  RequestCompleteHandler; \
+  RECEIVE_PACKET_HANDLER  ReceivePacketHandler; \
+  SEND_PACKETS_HANDLER  SendPacketsHandler; \
+  RESET_HANDLER  ResetHandler; \
+  REQUEST_HANDLER  RequestHandler; \
+  RESET_COMPLETE_HANDLER  ResetCompleteHandler; \
+  STATUS_HANDLER  StatusHandler; \
+  STATUS_COMPLETE_HANDLER  StatusCompleteHandler; \
+  NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
+
+typedef struct _NDIS_COMMON_OPEN_BLOCK {
+  NDIS_COMMON_OPEN_BLOCK_S
+} NDIS_COMMON_OPEN_BLOCK;
+
+struct _NDIS_OPEN_BLOCK
+{
+#ifdef __cplusplus
+  NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
+#else
+  NDIS_COMMON_OPEN_BLOCK_S
+#endif
+};
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisOpenConfiguration(
-  OUT  PNDIS_STATUS  Status,
-  OUT  PNDIS_HANDLE  ConfigurationHandle,
-  IN NDIS_HANDLE  WrapperConfigurationContext);
+NdisInitializeTimer(
+  PNDIS_TIMER Timer,
+  PNDIS_TIMER_FUNCTION TimerFunction,
+  PVOID FunctionContext);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisReadNetworkAddress(
-  OUT PNDIS_STATUS  Status,
-  OUT PVOID  *NetworkAddress,
-  OUT PUINT  NetworkAddressLength,
-  IN NDIS_HANDLE  ConfigurationHandle);
+NdisCancelTimer(
+  PNDIS_TIMER Timer,
+  PBOOLEAN TimerCancelled);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisReadEisaSlotInformation(
-  OUT PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  WrapperConfigurationContext,
-  OUT PUINT  SlotNumber,
-  OUT PNDIS_EISA_FUNCTION_INFORMATION  EisaData);
+NdisSetTimer(
+  PNDIS_TIMER Timer,
+  UINT MillisecondsToDelay);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisReadEisaSlotInformationEx(
-  OUT PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  WrapperConfigurationContext,
-  OUT PUINT  SlotNumber,
-  OUT PNDIS_EISA_FUNCTION_INFORMATION  *EisaData,
-  OUT PUINT  NumberOfFunctions);
+NdisSetPeriodicTimer(
+  PNDIS_TIMER NdisTimer,
+  UINT MillisecondsPeriod);
 
 NDISAPI
 
 NDISAPI
-ULONG
+VOID
 NTAPI
 NTAPI
-NdisReadPciSlotInformation(
-  IN NDIS_HANDLE  NdisAdapterHandle,
-  IN ULONG  SlotNumber,
-  IN ULONG  Offset,
-  IN PVOID  Buffer,
-  IN ULONG  Length);
+NdisSetTimerEx(
+  PNDIS_TIMER NdisTimer,
+  UINT MillisecondsToDelay,
+  PVOID FunctionContext);
 
 NDISAPI
 
 NDISAPI
-ULONG
+PVOID
 NTAPI
 NTAPI
-NdisWritePciSlotInformation(
-  IN NDIS_HANDLE  NdisAdapterHandle,
-  IN ULONG  SlotNumber,
-  IN ULONG  Offset,
-  IN PVOID  Buffer,
-  IN ULONG  Length);
+NdisGetRoutineAddress(
+  PNDIS_STRING NdisRoutineName);
 
 
+NDISAPI
+UINT
+NTAPI
+NdisGetVersion(VOID);
 
 
+#if NDIS_LEGACY_DRIVER
 
 
-/* String management routines */
+NDISAPI
+VOID
+NTAPI
+NdisAllocateBuffer(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_BUFFER *Buffer,
+  IN NDIS_HANDLE PoolHandle OPTIONAL,
+  IN PVOID VirtualAddress,
+  IN UINT Length);
 
 NDISAPI
 
 NDISAPI
-NDIS_STATUS
+VOID
 NTAPI
 NTAPI
-NdisAnsiStringToUnicodeString(
-  IN OUT PNDIS_STRING  DestinationString,
-  IN PNDIS_ANSI_STRING  SourceString);
+NdisAllocateBufferPool(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_HANDLE PoolHandle,
+  IN UINT NumberOfDescriptors);
+
+NDISAPI
+VOID
+NTAPI
+NdisFreeBufferPool(
+  IN NDIS_HANDLE PoolHandle);
 
 /*
 
 /*
- * BOOLEAN
- * NdisEqualString(
- *   IN PNDIS_STRING  String1,
- *   IN PNDIS_STRING  String2,
- *   IN BOOLEAN  CaseInsensitive);
- */
-#define NdisEqualString(_String1, _String2, _CaseInsensitive) \
-  RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive)
+NDISAPI
+VOID
+NTAPI
+NdisFreeBuffer(
+  IN PNDIS_BUFFER Buffer);
+*/
+#define NdisFreeBuffer IoFreeMdl
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisInitAnsiString(
-  IN OUT PNDIS_ANSI_STRING  DestinationString,
-  IN PCSTR  SourceString);
+NdisAllocatePacketPool(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_HANDLE PoolHandle,
+  IN UINT NumberOfDescriptors,
+  IN UINT ProtocolReservedLength);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisInitUnicodeString(
-  IN OUT PNDIS_STRING  DestinationString,
-  IN PCWSTR  SourceString);
+NdisAllocatePacketPoolEx(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_HANDLE PoolHandle,
+  IN UINT NumberOfDescriptors,
+  IN UINT NumberOfOverflowDescriptors,
+  IN UINT ProtocolReservedLength);
 
 NDISAPI
 
 NDISAPI
-NDIS_STATUS
+VOID
 NTAPI
 NTAPI
-NdisUnicodeStringToAnsiString(
-  IN OUT PNDIS_ANSI_STRING  DestinationString,
-  IN PNDIS_STRING  SourceString);
+NdisSetPacketPoolProtocolId(
+  IN NDIS_HANDLE PacketPoolHandle,
+  IN UINT ProtocolId);
 
 
-#define NdisFreeString(_s)  NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
-#define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
+NDISAPI
+UINT
+NTAPI
+NdisPacketPoolUsage(
+  IN NDIS_HANDLE PoolHandle);
 
 
+NDISAPI
+UINT
+NTAPI
+NdisPacketSize(
+  IN UINT ProtocolReservedSize);
 
 
-/* Spin lock reoutines */
+NDISAPI
+NDIS_HANDLE
+NTAPI
+NdisGetPoolFromPacket(
+  IN PNDIS_PACKET Packet);
 
 
-/*
 NDISAPI
 NDISAPI
-VOID
 NTAPI
 NTAPI
-NdisAllocateSpinLock(
-  IN PNDIS_SPIN_LOCK SpinLock);
-*/
-#define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock)
+PNDIS_PACKET_STACK
+NdisIMGetCurrentPacketStack(
+  IN PNDIS_PACKET Packet,
+  OUT BOOLEAN * StacksRemaining);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisFreeSpinLock(
-  IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisFreeSpinLock(_SpinLock)
+NdisFreePacketPool(
+  IN NDIS_HANDLE PoolHandle);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisAcquireSpinLock(
-  IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
+NdisFreePacket(
+  IN PNDIS_PACKET Packet);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisReleaseSpinLock(
-  IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql)
+NdisDprFreePacket(
+  IN PNDIS_PACKET Packet);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisDprAcquireSpinLock(
-  IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisDprAcquireSpinLock(_SpinLock) KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock)
+NdisDprFreePacketNonInterlocked(
+  IN PNDIS_PACKET Packet);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisDprReleaseSpinLock(
-  IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
+NdisAllocatePacket(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_PACKET *Packet,
+  IN NDIS_HANDLE PoolHandle);
 
 
-/* I/O routines */
+NDISAPI
+VOID
+NTAPI
+NdisDprAllocatePacket(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_PACKET *Packet,
+  IN NDIS_HANDLE PoolHandle);
 
 
-/*
- * VOID
- * NdisRawReadPortBufferUchar(
- *   IN ULONG  Port,
- *   OUT PUCHAR  Buffer,
- *   IN ULONG  Length);
- */
-#define NdisRawReadPortBufferUchar(Port, Buffer, Length)    \
-  READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
+NDISAPI
+VOID
+NTAPI
+NdisDprAllocatePacketNonInterlocked(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_PACKET *Packet,
+  IN NDIS_HANDLE PoolHandle);
 
 /*
  * VOID
 
 /*
  * VOID
- * NdisRawReadPortBufferUlong(
- *   IN ULONG  Port,
- *   OUT PULONG  Buffer,
- *   IN ULONG  Length);
+ * NdisReinitializePacket(
+ *   IN OUT  PNDIS_PACKET  Packet);
  */
  */
-#define NdisRawReadPortBufferUlong(Port, Buffer, Length)  \
-  READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
+#define NdisReinitializePacket(Packet) {        \
+  (Packet)->Private.Head = (PNDIS_BUFFER)NULL;  \
+  (Packet)->Private.ValidCounts = FALSE;        \
+}
 
 /*
 
 /*
- * VOID
- * NdisRawReadPortBufferUshort(
- *   IN ULONG  Port,
- *   OUT PUSHORT  Buffer,
- *   IN ULONG  Length);
- */
-#define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
-  READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
+NDISAPI
+VOID
+NTAPI
+NdisQueryBuffer(
+  IN PNDIS_BUFFER Buffer,
+  OUT PVOID *VirtualAddress OPTIONAL,
+  OUT PUINT Length);
+*/
+#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length) {         \
+  if (ARGUMENT_PRESENT(_VirtualAddress)) {                           \
+    *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdl(_Buffer); \
+  }                                                                  \
+  *(_Length) = MmGetMdlByteCount(_Buffer);                           \
+}
 
 
+NDISAPI
+VOID
+NTAPI
+NdisGetFirstBufferFromPacket(
+  IN PNDIS_PACKET _Packet,
+  OUT PNDIS_BUFFER *_FirstBuffer,
+  OUT PVOID *_FirstBufferVA,
+  OUT PUINT _FirstBufferLength,
+  OUT PUINT _TotalBufferLength);
 
 /*
  * VOID
 
 /*
  * VOID
- * NdisRawReadPortUchar(
- *   IN ULONG  Port,
- *   OUT PUCHAR  Data);
+ * NdisGetFirstBufferFromPacketSafe(
+ * IN PNDIS_PACKET _Packet,
+ * OUT PNDIS_BUFFER * _FirstBuffer,
+ * OUT PVOID * _FirstBufferVA,
+ * OUT PUINT _FirstBufferLength,
+ * OUT PUINT _TotalBufferLength),
+ * IN MM_PAGE_PRIORITY _Priority)
  */
  */
-#define NdisRawReadPortUchar(Port, Data) \
-  *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
+#define NdisGetFirstBufferFromPacketSafe(_Packet,                             \
+                                     _FirstBuffer,                            \
+                                     _FirstBufferVA,                          \
+                                     _FirstBufferLength,                      \
+                                     _TotalBufferLength,                      \
+                                     _Priority)                               \
+{                                                                             \
+  PNDIS_BUFFER _Buffer;                                                       \
+                                                                              \
+  _Buffer         = (_Packet)->Private.Head;                                  \
+  *(_FirstBuffer) = _Buffer;                                                  \
+  if (_Buffer != NULL) {                                                      \
+    *(_FirstBufferVA)     = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
+    *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer);                       \
+    _Buffer = _Buffer->Next;                                                  \
+    *(_TotalBufferLength) = *(_FirstBufferLength);                            \
+    while (_Buffer != NULL) {                                                 \
+      *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer);                    \
+      _Buffer = _Buffer->Next;                                                \
+    }                                                                         \
+  }                                                                           \
+  else {                                                                      \
+    *(_FirstBufferVA) = 0;                                                    \
+    *(_FirstBufferLength) = 0;                                                \
+    *(_TotalBufferLength) = 0;                                                \
+  }                                                                           \
+}
 
 /*
  * VOID
 
 /*
  * VOID
- * NdisRawReadPortUlong(
- *   IN ULONG  Port,
- *   OUT PULONG  Data);
+ * NdisRecalculatePacketCounts(
+ *   IN OUT PNDIS_PACKET Packet);
  */
  */
-#define NdisRawReadPortUlong(Port, Data) \
-  *(Data) = READ_PORT_ULONG((PULONG)(Port))
+#define NdisRecalculatePacketCounts(Packet) {     \
+  PNDIS_BUFFER _Buffer = (Packet)->Private.Head;  \
+  if (_Buffer != NULL) {                          \
+    while (_Buffer->Next != NULL) {               \
+      _Buffer = _Buffer->Next;                    \
+    }                                             \
+    (Packet)->Private.Tail = _Buffer;             \
+  }                                               \
+  (Packet)->Private.ValidCounts = FALSE;          \
+}
 
 /*
  * VOID
 
 /*
  * VOID
- * NdisRawReadPortUshort(
- *   IN ULONG   Port,
- *   OUT PUSHORT Data);
+ * NdisChainBufferAtFront(
+ *   IN OUT PNDIS_PACKET Packet,
+ *   IN OUT PNDIS_BUFFER Buffer)
  */
  */
-#define NdisRawReadPortUshort(Port, Data) \
-  *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
-
-
-/*
- * VOID
- * NdisRawWritePortBufferUchar(
- *   IN ULONG  Port,
- *   IN PUCHAR  Buffer,
- *   IN ULONG  Length);
- */
-#define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
-  WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
-
-/*
- * VOID
- * NdisRawWritePortBufferUlong(
- *   IN ULONG  Port,
- *   IN PULONG  Buffer,
- *   IN ULONG  Length);
- */
-#define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
-  WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
-
-/*
- * VOID
- * NdisRawWritePortBufferUshort(
- *   IN ULONG   Port,
- *   IN PUSHORT Buffer,
- *   IN ULONG   Length);
- */
-#define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
-  WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
-
-
-/*
- * VOID
- * NdisRawWritePortUchar(
- *   IN ULONG  Port,
- *   IN UCHAR  Data);
- */
-#define NdisRawWritePortUchar(Port, Data) \
-  WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
-
-/*
- * VOID
- * NdisRawWritePortUlong(
- *   IN ULONG  Port,
- *   IN ULONG  Data);
- */
-#define NdisRawWritePortUlong(Port, Data)   \
-  WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
-
-/*
- * VOID
- * NdisRawWritePortUshort(
- *   IN ULONG  Port,
- *   IN USHORT  Data);
- */
-#define NdisRawWritePortUshort(Port, Data) \
-  WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
-
-
-/*
- * VOID
- * NdisReadRegisterUchar(
- *   IN PUCHAR  Register,
- *   OUT PUCHAR  Data);
- */
-#define NdisReadRegisterUchar(Register, Data) \
-  *(Data) = *(Register)
-
-/*
- * VOID
- * NdisReadRegisterUlong(
- *   IN PULONG  Register,
- *   OUT PULONG  Data);
- */
-#define NdisReadRegisterUlong(Register, Data)   \
-  *(Data) = *(Register)
-
-/*
- * VOID
- * NdisReadRegisterUshort(
- *   IN PUSHORT  Register,
- *   OUT PUSHORT  Data);
- */
-#define NdisReadRegisterUshort(Register, Data)  \
-    *(Data) = *(Register)
-
-/*
- * VOID
- * NdisReadRegisterUchar(
- *   IN PUCHAR  Register,
- *   IN UCHAR  Data);
- */
-#define NdisWriteRegisterUchar(Register, Data) \
-  WRITE_REGISTER_UCHAR((Register), (Data))
-
-/*
- * VOID
- * NdisReadRegisterUlong(
- *   IN PULONG  Register,
- *   IN ULONG  Data);
- */
-#define NdisWriteRegisterUlong(Register, Data) \
-  WRITE_REGISTER_ULONG((Register), (Data))
-
-/*
- * VOID
- * NdisReadRegisterUshort(
- *   IN PUSHORT  Register,
- *   IN USHORT  Data);
- */
-#define NdisWriteRegisterUshort(Register, Data) \
-  WRITE_REGISTER_USHORT((Register), (Data))
-
-
-/* Linked lists */
-
-/*
- * VOID
- * NdisInitializeListHead(
- *   IN PLIST_ENTRY  ListHead);
- */
-#define NdisInitializeListHead(_ListHead) \
-  InitializeListHead(_ListHead)
-
-/*
- * PLIST_ENTRY
- * NdisInterlockedInsertHeadList(
- *   IN PLIST_ENTRY  ListHead,
- *   IN PLIST_ENTRY  ListEntry,
- *   IN PNDIS_SPIN_LOCK  SpinLock);
- */
-#define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
-  ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
-
-/*
- * PLIST_ENTRY
- * NdisInterlockedInsertTailList(
- *   IN PLIST_ENTRY  ListHead,
- *   IN PLIST_ENTRY  ListEntry,
- *   IN PNDIS_SPIN_LOCK  SpinLock);
- */
-#define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
-  ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
-
-/*
- * PLIST_ENTRY
- * NdisInterlockedRemoveHeadList(
- *   IN PLIST_ENTRY  ListHead,
- *   IN PNDIS_SPIN_LOCK  SpinLock);
-*/
-#define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
-  ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
+#define NdisChainBufferAtFront(Packet,        \
+                               Buffer)        \
+{                                             \
+  PNDIS_BUFFER _NdisBuffer = (Buffer);        \
+                                              \
+  while (_NdisBuffer->Next != NULL)           \
+    _NdisBuffer = _NdisBuffer->Next;          \
+                                              \
+  if ((Packet)->Private.Head == NULL)         \
+    (Packet)->Private.Tail = _NdisBuffer;     \
+                                              \
+  _NdisBuffer->Next = (Packet)->Private.Head; \
+  (Packet)->Private.Head = (Buffer);          \
+  (Packet)->Private.ValidCounts = FALSE;      \
+}
 
 /*
  * VOID
 
 /*
  * VOID
- * NdisInitializeSListHead(
- *   IN PSLIST_HEADER  SListHead);
- */
-#define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
-
-/*
- * USHORT NdisQueryDepthSList(
- *   IN PSLIST_HEADER  SListHead);
+ * NdisChainBufferAtBack(
+ *   IN OUT PNDIS_PACKET Packet,
+ *   IN OUT PNDIS_BUFFER Buffer)
  */
  */
-#define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
-
-#define NdisInterlockedPushEntryList(ListHead, ListEntry, Lock) \
-  ExInterlockedPushEntryList(ListHead, ListEntry, &(Lock)->SpinLock)
-
-#define NdisInterlockedPopEntryList(ListHead, Lock) \
-  ExInterlockedPopEntryList(ListHead, &(Lock)->SpinLock)
-
-/* Interlocked routines */
+#define NdisChainBufferAtBack(Packet,           \
+                              Buffer)           \
+{                                               \
+  PNDIS_BUFFER NdisBuffer = (Buffer);           \
+                                                \
+  while (NdisBuffer->Next != NULL)              \
+    NdisBuffer = NdisBuffer->Next;              \
+                                                \
+  NdisBuffer->Next = NULL;                      \
+                                                \
+  if ((Packet)->Private.Head != NULL)           \
+    (Packet)->Private.Tail->Next = (Buffer);    \
+  else                                          \
+    (Packet)->Private.Head = (Buffer);          \
+                                                \
+  (Packet)->Private.Tail = NdisBuffer;          \
+  (Packet)->Private.ValidCounts = FALSE;        \
+}
 
 
-/*
- * LONG
- * NdisInterlockedDecrement(
- *   IN PLONG  Addend);
- */
-#define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
+NDISAPI
+VOID
+NTAPI
+NdisUnchainBufferAtFront(
+  IN OUT PNDIS_PACKET Packet,
+  OUT PNDIS_BUFFER *Buffer);
 
 
-/*
- * LONG
- * NdisInterlockedIncrement(
- *   IN PLONG  Addend);
- */
-#define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
+NDISAPI
+VOID
+NTAPI
+NdisUnchainBufferAtBack(
+  IN OUT PNDIS_PACKET Packet,
+  OUT PNDIS_BUFFER *Buffer);
 
 
-/*
- * VOID
- * NdisInterlockedAddUlong(
- *   IN PULONG  Addend,
- *   IN ULONG  Increment,
- *   IN PNDIS_SPIN_LOCK  SpinLock);
- */
-#define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
-  ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
+NDISAPI
+VOID
+NTAPI
+NdisCopyFromPacketToPacket(
+  IN PNDIS_PACKET Destination,
+  IN UINT DestinationOffset,
+  IN UINT BytesToCopy,
+  IN PNDIS_PACKET Source,
+  IN UINT SourceOffset,
+  OUT PUINT BytesCopied);
 
 
+NDISAPI
+VOID
+NTAPI
+NdisCopyFromPacketToPacketSafe(
+  IN PNDIS_PACKET Destination,
+  IN UINT DestinationOffset,
+  IN UINT BytesToCopy,
+  IN PNDIS_PACKET Source,
+  IN UINT SourceOffset,
+  OUT PUINT BytesCopied,
+  IN MM_PAGE_PRIORITY Priority);
 
 
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisAllocateMemory(
+  OUT PVOID *VirtualAddress,
+  IN UINT Length,
+  IN UINT MemoryFlags,
+  IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
+
+#define NdisInitializeWorkItem(_WI_, _R_, _C_) { \
+  (_WI_)->Context = _C_;                         \
+  (_WI_)->Routine = _R_;                         \
+}
 
 
-/* Miscellaneous routines */
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisScheduleWorkItem(
+  IN PNDIS_WORK_ITEM WorkItem);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCloseConfiguration(
-  IN NDIS_HANDLE  ConfigurationHandle);
+NdisSetPacketStatus(
+  IN PNDIS_PACKET Packet,
+  IN NDIS_STATUS Status,
+  IN NDIS_HANDLE Handle,
+  IN ULONG Code);
+
+#endif /* NDIS_LEGACY_DRIVER */
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisReadConfiguration(
-  OUT  PNDIS_STATUS  Status,
-  OUT  PNDIS_CONFIGURATION_PARAMETER  *ParameterValue,
-  IN NDIS_HANDLE  ConfigurationHandle,
-  IN PNDIS_STRING  Keyword,
-  IN NDIS_PARAMETER_TYPE  ParameterType);
+NdisOpenFile(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_HANDLE FileHandle,
+  OUT PUINT FileLength,
+  IN PNDIS_STRING FileName,
+  IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisWriteConfiguration(
-  OUT  PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  WrapperConfigurationContext,
-  IN PNDIS_STRING  Keyword,
-  IN PNDIS_CONFIGURATION_PARAMETER  ParameterValue);
+NdisCloseFile(
+  IN NDIS_HANDLE FileHandle);
 
 NDISAPI
 VOID
 
 NDISAPI
 VOID
-__cdecl
-NdisWriteErrorLogEntry(
-       IN NDIS_HANDLE  NdisAdapterHandle,
-       IN NDIS_ERROR_CODE  ErrorCode,
-       IN ULONG  NumberOfErrorValues,
-       IN ...);
-
-/*
- * VOID
- * NdisStallExecution(
- *   IN UINT  MicrosecondsToStall)
- */
-#define NdisStallExecution KeStallExecutionProcessor
+NTAPI
+NdisMapFile(
+  OUT PNDIS_STATUS Status,
+  OUT PVOID *MappedBuffer,
+  IN NDIS_HANDLE FileHandle);
 
 
-/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisGetCurrentSystemTime(
-  IN PLARGE_INTEGER  pSystemTime);
-*/
-#define NdisGetCurrentSystemTime KeQuerySystemTime
+NdisUnmapFile(
+  IN NDIS_HANDLE FileHandle);
 
 NDISAPI
 
 NDISAPI
-CCHAR
+ULONG
 NTAPI
 NTAPI
-NdisSystemProcessorCount(VOID);
+NdisGetSharedDataAlignment(VOID);
+
+#define NdisFlushBuffer(Buffer,WriteToDevice) \
+  KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE)
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisGetCurrentProcessorCpuUsage(
-  OUT PULONG  pCpuUsage);
-
-
-
-/* NDIS helper macros */
+NdisCopyBuffer(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_BUFFER *Buffer,
+  IN NDIS_HANDLE PoolHandle,
+  IN PVOID MemoryDescriptor,
+  IN UINT Offset,
+  IN UINT Length);
 
 /*
  * VOID
 
 /*
  * VOID
- * NDIS_INIT_FUNCTION(FunctionName)
+ * NdisCopyLookaheadData(
+ *   IN PVOID Destination,
+ *   IN PVOID Source,
+ *   IN ULONG Length,
+ *   IN ULONG ReceiveFlags);
  */
  */
-#define NDIS_INIT_FUNCTION(FunctionName)    \
-  alloc_text(init, FunctionName)
 
 
-/*
- * VOID
- * NDIS_PAGABLE_FUNCTION(FunctionName)
- */
-#define NDIS_PAGEABLE_FUNCTION(FunctionName) \
-  alloc_text(page, FunctionName)
-
-#define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
-
-
-/* NDIS 4.0 extensions */
-
-NDISAPI
-VOID
-NTAPI
-NdisMFreeSharedMemory(
-       IN NDIS_HANDLE  MiniportAdapterHandle,
-       IN ULONG  Length,
-       IN BOOLEAN  Cached,
-       IN PVOID  VirtualAddress,
-       IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
-
-NDISAPI
-VOID
-NTAPI
-NdisMWanIndicateReceive(
-       OUT PNDIS_STATUS  Status,
-       IN NDIS_HANDLE  MiniportAdapterHandle,
-       IN NDIS_HANDLE  NdisLinkContext,
-       IN PUCHAR  PacketBuffer,
-       IN UINT  PacketSize);
+#if defined(_M_IX86) || defined(_M_AMD64)
+#define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
+  RtlCopyMemory(Destination, Source, Length)
+#else
+#define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
+  { \
+    if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
+    { \
+      RtlCopyMemory(_Destination, _Source, _Length); \
+    } \
+    else \
+    { \
+      PUCHAR _Src = (PUCHAR)(Source); \
+      PUCHAR _Dest = (PUCHAR)(Destination); \
+      PUCHAR _End = _Dest + (Length); \
+      while (_Dest < _End) \
+        *_Dest++ = *_Src++; \
+    } \
+  }
+#endif
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisMWanIndicateReceiveComplete(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+NdisReturnPackets(
+  IN PNDIS_PACKET  *PacketsToReturn,
+  IN UINT  NumberOfPackets);
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisMWanSendComplete(
-       IN NDIS_HANDLE  MiniportAdapterHandle,
-       IN PNDIS_WAN_PACKET  Packet,
-       IN NDIS_STATUS  Status);
-
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisPciAssignResources(
-       IN NDIS_HANDLE  NdisMacHandle,
-       IN NDIS_HANDLE  NdisWrapperHandle,
-       IN NDIS_HANDLE  WrapperConfigurationContext,
-       IN ULONG  SlotNumber,
-       OUT PNDIS_RESOURCE_LIST  *AssignedResources);
-
+NdisAdjustBufferLength(
+  IN PNDIS_BUFFER Buffer,
+  IN UINT Length);
+*/
+#define NdisAdjustBufferLength(Buffer, Length) \
+  (((Buffer)->ByteCount) = (Length))
 
 
-/* NDIS 5.0 extensions */
+#if NDIS_SUPPORT_NDIS6
+#define NdisAdjustMdlLength(_Mdl, _Length) \
+  (((_Mdl)->ByteCount) = (_Length))
+#endif
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisAcquireReadWriteLock(
-  IN PNDIS_RW_LOCK  Lock,
-  IN BOOLEAN  fWrite,
-  IN PLOCK_STATE  LockState);
+NdisBufferLength(
+  IN PNDIS_BUFFER  Buffer);
 
 NDISAPI
 
 NDISAPI
-NDIS_STATUS
+PVOID
 NTAPI
 NTAPI
-NdisAllocateMemoryWithTag(
-  OUT PVOID  *VirtualAddress,
-  IN UINT  Length,
-  IN ULONG  Tag);
+NdisBufferVirtualAddress(
+  IN PNDIS_BUFFER  Buffer);
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisAllocatePacketPoolEx(
-  OUT PNDIS_STATUS  Status,
-  OUT PNDIS_HANDLE  PoolHandle,
-  IN UINT  NumberOfDescriptors,
-  IN UINT  NumberOfOverflowDescriptors,
-  IN UINT  ProtocolReservedLength);
+NDIS_BUFFER_TO_SPAN_PAGES(
+  IN PNDIS_BUFFER Buffer);
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisSetPacketPoolProtocolId(
-  IN NDIS_HANDLE PacketPoolHandle,
-  IN UINT ProtocolId);
+NdisGetBufferPhysicalArraySize(
+  IN PNDIS_BUFFER Buffer,
+  OUT PUINT ArraySize);
+*/
+#define NdisGetBufferPhysicalArraySize(Buffer, ArraySize) \
+  (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer))
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisCompletePnPEvent(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisBindingHandle,
-  IN PNET_PNP_EVENT  NetPnPEvent);
+NdisQueryBufferOffset(
+  IN PNDIS_BUFFER Buffer,
+  OUT PUINT Offset,
+  OUT PUINT Length);
+*/
+#define NdisQueryBufferOffset(_Buffer, _Offset, _Length) { \
+  *(_Offset) = MmGetMdlByteOffset(_Buffer);                \
+  *(_Length) = MmGetMdlByteCount(_Buffer);                 \
+}
 
 
-NDISAPI
-VOID
-NTAPI
-NdisGetCurrentProcessorCounts(
-  OUT PULONG  pIdleCount,
-  OUT PULONG  pKernelAndUser,
-  OUT PULONG  pIndex);
+/*
+ * PVOID
+ * NDIS_BUFFER_LINKAGE(
+ *   IN PNDIS_BUFFER Buffer);
+ */
+#define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
 
 
-NDISAPI
-VOID
-NTAPI
-NdisGetDriverHandle(
-  IN PNDIS_HANDLE  NdisBindingHandle,
-  OUT PNDIS_HANDLE  NdisDriverHandle);
+/*
+ * VOID
+ * NdisGetNextBuffer(
+ *   IN PNDIS_BUFFER CurrentBuffer,
+ *   OUT PNDIS_BUFFER * NextBuffer)
+ */
+#define NdisGetNextBuffer(CurrentBuffer,  \
+                          NextBuffer)     \
+{                                         \
+  *(NextBuffer) = (CurrentBuffer)->Next;  \
+}
 
 
-NDISAPI
-PNDIS_PACKET
-NTAPI
-NdisGetReceivedPacket(
-  IN PNDIS_HANDLE  NdisBindingHandle,
-  IN PNDIS_HANDLE  MacContext);
+#if NDIS_LEGACY_DRIVER
 
 
-NDISAPI
-VOID
-NTAPI
-NdisGetSystemUpTime(
-  OUT PULONG  pSystemUpTime);
+#define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head)
+#define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail)
+#define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisInitializeReadWriteLock(
-  IN PNDIS_RW_LOCK  Lock);
+/*
+ * UINT
+ * NdisGetPacketFlags(
+ *   IN PNDIS_PACKET  Packet);
+ */
+#define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMDeregisterDevice(
-  IN NDIS_HANDLE  NdisDeviceHandle);
+/*
+ * ULONG
+ * NDIS_GET_PACKET_PROTOCOL_TYPE(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
+  ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisMGetDeviceProperty(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN OUT PDEVICE_OBJECT  *PhysicalDeviceObject  OPTIONAL,
-  IN OUT PDEVICE_OBJECT  *FunctionalDeviceObject  OPTIONAL,
-  IN OUT PDEVICE_OBJECT  *NextDeviceObject  OPTIONAL,
-  IN OUT PCM_RESOURCE_LIST  *AllocatedResources  OPTIONAL,
-  IN OUT PCM_RESOURCE_LIST  *AllocatedResourcesTranslated  OPTIONAL);
+/*
+ * PNDIS_PACKET_OOB_DATA
+ * NDIS_OOB_DATA_FROM_PACKET(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_OOB_DATA_FROM_PACKET(_Packet)    \
+  (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+  (_Packet)->Private.NdisPacketOobOffset)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMInitializeScatterGatherDma(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN BOOLEAN  Dma64BitAddresses,
-  IN ULONG  MaximumPhysicalMapping);
+/*
+ * ULONG
+ * NDIS_GET_PACKET_HEADER_SIZE(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_HEADER_SIZE(_Packet)   \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+  (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMPromoteMiniport(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+/*
+ * NDIS_STATUS
+ * NDIS_GET_PACKET_STATUS(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_STATUS(_Packet)        \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+  (_Packet)->Private.NdisPacketOobOffset))->Status
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMQueryAdapterInstanceName(
-  OUT PNDIS_STRING  AdapterInstanceName,
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_TO_SEND(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_TO_SEND(_Packet)   \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMRegisterDevice(
-  IN NDIS_HANDLE  NdisWrapperHandle,
-  IN PNDIS_STRING  DeviceName,
-  IN PNDIS_STRING  SymbolicName,
-  IN PDRIVER_DISPATCH  MajorFunctions[],
-  OUT PDEVICE_OBJECT  *pDeviceObject,
-  OUT NDIS_HANDLE  *NdisDeviceHandle);
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_SENT(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_SENT(_Packet)      \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeSent
 
 
-NDISAPI
-VOID
-NTAPI
-NdisMRegisterUnloadHandler(
-  IN NDIS_HANDLE  NdisWrapperHandle,
-  IN PDRIVER_UNLOAD  UnloadHandler);
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_RECEIVED(
+ *   IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_RECEIVED(_Packet)  \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +  \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMRemoveMiniport(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+/*
+ * VOID
+ * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
+ *   IN PNDIS_PACKET Packet,
+ *   IN PPVOID pMediaSpecificInfo,
+ *   IN PUINT pSizeMediaSpecificInfo);
+ */
+#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet,                                  \
+                                            _pMediaSpecificInfo,                      \
+                                            _pSizeMediaSpecificInfo)                  \
+{                                                                                     \
+  if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) ||            \
+      !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO))   \
+    {                                                                                 \
+      *(_pMediaSpecificInfo) = NULL;                                                  \
+      *(_pSizeMediaSpecificInfo) = 0;                                                 \
+    }                                                                                 \
+  else                                                                                \
+    {                                                                                 \
+      *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +           \
+        (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation;           \
+      *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +       \
+        (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo;              \
+    }                                                                                 \
+}
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMSetMiniportSecondary(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_HANDLE  PrimaryMiniportAdapterHandle);
+/*
+ * VOID
+ * NDIS_SET_PACKET_HEADER_SIZE(
+ *   IN PNDIS_PACKET Packet,
+ *   IN UINT HdrSize);
+ */
+#define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize)              \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                      \
+  (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisOpenConfigurationKeyByIndex(
-  OUT PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  ConfigurationHandle,
-  IN ULONG  Index,
-  OUT PNDIS_STRING  KeyName,
-  OUT PNDIS_HANDLE  KeyHandle);
+/*
+ * VOID
+ * NDIS_SET_PACKET_STATUS(
+ *   IN PNDIS_PACKET Packet,
+ *   IN NDIS_STATUS Status);
+ */
+#define NDIS_SET_PACKET_STATUS(_Packet, _Status)  \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +    \
+  (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisOpenConfigurationKeyByName(
-  OUT PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  ConfigurationHandle,
-  IN PNDIS_STRING  SubKeyName,
-  OUT PNDIS_HANDLE  SubKeyHandle);
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_TO_SEND(
+ *   IN PNDIS_PACKET Packet,
+ *   IN ULONGLONG TimeToSend);
+ */
+#define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend)  \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +              \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
 
 
-NDISAPI
-UINT
-NTAPI
-NdisPacketPoolUsage(
-  IN NDIS_HANDLE  PoolHandle);
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_SENT(
+ *   IN PNDIS_PACKET Packet,
+ *   IN ULONGLONG TimeSent);
+ */
+#define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +        \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisQueryAdapterInstanceName(
-  OUT PNDIS_STRING  AdapterInstanceName,
-  IN NDIS_HANDLE  NdisBindingHandle);
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_RECEIVED(
+ *   IN PNDIS_PACKET Packet,
+ *   IN ULONGLONG TimeReceived);
+ */
+#define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
+  ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                \
+  (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
 
 
-NDISAPI
-ULONG
-NTAPI
-NdisReadPcmciaAttributeMemory(
-  IN NDIS_HANDLE  NdisAdapterHandle,
-  IN ULONG  Offset,
-  IN PVOID  Buffer,
-  IN ULONG  Length);
+/*
+ * VOID
+ * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
+ *   IN PNDIS_PACKET Packet,
+ *   IN PVOID MediaSpecificInfo,
+ *   IN UINT SizeMediaSpecificInfo);
+ */
+#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet,                      \
+                                            _MediaSpecificInfo,           \
+                                            _SizeMediaSpecificInfo)       \
+{                                                                         \
+  if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS)     \
+    {                                                                     \
+      (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
+      ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                        \
+        (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
+          (_MediaSpecificInfo);                                           \
+      ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +                        \
+        (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
+          (_SizeMediaSpecificInfo);                                       \
+    }                                                                     \
+}
 
 
-NDISAPI
-VOID
-NTAPI
-NdisReleaseReadWriteLock(
-  IN PNDIS_RW_LOCK  Lock,
-  IN PLOCK_STATE  LockState);
+/*
+ * VOID
+ * NdisSetPacketFlags(
+ *   IN PNDIS_PACKET  Packet,
+ *   IN UINT  Flags);
+ */
+#define NdisSetPacketFlags(Packet, Flags) (Packet)->Private.Flags |= (Flags)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisWriteEventLogEntry(
-  IN PVOID  LogHandle,
-  IN NDIS_STATUS  EventCode,
-  IN ULONG  UniqueEventValue,
-  IN USHORT  NumStrings,
-  IN PVOID  StringsList  OPTIONAL,
-  IN ULONG  DataSize,
-  IN PVOID  Data  OPTIONAL);
+/*
+ * VOID
+ * NdisClearPacketFlags(
+ *   IN PNDIS_PACKET  Packet,
+ *   IN UINT  Flags);
+ */
+#define NdisClearPacketFlags(Packet, Flags) (Packet)->Private.Flags &= ~(Flags)
 
 
-NDISAPI
-ULONG
-NTAPI
-NdisWritePcmciaAttributeMemory(
-  IN NDIS_HANDLE  NdisAdapterHandle,
-  IN ULONG  Offset,
-  IN PVOID  Buffer,
-  IN ULONG  Length);
+/*
+ * VOID
+ * NdisQueryPacket(
+ *   IN PNDIS_PACKET Packet,
+ *   OUT PUINT PhysicalBufferCount OPTIONAL,
+ *   OUT PUINT BufferCount OPTIONAL,
+ *   OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
+ *   OUT PUINT TotalPacketLength OPTIONAL);
+ */
+static __inline
+VOID
+NdisQueryPacket(
+  IN PNDIS_PACKET Packet,
+  OUT PUINT PhysicalBufferCount OPTIONAL,
+  OUT PUINT BufferCount OPTIONAL,
+  OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
+  OUT PUINT TotalPacketLength OPTIONAL)
+{
+  if (FirstBuffer)
+    *FirstBuffer = Packet->Private.Head;
+  if (TotalPacketLength || BufferCount || PhysicalBufferCount) {
+    if (!Packet->Private.ValidCounts) {
+      UINT Offset;
+      UINT PacketLength;
+      PNDIS_BUFFER NdisBuffer;
+      UINT PhysicalBufferCount = 0;
+      UINT TotalPacketLength = 0;
+      UINT Count = 0;
+
+      for (NdisBuffer = Packet->Private.Head;
+           NdisBuffer != (PNDIS_BUFFER)NULL;
+           NdisBuffer = NdisBuffer->Next) {
+        PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
+        NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
+        TotalPacketLength += PacketLength;
+        Count++;
+      }
+      Packet->Private.PhysicalCount = PhysicalBufferCount;
+      Packet->Private.TotalLength = TotalPacketLength;
+      Packet->Private.Count = Count;
+      Packet->Private.ValidCounts = TRUE;
+    }
 
 
+    if (PhysicalBufferCount)
+      *PhysicalBufferCount = Packet->Private.PhysicalCount;
 
 
-/* Connectionless services */
+    if (BufferCount)
+      *BufferCount = Packet->Private.Count;
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClAddParty(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN NDIS_HANDLE  ProtocolPartyContext,
-  IN OUT PCO_CALL_PARAMETERS  CallParameters,
-  OUT PNDIS_HANDLE  NdisPartyHandle);
+    if (TotalPacketLength)
+      *TotalPacketLength = Packet->Private.TotalLength;
+  }
+}
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClCloseAddressFamily(
-  IN NDIS_HANDLE  NdisAfHandle);
+/*
+ * VOID
+ * NdisQueryPacketLength(
+ *   IN PNDIS_PACKET Packet,
+ *   OUT PUINT PhysicalBufferCount OPTIONAL,
+ *   OUT PUINT BufferCount OPTIONAL,
+ *   OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
+ *   OUT PUINT TotalPacketLength OPTIONAL);
+ */
+#define NdisQueryPacketLength(_Packet,                              \
+                              _TotalPacketLength)                   \
+{                                                                   \
+  if (!(_Packet)->Private.ValidCounts) {                            \
+    NdisQueryPacket(_Packet, NULL, NULL, NULL, _TotalPacketLength); \
+  }                                                                 \
+  else *(_TotalPacketLength) = (_Packet)->Private.TotalLength;      \
+}
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClCloseCall(
-  IN NDIS_HANDLE NdisVcHandle,
-  IN NDIS_HANDLE NdisPartyHandle  OPTIONAL,
-  IN PVOID  Buffer  OPTIONAL,
-  IN UINT  Size);
+#endif /* NDIS_LEGACY_DRIVER */
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClDeregisterSap(
-  IN NDIS_HANDLE  NdisSapHandle);
+/*
+ * VOID
+ * NdisSetSendFlags(
+ *   IN PNDIS_PACKET  Packet,
+ *   IN UINT  Flags);
+ */
+#define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClDropParty(
-  IN NDIS_HANDLE  NdisPartyHandle,
-  IN PVOID  Buffer  OPTIONAL,
-  IN UINT  Size);
+/* Memory management routines */
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisClIncomingCallComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+NdisCreateLookaheadBufferFromSharedMemory(
+  IN PVOID pSharedMemory,
+  IN UINT LookaheadLength,
+  OUT PVOID *pLookaheadBuffer);
+*/
+#define NdisCreateLookaheadBufferFromSharedMemory(_S, _L, _B) ((*(_B)) = (_S))
 
 NDISAPI
 
 NDISAPI
-NDIS_STATUS
+VOID
 NTAPI
 NTAPI
-NdisClMakeCall(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN OUT PCO_CALL_PARAMETERS  CallParameters,
-  IN NDIS_HANDLE  ProtocolPartyContext  OPTIONAL,
-  OUT PNDIS_HANDLE  NdisPartyHandle  OPTIONAL);
+NdisDestroyLookaheadBufferFromSharedMemory(
+  IN PVOID pLookaheadBuffer);
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClModifyCallQoS(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
 
 
+/*
+ * VOID
+ * NdisMoveMappedMemory(
+ *   OUT PVOID  Destination,
+ *   IN PVOID  Source,
+ *   IN ULONG  Length);
+ */
+#define NdisMoveMappedMemory(Destination, Source, Length) \
+  RtlCopyMemory(Destination, Source, Length)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClOpenAddressFamily(
-  IN NDIS_HANDLE  NdisBindingHandle,
-  IN PCO_ADDRESS_FAMILY  AddressFamily,
-  IN NDIS_HANDLE  ProtocolAfContext,
-  IN PNDIS_CLIENT_CHARACTERISTICS  ClCharacteristics,
-  IN UINT  SizeOfClCharacteristics,
-  OUT PNDIS_HANDLE  NdisAfHandle);
-
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisClRegisterSap(
-  IN NDIS_HANDLE  NdisAfHandle,
-  IN NDIS_HANDLE  ProtocolSapContext,
-  IN PCO_SAP  Sap,
-  OUT PNDIS_HANDLE  NdisSapHandle);
-
+/*
+ * VOID
+ * NdisZeroMappedMemory(
+ *   IN PVOID  Destination,
+ *   IN ULONG  Length);
+ */
+#define NdisZeroMappedMemory(Destination, Length) \
+  RtlZeroMemory(Destination, Length)
 
 
-/* Call Manager services */
+#else
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCmActivateVc(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN OUT PCO_CALL_PARAMETERS  CallParameters);
+#define NdisMoveMappedMemory(Destination, Source, Length) \
+{ \
+  PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
+  while (_Dest < _End) \
+    *_Dest++ = _Src++; \
+}
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmAddPartyComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisPartyHandle,
-  IN NDIS_HANDLE  CallMgrPartyContext  OPTIONAL,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+#define NdisZeroMappedMemory(Destination, Length) \
+{ \
+  PUCHAR _Dest = Destination, _End = _Dest + Length; \
+  while (_Dest < _End) \
+    *_Dest++ = 0; \
+}
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmCloseAddressFamilyComplete(
-  IN NDIS_STATUS Status,
-  IN NDIS_HANDLE NdisAfHandle);
+#endif /* _M_IX86 or _M_AMD64 */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmCloseCallComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL);
+/*
+ * VOID
+ * NdisMoveFromMappedMemory(
+ *   OUT PVOID  Destination,
+ *   IN PVOID  Source,
+ *   IN ULONG  Length);
+ */
+#define NdisMoveFromMappedMemory(Destination, Source, Length) \
+  NdisMoveMappedMemory(Destination, Source, Length)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCmDeactivateVc(
-  IN NDIS_HANDLE  NdisVcHandle);
+/*
+ * VOID
+ * NdisMoveToMappedMemory(
+ *   OUT PVOID  Destination,
+ *   IN PVOID  Source,
+ *   IN ULONG  Length);
+ */
+#define NdisMoveToMappedMemory(Destination, Source, Length) \
+  NdisMoveMappedMemory(Destination, Source, Length)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmDeregisterSapComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisSapHandle);
+/*
+ * VOID
+ * NdisMUpdateSharedMemory(
+ *   IN NDIS_HANDLE  MiniportAdapterHandle,
+ *   IN ULONG  Length,
+ *   IN PVOID  VirtualAddress,
+ *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
+ */
+#define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
+  NdisUpdateSharedMemory(_H, _L, _V, _P)
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmDispatchCallConnected(
-  IN NDIS_HANDLE  NdisVcHandle);
-
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCmDispatchIncomingCall(
-  IN NDIS_HANDLE  NdisSapHandle,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+NdisFreeMemory(
+  IN PVOID VirtualAddress,
+  IN UINT Length,
+  IN UINT MemoryFlags);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmDispatchIncomingCallQoSChange(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+NdisFreeMemoryWithTag(
+  IN PVOID VirtualAddress,
+  IN ULONG Tag);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmDispatchIncomingCloseCall(
-  IN NDIS_STATUS  CloseStatus,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PVOID  Buffer  OPTIONAL,
-  IN UINT  Size);
+NdisImmediateReadSharedMemory(
+  IN NDIS_HANDLE WrapperConfigurationContext,
+  IN ULONG       SharedMemoryAddress,
+  OUT PUCHAR      Buffer,
+  IN ULONG       Length);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmDispatchIncomingDropParty(
-  IN NDIS_STATUS  DropStatus,
-  IN NDIS_HANDLE  NdisPartyHandle,
-  IN PVOID  Buffer  OPTIONAL,
-  IN UINT  Size);
+NdisImmediateWriteSharedMemory(
+  IN NDIS_HANDLE WrapperConfigurationContext,
+  IN ULONG       SharedMemoryAddress,
+  IN PUCHAR      Buffer,
+  IN ULONG       Length);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmDropPartyComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisPartyHandle);
+NdisMAllocateSharedMemory(
+  IN   NDIS_HANDLE  MiniportAdapterHandle,
+  IN   ULONG  Length,
+  IN   BOOLEAN  Cached,
+  OUT   PVOID  *VirtualAddress,
+  OUT   PNDIS_PHYSICAL_ADDRESS  PhysicalAddress);
 
 NDISAPI
 
 NDISAPI
-VOID
+NDIS_STATUS
 NTAPI
 NTAPI
-NdisCmMakeCallComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
-  IN NDIS_HANDLE  CallMgrPartyContext  OPTIONAL,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+NdisMAllocateSharedMemoryAsync(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN ULONG  Length,
+  IN BOOLEAN  Cached,
+  IN PVOID  Context);
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmModifyCallQoSComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+#if defined(NDIS50)
 
 
-NDISAPI
-VOID
-NTAPI
-NdisCmOpenAddressFamilyComplete(
-  IN NDIS_STATUS Status,
-  IN NDIS_HANDLE NdisAfHandle,
-  IN NDIS_HANDLE CallMgrAfContext);
+#define NdisUpdateSharedMemory(NdisAdapterHandle, \
+                               Length,            \
+                               VirtualAddress,    \
+                               PhysicalAddress)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCmRegisterAddressFamily(
-  IN NDIS_HANDLE  NdisBindingHandle,
-  IN PCO_ADDRESS_FAMILY  AddressFamily,
-  IN PNDIS_CALL_MANAGER_CHARACTERISTICS  CmCharacteristics,
-  IN UINT  SizeOfCmCharacteristics);
+#else
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCmRegisterSapComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisSapHandle,
-  IN NDIS_HANDLE  CallMgrSapContext);
-
+NdisUpdateSharedMemory(
+  IN NDIS_HANDLE             NdisAdapterHandle,
+  IN ULONG                   Length,
+  IN PVOID                   VirtualAddress,
+  IN NDIS_PHYSICAL_ADDRESS   PhysicalAddress);
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmActivateVc(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+#endif /* defined(NDIS50) */
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmCreateVc(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_HANDLE  NdisAfHandle,
-  IN NDIS_HANDLE  MiniportVcContext,
-  OUT  PNDIS_HANDLE  NdisVcHandle);
+/*
+ * ULONG
+ * NdisGetPhysicalAddressHigh(
+ *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
+ */
+#define NdisGetPhysicalAddressHigh(PhysicalAddress) \
+  ((PhysicalAddress).HighPart)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmDeactivateVc(
-  IN NDIS_HANDLE  NdisVcHandle);
+/*
+ * VOID
+ * NdisSetPhysicalAddressHigh(
+ *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
+ *   IN ULONG  Value);
+ */
+#define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
+  ((PhysicalAddress).HighPart) = (Value)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmDeleteVc(
-  IN NDIS_HANDLE  NdisVcHandle);
+/*
+ * ULONG
+ * NdisGetPhysicalAddressLow(
+ *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
+ */
+#define NdisGetPhysicalAddressLow(PhysicalAddress) \
+  ((PhysicalAddress).LowPart)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmRegisterAddressFamily(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN PCO_ADDRESS_FAMILY  AddressFamily,
-  IN PNDIS_CALL_MANAGER_CHARACTERISTICS  CmCharacteristics,
-  IN UINT  SizeOfCmCharacteristics);
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisMCmRequest(
-  IN NDIS_HANDLE  NdisAfHandle,
-  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
-  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
-  IN OUT  PNDIS_REQUEST  NdisRequest);
+/*
+ * VOID
+ * NdisSetPhysicalAddressLow(
+ *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
+ *   IN ULONG  Value);
+ */
+#define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
+  ((PhysicalAddress).LowPart) = (Value)
 
 
+/*
+ * VOID
+ * NDIS_PHYSICAL_ADDRESS_CONST(
+ *   IN ULONG  Low,
+ *   IN LONG  High);
+ */
+#define NDIS_PHYSICAL_ADDRESS_CONST(Low, High)  \
+    { {(ULONG)(Low), (LONG)(High)} }
 
 
-/* Connection-oriented services */
+/*
+ * ULONG
+ * NdisEqualMemory(
+ *  IN CONST VOID  *Source1,
+ *  IN CONST VOID  *Source2,
+ *  IN ULONG  Length);
+ */
+#define NdisEqualMemory(Source1, Source2, Length) \
+  RtlEqualMemory(Source1, Source2, Length)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCoCreateVc(
-  IN NDIS_HANDLE  NdisBindingHandle,
-  IN NDIS_HANDLE  NdisAfHandle  OPTIONAL,
-  IN NDIS_HANDLE  ProtocolVcContext,
-  IN OUT PNDIS_HANDLE  NdisVcHandle);
+/*
+ * VOID
+ * NdisFillMemory(
+ *   IN PVOID  Destination,
+ *   IN ULONG  Length,
+ *   IN UCHAR  Fill);
+ */
+#define NdisFillMemory(Destination, Length, Fill) \
+  RtlFillMemory(Destination, Length, Fill)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCoDeleteVc(
-  IN NDIS_HANDLE  NdisVcHandle);
+/*
+ * VOID
+ * NdisMoveMemory(
+ *   OUT  PVOID  Destination,
+ *   IN PVOID  Source,
+ *   IN ULONG  Length);
+ */
+#define NdisMoveMemory(Destination, Source, Length) \
+  RtlCopyMemory(Destination, Source, Length)
 
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisCoRequest(
-  IN NDIS_HANDLE  NdisBindingHandle,
-  IN NDIS_HANDLE  NdisAfHandle  OPTIONAL,
-  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
-  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
-  IN OUT  PNDIS_REQUEST  NdisRequest);
 
 
+/*
+ * VOID
+ * NdisRetrieveUlong(
+ *   IN PULONG  DestinationAddress,
+ *   IN PULONG  SourceAddress);
+ */
+#define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
+  RtlRetrieveUlong(DestinationAddress, SourceAddress)
+
+
+/*
+ * VOID
+ * NdisStoreUlong(
+ *   IN PULONG  DestinationAddress,
+ *   IN ULONG  Value);
+ */
+#define NdisStoreUlong(DestinationAddress, Value) \
+  RtlStoreUlong(DestinationAddress, Value)
+
+
+/*
+ * VOID
+ * NdisZeroMemory(
+ *   IN PVOID  Destination,
+ *   IN ULONG  Length)
+ */
+#define NdisZeroMemory(Destination, Length) \
+  RtlZeroMemory(Destination, Length)
+
+typedef VOID
+(NTAPI *NDIS_BLOCK_INITIALIZER) (
+    IN  PUCHAR  Block,
+    IN  SIZE_T  NumberOfBytes
+    );
+
+/* Configuration routines */
+
+#if NDIS_LEGACY_DRIVER
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisCoRequestComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisAfHandle,
-  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
-  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
-  IN PNDIS_REQUEST  NdisRequest);
+NdisOpenConfiguration(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_HANDLE ConfigurationHandle,
+  IN NDIS_HANDLE WrapperConfigurationContext);
+#endif
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisCoSendPackets(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PPNDIS_PACKET  PacketArray,
-  IN UINT  NumberOfPackets);
+NdisReadNetworkAddress(
+  OUT PNDIS_STATUS Status,
+  OUT PVOID *NetworkAddress,
+  OUT PUINT NetworkAddressLength,
+  IN NDIS_HANDLE ConfigurationHandle);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisMCoActivateVcComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PCO_CALL_PARAMETERS  CallParameters);
+NdisReadEisaSlotInformation(
+  OUT PNDIS_STATUS  Status,
+  IN NDIS_HANDLE  WrapperConfigurationContext,
+  OUT PUINT  SlotNumber,
+  OUT PNDIS_EISA_FUNCTION_INFORMATION  EisaData);
 
 NDISAPI
 VOID
 NTAPI
 
 NDISAPI
 VOID
 NTAPI
-NdisMCoDeactivateVcComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle);
+NdisReadEisaSlotInformationEx(
+  OUT PNDIS_STATUS  Status,
+  IN NDIS_HANDLE  WrapperConfigurationContext,
+  OUT PUINT  SlotNumber,
+  OUT PNDIS_EISA_FUNCTION_INFORMATION  *EisaData,
+  OUT PUINT  NumberOfFunctions);
+
+#if NDIS_LEGACY_MINIPORT
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisMCoIndicateReceivePacket(
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PPNDIS_PACKET  PacketArray,
-  IN UINT  NumberOfPackets);
+NdisReadPciSlotInformation(
+  IN NDIS_HANDLE NdisAdapterHandle,
+  IN ULONG SlotNumber,
+  IN ULONG Offset,
+  OUT PVOID Buffer,
+  IN ULONG Length);
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisMCoIndicateStatus(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
-  IN NDIS_STATUS  GeneralStatus,
-  IN PVOID  StatusBuffer  OPTIONAL,
-  IN ULONG  StatusBufferSize);
+NdisWritePciSlotInformation(
+  IN NDIS_HANDLE NdisAdapterHandle,
+  IN ULONG SlotNumber,
+  IN ULONG Offset,
+  IN PVOID Buffer,
+  IN ULONG Length);
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisMCoReceiveComplete(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+NdisReadPcmciaAttributeMemory(
+  IN NDIS_HANDLE NdisAdapterHandle,
+  IN ULONG Offset,
+  OUT PVOID Buffer,
+  IN ULONG Length);
 
 NDISAPI
 
 NDISAPI
-VOID
+ULONG
 NTAPI
 NTAPI
-NdisMCoRequestComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN PNDIS_REQUEST  Request);
+NdisWritePcmciaAttributeMemory(
+  IN NDIS_HANDLE NdisAdapterHandle,
+  IN ULONG Offset,
+  IN PVOID Buffer,
+  IN ULONG Length);
+
+#endif /* NDIS_LEGACY_MINIPORT */
+
+/* String management routines */
 
 
+/*
 NDISAPI
 NDISAPI
-VOID
+NDIS_STATUS
 NTAPI
 NTAPI
-NdisMCoSendComplete(
-  IN NDIS_STATUS  Status,
-  IN NDIS_HANDLE  NdisVcHandle,
-  IN PNDIS_PACKET  Packet);
+NdisAnsiStringToUnicodeString(
+  IN OUT PNDIS_STRING DestinationString,
+  IN PNDIS_ANSI_STRING SourceString);
+*/
+#define NdisAnsiStringToUnicodeString(_us, _as) RtlAnsiStringToUnicodeString(_us, _as, FALSE)
 
 
+/*
+ * BOOLEAN
+ * NdisEqualString(
+ *   IN PNDIS_STRING String1,
+ *   IN PNDIS_STRING String2,
+ *   IN BOOLEAN CaseInsensitive);
+ */
+#define NdisEqualString RtlEqualString
 
 
-/* NDIS 5.0 extensions for intermediate drivers */
+#define NdisEqualUnicodeString RtlEqualUnicodeString
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisIMAssociateMiniport(
-  IN NDIS_HANDLE  DriverHandle,
-  IN NDIS_HANDLE  ProtocolHandle);
+NdisInitAnsiString(
+  IN OUT PNDIS_ANSI_STRING DestinationString,
+  IN PCSTR SourceString);
+*/
+#define NdisInitAnsiString RtlInitString
+
+NDISAPI
+VOID
+NTAPI
+NdisInitUnicodeString(
+  IN OUT PNDIS_STRING  DestinationString,
+  IN PCWSTR  SourceString);
 
 
+/*
 NDISAPI
 NDIS_STATUS
 NTAPI
 NDISAPI
 NDIS_STATUS
 NTAPI
-NdisIMCancelInitializeDeviceInstance(
-  IN NDIS_HANDLE  DriverHandle,
-  IN PNDIS_STRING  DeviceInstance);
+NdisUnicodeStringToAnsiString(
+  IN OUT PNDIS_ANSI_STRING DestinationString,
+  IN PNDIS_STRING SourceString);
+*/
+#define NdisUnicodeStringToAnsiString(_as, _us) RtlUnicodeStringToAnsiString(_as, _us, FALSE)
+
+#define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
+#define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
 
 
+/* Spin lock reoutines */
+
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisIMCopySendCompletePerPacketInfo(
-  IN PNDIS_PACKET  DstPacket,
-  IN PNDIS_PACKET  SrcPacket);
+NdisAllocateSpinLock(
+  IN PNDIS_SPIN_LOCK SpinLock);
+*/
+#define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock)
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisIMCopySendPerPacketInfo(
-  IN PNDIS_PACKET  DstPacket,
-  IN PNDIS_PACKET  SrcPacket);
+NdisFreeSpinLock(
+  IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisFreeSpinLock(_SpinLock)
 
 
+/*
 NDISAPI
 VOID
 NTAPI
 NDISAPI
 VOID
 NTAPI
-NdisIMDeregisterLayeredMiniport(
-  IN NDIS_HANDLE  DriverHandle);
+NdisAcquireSpinLock(
+  IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
 
 
+/*
 NDISAPI
 NDISAPI
-NDIS_HANDLE
+VOID
 NTAPI
 NTAPI
-NdisIMGetBindingContext(
-  IN NDIS_HANDLE  NdisBindingHandle);
+NdisReleaseSpinLock(
+  IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql)
 
 
+/*
 NDISAPI
 NDISAPI
-NDIS_HANDLE
+VOID
 NTAPI
 NTAPI
-NdisIMGetDeviceContext(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+NdisDprAcquireSpinLock(
+  IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisDprAcquireSpinLock(_SpinLock) KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock)
 
 
+/*
 NDISAPI
 NDISAPI
-NDIS_STATUS
+VOID
 NTAPI
 NTAPI
-NdisIMInitializeDeviceInstanceEx(
-  IN NDIS_HANDLE  DriverHandle,
-  IN PNDIS_STRING  DriverInstance,
-  IN NDIS_HANDLE  DeviceContext  OPTIONAL);
-
-NDISAPI
-PSINGLE_LIST_ENTRY
-NTAPI
-NdisInterlockedPopEntrySList(
-  IN PSLIST_HEADER  ListHead,
-  IN PKSPIN_LOCK  Lock);
+NdisDprReleaseSpinLock(
+  IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
 
 
-NDISAPI
-PSINGLE_LIST_ENTRY
-NTAPI
-NdisInterlockedPushEntrySList(
-  IN PSLIST_HEADER  ListHead,
-  IN PSINGLE_LIST_ENTRY  ListEntry,
-  IN PKSPIN_LOCK  Lock);
+/* I/O routines */
 
 
-NDISAPI
-VOID
-NTAPI
-NdisQueryBufferSafe(
-  IN PNDIS_BUFFER  Buffer,
-  OUT PVOID  *VirtualAddress  OPTIONAL,
-  OUT PUINT  Length,
-  IN UINT  Priority);
+/*
+ * VOID
+ * NdisRawReadPortBufferUchar(
+ *   IN ULONG Port,
+ *   OUT PUCHAR Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
+  READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
 
 
-/* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
+/*
+ * VOID
+ * NdisRawReadPortBufferUlong(
+ *   IN ULONG Port,
+ *   OUT PULONG Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
+  READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
 
 
-typedef BOOLEAN
-(NTAPI *W_CHECK_FOR_HANG_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawReadPortBufferUshort(
+ *   IN ULONG Port,
+ *   OUT PUSHORT Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
+  READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
 
 
-typedef VOID
-(NTAPI *W_DISABLE_INTERRUPT_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawReadPortUchar(
+ *   IN ULONG Port,
+ *   OUT PUCHAR Data);
+ */
+#define NdisRawReadPortUchar(Port, Data) \
+  *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
 
 
-typedef VOID
-(NTAPI *W_ENABLE_INTERRUPT_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawReadPortUlong(
+ *   IN ULONG Port,
+ *   OUT PULONG Data);
+ */
+#define NdisRawReadPortUlong(Port, Data) \
+  *(Data) = READ_PORT_ULONG((PULONG)(Port))
 
 
-typedef VOID
-(NTAPI *W_HALT_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawReadPortUshort(
+ *   IN ULONG Port,
+ *   OUT PUSHORT Data);
+ */
+#define NdisRawReadPortUshort(Port, Data) \
+  *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
 
 
-typedef VOID
-(NTAPI *W_HANDLE_INTERRUPT_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawWritePortBufferUchar(
+ *   IN ULONG Port,
+ *   IN PUCHAR Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
+  WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
 
 
-typedef NDIS_STATUS
-(NTAPI *W_INITIALIZE_HANDLER)(
-  OUT PNDIS_STATUS  OpenErrorStatus,
-  OUT PUINT  SelectedMediumIndex,
-  IN PNDIS_MEDIUM  MediumArray,
-  IN UINT  MediumArraySize,
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE  WrapperConfigurationContext);
+/*
+ * VOID
+ * NdisRawWritePortBufferUlong(
+ *   IN ULONG Port,
+ *   IN PULONG Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
+  WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
 
 
-typedef VOID
-(NTAPI *W_ISR_HANDLER)(
-  OUT PBOOLEAN  InterruptRecognized,
-  OUT PBOOLEAN  QueueMiniportHandleInterrupt,
-  IN   NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawWritePortBufferUshort(
+ *   IN ULONG Port,
+ *   IN PUSHORT Buffer,
+ *   IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
+  WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
 
 
-typedef NDIS_STATUS
-(NTAPI *W_QUERY_INFORMATION_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
 IN NDIS_OID  Oid,
-  IN PVOID  InformationBuffer,
-  IN ULONG  InformationBufferLength,
-  OUT PULONG  BytesWritten,
-  OUT PULONG  BytesNeeded);
+/*
+ * VOID
+ * NdisRawWritePortUchar(
*   IN ULONG Port,
+ *   IN UCHAR Data);
+ */
+#define NdisRawWritePortUchar(Port, Data) \
+  WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
 
 
-typedef NDIS_STATUS
-(NTAPI *W_RECONFIGURE_HANDLER)(
-  OUT PNDIS_STATUS  OpenErrorStatus,
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE       WrapperConfigurationContext);
+/*
+ * VOID
+ * NdisRawWritePortUlong(
+ *   IN ULONG Port,
+ *   IN ULONG Data);
+ */
+#define NdisRawWritePortUlong(Port, Data) \
+  WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
 
 
-typedef NDIS_STATUS
-(NTAPI *W_RESET_HANDLER)(
-  OUT PBOOLEAN  AddressingReset,
-  IN NDIS_HANDLE  MiniportAdapterContext);
+/*
+ * VOID
+ * NdisRawWritePortUshort(
+ *   IN ULONG Port,
+ *   IN USHORT Data);
+ */
+#define NdisRawWritePortUshort(Port, Data) \
+  WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
 
 
-typedef NDIS_STATUS
-(NTAPI *W_SEND_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN PNDIS_PACKET  Packet,
-  IN UINT  Flags);
 
 
-typedef NDIS_STATUS
-(NTAPI *WM_SEND_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE  NdisLinkHandle,
-  IN PNDIS_WAN_PACKET  Packet);
+/*
+ * VOID
+ * NdisReadRegisterUchar(
+ *   IN PUCHAR Register,
+ *   OUT PUCHAR Data);
+ */
+#define NdisReadRegisterUchar(Register, Data) \
+  *(Data) = *(Register)
 
 
-typedef NDIS_STATUS
-(NTAPI *W_SET_INFORMATION_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
 IN NDIS_OID  Oid,
-  IN PVOID  InformationBuffer,
-  IN ULONG  InformationBufferLength,
-  OUT PULONG  BytesRead,
-  OUT PULONG  BytesNeeded);
+/*
+ * VOID
+ * NdisReadRegisterUlong(
*   IN PULONG  Register,
+ *   OUT PULONG  Data);
+ */
+#define NdisReadRegisterUlong(Register, Data)   \
+  *(Data) = *(Register)
 
 
-typedef NDIS_STATUS
-(NTAPI *W_TRANSFER_DATA_HANDLER)(
-  OUT PNDIS_PACKET  Packet,
 OUT PUINT  BytesTransferred,
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE  MiniportReceiveContext,
-  IN UINT  ByteOffset,
-  IN UINT  BytesToTransfer);
+/*
+ * VOID
+ * NdisReadRegisterUshort(
*   IN PUSHORT Register,
+ *   OUT PUSHORT Data);
+ */
+#define NdisReadRegisterUshort(Register, Data) \
+    *(Data) = *(Register)
 
 
-typedef NDIS_STATUS
-(NTAPI *WM_TRANSFER_DATA_HANDLER)(
-  VOID);
+/*
+ * VOID
+ * NdisReadRegisterUchar(
+ *   IN PUCHAR Register,
+ *   IN UCHAR Data);
+ */
+#define NdisWriteRegisterUchar(Register, Data) \
+  WRITE_REGISTER_UCHAR((Register), (Data))
 
 
+/*
+ * VOID
+ * NdisReadRegisterUlong(
+ *   IN PULONG Register,
+ *   IN ULONG Data);
+ */
+#define NdisWriteRegisterUlong(Register, Data) \
+  WRITE_REGISTER_ULONG((Register), (Data))
 
 
-/* NDIS structures available only to miniport drivers */
+/*
+ * VOID
+ * NdisReadRegisterUshort(
+ *   IN PUSHORT Register,
+ *   IN USHORT Data);
+ */
+#define NdisWriteRegisterUshort(Register, Data) \
+  WRITE_REGISTER_USHORT((Register), (Data))
 
 
-#define NDIS30_MINIPORT_CHARACTERISTICS_S \
-  UCHAR  MajorNdisVersion; \
-  UCHAR  MinorNdisVersion; \
-  UINT  Reserved; \
-  W_CHECK_FOR_HANG_HANDLER  CheckForHangHandler; \
-  W_DISABLE_INTERRUPT_HANDLER  DisableInterruptHandler; \
-  W_ENABLE_INTERRUPT_HANDLER  EnableInterruptHandler; \
-  W_HALT_HANDLER  HaltHandler; \
-  W_HANDLE_INTERRUPT_HANDLER  HandleInterruptHandler; \
-  W_INITIALIZE_HANDLER  InitializeHandler; \
-  W_ISR_HANDLER  ISRHandler; \
-  W_QUERY_INFORMATION_HANDLER  QueryInformationHandler; \
-  W_RECONFIGURE_HANDLER  ReconfigureHandler; \
-  W_RESET_HANDLER  ResetHandler; \
-  W_SEND_HANDLER  SendHandler; \
-  W_SET_INFORMATION_HANDLER  SetInformationHandler; \
-  W_TRANSFER_DATA_HANDLER  TransferDataHandler;
 
 
-typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
-  NDIS30_MINIPORT_CHARACTERISTICS_S
-} NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
+/* Linked lists */
 
 
+/*
+ * VOID
+ * NdisInitializeListHead(
+ *   IN PLIST_ENTRY ListHead);
+ */
+#define NdisInitializeListHead InitializeListHead
 
 
-/* Extensions for NDIS 4.0 miniports */
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedInsertHeadList(
+ *   IN PLIST_ENTRY  ListHead,
+ *   IN PLIST_ENTRY  ListEntry,
+ *   IN PNDIS_SPIN_LOCK  SpinLock);
+ */
+#define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
+  ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
 
 
-typedef VOID
-(NTAPI *W_SEND_PACKETS_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN PPNDIS_PACKET  PacketArray,
-  IN UINT  NumberOfPackets);
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedInsertTailList(
+ *   IN PLIST_ENTRY  ListHead,
+ *   IN PLIST_ENTRY  ListEntry,
+ *   IN PNDIS_SPIN_LOCK  SpinLock);
+ */
+#define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
+  ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
 
 
-typedef VOID
-(NTAPI *W_RETURN_PACKET_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN PNDIS_PACKET  Packet);
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedRemoveHeadList(
+ *   IN PLIST_ENTRY  ListHead,
+ *   IN PNDIS_SPIN_LOCK  SpinLock);
+*/
+#define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
+  ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
 
 
-typedef VOID
-(NTAPI *W_ALLOCATE_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN PVOID  VirtualAddress,
-  IN PNDIS_PHYSICAL_ADDRESS  PhysicalAddress,
-  IN ULONG  Length,
-  IN PVOID  Context);
+/*
+ * VOID
+ * NdisInitializeSListHead(
+ *   IN PSLIST_HEADER SListHead);
+ */
+#define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
 
 
-#ifdef __cplusplus
+/*
+ * USHORT NdisQueryDepthSList(
+ *   IN PSLIST_HEADER SListHead);
+ */
+#define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
 
 
-#define NDIS40_MINIPORT_CHARACTERISTICS_S \
-  NDIS30_MINIPORT_CHARACTERISTICS  Ndis30Chars; \
-  W_RETURN_PACKET_HANDLER  ReturnPacketHandler; \
-  W_SEND_PACKETS_HANDLER  SendPacketsHandler; \
-  W_ALLOCATE_COMPLETE_HANDLER  AllocateCompleteHandler;
+#define NdisInterlockedPushEntryList(ListHead, ListEntry, Lock) \
+  ExInterlockedPushEntryList(ListHead, ListEntry, &(Lock)->SpinLock)
 
 
-#else /* !__cplusplus */
+#define NdisInterlockedPopEntryList(ListHead, Lock) \
+  ExInterlockedPopEntryList(ListHead, &(Lock)->SpinLock)
 
 
-#define NDIS40_MINIPORT_CHARACTERISTICS_S \
-  NDIS30_MINIPORT_CHARACTERISTICS_S \
-  W_RETURN_PACKET_HANDLER  ReturnPacketHandler; \
-  W_SEND_PACKETS_HANDLER  SendPacketsHandler; \
-  W_ALLOCATE_COMPLETE_HANDLER  AllocateCompleteHandler;
+/* Non-paged lookaside lists */
 
 
-#endif /* !__cplusplus */
+#define NdisInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D) \
+  ExInitializeNPagedLookasideList(_L, _AR, _FR, _Fl, _S, _T, _D)
+#define NdisDeleteNPagedLookasideList(_L) ExDeleteNPagedLookasideList(_L)
+#define NdisAllocateFromNPagedLookasideList(_L) ExAllocateFromNPagedLookasideList(_L)
+#define NdisFreeToNPagedLookasideList(_L, _E) ExFreeToNPagedLookasideList(_L, _E)
 
 
-typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
-  NDIS40_MINIPORT_CHARACTERISTICS_S
-} NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
+/* Interlocked routines */
 
 
+/*
+ * LONG
+ * NdisInterlockedDecrement(
+ *   IN PLONG  Addend);
+ */
+#define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
 
 
-/* Extensions for NDIS 5.0 miniports */
+/*
+ * LONG
+ * NdisInterlockedIncrement(
+ *   IN PLONG  Addend);
+ */
+#define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
 
 
-typedef NDIS_STATUS
-(NTAPI *W_CO_CREATE_VC_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE  NdisVcHandle,
-  OUT PNDIS_HANDLE  MiniportVcContext);
+/*
+ * VOID
+ * NdisInterlockedAddUlong(
+ *   IN PULONG  Addend,
+ *   IN ULONG  Increment,
+ *   IN PNDIS_SPIN_LOCK  SpinLock);
+ */
+#define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
+  ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
 
 
-typedef NDIS_STATUS
-(NTAPI *W_CO_DELETE_VC_HANDLER)(
-  IN NDIS_HANDLE  MiniportVcContext);
+/* Miscellaneous routines */
 
 
-typedef NDIS_STATUS
-(NTAPI *W_CO_ACTIVATE_VC_HANDLER)(
-  IN NDIS_HANDLE  MiniportVcContext,
-  IN OUT PCO_CALL_PARAMETERS  CallParameters);
+NDISAPI
+VOID
+NTAPI
+NdisCloseConfiguration(
+  IN NDIS_HANDLE ConfigurationHandle);
 
 
-typedef NDIS_STATUS
-(NTAPI *W_CO_DEACTIVATE_VC_HANDLER)(
-  IN NDIS_HANDLE  MiniportVcContext);
+NDISAPI
+VOID
+NTAPI
+NdisReadConfiguration(
+  OUT PNDIS_STATUS Status,
+  OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
+  IN NDIS_HANDLE ConfigurationHandle,
+  IN PNDIS_STRING Keyword,
+  IN NDIS_PARAMETER_TYPE ParameterType);
 
 
-typedef VOID
-(NTAPI *W_CO_SEND_PACKETS_HANDLER)(
-  IN NDIS_HANDLE  MiniportVcContext,
-  IN PPNDIS_PACKET  PacketArray,
-  IN UINT  NumberOfPackets);
+NDISAPI
+VOID
+NTAPI
+NdisWriteConfiguration(
+  OUT PNDIS_STATUS Status,
+  IN NDIS_HANDLE WrapperConfigurationContext,
+  IN PNDIS_STRING Keyword,
+  IN PNDIS_CONFIGURATION_PARAMETER ParameterValue);
 
 
-typedef NDIS_STATUS
-(NTAPI *W_CO_REQUEST_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_HANDLE  MiniportVcContext  OPTIONAL,
-  IN OUT PNDIS_REQUEST  NdisRequest);
+NDISAPI
+VOID
+__cdecl
+NdisWriteErrorLogEntry(
+  IN NDIS_HANDLE NdisAdapterHandle,
+  IN NDIS_ERROR_CODE ErrorCode,
+  IN ULONG NumberOfErrorValues,
+  IN ...);
 
 
-#ifdef __cplusplus
+NDISAPI
+VOID
+NTAPI
+NdisInitializeString(
+  OUT PNDIS_STRING Destination,
+  IN PUCHAR Source);
 
 
-#define NDIS50_MINIPORT_CHARACTERISTICS_S \
-  NDIS40_MINIPORT_CHARACTERISTICS  Ndis40Chars; \
-  W_CO_CREATE_VC_HANDLER  CoCreateVcHandler; \
-  W_CO_DELETE_VC_HANDLER  CoDeleteVcHandler; \
-  W_CO_ACTIVATE_VC_HANDLER  CoActivateVcHandler; \
-  W_CO_DEACTIVATE_VC_HANDLER  CoDeactivateVcHandler; \
-  W_CO_SEND_PACKETS_HANDLER  CoSendPacketsHandler; \
-  W_CO_REQUEST_HANDLER  CoRequestHandler;
+/*
+ * VOID
+ * NdisStallExecution(
+ *   IN UINT MicrosecondsToStall)
+ */
+#define NdisStallExecution KeStallExecutionProcessor
 
 
-#else /* !__cplusplus */
+/*
+NDISAPI
+VOID
+NTAPI
+NdisGetCurrentSystemTime(
+  IN PLARGE_INTEGER  pSystemTime);
+*/
+#define NdisGetCurrentSystemTime KeQuerySystemTime
 
 
-#define NDIS50_MINIPORT_CHARACTERISTICS_S \
-  NDIS40_MINIPORT_CHARACTERISTICS_S \
-  W_CO_CREATE_VC_HANDLER  CoCreateVcHandler; \
-  W_CO_DELETE_VC_HANDLER  CoDeleteVcHandler; \
-  W_CO_ACTIVATE_VC_HANDLER  CoActivateVcHandler; \
-  W_CO_DEACTIVATE_VC_HANDLER  CoDeactivateVcHandler; \
-  W_CO_SEND_PACKETS_HANDLER  CoSendPacketsHandler; \
-  W_CO_REQUEST_HANDLER  CoRequestHandler;
+#if NDIS_SUPPORT_60_COMPATIBLE_API
+NDISAPI
+CCHAR
+NTAPI
+NdisSystemProcessorCount(VOID);
+#endif
 
 
-#endif /* !__cplusplus */
+NDISAPI
+VOID
+NTAPI
+NdisGetCurrentProcessorCpuUsage(
+  OUT PULONG pCpuUsage);
 
 
-typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
-   NDIS50_MINIPORT_CHARACTERISTICS_S
-} NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
+/* NDIS helper macros */
 
 
+/*
+ * VOID
+ * NDIS_INIT_FUNCTION(FunctionName)
+ */
+#define NDIS_INIT_FUNCTION(FunctionName)    \
+  alloc_text(init, FunctionName)
 
 
-/* Extensions for NDIS 5.1 miniports */
+/*
+ * VOID
+ * NDIS_PAGABLE_FUNCTION(FunctionName)
+ */
+#define NDIS_PAGEABLE_FUNCTION(FunctionName) \
+  alloc_text(page, FunctionName)
 
 
-typedef VOID
-(NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN PVOID  CancelId);
+#define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
 
 
-typedef VOID
-(NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
-  IN NDIS_DEVICE_PNP_EVENT  PnPEvent,
-  IN PVOID  InformationBuffer,
-  IN ULONG  InformationBufferLength);
 
 
-typedef VOID
-(NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)(
-  IN PVOID  ShutdownContext);
+/* NDIS 4.0 extensions */
 
 
-#ifdef __cplusplus
+NDISAPI
+VOID
+NTAPI
+NdisMFreeSharedMemory(
+       IN NDIS_HANDLE  MiniportAdapterHandle,
+       IN ULONG  Length,
+       IN BOOLEAN  Cached,
+       IN PVOID  VirtualAddress,
+       IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
 
 
-#define NDIS51_MINIPORT_CHARACTERISTICS_S \
-  NDIS50_MINIPORT_CHARACTERISTICS  Ndis50Chars; \
-  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
-  W_PNP_EVENT_NOTIFY_HANDLER  PnPEventNotifyHandler; \
-  W_MINIPORT_SHUTDOWN_HANDLER  AdapterShutdownHandler;
+NDISAPI
+VOID
+NTAPI
+NdisMWanIndicateReceive(
+       OUT PNDIS_STATUS  Status,
+       IN NDIS_HANDLE  MiniportAdapterHandle,
+       IN NDIS_HANDLE  NdisLinkContext,
+       IN PUCHAR  PacketBuffer,
+       IN UINT  PacketSize);
 
 
-#else
+NDISAPI
+VOID
+NTAPI
+NdisMWanIndicateReceiveComplete(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-#define NDIS51_MINIPORT_CHARACTERISTICS_S \
-  NDIS50_MINIPORT_CHARACTERISTICS_S \
-  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
-  W_PNP_EVENT_NOTIFY_HANDLER  PnPEventNotifyHandler; \
-  W_MINIPORT_SHUTDOWN_HANDLER  AdapterShutdownHandler;
+NDISAPI
+VOID
+NTAPI
+NdisMWanSendComplete(
+       IN NDIS_HANDLE  MiniportAdapterHandle,
+       IN PNDIS_WAN_PACKET  Packet,
+       IN NDIS_STATUS  Status);
 
 
-#endif
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisPciAssignResources(
+       IN NDIS_HANDLE  NdisMacHandle,
+       IN NDIS_HANDLE  NdisWrapperHandle,
+       IN NDIS_HANDLE  WrapperConfigurationContext,
+       IN ULONG  SlotNumber,
+       OUT PNDIS_RESOURCE_LIST  *AssignedResources);
 
 
-typedef struct _NDIS51_MINIPORT_CHARACTERISTICS {
-   NDIS51_MINIPORT_CHARACTERISTICS_S
-} NDIS51_MINIPORT_CHARACTERISTICS, *PSNDIS51_MINIPORT_CHARACTERISTICS;
 
 
-#if defined(NDIS51_MINIPORT)
-typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
-  NDIS51_MINIPORT_CHARACTERISTICS_S
-} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
-#elif defined(NDIS50_MINIPORT)
-typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
-  NDIS50_MINIPORT_CHARACTERISTICS_S
-} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
-#elif defined(NDIS40_MINIPORT)
-typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
-  NDIS40_MINIPORT_CHARACTERISTICS_S
-} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
-#else /* NDIS30 */
-typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
-  NDIS30_MINIPORT_CHARACTERISTICS_S
-} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
-#endif
+/* NDIS 5.0 extensions */
 
 
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisAllocateMemoryWithTag(
+  OUT PVOID *VirtualAddress,
+  IN UINT Length,
+  IN ULONG Tag);
 
 
-typedef NDIS_STATUS
-(NTAPI *SEND_HANDLER)(
-  IN NDIS_HANDLE  MacBindingHandle,
-  IN PNDIS_PACKET  Packet);
+NDISAPI
+VOID
+NTAPI
+NdisCompletePnPEvent(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisBindingHandle,
+  IN PNET_PNP_EVENT  NetPnPEvent);
 
 
-typedef NDIS_STATUS
-(NTAPI *TRANSFER_DATA_HANDLER)(
-  IN NDIS_HANDLE  MacBindingHandle,
-  IN NDIS_HANDLE  MacReceiveContext,
-  IN UINT  ByteOffset,
-  IN UINT  BytesToTransfer,
-  OUT PNDIS_PACKET  Packet,
-  OUT PUINT  BytesTransferred);
+NDISAPI
+VOID
+NTAPI
+NdisGetCurrentProcessorCounts(
+  OUT PULONG pIdleCount,
+  OUT PULONG pKernelAndUser,
+  OUT PULONG pIndex);
 
 
-typedef NDIS_STATUS
-(NTAPI *RESET_HANDLER)(
-  IN NDIS_HANDLE  MacBindingHandle);
+NDISAPI
+VOID
+NTAPI
+NdisGetDriverHandle(
+  IN PNDIS_HANDLE  NdisBindingHandle,
+  OUT PNDIS_HANDLE  NdisDriverHandle);
 
 
-typedef NDIS_STATUS
-(NTAPI *REQUEST_HANDLER)(
-  IN NDIS_HANDLE   MacBindingHandle,
-  IN PNDIS_REQUEST   NdisRequest);
+NDISAPI
+PNDIS_PACKET
+NTAPI
+NdisGetReceivedPacket(
+  IN PNDIS_HANDLE  NdisBindingHandle,
+  IN PNDIS_HANDLE  MacContext);
 
 
+#if NDIS_LEGACY_DRIVER
+NDISAPI
+VOID
+NTAPI
+NdisGetSystemUpTime(
+  OUT PULONG pSystemUpTime);
+#endif
 
 
+#if NDIS_SUPPORT_60_COMPATIBLE_API
 
 
-/* Structures available only to full MAC drivers */
+NDISAPI
+VOID
+NTAPI
+NdisAcquireReadWriteLock(
+  IN OUT PNDIS_RW_LOCK Lock,
+  IN BOOLEAN fWrite,
+  OUT PLOCK_STATE LockState);
 
 
-typedef BOOLEAN
-(NTAPI *PNDIS_INTERRUPT_SERVICE)(
-  IN PVOID  InterruptContext);
+NDISAPI
+VOID
+NTAPI
+NdisInitializeReadWriteLock(
+  OUT PNDIS_RW_LOCK Lock);
 
 
-typedef VOID
-(NTAPI *PNDIS_DEFERRED_PROCESSING)(
-  IN PVOID  SystemSpecific1,
-  IN PVOID  InterruptContext,
-  IN PVOID  SystemSpecific2,
-  IN PVOID  SystemSpecific3);
+NDISAPI
+VOID
+NTAPI
+NdisReleaseReadWriteLock(
+  IN OUT PNDIS_RW_LOCK Lock,
+  IN PLOCK_STATE LockState);
 
 
+#if NDIS_SUPPORT_NDIS6
 
 
+NDISAPI
+VOID
+NTAPI
+NdisDprAcquireReadWriteLock(
+  IN PNDIS_RW_LOCK Lock,
+  IN BOOLEAN fWrite,
+  IN PLOCK_STATE LockState);
 
 
-typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
-typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
-typedef struct _NDIS_OPEN_BLOCK                NDIS_OPEN_BLOCK,     *PNDIS_OPEN_BLOCK;
-typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
-typedef        struct _NDIS_AF_LIST        NDIS_AF_LIST,        *PNDIS_AF_LIST;
+NDISAPI
+VOID
+NTAPI
+NdisDprReleaseReadWriteLock(
+  IN PNDIS_RW_LOCK Lock,
+  IN PLOCK_STATE LockState);
 
 
-//
-// FIXME: Should be   typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER;
-//
-typedef PVOID ETH_FILTER, *PETH_FILTER;
+#endif /* NDIS_SUPPORT_NDIS6 */
 
 
+#endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
 
 
-typedef struct _NDIS_MINIPORT_INTERRUPT {
-  PKINTERRUPT  InterruptObject;
-  KSPIN_LOCK  DpcCountLock;
-  PVOID  MiniportIdField;
-  W_ISR_HANDLER  MiniportIsr;
-  W_HANDLE_INTERRUPT_HANDLER  MiniportDpc;
-  KDPC  InterruptDpc;
-  PNDIS_MINIPORT_BLOCK  Miniport;
-  UCHAR  DpcCount;
-  BOOLEAN  Filler1;
-  KEVENT  DpcsCompletedEvent;
-  BOOLEAN  SharedInterrupt;
-  BOOLEAN  IsrRequested;
-} NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMDeregisterDevice(
+  IN NDIS_HANDLE  NdisDeviceHandle);
 
 
-typedef struct _NDIS_MINIPORT_TIMER {
-  KTIMER  Timer;
-  KDPC  Dpc;
-  PNDIS_TIMER_FUNCTION  MiniportTimerFunction;
-  PVOID  MiniportTimerContext;
-  PNDIS_MINIPORT_BLOCK  Miniport;
-  struct _NDIS_MINIPORT_TIMER  *NextDeferredTimer;
-} NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
+NDISAPI
+VOID
+NTAPI
+NdisMGetDeviceProperty(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN OUT PDEVICE_OBJECT  *PhysicalDeviceObject  OPTIONAL,
+  IN OUT PDEVICE_OBJECT  *FunctionalDeviceObject  OPTIONAL,
+  IN OUT PDEVICE_OBJECT  *NextDeviceObject  OPTIONAL,
+  IN OUT PCM_RESOURCE_LIST  *AllocatedResources  OPTIONAL,
+  IN OUT PCM_RESOURCE_LIST  *AllocatedResourcesTranslated  OPTIONAL);
 
 
-typedef struct _NDIS_INTERRUPT {
-  PKINTERRUPT  InterruptObject;
-  KSPIN_LOCK  DpcCountLock;
-  PNDIS_INTERRUPT_SERVICE  MacIsr;
-  PNDIS_DEFERRED_PROCESSING  MacDpc;
-  KDPC  InterruptDpc;
-  PVOID  InterruptContext;
-  UCHAR  DpcCount;
-  BOOLEAN       Removing;
-  KEVENT  DpcsCompletedEvent;
-} NDIS_INTERRUPT, *PNDIS_INTERRUPT;
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMInitializeScatterGatherDma(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN BOOLEAN  Dma64BitAddresses,
+  IN ULONG  MaximumPhysicalMapping);
 
 
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMPromoteMiniport(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-typedef enum _NDIS_WORK_ITEM_TYPE {
-  NdisWorkItemRequest,
-  NdisWorkItemSend,
-  NdisWorkItemReturnPackets,
-  NdisWorkItemResetRequested,
-  NdisWorkItemResetInProgress,
-  NdisWorkItemHalt,
-  NdisWorkItemSendLoopback,
-  NdisWorkItemMiniportCallback,
-  NdisMaxWorkItems
-} NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMQueryAdapterInstanceName(
+  OUT PNDIS_STRING  AdapterInstanceName,
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-#define        NUMBER_OF_WORK_ITEM_TYPES         NdisMaxWorkItems
-#define        NUMBER_OF_SINGLE_WORK_ITEMS       6
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMRegisterDevice(
+  IN NDIS_HANDLE  NdisWrapperHandle,
+  IN PNDIS_STRING  DeviceName,
+  IN PNDIS_STRING  SymbolicName,
+  IN PDRIVER_DISPATCH  MajorFunctions[],
+  OUT PDEVICE_OBJECT  *pDeviceObject,
+  OUT NDIS_HANDLE  *NdisDeviceHandle);
 
 
-typedef struct _NDIS_MINIPORT_WORK_ITEM {
-       SINGLE_LIST_ENTRY  Link;
-       NDIS_WORK_ITEM_TYPE  WorkItemType;
-       PVOID  WorkItemContext;
-} NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
+NDISAPI
+VOID
+NTAPI
+NdisMRegisterUnloadHandler(
+  IN NDIS_HANDLE  NdisWrapperHandle,
+  IN PDRIVER_UNLOAD  UnloadHandler);
 
 
-struct _NDIS_WORK_ITEM;
-typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMRemoveMiniport(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
 
 
-typedef struct _NDIS_WORK_ITEM {
-  PVOID Context;
-  NDIS_PROC Routine;
-  UCHAR WrapperReserved[8*sizeof(PVOID)];
-} NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMSetMiniportSecondary(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_HANDLE  PrimaryMiniportAdapterHandle);
 
 
-typedef struct _NDIS_BIND_PATHS {
-       UINT  Number;
-       NDIS_STRING  Paths[1];
-} NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
+NDISAPI
+VOID
+NTAPI
+NdisOpenConfigurationKeyByIndex(
+  OUT PNDIS_STATUS Status,
+  IN NDIS_HANDLE ConfigurationHandle,
+  IN ULONG Index,
+  OUT PNDIS_STRING KeyName,
+  OUT PNDIS_HANDLE KeyHandle);
 
 
+NDISAPI
+VOID
+NTAPI
+NdisOpenConfigurationKeyByName(
+  OUT PNDIS_STATUS Status,
+  IN NDIS_HANDLE ConfigurationHandle,
+  IN PNDIS_STRING SubKeyName,
+  OUT PNDIS_HANDLE SubKeyHandle);
 
 
-typedef VOID
-(NTAPI *ETH_RCV_COMPLETE_HANDLER)(
-  IN PETH_FILTER  Filter);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisQueryAdapterInstanceName(
+  OUT PNDIS_STRING  AdapterInstanceName,
+  IN NDIS_HANDLE  NdisBindingHandle);
 
 
-typedef VOID
-(NTAPI *ETH_RCV_INDICATE_HANDLER)(
-  IN PETH_FILTER  Filter,
-  IN NDIS_HANDLE  MacReceiveContext,
-  IN PCHAR  Address,
-  IN PVOID  HeaderBuffer,
-  IN UINT  HeaderBufferSize,
-  IN PVOID  LookaheadBuffer,
-  IN UINT  LookaheadBufferSize,
-  IN UINT  PacketSize);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisWriteEventLogEntry(
+  IN PVOID  LogHandle,
+  IN NDIS_STATUS  EventCode,
+  IN ULONG  UniqueEventValue,
+  IN USHORT  NumStrings,
+  IN PVOID  StringsList  OPTIONAL,
+  IN ULONG  DataSize,
+  IN PVOID  Data  OPTIONAL);
 
 
-typedef VOID
-(NTAPI *FDDI_RCV_COMPLETE_HANDLER)(
-  IN PFDDI_FILTER  Filter);
+/* Connectionless services */
 
 
-typedef VOID
-(NTAPI *FDDI_RCV_INDICATE_HANDLER)(
-  IN PFDDI_FILTER  Filter,
-  IN NDIS_HANDLE  MacReceiveContext,
-  IN PCHAR  Address,
-  IN UINT  AddressLength,
-  IN PVOID  HeaderBuffer,
-  IN UINT  HeaderBufferSize,
-  IN PVOID  LookaheadBuffer,
-  IN UINT  LookaheadBufferSize,
-  IN UINT  PacketSize);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClAddParty(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN NDIS_HANDLE  ProtocolPartyContext,
+  IN OUT PCO_CALL_PARAMETERS  CallParameters,
+  OUT PNDIS_HANDLE  NdisPartyHandle);
 
 
-typedef VOID
-(NTAPI *FILTER_PACKET_INDICATION_HANDLER)(
-  IN NDIS_HANDLE  Miniport,
-  IN PPNDIS_PACKET  PacketArray,
-  IN UINT  NumberOfPackets);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClCloseAddressFamily(
+  IN NDIS_HANDLE  NdisAfHandle);
 
 
-typedef VOID
-(NTAPI *TR_RCV_COMPLETE_HANDLER)(
-  IN PTR_FILTER  Filter);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClCloseCall(
+  IN NDIS_HANDLE NdisVcHandle,
+  IN NDIS_HANDLE NdisPartyHandle  OPTIONAL,
+  IN PVOID  Buffer  OPTIONAL,
+  IN UINT  Size);
 
 
-typedef VOID
-(NTAPI *TR_RCV_INDICATE_HANDLER)(
-  IN PTR_FILTER  Filter,
-  IN NDIS_HANDLE  MacReceiveContext,
-  IN PVOID  HeaderBuffer,
-  IN UINT  HeaderBufferSize,
-  IN PVOID  LookaheadBuffer,
-  IN UINT  LookaheadBufferSize,
-  IN UINT  PacketSize);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClDeregisterSap(
+  IN NDIS_HANDLE  NdisSapHandle);
 
 
-typedef VOID
-(NTAPI *WAN_RCV_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_HANDLE  NdisLinkContext);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClDropParty(
+  IN NDIS_HANDLE  NdisPartyHandle,
+  IN PVOID  Buffer  OPTIONAL,
+  IN UINT  Size);
 
 
-typedef VOID
-(NTAPI *WAN_RCV_HANDLER)(
-  OUT PNDIS_STATUS  Status,
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_HANDLE  NdisLinkContext,
-  IN PUCHAR  Packet,
-  IN ULONG  PacketSize);
+NDISAPI
+VOID
+NTAPI
+NdisClIncomingCallComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef VOID
-(FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
-  IN PNDIS_MINIPORT_BLOCK  Miniport,
-  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
-  OUT PVOID  *WorkItemContext);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClMakeCall(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN OUT PCO_CALL_PARAMETERS  CallParameters,
+  IN NDIS_HANDLE  ProtocolPartyContext  OPTIONAL,
+  OUT PNDIS_HANDLE  NdisPartyHandle  OPTIONAL);
 
 
-typedef NDIS_STATUS
-(FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
-  IN PNDIS_MINIPORT_BLOCK  Miniport,
-  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
-  IN PVOID  WorkItemContext);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClModifyCallQoS(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef NDIS_STATUS
-(FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
-  IN PNDIS_MINIPORT_BLOCK  Miniport,
-  IN NDIS_WORK_ITEM_TYPE  WorkItemType,
-  IN PVOID  WorkItemContext);
 
 
-typedef VOID
-(NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_STATUS  Status);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClOpenAddressFamily(
+  IN NDIS_HANDLE  NdisBindingHandle,
+  IN PCO_ADDRESS_FAMILY  AddressFamily,
+  IN NDIS_HANDLE  ProtocolAfContext,
+  IN PNDIS_CLIENT_CHARACTERISTICS  ClCharacteristics,
+  IN UINT  SizeOfClCharacteristics,
+  OUT PNDIS_HANDLE  NdisAfHandle);
 
 
-typedef VOID
-(NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN NDIS_STATUS  Status,
-  IN BOOLEAN  AddressingReset);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisClRegisterSap(
+  IN NDIS_HANDLE  NdisAfHandle,
+  IN NDIS_HANDLE  ProtocolSapContext,
+  IN PCO_SAP  Sap,
+  OUT PNDIS_HANDLE  NdisSapHandle);
 
 
-typedef VOID
-(NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN PNDIS_PACKET  Packet,
-  IN NDIS_STATUS  Status);
 
 
-typedef VOID
-(NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+/* Call Manager services */
 
 
-typedef BOOLEAN
-(FASTCALL *NDIS_M_START_SENDS)(
-  IN PNDIS_MINIPORT_BLOCK  Miniport);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCmActivateVc(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN OUT PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef VOID
-(NTAPI *NDIS_M_STATUS_HANDLER)(
-  IN NDIS_HANDLE  MiniportHandle,
-  IN NDIS_STATUS  GeneralStatus,
-  IN PVOID  StatusBuffer,
-  IN UINT  StatusBufferSize);
+NDISAPI
+VOID
+NTAPI
+NdisCmAddPartyComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisPartyHandle,
+  IN NDIS_HANDLE  CallMgrPartyContext  OPTIONAL,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef VOID
-(NTAPI *NDIS_M_STS_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle);
+NDISAPI
+VOID
+NTAPI
+NdisCmCloseAddressFamilyComplete(
+  IN NDIS_STATUS Status,
+  IN NDIS_HANDLE NdisAfHandle);
 
 
-typedef VOID
-(NTAPI *NDIS_M_TD_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN PNDIS_PACKET  Packet,
+NDISAPI
+VOID
+NTAPI
+NdisCmCloseCallComplete(
   IN NDIS_STATUS  Status,
   IN NDIS_STATUS  Status,
-  IN UINT  BytesTransferred);
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL);
 
 
-typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterHandle,
-  IN PVOID  Packet,
-  IN NDIS_STATUS  Status);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCmDeactivateVc(
+  IN NDIS_HANDLE  NdisVcHandle);
 
 
+NDISAPI
+VOID
+NTAPI
+NdisCmDeregisterSapComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisSapHandle);
 
 
-#if ARCNET
+NDISAPI
+VOID
+NTAPI
+NdisCmDispatchCallConnected(
+  IN NDIS_HANDLE  NdisVcHandle);
 
 
-#define ARC_SEND_BUFFERS                  8
-#define ARC_HEADER_SIZE                   4
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCmDispatchIncomingCall(
+  IN NDIS_HANDLE  NdisSapHandle,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef struct _NDIS_ARC_BUF {
-  NDIS_HANDLE  ArcnetBufferPool;
-  PUCHAR  ArcnetLookaheadBuffer;
-  UINT  NumFree;
-  ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
-} NDIS_ARC_BUF, *PNDIS_ARC_BUF;
+NDISAPI
+VOID
+NTAPI
+NdisCmDispatchIncomingCallQoSChange(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-#endif /* ARCNET */
+NDISAPI
+VOID
+NTAPI
+NdisCmDispatchIncomingCloseCall(
+  IN NDIS_STATUS  CloseStatus,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PVOID  Buffer  OPTIONAL,
+  IN UINT  Size);
 
 
-typedef struct _NDIS_LOG {
-  PNDIS_MINIPORT_BLOCK  Miniport;
-  KSPIN_LOCK  LogLock;
-  PIRP  Irp;
-  UINT  TotalSize;
-  UINT  CurrentSize;
-  UINT  InPtr;
-  UINT  OutPtr;
-  UCHAR  LogBuf[1];
-} NDIS_LOG, *PNDIS_LOG;
+NDISAPI
+VOID
+NTAPI
+NdisCmDispatchIncomingDropParty(
+  IN NDIS_STATUS  DropStatus,
+  IN NDIS_HANDLE  NdisPartyHandle,
+  IN PVOID  Buffer  OPTIONAL,
+  IN UINT  Size);
 
 
-#if ARCNET
-#define FILTERDBS_ARCNET_S \
-  PARC_FILTER  ArcDB;
-#else /* !ARCNET */
-#define FILTERDBS_ARCNET_S \
-  PVOID  XXXDB;
-#endif /* !ARCNET */
+NDISAPI
+VOID
+NTAPI
+NdisCmDropPartyComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisPartyHandle);
 
 
-#define FILTERDBS_S \
-  _ANONYMOUS_UNION union { \
-    PETH_FILTER  EthDB; \
-    PNULL_FILTER  NullDB; \
-  } DUMMYUNIONNAME; \
-  PTR_FILTER  TrDB; \
-  PFDDI_FILTER  FddiDB; \
-  FILTERDBS_ARCNET_S
+NDISAPI
+VOID
+NTAPI
+NdisCmMakeCallComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
+  IN NDIS_HANDLE  CallMgrPartyContext  OPTIONAL,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-typedef struct _FILTERDBS {
-  FILTERDBS_S
-} FILTERDBS, *PFILTERDBS;
+NDISAPI
+VOID
+NTAPI
+NdisCmModifyCallQoSComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
+NDISAPI
+VOID
+NTAPI
+NdisCmOpenAddressFamilyComplete(
+  IN NDIS_STATUS Status,
+  IN NDIS_HANDLE NdisAfHandle,
+  IN NDIS_HANDLE CallMgrAfContext);
 
 
-struct _NDIS_MINIPORT_BLOCK {
-  PVOID  Signature;
-  PNDIS_MINIPORT_BLOCK  NextMiniport;
-  PNDIS_M_DRIVER_BLOCK  DriverHandle;
-  NDIS_HANDLE  MiniportAdapterContext;
-  UNICODE_STRING  MiniportName;
-  PNDIS_BIND_PATHS  BindPaths;
-  NDIS_HANDLE  OpenQueue;
-  REFERENCE  ShortRef;
-  NDIS_HANDLE  DeviceContext;
-  UCHAR  Padding1;
-  UCHAR  LockAcquired;
-  UCHAR  PmodeOpens;
-  UCHAR  AssignedProcessor;
-  KSPIN_LOCK  Lock;
-  PNDIS_REQUEST  MediaRequest;
-  PNDIS_MINIPORT_INTERRUPT  Interrupt;
-  ULONG  Flags;
-  ULONG  PnPFlags;
-  LIST_ENTRY  PacketList;
-  PNDIS_PACKET  FirstPendingPacket;
-  PNDIS_PACKET  ReturnPacketsQueue;
-  ULONG  RequestBuffer;
-  PVOID  SetMCastBuffer;
-  PNDIS_MINIPORT_BLOCK  PrimaryMiniport;
-  PVOID  WrapperContext;
-  PVOID  BusDataContext;
-  ULONG  PnPCapabilities;
-  PCM_RESOURCE_LIST  Resources;
-  NDIS_TIMER  WakeUpDpcTimer;
-  UNICODE_STRING  BaseName;
-  UNICODE_STRING  SymbolicLinkName;
-  ULONG  CheckForHangSeconds;
-  USHORT  CFHangTicks;
-  USHORT  CFHangCurrentTick;
-  NDIS_STATUS  ResetStatus;
-  NDIS_HANDLE  ResetOpen;
-  FILTERDBS_S
-  FILTER_PACKET_INDICATION_HANDLER  PacketIndicateHandler;
-  NDIS_M_SEND_COMPLETE_HANDLER  SendCompleteHandler;
-  NDIS_M_SEND_RESOURCES_HANDLER  SendResourcesHandler;
-  NDIS_M_RESET_COMPLETE_HANDLER  ResetCompleteHandler;
-  NDIS_MEDIUM  MediaType;
-  ULONG  BusNumber;
-  NDIS_INTERFACE_TYPE  BusType;
-  NDIS_INTERFACE_TYPE  AdapterType;
-  PDEVICE_OBJECT  DeviceObject;
-  PDEVICE_OBJECT  PhysicalDeviceObject;
-  PDEVICE_OBJECT  NextDeviceObject;
-  PMAP_REGISTER_ENTRY  MapRegisters;
-  PNDIS_AF_LIST  CallMgrAfList;
-  PVOID  MiniportThread;
-  PVOID  SetInfoBuf;
-  USHORT  SetInfoBufLen;
-  USHORT  MaxSendPackets;
-  NDIS_STATUS  FakeStatus;
-  PVOID  LockHandler;
-  PUNICODE_STRING  pAdapterInstanceName;
-  PNDIS_MINIPORT_TIMER  TimerQueue;
-  UINT  MacOptions;
-  PNDIS_REQUEST  PendingRequest;
-  UINT  MaximumLongAddresses;
-  UINT  MaximumShortAddresses;
-  UINT  CurrentLookahead;
-  UINT  MaximumLookahead;
-  W_HANDLE_INTERRUPT_HANDLER  HandleInterruptHandler;
-  W_DISABLE_INTERRUPT_HANDLER  DisableInterruptHandler;
-  W_ENABLE_INTERRUPT_HANDLER  EnableInterruptHandler;
-  W_SEND_PACKETS_HANDLER  SendPacketsHandler;
-  NDIS_M_START_SENDS  DeferredSendHandler;
-  ETH_RCV_INDICATE_HANDLER  EthRxIndicateHandler;
-  TR_RCV_INDICATE_HANDLER  TrRxIndicateHandler;
-  FDDI_RCV_INDICATE_HANDLER  FddiRxIndicateHandler;
-  ETH_RCV_COMPLETE_HANDLER  EthRxCompleteHandler;
-  TR_RCV_COMPLETE_HANDLER  TrRxCompleteHandler;
-  FDDI_RCV_COMPLETE_HANDLER  FddiRxCompleteHandler;
-  NDIS_M_STATUS_HANDLER  StatusHandler;
-  NDIS_M_STS_COMPLETE_HANDLER  StatusCompleteHandler;
-  NDIS_M_TD_COMPLETE_HANDLER  TDCompleteHandler;
-  NDIS_M_REQ_COMPLETE_HANDLER  QueryCompleteHandler;
-  NDIS_M_REQ_COMPLETE_HANDLER  SetCompleteHandler;
-  NDIS_WM_SEND_COMPLETE_HANDLER  WanSendCompleteHandler;
-  WAN_RCV_HANDLER  WanRcvHandler;
-  WAN_RCV_COMPLETE_HANDLER  WanRcvCompleteHandler;
-#if defined(NDIS_WRAPPER)
-  PNDIS_MINIPORT_BLOCK  NextGlobalMiniport;
-  SINGLE_LIST_ENTRY  WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
-  SINGLE_LIST_ENTRY  SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
-  UCHAR  SendFlags;
-  UCHAR  TrResetRing;
-  UCHAR  ArcnetAddress;
-  UCHAR  XState;
-  _ANONYMOUS_UNION union {
-#if ARCNET
-    PNDIS_ARC_BUF  ArcBuf;
-#endif
-    PVOID  BusInterface;
-  } DUMMYUNIONNAME;
-  PNDIS_LOG  Log;
-  ULONG  SlotNumber;
-  PCM_RESOURCE_LIST  AllocatedResources;
-  PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
-  SINGLE_LIST_ENTRY  PatternList;
-  NDIS_PNP_CAPABILITIES  PMCapabilities;
-  DEVICE_CAPABILITIES  DeviceCaps;
-  ULONG  WakeUpEnable;
-  DEVICE_POWER_STATE  CurrentDevicePowerState;
-  PIRP  pIrpWaitWake;
-  SYSTEM_POWER_STATE  WaitWakeSystemState;
-  LARGE_INTEGER  VcIndex;
-  KSPIN_LOCK  VcCountLock;
-  LIST_ENTRY  WmiEnabledVcs;
-  PNDIS_GUID  pNdisGuidMap;
-  PNDIS_GUID  pCustomGuidMap;
-  USHORT  VcCount;
-  USHORT  cNdisGuidMap;
-  USHORT  cCustomGuidMap;
-  USHORT  CurrentMapRegister;
-  PKEVENT  AllocationEvent;
-  USHORT  BaseMapRegistersNeeded;
-  USHORT  SGMapRegistersNeeded;
-  ULONG  MaximumPhysicalMapping;
-  NDIS_TIMER  MediaDisconnectTimer;
-  USHORT  MediaDisconnectTimeOut;
-  USHORT  InstanceNumber;
-  NDIS_EVENT  OpenReadyEvent;
-  NDIS_PNP_DEVICE_STATE  PnPDeviceState;
-  NDIS_PNP_DEVICE_STATE  OldPnPDeviceState;
-  PGET_SET_DEVICE_DATA  SetBusData;
-  PGET_SET_DEVICE_DATA  GetBusData;
-  KDPC  DeferredDpc;
-#if 0
-  /* FIXME: */
-  NDIS_STATS  NdisStats;
-#else
-  ULONG  NdisStats;
-#endif
-  PNDIS_PACKET  IndicatedPacket[MAXIMUM_PROCESSORS];
-  PKEVENT  RemoveReadyEvent;
-  PKEVENT  AllOpensClosedEvent;
-  PKEVENT  AllRequestsCompletedEvent;
-  ULONG  InitTimeMs;
-  NDIS_MINIPORT_WORK_ITEM  WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
-  PDMA_ADAPTER  SystemAdapterObject;
-  ULONG  DriverVerifyFlags;
-  POID_LIST  OidList;
-  USHORT  InternalResetCount;
-  USHORT  MiniportResetCount;
-  USHORT  MediaSenseConnectCount;
-  USHORT  MediaSenseDisconnectCount;
-  PNDIS_PACKET  *xPackets;
-  ULONG  UserModeOpenReferences;
-  _ANONYMOUS_UNION union {
-    PVOID  SavedSendHandler;
-    PVOID  SavedWanSendHandler;
-  } DUMMYUNIONNAME2;
-  PVOID  SavedSendPacketsHandler;
-  PVOID  SavedCancelSendPacketsHandler;
-  W_SEND_PACKETS_HANDLER  WSendPacketsHandler;
-  ULONG  MiniportAttributes;
-  PDMA_ADAPTER  SavedSystemAdapterObject;
-  USHORT  NumOpens;
-  USHORT  CFHangXTicks;
-  ULONG  RequestCount;
-  ULONG  IndicatedPacketsCount;
-  ULONG  PhysicalMediumType;
-  PNDIS_REQUEST  LastRequest;
-  LONG  DmaAdapterRefCount;
-  PVOID  FakeMac;
-  ULONG  LockDbg;
-  ULONG  LockDbgX;
-  PVOID  LockThread;
-  ULONG  InfoFlags;
-  KSPIN_LOCK  TimerQueueLock;
-  PKEVENT  ResetCompletedEvent;
-  PKEVENT  QueuedBindingCompletedEvent;
-  PKEVENT  DmaResourcesReleasedEvent;
-  FILTER_PACKET_INDICATION_HANDLER  SavedPacketIndicateHandler;
-  ULONG  RegisteredInterrupts;
-  PNPAGED_LOOKASIDE_LIST  SGListLookasideList;
-  ULONG  ScatterGatherListSize;
-#endif /* _NDIS_ */
-};
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCmRegisterAddressFamily(
+  IN NDIS_HANDLE  NdisBindingHandle,
+  IN PCO_ADDRESS_FAMILY  AddressFamily,
+  IN PNDIS_CALL_MANAGER_CHARACTERISTICS  CmCharacteristics,
+  IN UINT  SizeOfCmCharacteristics);
+
+NDISAPI
+VOID
+NTAPI
+NdisCmRegisterSapComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisSapHandle,
+  IN NDIS_HANDLE  CallMgrSapContext);
+
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmActivateVc(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmCreateVc(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_HANDLE  NdisAfHandle,
+  IN NDIS_HANDLE  MiniportVcContext,
+  OUT  PNDIS_HANDLE  NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmDeactivateVc(
+  IN NDIS_HANDLE  NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmDeleteVc(
+  IN NDIS_HANDLE  NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmRegisterAddressFamily(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN PCO_ADDRESS_FAMILY  AddressFamily,
+  IN PNDIS_CALL_MANAGER_CHARACTERISTICS  CmCharacteristics,
+  IN UINT  SizeOfCmCharacteristics);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisMCmRequest(
+  IN NDIS_HANDLE  NdisAfHandle,
+  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
+  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
+  IN OUT  PNDIS_REQUEST  NdisRequest);
 
 
 
 
-/* Handler prototypes for NDIS_OPEN_BLOCK */
+/* Connection-oriented services */
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCoCreateVc(
+  IN NDIS_HANDLE  NdisBindingHandle,
+  IN NDIS_HANDLE  NdisAfHandle  OPTIONAL,
+  IN NDIS_HANDLE  ProtocolVcContext,
+  IN OUT PNDIS_HANDLE  NdisVcHandle);
 
 
-typedef NDIS_STATUS (NTAPI *WAN_SEND_HANDLER)(
-  IN NDIS_HANDLE  MacBindingHandle,
-  IN NDIS_HANDLE  LinkHandle,
-  IN PVOID  Packet);
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCoDeleteVc(
+  IN NDIS_HANDLE  NdisVcHandle);
 
 
-/* NDIS 4.0 extension */
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisCoRequest(
+  IN NDIS_HANDLE  NdisBindingHandle,
+  IN NDIS_HANDLE  NdisAfHandle  OPTIONAL,
+  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
+  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
+  IN OUT  PNDIS_REQUEST  NdisRequest);
 
 
-typedef VOID (NTAPI *SEND_PACKETS_HANDLER)(
-  IN NDIS_HANDLE  MiniportAdapterContext,
+NDISAPI
+VOID
+NTAPI
+NdisCoRequestComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisAfHandle,
+  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
+  IN NDIS_HANDLE  NdisPartyHandle  OPTIONAL,
+  IN PNDIS_REQUEST  NdisRequest);
+
+NDISAPI
+VOID
+NTAPI
+NdisCoSendPackets(
+  IN NDIS_HANDLE  NdisVcHandle,
   IN PPNDIS_PACKET  PacketArray,
   IN UINT  NumberOfPackets);
 
   IN PPNDIS_PACKET  PacketArray,
   IN UINT  NumberOfPackets);
 
-#if defined(NDIS_WRAPPER)
-#define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S \
-  ULONG  Flags; \
-  ULONG  References; \
-  KSPIN_LOCK  SpinLock; \
-  NDIS_HANDLE  FilterHandle; \
-  ULONG  ProtocolOptions; \
-  USHORT  CurrentLookahead; \
-  USHORT  ConnectDampTicks; \
-  USHORT  DisconnectDampTicks; \
-  W_SEND_HANDLER  WSendHandler; \
-  W_TRANSFER_DATA_HANDLER  WTransferDataHandler; \
-  W_SEND_PACKETS_HANDLER  WSendPacketsHandler; \
-  W_CANCEL_SEND_PACKETS_HANDLER  CancelSendPacketsHandler; \
-  ULONG  WakeUpEnable; \
-  PKEVENT  CloseCompleteEvent; \
-  QUEUED_CLOSE  QC; \
-  ULONG  AfReferences; \
-  PNDIS_OPEN_BLOCK  NextGlobalOpen;
-#else
-#define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
-#endif
+NDISAPI
+VOID
+NTAPI
+NdisMCoActivateVcComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PCO_CALL_PARAMETERS  CallParameters);
 
 
-#define NDIS_COMMON_OPEN_BLOCK_S \
-  PVOID  MacHandle; \
-  NDIS_HANDLE  BindingHandle; \
-  PNDIS_MINIPORT_BLOCK  MiniportHandle; \
-  PNDIS_PROTOCOL_BLOCK  ProtocolHandle; \
-  NDIS_HANDLE  ProtocolBindingContext; \
-  PNDIS_OPEN_BLOCK  MiniportNextOpen; \
-  PNDIS_OPEN_BLOCK  ProtocolNextOpen; \
-  NDIS_HANDLE  MiniportAdapterContext; \
-  BOOLEAN  Reserved1; \
-  BOOLEAN  Reserved2; \
-  BOOLEAN  Reserved3; \
-  BOOLEAN  Reserved4; \
-  PNDIS_STRING  BindDeviceName; \
-  KSPIN_LOCK  Reserved5; \
-  PNDIS_STRING  RootDeviceName; \
-  _ANONYMOUS_UNION union { \
-    SEND_HANDLER  SendHandler; \
-    WAN_SEND_HANDLER  WanSendHandler; \
-  } DUMMYUNIONNAME; \
-  TRANSFER_DATA_HANDLER  TransferDataHandler; \
-  SEND_COMPLETE_HANDLER  SendCompleteHandler; \
-  TRANSFER_DATA_COMPLETE_HANDLER  TransferDataCompleteHandler; \
-  RECEIVE_HANDLER  ReceiveHandler; \
-  RECEIVE_COMPLETE_HANDLER  ReceiveCompleteHandler; \
-  WAN_RECEIVE_HANDLER  WanReceiveHandler; \
-  REQUEST_COMPLETE_HANDLER  RequestCompleteHandler; \
-  RECEIVE_PACKET_HANDLER  ReceivePacketHandler; \
-  SEND_PACKETS_HANDLER  SendPacketsHandler; \
-  RESET_HANDLER  ResetHandler; \
-  REQUEST_HANDLER  RequestHandler; \
-  RESET_COMPLETE_HANDLER  ResetCompleteHandler; \
-  STATUS_HANDLER  StatusHandler; \
-  STATUS_COMPLETE_HANDLER  StatusCompleteHandler; \
-  NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
+NDISAPI
+VOID
+NTAPI
+NdisMCoDeactivateVcComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle);
 
 
-typedef struct _NDIS_COMMON_OPEN_BLOCK {
-  NDIS_COMMON_OPEN_BLOCK_S
-} NDIS_COMMON_OPEN_BLOCK;
+NDISAPI
+VOID
+NTAPI
+NdisMCoIndicateReceivePacket(
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PPNDIS_PACKET  PacketArray,
+  IN UINT  NumberOfPackets);
 
 
-struct _NDIS_OPEN_BLOCK
-{
-#ifdef __cplusplus
-  NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
-#else
-  NDIS_COMMON_OPEN_BLOCK_S
-#endif
-};
+NDISAPI
+VOID
+NTAPI
+NdisMCoIndicateStatus(
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN NDIS_HANDLE  NdisVcHandle  OPTIONAL,
+  IN NDIS_STATUS  GeneralStatus,
+  IN PVOID  StatusBuffer  OPTIONAL,
+  IN ULONG  StatusBufferSize);
+
+NDISAPI
+VOID
+NTAPI
+NdisMCoReceiveComplete(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
+
+NDISAPI
+VOID
+NTAPI
+NdisMCoRequestComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  MiniportAdapterHandle,
+  IN PNDIS_REQUEST  Request);
+
+NDISAPI
+VOID
+NTAPI
+NdisMCoSendComplete(
+  IN NDIS_STATUS  Status,
+  IN NDIS_HANDLE  NdisVcHandle,
+  IN PNDIS_PACKET  Packet);
+
+
+/* NDIS 5.0 extensions for intermediate drivers */
+
+NDISAPI
+VOID
+NTAPI
+NdisIMAssociateMiniport(
+  IN NDIS_HANDLE  DriverHandle,
+  IN NDIS_HANDLE  ProtocolHandle);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisIMCancelInitializeDeviceInstance(
+  IN NDIS_HANDLE  DriverHandle,
+  IN PNDIS_STRING  DeviceInstance);
+
+NDISAPI
+VOID
+NTAPI
+NdisIMCopySendCompletePerPacketInfo(
+  IN PNDIS_PACKET  DstPacket,
+  IN PNDIS_PACKET  SrcPacket);
+
+NDISAPI
+VOID
+NTAPI
+NdisIMCopySendPerPacketInfo(
+  IN PNDIS_PACKET  DstPacket,
+  IN PNDIS_PACKET  SrcPacket);
+
+NDISAPI
+VOID
+NTAPI
+NdisIMDeregisterLayeredMiniport(
+  IN NDIS_HANDLE  DriverHandle);
+
+NDISAPI
+NDIS_HANDLE
+NTAPI
+NdisIMGetBindingContext(
+  IN NDIS_HANDLE  NdisBindingHandle);
+
+NDISAPI
+NDIS_HANDLE
+NTAPI
+NdisIMGetDeviceContext(
+  IN NDIS_HANDLE  MiniportAdapterHandle);
+
+NDISAPI
+NDIS_STATUS
+NTAPI
+NdisIMInitializeDeviceInstanceEx(
+  IN NDIS_HANDLE  DriverHandle,
+  IN PNDIS_STRING  DriverInstance,
+  IN NDIS_HANDLE  DeviceContext  OPTIONAL);
+
+/*
+NDISAPI
+PSINGLE_LIST_ENTRY
+NTAPI
+NdisInterlockedPopEntrySList(
+  IN PSLIST_HEADER ListHead,
+  IN PKSPIN_LOCK Lock);
+*/
+#define NdisInterlockedPopEntrySList(SListHead, Lock) \
+  ExInterlockedPopEntrySList(SListHead, &(Lock)->SpinLock)
+
+/*
+NDISAPI
+PSINGLE_LIST_ENTRY
+NTAPI
+NdisInterlockedPushEntrySList(
+  IN PSLIST_HEADER ListHead,
+  IN PSINGLE_LIST_ENTRY ListEntry,
+  IN PKSPIN_LOCK Lock);
+*/
+#define NdisInterlockedPushEntrySList(SListHead, SListEntry, Lock) \
+  ExInterlockedPushEntrySList(SListHead, SListEntry, &(Lock)->SpinLock)
+
+#define NdisInterlockedFlushSList(SListHead) ExInterlockedFlushSList(SListHead)
+
+/*
+NDISAPI
+VOID
+NTAPI
+NdisQueryBufferSafe(
+  IN PNDIS_BUFFER Buffer,
+  OUT PVOID *VirtualAddress OPTIONAL,
+  OUT PUINT Length,
+  IN UINT Priority);
+*/
+#define NdisQueryBufferSafe(_Buffer, _VirtualAddress, _Length, _Priority) {         \
+  if (ARGUMENT_PRESENT(_VirtualAddress)) {                                          \
+    *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
+  }                                                                                 \
+  *(_Length) = MmGetMdlByteCount(_Buffer);                                          \
+}
 
 /* Routines for NDIS miniport drivers */
 
 
 /* Routines for NDIS miniport drivers */
 
@@ -5467,36 +5693,32 @@ NdisMUnmapIoSpace(
   IN PVOID  VirtualAddress,
   IN UINT  Length);
 
   IN PVOID  VirtualAddress,
   IN UINT  Length);
 
-
-
 /* Event functions */
 
 NDISAPI
 VOID
 NTAPI
 NdisInitializeEvent(
 /* Event functions */
 
 NDISAPI
 VOID
 NTAPI
 NdisInitializeEvent(
-  IN PNDIS_EVENT  Event);
+  OUT PNDIS_EVENT Event);
 
 NDISAPI
 VOID
 NTAPI
 NdisSetEvent(
 
 NDISAPI
 VOID
 NTAPI
 NdisSetEvent(
-  IN PNDIS_EVENT  Event);
+  IN PNDIS_EVENT Event);
 
 NDISAPI
 VOID
 NTAPI
 NdisResetEvent(
 
 NDISAPI
 VOID
 NTAPI
 NdisResetEvent(
-  IN PNDIS_EVENT  Event);
+  IN PNDIS_EVENT Event);
 
 NDISAPI
 BOOLEAN
 NTAPI
 NdisWaitEvent(
 
 NDISAPI
 BOOLEAN
 NTAPI
 NdisWaitEvent(
-  IN PNDIS_EVENT  Event,
-  IN UINT  Timeout);
-
-
+  IN PNDIS_EVENT Event,
+  IN UINT Timeout);
 
 /* NDIS intermediate miniport structures */
 
 
 /* NDIS intermediate miniport structures */
 
@@ -5504,8 +5726,6 @@ typedef VOID (NTAPI *W_MINIPORT_CALLBACK)(
   IN NDIS_HANDLE  MiniportAdapterContext,
   IN PVOID  CallbackContext);
 
   IN NDIS_HANDLE  MiniportAdapterContext,
   IN PVOID  CallbackContext);
 
-
-
 /* Routines for intermediate miniport drivers */
 
 NDISAPI
 /* Routines for intermediate miniport drivers */
 
 NDISAPI
@@ -5552,12 +5772,15 @@ NdisSetupDmaTransfer(
   IN ULONG  Length,
   IN BOOLEAN  WriteToDevice);
 
   IN ULONG  Length,
   IN BOOLEAN  WriteToDevice);
 
+/*
 NDISAPI
 NTSTATUS
 NTAPI
 NdisUpcaseUnicodeString(
 NDISAPI
 NTSTATUS
 NTAPI
 NdisUpcaseUnicodeString(
-  OUT PUNICODE_STRING  DestinationString,
-  IN PUNICODE_STRING  SourceString);
+  OUT PUNICODE_STRING DestinationString,
+  IN PUNICODE_STRING SourceString);
+*/
+#define NdisUpcaseUnicodeString(_d, _s) RtlUpcaseUnicodeString(_d, _s, FALSE)
 
 
 /* Routines for NDIS protocol drivers */
 
 
 /* Routines for NDIS protocol drivers */
@@ -5667,12 +5890,6 @@ NdisRegisterProtocol(
   IN PNDIS_PROTOCOL_CHARACTERISTICS  ProtocolCharacteristics,
   IN UINT  CharacteristicsLength);
 
   IN PNDIS_PROTOCOL_CHARACTERISTICS  ProtocolCharacteristics,
   IN UINT  CharacteristicsLength);
 
-NDISAPI
-NDIS_STATUS
-NTAPI
-NdisScheduleWorkItem(
-  IN  PNDIS_WORK_ITEM WorkItem);
-
 /* Obsoleted in Windows XP */
 
 /* Prototypes for NDIS_MAC_CHARACTERISTICS */
 /* Obsoleted in Windows XP */
 
 /* Prototypes for NDIS_MAC_CHARACTERISTICS */