44 Request.DATA.SET_INFORMATION.InformationBufferLength =
Length;
50 Request.DATA.QUERY_INFORMATION.InformationBufferLength =
Length;
252 (
"Ether Type = %x Total = %d Packet %x Payload %x\n",
256 NdisBuffer->Next =
NULL;
260 ListEntry = ListEntry->
Flink)
276 Tail.Overlay.ListEntry);
283 (
"Writing packet at %x\n",
Header));
288 Header->Fixed.PacketType = PacketType;
304 Header->Fixed.Mdl = NdisBuffer;
316 #error move this out of SEH!
322 (
"Failed write to packet in client\n"));
359 UINT HeaderBufferSize,
360 PVOID LookaheadBuffer,
361 UINT LookaheadBufferSize,
379 if (HeaderBufferSize < Adapter->HeaderSize)
397 (
"pretransfer LookaheadBufferSize %d packsize %d\n",
407 (
"pretransfer LookaheadBufferSize %d HeaderBufferSize %d packsize %d\n",
408 LookaheadBufferSize,HeaderBufferSize,
PacketSize));
552 UINT Size, PayloadSize = OverallLength -
564 if (!Adapter)
goto end;
567 if (!EthHeader)
goto end;
590 (
"Writing %d bytes of payload\n", PayloadSize));
605 return OverallLength;
703 switch (Adapter->
Media)
791 Adapter->
Speed = Speed * 100L;
813 (
"Could not set lookahead buffer size (0x%X).\n",
961 NextEntry = CurrentEntry->
Flink;
965 CurrentEntry = NextEntry;
982 PCHAR ProtoNumbersToMatch;
986 EaInfo =
Irp->AssociatedIrp.SystemBuffer;
1006 ProtoNumbersToMatch,
1019 Irp->IoStatus.Information = 0;
1053 Tail.Overlay.ListEntry);
1054 ReadIrp->IoStatus.Information = 0;
1082 ListEntry = ListEntry->
Flink)
1111 Irp->IoStatus.Information =
1134 &
Irp->Tail.Overlay.ListEntry,
1138 Proto->ReadIrpListHead.Flink,
1139 Irp->Tail.Overlay.ListEntry.Flink));
1156 UINT AdapterCount = 0;
1166 ListEntry = ListEntry->
Flink)
1172 AdapterCount *
sizeof(
UINT))
1176 ListEntry = ListEntry->
Flink)
1179 *
Output++ = Adapter->Index;
1191 (
PCHAR)
Irp->AssociatedIrp.SystemBuffer;
1209 PUINT AdapterIndexPtr =
Irp->AssociatedIrp.SystemBuffer;
1213 PCHAR Writing =
Irp->AssociatedIrp.SystemBuffer;
1222 sizeof(*AdapterIndexPtr))
1230 for (ListEntry = Adapter->AddressList.Flink;
1231 ListEntry != &Adapter->AddressList;
1232 ListEntry = ListEntry->Flink)
1236 Address->ClientPart.HWAddressLen);
1240 for (ListEntry = Adapter->ForeignList.Flink;
1241 ListEntry != &Adapter->ForeignList;
1242 ListEntry = ListEntry->Flink)
1246 Address->ClientPart.HWAddressLen);
1248 BytesNeeded += Adapter->RegistryPath.Length;
1255 Info->Index = Adapter->Index;
1256 Info->Media = Adapter->Media;
1257 Info->Speed = Adapter->Speed;
1260 Info->Overhead = Adapter->HeaderSize;
1261 Info->MTU = Adapter->MTU;
1262 Info->RegKeySize = Adapter->RegistryPath.Length;
1265 Writing +=
sizeof(*Info);
1268 Adapter->RegistryPath.Length);
1271 Writing += Adapter->RegistryPath.Length;
1273 for (ListEntry = Adapter->AddressList.Flink;
1274 ListEntry != &Adapter->AddressList;
1275 ListEntry = ListEntry->Flink)
1280 Address->ClientPart.HWAddressLen);
1282 Writing += AddrSize;
1285 for (ListEntry = Adapter->ForeignList.Flink;
1286 ListEntry != &Adapter->ForeignList;
1287 ListEntry = ListEntry->Flink)
1293 Address->ClientPart.HWAddressLen);
1295 Writing += AddrSize;
1298 ASSERT(BytesNeeded == Writing -
Irp->AssociatedIrp.SystemBuffer);
1309 Irp->IoStatus.Information = BytesNeeded;
1334 sizeof(Proto->Buffered))
1336 Irp->AssociatedIrp.SystemBuffer,
1337 sizeof(Proto->Buffered));
1346 Irp->IoStatus.Information = 0;
1406 Irp->IoStatus.Information = 0;
1419 (
"Irp: Unknown Major code was %x\n",
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define NT_SUCCESS(StatCode)
DRIVER_INITIALIZE DriverEntry
_In_ PIO_STACK_LOCATION IrpSp
#define LA_DbgPrint(_t_, _x_)
VOID EXPORT NdisGetFirstBufferFromPacket(IN PNDIS_PACKET _Packet, OUT PNDIS_BUFFER *_FirstBuffer, OUT PVOID *_FirstBufferVA, OUT PUINT _FirstBufferLength, OUT PUINT _TotalBufferLength)
VOID EXPORT NdisOpenAdapter(OUT PNDIS_STATUS Status, OUT PNDIS_STATUS OpenErrorStatus, OUT PNDIS_HANDLE NdisBindingHandle, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE NdisProtocolHandle, IN NDIS_HANDLE ProtocolBindingContext, IN PNDIS_STRING AdapterName, IN UINT OpenOptions, IN PSTRING AddressingInformation OPTIONAL)
VOID EXPORT NdisDeregisterProtocol(OUT PNDIS_STATUS Status, IN NDIS_HANDLE NdisProtocolHandle)
VOID EXPORT NdisSend(OUT PNDIS_STATUS Status, IN NDIS_HANDLE NdisBindingHandle, IN PNDIS_PACKET Packet)
VOID EXPORT NdisCloseAdapter(OUT PNDIS_STATUS Status, IN NDIS_HANDLE NdisBindingHandle)
VOID EXPORT NdisTransferData(OUT PNDIS_STATUS Status, IN NDIS_HANDLE NdisBindingHandle, IN NDIS_HANDLE MacReceiveContext, IN UINT ByteOffset, IN UINT BytesToTransfer, IN OUT PNDIS_PACKET Packet, OUT PUINT BytesTransferred)
VOID EXPORT NdisRegisterProtocol(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE NdisProtocolHandle, IN PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics, IN UINT CharacteristicsLength)
#define IO_NETWORK_INCREMENT
#define IEEE_802_ADDR_LENGTH
#define RemoveEntryList(Entry)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeReleaseSpinLock(sl, irql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeAcquireSpinLock(sl, irql)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
#define ExAllocatePool(type, size)
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
#define EXCEPTION_EXECUTE_HANDLER
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
#define NDIS_VERSION_MAJOR
void GetDataPtr(PNDIS_PACKET Packet, UINT Offset, PCHAR *DataOut, PUINT Size)
#define LAN_STATE_STOPPED
#define NDIS_VERSION_MINOR
struct _LAN_DEVICE_EXT * PLAN_DEVICE_EXT
#define LAN_STATE_STARTED
struct LAN_ADAPTER * PLAN_ADAPTER
#define LAN_STATE_RESETTING
VOID NTAPI LanUnload(PDRIVER_OBJECT DriverObject)
VOID NTAPI ProtocolCloseAdapterComplete(NDIS_HANDLE BindingContext, NDIS_STATUS Status)
Called by NDIS to complete closing an adapter.
NTSTATUS NTAPI LanCloseProtocol(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
VOID BindAdapter(PLAN_ADAPTER Adapter, PNDIS_STRING RegistryPath)
Binds a LAN adapter to IP layer.
NTSTATUS NTAPI LanEnumAdapters(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
UINT LANTransmitInternal(PLAN_PACKET_HEADER ToWrite, UINT OverallLength)
VOID NTAPI ProtocolStatusComplete(NDIS_HANDLE NdisBindingContext)
Called by NDIS when a status-change has occurred.
NTSTATUS NTAPI LanSetBufferedMode(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
NTSTATUS NTAPI LanDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
VOID NTAPI ProtocolRequestComplete(NDIS_HANDLE BindingContext, PNDIS_REQUEST NdisRequest, NDIS_STATUS Status)
Called by NDIS to complete a request.
VOID NTAPI ProtocolReceiveComplete(NDIS_HANDLE BindingContext)
Called by NDIS when we're done receiving data.
PLAN_ADAPTER FindAdapterByIndex(PLAN_DEVICE_EXT DeviceExt, UINT Index)
VOID NTAPI ProtocolOpenAdapterComplete(NDIS_HANDLE BindingContext, NDIS_STATUS Status, NDIS_STATUS OpenErrorStatus)
Called by NDIS to complete opening of an adapter.
NTSTATUS NTAPI LanReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
NDIS_STATUS NTAPI ProtocolReceive(NDIS_HANDLE BindingContext, NDIS_HANDLE MacReceiveContext, PVOID HeaderBuffer, UINT HeaderBufferSize, PVOID LookaheadBuffer, UINT LookaheadBufferSize, UINT PacketSize)
Called by NDIS when a packet has been received on the physical link.
VOID NTAPI ProtocolTransferDataComplete(NDIS_HANDLE BindingContext, PNDIS_PACKET Packet, NDIS_STATUS Status, UINT BytesTransferred)
Called by NDIS to complete reception of data.
VOID LANTransmit(PLAN_ADAPTER Adapter, PNDIS_PACKET NdisPacket, PVOID LinkAddress, USHORT Type)
Transmits a packet ARGUMENTS:
VOID LANUnregisterProtocol(VOID)
Unregisters this protocol driver with NDIS.
VOID NTAPI ProtocolResetComplete(NDIS_HANDLE BindingContext, NDIS_STATUS Status)
Called by NDIS to complete resetting an adapter.
NDIS_STATUS LANRegisterAdapter(PNDIS_STRING AdapterName, PNDIS_STRING RegistryPath)
Registers protocol with an NDIS adapter.
VOID NTAPI ProtocolStatus(NDIS_HANDLE BindingContext, NDIS_STATUS GenerelStatus, PVOID StatusBuffer, UINT StatusBufferSize)
Called by NDIS when the underlying driver has changed state.
NTSTATUS NTAPI LanCreateProtocol(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
VOID NTAPI ProtocolBindAdapter(OUT PNDIS_STATUS Status, IN NDIS_HANDLE BindContext, IN PNDIS_STRING DeviceName, IN PVOID SystemSpecific1, IN PVOID SystemSpecific2)
Called by NDIS during NdisRegisterProtocol to set up initial bindings, and periodically thereafter as...
NTSTATUS NTAPI LanWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
NDIS_STATUS LANUnregisterAdapter(PLAN_ADAPTER Adapter)
Unregisters protocol with NDIS adapter.
VOID FreeAdapter(PLAN_ADAPTER Adapter)
Frees memory for a LAN_ADAPTER structure.
NTSTATUS NTAPI LanAdapterInfo(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
NTSTATUS LANRegisterProtocol(PNDIS_STRING Name)
Registers this protocol driver with NDIS.
PDEVICE_OBJECT LanDeviceObject
VOID NTAPI ProtocolSendComplete(NDIS_HANDLE BindingContext, PNDIS_PACKET Packet, NDIS_STATUS Status)
Called by NDIS to complete sending process.
NDIS_STATUS NDISCall(PLAN_ADAPTER Adapter, NDIS_REQUEST_TYPE Type, NDIS_OID OID, PVOID Buffer, UINT Length)
Send a request to NDIS.
NDIS_STATUS InitNdisPools()
#define AllocatePacketWithBuffer(x, y, z)
#define exAllocatePool(x, y)
#define FreeNdisPacket(x)
#define NDIS_STATUS_PENDING
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
_In_ PVOID _In_ PVOID SystemSpecific2
#define NDIS_STATUS_CLOSED
_In_opt_ NDIS_HANDLE _In_ NDIS_STATUS _In_ PVOID _In_ UINT StatusBufferSize
#define NDIS_STATUS_NOT_SUPPORTED
#define NDIS_PACKET_TYPE_BROADCAST
#define NDIS_STATUS_SUCCESS
enum _NDIS_REQUEST_TYPE NDIS_REQUEST_TYPE
#define NDIS_PACKET_TYPE_MULTICAST
#define NDIS_STATUS_NOT_ACCEPTED
#define NDIS_PACKET_TYPE_DIRECTED
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
_In_opt_ NDIS_HANDLE _In_ NDIS_STATUS _In_ PVOID StatusBuffer
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT _In_ NDIS_HANDLE _In_ NDIS_HANDLE _In_ PNDIS_STRING AdapterName
_In_opt_ NDIS_HANDLE _In_opt_ NDIS_HANDLE _Inout_ PNDIS_REQUEST NdisRequest
_In_ NDIS_STATUS _In_ NDIS_STATUS OpenStatus
@ NdisRequestQueryInformation
@ NdisRequestSetInformation
#define NDIS_STATUS_RESOURCES
#define IOCTL_IF_ADAPTER_INFO
#define IOCTL_IF_ENUM_ADAPTERS
#define LAN_ADDR_SIZE(AddrLen, HWAddrLen)
#define IOCTL_IF_BUFFERED_MODE
struct _LAN_ADAPTER_INFO_S * PLAN_ADAPTER_INFO_S
static NDIS_MEDIUM MediaArray[MEDIA_ARRAY_SIZE]
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_MAXIMUM_TOTAL_SIZE
#define OID_GEN_LINK_SPEED
#define OID_GEN_CURRENT_PACKET_FILTER
#define OID_802_3_CURRENT_ADDRESS
#define OID_GEN_MAXIMUM_FRAME_SIZE
#define OID_GEN_CURRENT_LOOKAHEAD
#define OID_GEN_MAXIMUM_SEND_PACKETS
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
#define IoCompleteRequest
#define STATUS_ACCESS_VIOLATION
#define STATUS_NOT_IMPLEMENTED
#define FILE_DEVICE_NAMED_PIPE
#define _SEH2_EXCEPT(...)
#define IRP_MJ_DEVICE_CONTROL
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
#define STATUS_BUFFER_TOO_SMALL
UCHAR HWAddress[IEEE_802_ADDR_LENGTH]
UNICODE_STRING RegistryPath
struct _IO_STACK_LOCATION::@3974::@3979 Write
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
union _IO_STACK_LOCATION::@1575 Parameters
union _IRP::@1577 AssociatedIrp
LIST_ENTRY AdapterListHead
NDIS_HANDLE NdisProtocolHandle
LIST_ENTRY ProtocolListHead
LIST_ENTRY ReadIrpListHead
struct _LIST_ENTRY * Flink
STATUS_COMPLETE_HANDLER StatusCompleteHandler
TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler
RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler
REQUEST_COMPLETE_HANDLER RequestCompleteHandler
SEND_COMPLETE_HANDLER SendCompleteHandler
RECEIVE_HANDLER ReceiveHandler
BIND_HANDLER BindAdapterHandler
RESET_COMPLETE_HANDLER ResetCompleteHandler
STATUS_HANDLER StatusHandler
OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler
CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR _Out_opt_ PULONG BytesTransferred
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql