ReactOS 0.4.15-dev-5672-gf73ac17
protocol.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PROTOCOL_BINDING
 
struct  _ADAPTER_BINDING
 
struct  _NDIS_REQUEST_MAC_BLOCK
 

Macros

#define GET_PROTOCOL_BINDING(Handle)   ((PPROTOCOL_BINDING)Handle)
 
#define GET_ADAPTER_BINDING(Handle)   ((PADAPTER_BINDING)Handle)
 

Typedefs

typedef struct _PROTOCOL_BINDING PROTOCOL_BINDING
 
typedef struct _PROTOCOL_BINDINGPPROTOCOL_BINDING
 
typedef struct _ADAPTER_BINDING ADAPTER_BINDING
 
typedef struct _ADAPTER_BINDINGPADAPTER_BINDING
 
typedef struct _NDIS_REQUEST_MAC_BLOCK NDIS_REQUEST_MAC_BLOCK
 
typedef struct _NDIS_REQUEST_MAC_BLOCKPNDIS_REQUEST_MAC_BLOCK
 

Functions

NDIS_STATUS ProIndicatePacket (PLOGICAL_ADAPTER Adapter, PNDIS_PACKET Packet)
 
VOID NTAPI ProSendPackets (IN NDIS_HANDLE NdisBindingHandle, IN PPNDIS_PACKET PacketArray, IN UINT NumberOfPackets)
 
NTSTATUS NTAPI NdisIPnPQueryStopDevice (IN PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI NdisIPnPCancelStopDevice (IN PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NDIS_STATUS proSendPacketToMiniport (PLOGICAL_ADAPTER Adapter, PNDIS_PACKET Packet)
 
VOID NTAPI ndisBindMiniportsToProtocol (OUT PNDIS_STATUS Status, IN PPROTOCOL_BINDING Protocol)
 

Variables

LIST_ENTRY ProtocolListHead
 
KSPIN_LOCK ProtocolListLock
 

Macro Definition Documentation

◆ GET_ADAPTER_BINDING

#define GET_ADAPTER_BINDING (   Handle)    ((PADAPTER_BINDING)Handle)

Definition at line 39 of file protocol.h.

◆ GET_PROTOCOL_BINDING

#define GET_PROTOCOL_BINDING (   Handle)    ((PPROTOCOL_BINDING)Handle)

Definition at line 18 of file protocol.h.

Typedef Documentation

◆ ADAPTER_BINDING

◆ NDIS_REQUEST_MAC_BLOCK

◆ PADAPTER_BINDING

◆ PNDIS_REQUEST_MAC_BLOCK

◆ PPROTOCOL_BINDING

◆ PROTOCOL_BINDING

Function Documentation

◆ ndisBindMiniportsToProtocol()

VOID NTAPI ndisBindMiniportsToProtocol ( OUT PNDIS_STATUS  Status,
IN PPROTOCOL_BINDING  Protocol 
)

Definition at line 908 of file protocol.c.

909{
910 /*
911 * bind the protocol to all of its miniports
912 *
913 * open registry path
914 * get list of devices from Bind key
915 * call BindAdapterHandler for each
916 */
919 WCHAR *RegistryPathStr, *DataPtr = NULL;
920 NTSTATUS NtStatus;
921 HANDLE DriverKeyHandle = NULL;
922 PKEY_VALUE_PARTIAL_INFORMATION KeyInformation = NULL;
926 PLIST_ENTRY CurrentEntry = NULL;
927
928 RegistryPathStr = ExAllocatePoolWithTag(PagedPool, sizeof(SERVICES_KEY) + ProtocolCharacteristics->Name.Length + sizeof(LINKAGE_KEY), NDIS_TAG + __LINE__);
929 if(!RegistryPathStr)
930 {
931 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
933 return;
934 }
935
936 wcscpy(RegistryPathStr, SERVICES_KEY);
937 wcsncat(RegistryPathStr, ((WCHAR *)ProtocolCharacteristics->Name.Buffer), ProtocolCharacteristics->Name.Length / sizeof(WCHAR));
938 RegistryPathStr[wcslen(SERVICES_KEY)+ProtocolCharacteristics->Name.Length/sizeof(WCHAR)] = 0;
939 wcscat(RegistryPathStr, LINKAGE_KEY);
940
941 RtlInitUnicodeString(&RegistryPath, RegistryPathStr);
942 NDIS_DbgPrint(MAX_TRACE, ("Opening configuration key: %wZ\n", &RegistryPath));
943
945 NtStatus = ZwOpenKey(&DriverKeyHandle, KEY_READ, &ObjectAttributes);
946
947 ExFreePool(RegistryPathStr);
948
949 if(NT_SUCCESS(NtStatus))
950 {
951 NDIS_DbgPrint(MAX_TRACE, ("Successfully opened the registry configuration\n"));
952
954
955 NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, NULL, 0, &ResultLength);
956 if(NtStatus != STATUS_BUFFER_OVERFLOW && NtStatus != STATUS_BUFFER_TOO_SMALL && NtStatus != STATUS_SUCCESS)
957 {
958 NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value for size\n"));
959 ZwClose(DriverKeyHandle);
960 }
961 else
962 {
964 if(!KeyInformation)
965 {
966 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
967 ZwClose(DriverKeyHandle);
968 NtStatus = STATUS_NO_MEMORY;
969 }
970 else
971 {
972 NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, KeyInformation,
974
975 ZwClose(DriverKeyHandle);
976
977 if(!NT_SUCCESS(NtStatus))
978 {
979 NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n"));
980 ExFreePool(KeyInformation);
981 KeyInformation = NULL;
982 }
983 }
984 }
985 }
986
987 if (!NT_SUCCESS(NtStatus))
988 {
989 NDIS_DbgPrint(MID_TRACE, ("Performing global bind for protocol '%wZ'\n", &ProtocolCharacteristics->Name));
990 KeyInformation = NULL;
991
992 CurrentEntry = AdapterListHead.Flink;
993 }
994 else
995 {
996 NDIS_DbgPrint(MID_TRACE, ("Performing standard bind for protocol '%wZ'\n", &ProtocolCharacteristics->Name));
997
998 DataPtr = (WCHAR*)KeyInformation->Data;
999 }
1000
1001 /* Assume success for now */
1003
1004 while (TRUE)
1005 {
1006 /* BindContext is for tracking pending binding operations */
1007 VOID *BindContext = 0;
1010 WCHAR *RegistryPathStr = NULL;
1011 ULONG PathLength = 0;
1012 PLOGICAL_ADAPTER Adapter;
1013
1014 if (KeyInformation)
1015 {
1016 /* Parse the REG_MULTI_SZ entry for device names */
1017 if (!(*DataPtr))
1018 break;
1019
1021 }
1022 else
1023 {
1024 /* Use the device name from the global adapter list */
1025 if (CurrentEntry == &AdapterListHead)
1026 break;
1027
1028 Adapter = CONTAINING_RECORD(CurrentEntry, LOGICAL_ADAPTER, ListEntry);
1029
1031 }
1032
1033 /* Make sure the adapter has started */
1035 {
1036 /* It wasn't in the global miniport list, so skip the bind entry */
1037 goto next;
1038 }
1039
1040 /* Make sure this device isn't already bound to this protocol */
1042 {
1043 /* It was already in this protocol's bound adapter list, so skip the bind entry */
1044 goto next;
1045 }
1046
1047 /*
1048 * RegistryPath should be:
1049 * \Registry\Machine\System\CurrentControlSet\Services\Nic1\Parameters\Tcpip
1050 *
1051 * This is constructed as follows:
1052 * SERVICES_KEY + extracted device name + Protocol name from characteristics
1053 */
1054
1055 PathLength = sizeof(SERVICES_KEY) + /* \Registry\Machine\System\CurrentControlSet\Services\ */
1056 wcslen( DeviceName.Buffer + 8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */
1057 sizeof(PARAMETERS_KEY) + /* \Parameters\ */
1058 ProtocolCharacteristics->Name.Length + sizeof(WCHAR); /* Tcpip */
1059
1060 RegistryPathStr = ExAllocatePool(PagedPool, PathLength);
1061 if(!RegistryPathStr)
1062 {
1063 NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n"));
1065 break;
1066 }
1067
1068 wcscpy(RegistryPathStr, SERVICES_KEY);
1069 wcscat(RegistryPathStr, DeviceName.Buffer + 8 );
1070 wcscat(RegistryPathStr, PARAMETERS_KEY);
1071 wcsncat(RegistryPathStr, ProtocolCharacteristics->Name.Buffer, ProtocolCharacteristics->Name.Length / sizeof(WCHAR) );
1072
1073 RegistryPathStr[PathLength/sizeof(WCHAR) - 1] = 0;
1074
1075 RtlInitUnicodeString(&RegistryPath, RegistryPathStr);
1076
1077 NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n",
1079
1080 {
1081 BIND_HANDLER BindHandler = ProtocolCharacteristics->BindAdapterHandler;
1082 if(BindHandler)
1083 {
1084 BindHandler(Status, BindContext, &DeviceName, &RegistryPath, 0);
1085 NDIS_DbgPrint(MID_TRACE, ("%wZ's BindAdapter handler returned 0x%x for %wZ\n", &ProtocolCharacteristics->Name, *Status, &DeviceName));
1086 }
1087 else
1088 NDIS_DbgPrint(MID_TRACE, ("No protocol bind handler specified\n"));
1089 }
1090
1091 next:
1092 if (KeyInformation)
1093 {
1094 /* Advance to the next adapter in the REG_MULTI_SZ */
1095 DataPtr += (DeviceName.Length / sizeof(WCHAR)) + 1;
1096 }
1097 else
1098 {
1099 /* Advance to the next adapter in the global list */
1100 CurrentEntry = CurrentEntry->Flink;
1101 }
1102 }
1103
1104 if (KeyInformation)
1105 {
1106 ExFreePool(KeyInformation);
1107 }
1108}
static USHORT PathLength
LONG NTSTATUS
Definition: precomp.h:26
#define MIN_TRACE
Definition: debug.h:14
#define MID_TRACE
Definition: debug.h:15
#define MAX_TRACE
Definition: debug.h:16
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
LIST_ENTRY AdapterListHead
Definition: miniport.c:57
PLOGICAL_ADAPTER MiniLocateDevice(PNDIS_STRING AdapterName)
Definition: miniport.c:690
#define SERVICES_KEY
Definition: protocol.c:15
PADAPTER_BINDING NTAPI LocateAdapterBindingByName(IN PPROTOCOL_BINDING ProtocolBinding, IN PNDIS_STRING AdapterName)
Definition: protocol.c:878
#define PARAMETERS_KEY
Definition: protocol.c:17
#define LINKAGE_KEY
Definition: protocol.c:16
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Out_ PNDIS_HANDLE _In_ PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics
Definition: ndis.h:6135
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
VOID(NTAPI * BIND_HANDLER)(OUT PNDIS_STATUS Status, IN NDIS_HANDLE BindContext, IN PNDIS_STRING DeviceName, IN PVOID SystemSpecific1, IN PVOID SystemSpecific2)
Definition: ndis.h:1844
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
#define NDIS_TAG
Definition: ndissys.h:29
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
Definition: nt_native.h:1182
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define L(x)
Definition: ntvdm.h:50
static unsigned __int64 next
Definition: rand_nt.c:6
_CRTIMP wchar_t *__cdecl wcsncat(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
UNICODE_STRING MiniportName
Definition: ndis.h:2511
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by NdisIPnPStartDevice(), NdisReEnumerateProtocolBindings(), and NdisRegisterProtocol().

◆ NdisIPnPCancelStopDevice()

NTSTATUS NTAPI NdisIPnPCancelStopDevice ( IN PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 172 of file protocol.c.

175{
176 PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension;
177 PNET_PNP_EVENT PnPEvent;
178
180 if (!PnPEvent) {
181 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
183 }
184
185 return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
186}
_In_ PIRP Irp
Definition: csq.h:116
struct _LOGICAL_ADAPTER * PLOGICAL_ADAPTER
PNET_PNP_EVENT ProSetupPnPEvent(NET_PNP_EVENT_CODE EventCode, PVOID EventBuffer, ULONG EventBufferLength)
Definition: protocol.c:30
NDIS_STATUS ProSendAndFreePnPEvent(PLOGICAL_ADAPTER Adapter, PNET_PNP_EVENT PnPEvent, PIRP Irp)
Definition: protocol.c:66
@ NetEventCancelRemoveDevice
Definition: netpnp.h:18
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

Referenced by NdisIDispatchPnp().

◆ NdisIPnPQueryStopDevice()

NTSTATUS NTAPI NdisIPnPQueryStopDevice ( IN PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 154 of file protocol.c.

157{
158 PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension;
159 PNET_PNP_EVENT PnPEvent;
160
162 if (!PnPEvent) {
163 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
165 }
166
167 return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
168}
@ NetEventQueryRemoveDevice
Definition: netpnp.h:17

Referenced by NdisIDispatchPnp().

◆ ProIndicatePacket()

NDIS_STATUS ProIndicatePacket ( PLOGICAL_ADAPTER  Adapter,
PNDIS_PACKET  Packet 
)

Definition at line 243 of file protocol.c.

256{
257 UINT BufferedLength;
258 UINT PacketLength;
260 PUCHAR LookaheadBuffer;
261
262 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
263
264#if DBG
265 MiniDisplayPacket(Packet, "INDICATE");
266#endif
267
268 NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength);
269
270 LookaheadBuffer = ExAllocatePool(NonPagedPool, PacketLength);
271 if (!LookaheadBuffer) {
272 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
274 }
275
276 NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
278 {
279 BufferedLength = CopyPacketToBuffer(LookaheadBuffer, Packet, 0, PacketLength);
280 Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = Packet;
281 }
283
284 if (BufferedLength > Adapter->MediumHeaderSize)
285 {
286 /* XXX Change this to call SendPackets so we don't have to duplicate this wacky logic */
287 MiniIndicateData(Adapter, NULL, LookaheadBuffer, Adapter->MediumHeaderSize,
288 &LookaheadBuffer[Adapter->MediumHeaderSize], BufferedLength - Adapter->MediumHeaderSize,
289 PacketLength - Adapter->MediumHeaderSize);
290 }
291 else
292 {
293 MiniIndicateData(Adapter, NULL, LookaheadBuffer, Adapter->MediumHeaderSize, NULL, 0, 0);
294 }
295
296 ExFreePool(LookaheadBuffer);
297
299 {
300 Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = NULL;
301 }
303
304 return NDIS_STATUS_SUCCESS;
305}
UINT CopyPacketToBuffer(PUCHAR DstData, PNDIS_PACKET SrcPacket, UINT SrcOffset, UINT Length)
Definition: buffer.c:172
VOID MiniIndicateData(PLOGICAL_ADAPTER Adapter, NDIS_HANDLE MacReceiveContext, PVOID HeaderBuffer, UINT HeaderBufferSize, PVOID LookaheadBuffer, UINT LookaheadBufferSize, UINT PacketSize)
Definition: miniport.c:175
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define NonPagedPool
Definition: env_spec_w32.h:307
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
unsigned int UINT
Definition: ndis.h:50
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)
Definition: ndis.h:3593
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
ULONG MediumHeaderSize
Definition: miniport.h:95
KSPIN_LOCK Lock
Definition: ndis.h:2520
unsigned char * PUCHAR
Definition: typedefs.h:53
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792

Referenced by MiniportWorker(), and ProSend().

◆ ProSendPackets()

VOID NTAPI ProSendPackets ( IN NDIS_HANDLE  NdisBindingHandle,
IN PPNDIS_PACKET  PacketArray,
IN UINT  NumberOfPackets 
)

Definition at line 577 of file protocol.c.

581{
582 PADAPTER_BINDING AdapterBinding = NdisBindingHandle;
583 PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
584 KIRQL RaiseOldIrql;
585 NDIS_STATUS NdisStatus;
586 UINT i;
587
588 if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
589 {
591 {
592 (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
594 }
595 else
596 {
597 /* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
598 KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
599 (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
601 KeLowerIrql(RaiseOldIrql);
602 for (i = 0; i < NumberOfPackets; i++)
603 {
604 NdisStatus = NDIS_GET_PACKET_STATUS(PacketArray[i]);
605 if (NdisStatus != NDIS_STATUS_PENDING)
606 MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
607 }
608 }
609 }
610 else
611 {
613 {
614 for (i = 0; i < NumberOfPackets; i++)
615 {
616 NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
618 if (NdisStatus != NDIS_STATUS_PENDING)
619 MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
620 }
621 }
622 else
623 {
624 /* Send is called at DISPATCH_LEVEL for all serialized miniports */
625 KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
626 for (i = 0; i < NumberOfPackets; i++)
627 {
628 NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
630 if (NdisStatus != NDIS_STATUS_PENDING)
631 MiniSendComplete(Adapter, PacketArray[i], NdisStatus);
632 }
633 KeLowerIrql(RaiseOldIrql);
634 }
635 }
636}
VOID NTAPI MiniSendComplete(IN NDIS_HANDLE MiniportAdapterHandle, IN PNDIS_PACKET Packet, IN NDIS_STATUS Status)
Definition: miniport.c:530
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Must_inspect_result_ _In_ NDIS_HANDLE NdisBindingHandle
Definition: ndis.h:4735
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
_In_ PPNDIS_PACKET _In_ UINT NumberOfPackets
Definition: ndis.h:5121
_In_ PPNDIS_PACKET PacketArray
Definition: ndis.h:5120
#define NDIS_ATTRIBUTE_DESERIALIZE
Definition: ndis.h:588
#define NDIS_GET_PACKET_STATUS(_Packet)
Definition: ndis.h:3436
int NDIS_STATUS
Definition: ntddndis.h:475
PLOGICAL_ADAPTER Adapter
Definition: protocol.h:29
NDIS_HANDLE MiniportAdapterContext
Definition: ndis.h:2510
PNDIS_M_DRIVER_BLOCK DriverHandle
Definition: ndis.h:2509
NDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics
Definition: miniport.h:22
NDIS_PACKET_PRIVATE Private
Definition: ndis.h:735

Referenced by NdisIPnPStartDevice(), NdisOpenAdapter(), and NdisSendPackets().

◆ proSendPacketToMiniport()

NDIS_STATUS proSendPacketToMiniport ( PLOGICAL_ADAPTER  Adapter,
PNDIS_PACKET  Packet 
)

Definition at line 389 of file protocol.c.

390{
391#if WORKER_TEST
393 return NDIS_STATUS_PENDING;
394#else
395 KIRQL RaiseOldIrql;
396 NDIS_STATUS NdisStatus;
397
398 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
399
400 if(MiniIsBusy(Adapter, NdisWorkItemSend)) {
401 NDIS_DbgPrint(MID_TRACE, ("Busy: NdisWorkItemSend.\n"));
402
404 return NDIS_STATUS_PENDING;
405 }
406
407#if DBG
408 MiniDisplayPacket(Packet, "SEND");
409#endif
410
411 if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
412 {
414 {
415 NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
416 (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
418 NdisStatus = NDIS_STATUS_PENDING;
419 } else {
420 /* SendPackets is called at DISPATCH_LEVEL for all serialized miniports */
421 KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
422 {
423 NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
424 (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
426 }
427 KeLowerIrql(RaiseOldIrql);
428
429 NdisStatus = NDIS_GET_PACKET_STATUS(Packet);
430 if (NdisStatus == NDIS_STATUS_RESOURCES) {
432 NdisStatus = NDIS_STATUS_PENDING;
433 }
434 }
435
436 if (NdisStatus != NDIS_STATUS_PENDING) {
438 }
439
440 return NdisStatus;
441 } else {
443 {
444 NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
445 NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
446 Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, Packet->Private.Flags);
447 NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
448 } else {
449 /* Send is called at DISPATCH_LEVEL for all serialized miniports */
450 KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
451 NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
452 NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
453 Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, Packet->Private.Flags);
454 NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
455 KeLowerIrql(RaiseOldIrql);
456
457 if (NdisStatus == NDIS_STATUS_RESOURCES) {
459 NdisStatus = NDIS_STATUS_PENDING;
460 }
461 }
462
463 if (NdisStatus != NDIS_STATUS_PENDING) {
465 }
466
467 return NdisStatus;
468 }
469#endif
470}
#define FALSE
Definition: types.h:117
VOID MiniWorkItemComplete(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE WorkItemType)
Definition: miniport.c:964
VOID FASTCALL MiniQueueWorkItem(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE WorkItemType, PVOID WorkItemContext, BOOLEAN Top)
Definition: miniport.c:982
BOOLEAN MiniIsBusy(PLOGICAL_ADAPTER Adapter, NDIS_WORK_ITEM_TYPE Type)
Definition: miniport.c:142
@ NdisWorkItemSend
Definition: ndis.h:2295

Referenced by ProSend(), and ScatterGatherSendPacket().

Variable Documentation

◆ ProtocolListHead

LIST_ENTRY ProtocolListHead
extern

◆ ProtocolListLock