12#define UINT16_MAX (65535U)
36 switch (IcmpHeader->
Type)
41 switch (IcmpHeader->
Code)
78 AddrFile->RegisteredReceiveDatagramHandler =
FALSE;
118 Irp->IoStatus.Information =
sizeof(*ReplyBuffer);
182 RoundTripTime = (CurrentTime -
Context->StartTicks) * 1000 /
Context->TimerResolution.QuadPart;
212 CurrentReply->
Data = CurrentUserBuffer +
Context->RemainingSize - _DataSize;
215 Context->RemainingSize -= _DataSize;
223 if (OptionsLength > 0 &&
Context->RemainingSize > 0)
231 Context->RemainingSize -= _OptSize;
333 LocalAddressTa.
Address[0].Address[0].in_addr = 0;
392 AddrFile->
TTL = SavedTtl;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define IPv4Checksum(Data, Count, Seed)
#define NT_SUCCESS(StatCode)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
_In_ PIO_STACK_LOCATION IrpSp
#define TI_DbgPrint(_t_, _x_)
#define IO_NETWORK_INCREMENT
struct _ICMP_PACKET_CONTEXT ICMP_PACKET_CONTEXT
NTSTATUS NTAPI ReceiveDatagram(_In_opt_ PVOID TdiEventContext, _In_ LONG SourceAddressLength, _In_reads_bytes_(SourceAddressLength) PVOID SourceAddress, _In_ LONG OptionsLength, _In_reads_bytes_opt_(OptionsLength) PVOID Options, _In_ ULONG ReceiveDatagramFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *OutBytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
struct _ICMP_PACKET_CONTEXT * PICMP_PACKET_CONTEXT
static VOID ClearReceiveHandler(_In_ PADDRESS_FILE AddrFile)
static UINT32 GetReplyStatus(PICMP_HEADER IcmpHeader)
NTSTATUS DispEchoRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
KDEFERRED_ROUTINE TimeoutHandler
IO_WORKITEM_ROUTINE EndRequestHandler
static volatile INT16 IcmpSequence
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
NTSTATUS FileCloseAddress(PTDI_REQUEST Request)
NTSTATUS FileOpenAddress(PTDI_REQUEST Request, PTA_IP_ADDRESS AddrList, USHORT Protocol, BOOLEAN Shared, PVOID Options)
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID ReplyBuffer
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
#define ICMP_CODE_DU_HOST_UNREACH
#define ICMP_TYPE_ECHO_REPLY
#define ICMP_CODE_DU_SOURCE_ROUTE_FAILED
#define ICMP_CODE_DU_PORT_UNREACH
#define ICMP_TYPE_DEST_UNREACH
#define ICMP_CODE_DU_PROTOCOL_UNREACH
#define ICMP_TYPE_SOURCE_QUENCH
#define ICMP_CODE_TE_REASSEMBLY
#define ICMP_CODE_DU_NET_UNREACH
#define ICMP_CODE_DU_FRAG_DF_SET
#define ICMP_TYPE_ECHO_REQUEST
#define ICMP_TYPE_TIME_EXCEEDED
struct ICMP_HEADER * PICMP_HEADER
#define ICMP_TYPE_PARAMETER
#define InterlockedIncrement16
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
#define IP_DEST_NET_UNREACHABLE
#define IP_TTL_EXPIRED_REASSEM
#define IP_DEST_HOST_UNREACHABLE
struct icmp_echo_reply * PICMP_ECHO_REPLY
#define IP_DEST_PROT_UNREACHABLE
struct icmp_echo_reply ICMP_ECHO_REPLY
#define IP_DEST_PORT_UNREACHABLE
#define IP_TTL_EXPIRED_TRANSIT
IoSetCancelRoutine(Irp, CancelRoutine)
#define memcpy(s1, s2, n)
#define ExFreePoolWithTag(_P, _T)
unsigned __int3264 UINT_PTR
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
#define _In_reads_bytes_(s)
#define _In_reads_bytes_opt_(s)
#define IoCompleteRequest
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
HANDLE NTAPI PsGetCurrentProcessId(VOID)
BOOLEAN RegisteredReceiveDatagramHandler
DATAGRAM_SEND_ROUTINE Send
PVOID ReceiveDatagramHandlerContext
PTDI_IND_RECEIVE_DATAGRAM ReceiveDatagramHandler
LARGE_INTEGER TimerResolution
KEVENT DatagramProcessedEvent
KEVENT InitializationFinishedEvent
PIO_WORKITEM FinishWorker
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
union _IO_STACK_LOCATION::@1575 Parameters
struct _TA_ADDRESS_IP::_AddrIp Address[1]
union _TDI_REQUEST::@3235 Handle
IP_OPTION_INFORMATION Options
#define TDI_ADDRESS_LENGTH_IP
#define TDI_ADDRESS_TYPE_IP
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
#define UnlockObject(Object)
#define LockObject(Object)
struct _ADDRESS_FILE * PADDRESS_FILE
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2