ReactOS  0.4.15-dev-2526-g0fb3c1e
dispatch.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DISCONNECT_TYPE
 

Typedefs

typedef struct _DISCONNECT_TYPE DISCONNECT_TYPE
 
typedef struct _DISCONNECT_TYPEPDISCONNECT_TYPE
 

Functions

NTSTATUS DispTdiAccept (PIRP Irp)
 
NTSTATUS DispTdiAssociateAddress (PIRP Irp)
 
NTSTATUS DispTdiConnect (PIRP Irp)
 
NTSTATUS DispTdiDisassociateAddress (PIRP Irp)
 
NTSTATUS DispTdiDisconnect (PIRP Irp)
 
NTSTATUS DispTdiListen (PIRP Irp)
 
NTSTATUS DispTdiQueryInformation (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS DispTdiReceive (PIRP Irp)
 
NTSTATUS DispTdiReceiveDatagram (PIRP Irp)
 
NTSTATUS DispTdiSend (PIRP Irp)
 
NTSTATUS DispTdiSendDatagram (PIRP Irp)
 
NTSTATUS DispTdiSetEventHandler (PIRP Irp)
 
NTSTATUS DispTdiSetInformation (PIRP Irp)
 
NTSTATUS DispTdiQueryInformationEx (PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS DispTdiSetInformationEx (PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS DispTdiSetIPAddress (PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS DispTdiDeleteIPAddress (PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS DispTdiQueryIpHwAddress (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
VOID DispDoDisconnect (PVOID Data)
 
NTSTATUS IRPFinish (PIRP Irp, NTSTATUS Status)
 

Typedef Documentation

◆ DISCONNECT_TYPE

◆ PDISCONNECT_TYPE

Function Documentation

◆ DispDoDisconnect()

VOID DispDoDisconnect ( PVOID  Data)

◆ DispTdiAccept()

NTSTATUS DispTdiAccept ( PIRP  Irp)

Definition at line 254 of file dispatch.c.

263 {
264  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
265 
266  return STATUS_NOT_IMPLEMENTED;
267 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
return STATUS_NOT_IMPLEMENTED
#define DEBUG_IRP
Definition: debug.h:19

Referenced by TiDispatchInternal().

◆ DispTdiAssociateAddress()

NTSTATUS DispTdiAssociateAddress ( PIRP  Irp)

Definition at line 270 of file dispatch.c.

279 {
281  PTRANSPORT_CONTEXT TranContext;
283  PCONNECTION_ENDPOINT Connection, LastConnection;
285  PADDRESS_FILE AddrFile = NULL;
287  KIRQL OldIrql;
288 
289  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
290 
292 
293  /* Get associated connection endpoint file object. Quit if none exists */
294 
295  TranContext = IrpSp->FileObject->FsContext;
296  if (!TranContext) {
297  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
299  }
300 
301  Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
302  if (!Connection) {
303  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
305  }
306 
308 
310  Parameters->AddressHandle,
311  0,
313  KernelMode,
314  (PVOID*)&FileObject,
315  NULL);
316  if (!NT_SUCCESS(Status)) {
317  TI_DbgPrint(MID_TRACE, ("Bad address file object handle (0x%X): %x.\n",
318  Parameters->AddressHandle, Status));
320  }
321 
322  LockObject(Connection, &OldIrql);
323 
324  if (Connection->AddressFile) {
326  UnlockObject(Connection, OldIrql);
327  TI_DbgPrint(MID_TRACE, ("An address file is already associated.\n"));
329  }
330 
331  if (FileObject->FsContext2 != (PVOID)TDI_TRANSPORT_ADDRESS_FILE) {
333  UnlockObject(Connection, OldIrql);
334  TI_DbgPrint(MID_TRACE, ("Bad address file object. Magic (0x%X).\n",
335  FileObject->FsContext2));
337  }
338 
339  /* Get associated address file object. Quit if none exists */
340 
341  TranContext = FileObject->FsContext;
342  if (!TranContext) {
344  UnlockObject(Connection, OldIrql);
345  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
347  }
348 
349  AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
350  if (!AddrFile) {
351  UnlockObject(Connection, OldIrql);
353  TI_DbgPrint(MID_TRACE, ("No address file object.\n"));
355  }
356 
357  LockObjectAtDpcLevel(AddrFile);
358 
359  ReferenceObject(AddrFile);
360  Connection->AddressFile = AddrFile;
361 
362  /* Add connection endpoint to the address file */
363  ReferenceObject(Connection);
364  if (AddrFile->Connection == NULL)
365  AddrFile->Connection = Connection;
366  else
367  {
368  LastConnection = AddrFile->Connection;
369  while (LastConnection->Next != NULL)
370  LastConnection = LastConnection->Next;
371  LastConnection->Next = Connection;
372  }
373 
375 
376  UnlockObjectFromDpcLevel(AddrFile);
377  UnlockObject(Connection, OldIrql);
378 
379  return STATUS_SUCCESS;
380 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
struct _TDI_REQUEST_KERNEL_ASSOCIATE * PTDI_REQUEST_KERNEL_ASSOCIATE
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
#define LockObjectAtDpcLevel(Object)
Definition: titypes.h:44
if(dx==0 &&dy==0)
Definition: linetemp.h:174
HANDLE AddressHandle
Definition: titypes.h:311
struct _CONNECTION_ENDPOINT * Next
Definition: titypes.h:289
#define LockObject(Object, Irql)
Definition: titypes.h:34
PADDRESS_FILE AddressFile
Definition: titypes.h:268
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
_In_ PIRP Irp
Definition: csq.h:116
#define UnlockObject(Object, OldIrql)
Definition: titypes.h:54
struct _ADDRESS_FILE * PADDRESS_FILE
#define DEBUG_IRP
Definition: debug.h:19
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
* PFILE_OBJECT
Definition: iotypes.h:1998
#define UnlockObjectFromDpcLevel(Object)
Definition: titypes.h:63
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define TDI_TRANSPORT_ADDRESS_FILE
Definition: tdikrnl.h:65
#define ReferenceObject(Object)
Definition: titypes.h:14
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
struct _CONNECTION_ENDPOINT * Connection
Definition: titypes.h:151
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127

Referenced by TiDispatchInternal().

◆ DispTdiConnect()

NTSTATUS DispTdiConnect ( PIRP  Irp)

Definition at line 383 of file dispatch.c.

392 {
393  PCONNECTION_ENDPOINT Connection;
395  PTRANSPORT_CONTEXT TranContext;
398 
399  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
400 
402 
404 
405  /* Get associated connection endpoint file object. Quit if none exists */
406 
407  TranContext = IrpSp->FileObject->FsContext;
408  if (!TranContext) {
409  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
411  goto done;
412  }
413 
414  Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
415  if (!Connection) {
416  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
418  goto done;
419  }
420 
422 
424  Irp,
426 
427  if (NT_SUCCESS(Status)) {
428  Status = TCPConnect(
429  TranContext->Handle.ConnectionContext,
430  Parameters->RequestConnectionInformation,
431  Parameters->ReturnConnectionInformation,
433  Irp );
434  }
435 
436 done:
437  if (Status != STATUS_PENDING) {
439  }
440 
441  TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
442 
443  return STATUS_PENDING;
444 }
NTSTATUS TCPConnect(PCONNECTION_ENDPOINT Connection, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:277
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_In_ PIRP Irp
Definition: csq.h:116
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
#define MAX_TRACE
Definition: debug.h:16
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
struct _TDI_REQUEST_KERNEL * PTDI_REQUEST_KERNEL

Referenced by TiDispatchInternal().

◆ DispTdiDeleteIPAddress()

NTSTATUS DispTdiDeleteIPAddress ( PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 1612 of file dispatch.c.

1612  {
1614  PUSHORT NteIndex = Irp->AssociatedIrp.SystemBuffer;
1615  IF_LIST_ITER(IF);
1616 
1617  ForEachInterface(IF) {
1618  if( IF->Index == *NteIndex ) {
1619  IPRemoveInterfaceRoute( IF );
1620  IF->Unicast.Type = IP_ADDRESS_V4;
1621  IF->Unicast.Address.IPv4Address = 0;
1622 
1623  IF->Netmask.Type = IP_ADDRESS_V4;
1624  IF->Netmask.Address.IPv4Address = 0;
1625 
1626  IF->Broadcast.Type = IP_ADDRESS_V4;
1627  IF->Broadcast.Address.IPv4Address = 0;
1628 
1630  }
1631  } EndFor(IF);
1632 
1633  Irp->IoStatus.Status = Status;
1634  return Status;
1635 }
LONG NTSTATUS
Definition: precomp.h:26
#define IF_LIST_ITER(n)
Definition: tilists.h:5
_In_ PIRP Irp
Definition: csq.h:116
#define IP_ADDRESS_V4
Definition: ip.h:32
#define ForEachInterface(n)
Definition: tilists.h:9
Status
Definition: gdiplustypes.h:24
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define EndFor(n)
Definition: tilists.h:20
VOID IPRemoveInterfaceRoute(PIP_INTERFACE IF)
Definition: ip.c:335
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by TiDispatch().

◆ DispTdiDisassociateAddress()

NTSTATUS DispTdiDisassociateAddress ( PIRP  Irp)

Definition at line 447 of file dispatch.c.

456 {
457  PCONNECTION_ENDPOINT Connection;
458  PTRANSPORT_CONTEXT TranContext;
460 
461  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
462 
464 
465  /* Get associated connection endpoint file object. Quit if none exists */
466 
467  TranContext = IrpSp->FileObject->FsContext;
468  if (!TranContext) {
469  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
471  }
472 
473  Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
474  if (!Connection) {
475  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
477  }
478 
479  /* NO-OP because we need the address to deallocate the port when the connection closes */
480 
481  return STATUS_SUCCESS;
482 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_In_ PIRP Irp
Definition: csq.h:116
#define DEBUG_IRP
Definition: debug.h:19
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by TiDispatchInternal().

◆ DispTdiDisconnect()

NTSTATUS DispTdiDisconnect ( PIRP  Irp)

Definition at line 485 of file dispatch.c.

494 {
497  PCONNECTION_ENDPOINT Connection;
498  PTRANSPORT_CONTEXT TranContext;
500 
501  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
502 
505 
507 
508  /* Get associated connection endpoint file object. Quit if none exists */
509 
510  TranContext = IrpSp->FileObject->FsContext;
511  if (!TranContext) {
512  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
514  goto done;
515  }
516 
517  Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
518  if (!Connection) {
519  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
521  goto done;
522  }
523 
525  (TranContext->Handle.ConnectionContext,
526  Irp,
528 
529  if (NT_SUCCESS(Status))
530  {
532  DisReq->RequestFlags,
533  DisReq->RequestSpecific,
537  Irp);
538  }
539 
540 done:
541  if (Status != STATUS_PENDING) {
543  }
544 
545  TI_DbgPrint(MAX_TRACE, ("TCP Disconnect returned %08x\n", Status));
546 
547  return STATUS_PENDING;
548 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation
Definition: tdikrnl.h:42
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_In_ PIRP Irp
Definition: csq.h:116
TDI_REQUEST_KERNEL * PTDI_REQUEST_KERNEL_DISCONNECT
Definition: tdikrnl.h:93
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
PVOID RequestSpecific
Definition: tdikrnl.h:43
PTDI_CONNECTION_INFORMATION RequestConnectionInformation
Definition: tdikrnl.h:41
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
#define MAX_TRACE
Definition: debug.h:16
NTSTATUS TCPDisconnect(PCONNECTION_ENDPOINT Connection, UINT Flags, PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:387
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
ULONG RequestFlags
Definition: tdikrnl.h:40

Referenced by TiDispatchInternal().

◆ DispTdiListen()

NTSTATUS DispTdiListen ( PIRP  Irp)

Definition at line 551 of file dispatch.c.

560 {
561  PCONNECTION_ENDPOINT Connection;
563  PTRANSPORT_CONTEXT TranContext;
566  KIRQL OldIrql;
567 
568  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
569 
571 
573 
574  /* Get associated connection endpoint file object. Quit if none exists */
575 
576  TranContext = IrpSp->FileObject->FsContext;
577  if (TranContext == NULL)
578  {
579  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
581  goto done;
582  }
583 
584  Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
585  if (Connection == NULL)
586  {
587  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
589  goto done;
590  }
591 
593 
595  (TranContext->Handle.ConnectionContext,
596  Irp,
598 
599  LockObject(Connection, &OldIrql);
600 
601  if (Connection->AddressFile == NULL)
602  {
603  TI_DbgPrint(MID_TRACE, ("No associated address file\n"));
604  UnlockObject(Connection, OldIrql);
606  goto done;
607  }
608 
609  LockObjectAtDpcLevel(Connection->AddressFile);
610 
611  /* Listening will require us to create a listening socket and store it in
612  * the address file. It will be signalled, and attempt to complete an irp
613  * when a new connection arrives. */
614  /* The important thing to note here is that the irp we'll complete belongs
615  * to the socket to be accepted onto, not the listener */
616  if( NT_SUCCESS(Status) && !Connection->AddressFile->Listener ) {
617  Connection->AddressFile->Listener =
619 
620  if( !Connection->AddressFile->Listener )
622 
623  if( NT_SUCCESS(Status) ) {
624  ReferenceObject(Connection->AddressFile);
625  Connection->AddressFile->Listener->AddressFile =
626  Connection->AddressFile;
627 
628  Status = TCPSocket( Connection->AddressFile->Listener,
629  Connection->AddressFile->Family,
630  SOCK_STREAM,
631  Connection->AddressFile->Protocol );
632  }
633 
634  if( NT_SUCCESS(Status) ) {
635  ReferenceObject(Connection->AddressFile->Listener);
636  Status = TCPListen( Connection->AddressFile->Listener, 1024 );
637  /* BACKLOG */
638  }
639  }
640 
641  if( NT_SUCCESS(Status) ) {
642  Status = TCPAccept
644  Connection->AddressFile->Listener,
645  Connection,
647  Irp );
648  }
649 
651  UnlockObject(Connection, OldIrql);
652 
653 done:
654  if (Status != STATUS_PENDING) {
656  }
657 
658  TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
659 
660  return STATUS_PENDING;
661 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID NTAPI DispCancelListenRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:209
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
Definition: accept.c:47
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
USHORT Protocol
Definition: titypes.h:138
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
#define LockObjectAtDpcLevel(Object)
Definition: titypes.h:44
NTSTATUS TCPSocket(PCONNECTION_ENDPOINT Connection, UINT Family, UINT Type, UINT Proto)
Definition: tcp.c:125
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define LockObject(Object, Irql)
Definition: titypes.h:34
PADDRESS_FILE AddressFile
Definition: titypes.h:268
UCHAR KIRQL
Definition: env_spec_w32.h:591
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS TCPAccept(PTDI_REQUEST Request, PCONNECTION_ENDPOINT Listener, PCONNECTION_ENDPOINT Connection, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: accept.c:136
#define UnlockObject(Object, OldIrql)
Definition: titypes.h:54
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define UnlockObjectFromDpcLevel(Object)
Definition: titypes.h:63
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define ReferenceObject(Object)
Definition: titypes.h:14
struct _CONNECTION_ENDPOINT * Listener
Definition: titypes.h:153
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
USHORT Family
Definition: titypes.h:137
#define STATUS_SUCCESS
Definition: shellext.h:65
#define SOCK_STREAM
Definition: tcpip.h:118
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
struct _TDI_REQUEST_KERNEL * PTDI_REQUEST_KERNEL
PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint(PVOID ClientContext)
Definition: tcp.c:86

Referenced by TiDispatchInternal().

◆ DispTdiQueryInformation()

NTSTATUS DispTdiQueryInformation ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 664 of file dispatch.c.

675 {
677  PTRANSPORT_CONTEXT TranContext;
679 
680  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
681 
684 
685  TranContext = IrpSp->FileObject->FsContext;
686  if (!TranContext) {
687  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
689  }
690 
691  switch (Parameters->QueryType)
692  {
694  {
695  PTDI_ADDRESS_INFO AddressInfo;
696  PADDRESS_FILE AddrFile;
698  PCONNECTION_ENDPOINT Endpoint = NULL;
699 
700 
701  if (MmGetMdlByteCount(Irp->MdlAddress) <
702  (FIELD_OFFSET(TDI_ADDRESS_INFO, Address.Address[0].Address) +
703  sizeof(TDI_ADDRESS_IP))) {
704  TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
706  }
707 
708  AddressInfo = (PTDI_ADDRESS_INFO)MmGetSystemAddressForMdl(Irp->MdlAddress);
709  Address = (PTA_IP_ADDRESS)&AddressInfo->Address;
710 
711  switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
713  AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
714  if (AddrFile == NULL)
715  {
716  TI_DbgPrint(MIN_TRACE, ("FIXME: No address file object.\n"));
717  ASSERT(AddrFile != NULL);
719  }
720 
721  Address->TAAddressCount = 1;
722  Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
723  Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
724  Address->Address[0].Address[0].sin_port = AddrFile->Port;
725  Address->Address[0].Address[0].in_addr = AddrFile->Address.Address.IPv4Address;
727  &Address->Address[0].Address[0].sin_zero,
728  sizeof(Address->Address[0].Address[0].sin_zero));
729  return STATUS_SUCCESS;
730 
731  case TDI_CONNECTION_FILE:
732  Endpoint =
734  if (Endpoint == NULL || Endpoint->AddressFile == NULL)
735  {
736  TI_DbgPrint(MIN_TRACE, ("FIXME: No connection endpoint file object.\n"));
737  ASSERT(Endpoint != NULL && Endpoint->AddressFile != NULL);
739  }
740 
741  Address->TAAddressCount = 1;
742  Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
743  Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
744  Address->Address[0].Address[0].sin_port = Endpoint->AddressFile->Port;
745  Address->Address[0].Address[0].in_addr = Endpoint->AddressFile->Address.Address.IPv4Address;
747  &Address->Address[0].Address[0].sin_zero,
748  sizeof(Address->Address[0].Address[0].sin_zero));
749  return STATUS_SUCCESS;
750 
751  default:
752  TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
754  }
755  }
756 
758  {
759  PTDI_CONNECTION_INFO ConnectionInfo;
760  //PCONNECTION_ENDPOINT Endpoint;
761 
762  if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*ConnectionInfo)) {
763  TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
765  }
766 
767  ConnectionInfo = (PTDI_CONNECTION_INFO)
768  MmGetSystemAddressForMdl(Irp->MdlAddress);
769 
770  switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
771  case TDI_CONNECTION_FILE:
772  //Endpoint = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
773  RtlZeroMemory(ConnectionInfo, sizeof(*ConnectionInfo));
774  return STATUS_SUCCESS;
775 
776  default:
777  TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
779  }
780  }
781 
783  {
784  PTDI_MAX_DATAGRAM_INFO MaxDatagramInfo;
785 
786  if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*MaxDatagramInfo)) {
787  TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
789  }
790 
791  MaxDatagramInfo = (PTDI_MAX_DATAGRAM_INFO)
792  MmGetSystemAddressForMdl(Irp->MdlAddress);
793 
794  MaxDatagramInfo->MaxDatagramSize = 0xFFFF;
795 
796  return STATUS_SUCCESS;
797  }
798  }
799 
800  return STATUS_NOT_IMPLEMENTED;
801 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
IPv4_RAW_ADDRESS IPv4Address
Definition: ip.h:26
#define TDI_QUERY_CONNECTION_INFO
Definition: tdi.h:182
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ULONG MaxDatagramSize
Definition: tdi.h:230
struct _TDI_REQUEST_KERNEL_QUERY_INFO * PTDI_REQUEST_KERNEL_QUERY_INFORMATION
struct _TA_ADDRESS_IP * PTA_IP_ADDRESS
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
#define TDI_CONNECTION_FILE
Definition: tdikrnl.h:66
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
HANDLE AddressHandle
Definition: titypes.h:311
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define TDI_QUERY_ADDRESS_INFO
Definition: tdi.h:181
PADDRESS_FILE AddressFile
Definition: titypes.h:268
return STATUS_NOT_IMPLEMENTED
_In_ PIRP Irp
Definition: csq.h:116
struct _ADDRESS_FILE * PADDRESS_FILE
static WCHAR Address[46]
Definition: ping.c:68
switch(r->id)
Definition: btrfs.c:2980
#define DEBUG_IRP
Definition: debug.h:19
struct _TDI_CONNECTION_INFO * PTDI_CONNECTION_INFO
#define ASSERT(a)
Definition: mode.c:45
TRANSPORT_ADDRESS Address
Definition: tdi.h:388
#define TDI_TRANSPORT_ADDRESS_FILE
Definition: tdikrnl.h:65
#define TDI_ADDRESS_TYPE_IP
Definition: tdi.h:345
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
IP_ADDRESS Address
Definition: titypes.h:136
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define MmGetMdlByteCount(_Mdl)
#define NULL
Definition: types.h:112
union IP_ADDRESS::@995 Address
struct _TDI_ADDRESS_INFO * PTDI_ADDRESS_INFO
#define MmGetSystemAddressForMdl(Mdl)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MIN_TRACE
Definition: debug.h:14
USHORT Port
Definition: titypes.h:139
struct _TDI_MAX_DATAGRAM_INFO * PTDI_MAX_DATAGRAM_INFO
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TDI_ADDRESS_LENGTH_IP
Definition: tdi.h:413
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
#define TDI_QUERY_MAX_DATAGRAM_INFO
Definition: tdi.h:187

Referenced by TiDispatchInternal().

◆ DispTdiQueryInformationEx()

NTSTATUS DispTdiQueryInformationEx ( PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 1322 of file dispatch.c.

1333 {
1335  PTRANSPORT_CONTEXT TranContext;
1336  PTI_QUERY_CONTEXT QueryContext;
1339  UINT Size;
1342  BOOLEAN InputMdlLocked = FALSE;
1343  BOOLEAN OutputMdlLocked = FALSE;
1344  PMDL InputMdl = NULL;
1345  PMDL OutputMdl = NULL;
1347 
1348  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1349 
1350  TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
1351 
1352  switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
1354  Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1355  break;
1356 
1357  case TDI_CONNECTION_FILE:
1358  Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
1359  break;
1360 
1362  Request.Handle.ControlChannel = TranContext->Handle.ControlChannel;
1363  break;
1364 
1365  default:
1366  TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
1367  return STATUS_INVALID_PARAMETER;
1368  }
1369 
1370  InputBufferLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
1371  OutputBufferLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
1372 
1373  /* Validate parameters */
1375  (OutputBufferLength != 0)) {
1376 
1378  IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
1379  OutputBuffer = Irp->UserBuffer;
1380 
1382  if (QueryContext) {
1383  _SEH2_TRY {
1384  InputMdl = IoAllocateMdl(InputBuffer,
1386  FALSE, TRUE, NULL);
1387 
1388  OutputMdl = IoAllocateMdl(OutputBuffer,
1390 
1391  if (InputMdl && OutputMdl) {
1392 
1393  MmProbeAndLockPages(InputMdl, Irp->RequestorMode,
1394  IoModifyAccess);
1395 
1396  InputMdlLocked = TRUE;
1397 
1398  MmProbeAndLockPages(OutputMdl, Irp->RequestorMode,
1399  IoWriteAccess);
1400 
1401  OutputMdlLocked = TRUE;
1402 
1403  RtlCopyMemory(&QueryContext->QueryInfo,
1405  } else
1409  } _SEH2_END;
1410 
1411  if (NT_SUCCESS(Status)) {
1412  Size = MmGetMdlByteCount(OutputMdl);
1413 
1414  QueryContext->Irp = Irp;
1415  QueryContext->InputMdl = InputMdl;
1416  QueryContext->OutputMdl = OutputMdl;
1417 
1418  Request.RequestNotifyObject = DispTdiQueryInformationExComplete;
1419  Request.RequestContext = QueryContext;
1421  &QueryContext->QueryInfo.ID, OutputMdl,
1422  &Size, &QueryContext->QueryInfo.Context);
1424 
1425  TI_DbgPrint(MAX_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1426 
1427  return Status;
1428  }
1429 
1430  /* An error occurred if we get here */
1431 
1432  if (InputMdl) {
1433  if (InputMdlLocked)
1434  MmUnlockPages(InputMdl);
1435  IoFreeMdl(InputMdl);
1436  }
1437 
1438  if (OutputMdl) {
1439  if (OutputMdlLocked)
1440  MmUnlockPages(OutputMdl);
1441  IoFreeMdl(OutputMdl);
1442  }
1443 
1444  ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
1445  } else
1447  } else if( InputBufferLength ==
1449  /* Handle the case where the user is probing the buffer for length */
1450  TI_DbgPrint(MAX_TRACE, ("InputBufferLength %d OutputBufferLength %d\n",
1453  IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
1454 
1455  Size = 0;
1456 
1458  if (!QueryContext) return STATUS_INSUFFICIENT_RESOURCES;
1459 
1460  _SEH2_TRY {
1461  InputMdl = IoAllocateMdl(InputBuffer,
1463  FALSE, TRUE, NULL);
1464 
1465  MmProbeAndLockPages(InputMdl, Irp->RequestorMode,
1466  IoModifyAccess);
1467 
1468  InputMdlLocked = TRUE;
1471  TI_DbgPrint(MAX_TRACE, ("Failed to acquire client buffer\n"));
1473  } _SEH2_END;
1474 
1475  if( !NT_SUCCESS(Status) || !InputMdl ) {
1476  if( InputMdl ) IoFreeMdl( InputMdl );
1477  ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
1478  return Status;
1479  }
1480 
1481  RtlCopyMemory(&QueryContext->QueryInfo,
1483 
1484  QueryContext->Irp = Irp;
1485  QueryContext->InputMdl = InputMdl;
1486  QueryContext->OutputMdl = NULL;
1487 
1488  Request.RequestNotifyObject = DispTdiQueryInformationExComplete;
1489  Request.RequestContext = QueryContext;
1491  &QueryContext->QueryInfo.ID,
1492  NULL,
1493  &Size,
1494  &QueryContext->QueryInfo.Context);
1496  TI_DbgPrint(MAX_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1498 
1499  TI_DbgPrint(MIN_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1500 
1501  return Status;
1502 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
union _TRANSPORT_CONTEXT::@1013 Handle
TDI_STATUS InfoTdiQueryInformationEx(PTDI_REQUEST Request, TDIObjectID *ID, PNDIS_BUFFER Buffer, PUINT BufferSize, PVOID Context)
Definition: info.c:215
HANDLE ControlChannel
Definition: titypes.h:313
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ULONG_PTR Context[CONTEXT_SIZE/sizeof(ULONG_PTR)]
Definition: tdiinfo.h:84
LONG NTSTATUS
Definition: precomp.h:26
#define TDI_CONNECTION_FILE
Definition: tdikrnl.h:66
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1439
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:318
_SEH2_TRY
Definition: create.c:4226
HANDLE AddressHandle
Definition: titypes.h:311
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:318
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
unsigned char BOOLEAN
switch(r->id)
Definition: btrfs.c:2980
#define QUERY_CONTEXT_TAG
Definition: tags.h:17
#define DEBUG_IRP
Definition: debug.h:19
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
struct _TCP_REQUEST_QUERY_INFORMATION_EX * PTCP_REQUEST_QUERY_INFORMATION_EX
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
TCP_REQUEST_QUERY_INFORMATION_EX QueryInfo
Definition: titypes.h:323
#define TDI_TRANSPORT_ADDRESS_FILE
Definition: tdikrnl.h:65
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
_SEH2_END
Definition: create.c:4400
#define MAX_TRACE
Definition: debug.h:16
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define MmGetMdlByteCount(_Mdl)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
struct _TRANSPORT_CONTEXT * PTRANSPORT_CONTEXT
#define MIN_TRACE
Definition: debug.h:14
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
VOID DispTdiQueryInformationExComplete(PVOID Context, ULONG Status, UINT ByteCount)
Definition: dispatch.c:1285
#define TDI_CONTROL_CHANNEL_FILE
Definition: tdikrnl.h:67

Referenced by TiDispatch().

◆ DispTdiQueryIpHwAddress()

NTSTATUS DispTdiQueryIpHwAddress ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 1684 of file dispatch.c.

1684  {
1685  NTSTATUS Status;
1686  PULONG IPs;
1687  IP_ADDRESS Remote, Local;
1691 
1692  Irp->IoStatus.Information = 0;
1693 
1694  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < 2 * sizeof(ULONG) ||
1695  IrpSp->Parameters.DeviceIoControl.OutputBufferLength == 0) {
1697  goto Exit;
1698  }
1699 
1700  IPs = (PULONG)Irp->AssociatedIrp.SystemBuffer;
1701  AddrInitIPv4(&Remote, IPs[0]);
1702  AddrInitIPv4(&Local, IPs[1]);
1703 
1704  if (AddrIsUnspecified(&Remote)) {
1706  goto Exit;
1707  }
1708 
1710  if (Interface) {
1712 
1713  if (Interface->AddressLength > IrpSp->Parameters.DeviceIoControl.OutputBufferLength) {
1715  goto Exit;
1716  }
1717 
1718  OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
1719  RtlCopyMemory(OutputBuffer, Interface->Address, Interface->AddressLength);
1720  Irp->IoStatus.Information = Interface->AddressLength;
1722  goto Exit;
1723  }
1724 
1725  if (AddrIsUnspecified(&Local)) {
1727  if (NCE == NULL) {
1729  goto Exit;
1730  }
1731 
1732  Interface = NCE->Interface;
1733  }
1734  else {
1735  Interface = AddrLocateInterface(&Local);
1736  if (Interface == NULL) {
1738  if (Interface == NULL) {
1740  goto Exit;
1741  }
1742  }
1743  }
1744 
1746  if (WorkItem == NULL) {
1748  goto Exit;
1749  }
1750 
1752  if (WorkItem->WorkItem == NULL) {
1755  goto Exit;
1756  }
1757 
1758  WorkItem->Irp = Irp;
1759  WorkItem->IrpSp = IrpSp;
1761  WorkItem->RemoteIP = IPs[0];
1762  KeQuerySystemTime(&WorkItem->StartTime);
1763 
1765  if (NCE != NULL) {
1766  if (NCE->LinkAddressLength > IrpSp->Parameters.DeviceIoControl.OutputBufferLength) {
1767  IoFreeWorkItem(WorkItem->WorkItem);
1770  goto Exit;
1771  }
1772 
1773  if (!(NCE->State & NUD_INCOMPLETE)) {
1775  if (LinkAddress == NULL) {
1776  IoFreeWorkItem(WorkItem->WorkItem);
1779  goto Exit;
1780  }
1781  memset(LinkAddress, 0xff, NCE->LinkAddressLength);
1782  NBUpdateNeighbor(NCE, LinkAddress, NUD_INCOMPLETE);
1783  ExFreePoolWithTag(LinkAddress, QUERY_CONTEXT_TAG);
1784  }
1785  }
1786 
1787  if (!ARPTransmit(&Remote, NULL, Interface)) {
1788  IoFreeWorkItem(WorkItem->WorkItem);
1791  goto Exit;
1792  }
1793 
1794  if (Irp->Flags & IRP_SYNCHRONOUS_API) {
1796  Status = Irp->IoStatus.Status;
1797  } else {
1801  }
1802 
1803 Exit:
1804  return Status;
1805 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
BOOLEAN AddrIsUnspecified(PIP_ADDRESS Address)
Definition: address.c:113
VOID NTAPI WaitForHwAddress(PDEVICE_OBJECT DeviceObject, PVOID Context)
Definition: dispatch.c:1638
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: neighbor.h:28
LONG NTSTATUS
Definition: precomp.h:26
PINTERFACE Interface
Definition: iotypes.h:3247
PNEIGHBOR_CACHE_ENTRY RouteGetRouteToDestination(PIP_ADDRESS Destination)
Definition: router.c:300
PNEIGHBOR_CACHE_ENTRY NBLocateNeighbor(PIP_ADDRESS Address, PIP_INTERFACE Interface)
Definition: neighbor.c:417
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
UINT LinkAddressLength
Definition: neighbor.h:34
Definition: ip.h:23
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
BOOLEAN ARPTransmit(PIP_ADDRESS Address, PVOID LinkAddress, PIP_INTERFACE Interface)
Definition: arp.c:111
UCHAR State
Definition: neighbor.h:30
#define QUERY_CONTEXT_TAG
Definition: tags.h:17
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
Status
Definition: gdiplustypes.h:24
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
VOID NBUpdateNeighbor(PNEIGHBOR_CACHE_ENTRY NCE, PVOID LinkAddress, UCHAR State)
Definition: neighbor.c:346
#define STATUS_PENDING
Definition: ntstatus.h:82
static void Exit(void)
Definition: sock.c:1331
#define AddrInitIPv4(IPAddress, RawAddress)
Definition: address.h:16
#define NUD_INCOMPLETE
Definition: neighbor.h:41
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
PIP_INTERFACE Interface
Definition: neighbor.h:33
PIP_INTERFACE AddrLocateInterface(PIP_ADDRESS MatchAddress)
Definition: interface.c:89
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
PIP_INTERFACE GetDefaultInterface(VOID)
Definition: interface.c:156
unsigned int ULONG
Definition: retypes.h:1
#define IRP_SYNCHRONOUS_API
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:110
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
#define STATUS_NETWORK_UNREACHABLE
Definition: ntstatus.h:704
#define memset(x, y, z)
Definition: compat.h:39

Referenced by TiDispatch().

◆ DispTdiReceive()

NTSTATUS DispTdiReceive ( PIRP  Irp)

Definition at line 804 of file dispatch.c.

813 {
815  PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
816  PTRANSPORT_CONTEXT TranContext;
818  ULONG BytesReceived = 0;
819 
820  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
821 
823  ReceiveInfo = (PTDI_REQUEST_KERNEL_RECEIVE)&(IrpSp->Parameters);
824 
826 
827  TranContext = IrpSp->FileObject->FsContext;
828  if (TranContext == NULL)
829  {
830  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
832  goto done;
833  }
834 
835  if (TranContext->Handle.ConnectionContext == NULL)
836  {
837  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
839  goto done;
840  }
841 
842  /* Initialize a receive request */
844  (TranContext->Handle.ConnectionContext,
845  Irp,
847 
848  TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
849  if (NT_SUCCESS(Status))
850  {
852  TranContext->Handle.ConnectionContext,
853  (PNDIS_BUFFER)Irp->MdlAddress,
854  ReceiveInfo->ReceiveLength,
855  &BytesReceived,
856  ReceiveInfo->ReceiveFlags,
858  Irp);
859  }
860 
861 done:
862  if (Status != STATUS_PENDING) {
863  DispDataRequestComplete(Irp, Status, BytesReceived);
864  }
865 
866  TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
867 
868  return STATUS_PENDING;
869 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS TCPReceiveData(PCONNECTION_ENDPOINT Connection, PNDIS_BUFFER Buffer, ULONG ReceiveLength, PULONG BytesReceived, ULONG ReceiveFlags, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:476
MDL * PNDIS_BUFFER
Definition: ndis.h:343
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
struct _TDI_REQUEST_KERNEL_RECEIVE * PTDI_REQUEST_KERNEL_RECEIVE
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)

Referenced by TiDispatchInternal().

◆ DispTdiReceiveDatagram()

NTSTATUS DispTdiReceiveDatagram ( PIRP  Irp)

Definition at line 872 of file dispatch.c.

881 {
884  PTRANSPORT_CONTEXT TranContext;
887  ULONG BytesReceived = 0;
888 
889  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
890 
893 
895 
896  TranContext = IrpSp->FileObject->FsContext;
897  if (TranContext == NULL)
898  {
899  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
901  goto done;
902  }
903 
904  /* Initialize a receive request */
905  Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
906  Request.RequestNotifyObject = DispDataRequestComplete;
907  Request.RequestContext = Irp;
908 
910  IrpSp->FileObject->FsContext,
911  Irp,
913 
914  if (NT_SUCCESS(Status))
915  {
916  PVOID DataBuffer;
918 
919  NdisQueryBuffer( (PNDIS_BUFFER)Irp->MdlAddress,
920  &DataBuffer,
921  &BufferSize );
922 
924  Request.Handle.AddressHandle,
925  DgramInfo->ReceiveDatagramInformation,
926  DataBuffer,
927  DgramInfo->ReceiveLength,
928  DgramInfo->ReceiveFlags,
929  DgramInfo->ReturnDatagramInformation,
930  &BytesReceived,
932  Irp,
933  Irp);
934  }
935 
936 done:
937  if (Status != STATUS_PENDING) {
938  DispDataRequestComplete(Irp, Status, BytesReceived);
939  }
940 
941  TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
942 
943  return STATUS_PENDING;
944 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
struct _TDI_REQUEST_KERNEL_RECEIVEDG * PTDI_REQUEST_KERNEL_RECEIVEDG
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
MDL * PNDIS_BUFFER
Definition: ndis.h:343
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
HANDLE AddressHandle
Definition: titypes.h:311
_In_ PIRP Irp
Definition: csq.h:116
DATAGRAM_COMPLETION_ROUTINE PDATAGRAM_COMPLETION_ROUTINE
Definition: titypes.h:92
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
NTSTATUS DGReceiveDatagram(PADDRESS_FILE AddrFile, PTDI_CONNECTION_INFORMATION ConnInfo, PCHAR Buffer, ULONG ReceiveLength, ULONG ReceiveFlags, PTDI_CONNECTION_INFORMATION ReturnInfo, PULONG BytesReceived, PDATAGRAM_COMPLETION_ROUTINE Complete, PVOID Context, PIRP Irp)
Definition: datagram.c:228
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation
Definition: tdikrnl.h:109
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
VOID EXPORT NdisQueryBuffer(IN PNDIS_BUFFER Buffer, OUT PVOID *VirtualAddress OPTIONAL, OUT PUINT Length)
Definition: buffer.c:955
unsigned int ULONG
Definition: retypes.h:1
PTDI_CONNECTION_INFORMATION ReturnDatagramInformation
Definition: tdikrnl.h:110
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by TiDispatchInternal().

◆ DispTdiSend()

NTSTATUS DispTdiSend ( PIRP  Irp)

Definition at line 947 of file dispatch.c.

956 {
958  PTDI_REQUEST_KERNEL_SEND SendInfo;
959  PTRANSPORT_CONTEXT TranContext;
961  ULONG BytesSent = 0;
962 
963  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
964 
966  SendInfo = (PTDI_REQUEST_KERNEL_SEND)&(IrpSp->Parameters);
967 
969 
970  TranContext = IrpSp->FileObject->FsContext;
971  if (TranContext == NULL)
972  {
973  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
975  goto done;
976  }
977 
978  if (TranContext->Handle.ConnectionContext == NULL)
979  {
980  TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
982  goto done;
983  }
984 
986  IrpSp->FileObject->FsContext,
987  Irp,
989 
990  TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
991  if (NT_SUCCESS(Status))
992  {
993  PVOID Data;
994  UINT Len;
995 
996  NdisQueryBuffer( Irp->MdlAddress, &Data, &Len );
997 
998  TI_DbgPrint(MID_TRACE,("About to TCPSendData\n"));
1000  TranContext->Handle.ConnectionContext,
1001  Data,
1002  SendInfo->SendLength,
1003  &BytesSent,
1004  SendInfo->SendFlags,
1006  Irp);
1007  }
1008 
1009 done:
1010  if (Status != STATUS_PENDING) {
1011  DispDataRequestComplete(Irp, Status, BytesSent);
1012  }
1013 
1014  TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
1015 
1016  return STATUS_PENDING;
1017 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS TCPSendData(PCONNECTION_ENDPOINT Connection, PCHAR Buffer, ULONG DataSize, PULONG DataUsed, ULONG Flags, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:525
_In_ PIRP Irp
Definition: csq.h:116
struct _TDI_REQUEST_KERNEL_SEND * PTDI_REQUEST_KERNEL_SEND
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define Len
Definition: deflate.h:82
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
VOID EXPORT NdisQueryBuffer(IN PNDIS_BUFFER Buffer, OUT PVOID *VirtualAddress OPTIONAL, OUT PUINT Length)
Definition: buffer.c:955
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)

Referenced by TiDispatchInternal().

◆ DispTdiSendDatagram()

NTSTATUS DispTdiSendDatagram ( PIRP  Irp)

Definition at line 1020 of file dispatch.c.

1029 {
1032  PTDI_REQUEST_KERNEL_SENDDG DgramInfo;
1033  PTRANSPORT_CONTEXT TranContext;
1034  NTSTATUS Status;
1035 
1036  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1037 
1039  DgramInfo = (PTDI_REQUEST_KERNEL_SENDDG)&(IrpSp->Parameters);
1040 
1042 
1043  TranContext = IrpSp->FileObject->FsContext;
1044  if (TranContext == NULL)
1045  {
1046  TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
1048  goto done;
1049  }
1050 
1051  /* Initialize a send request */
1052  Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1053  Request.RequestNotifyObject = DispDataRequestComplete;
1054  Request.RequestContext = Irp;
1055 
1057  IrpSp->FileObject->FsContext,
1058  Irp,
1060 
1061  if (NT_SUCCESS(Status)) {
1062  PVOID DataBuffer;
1063  UINT BufferSize;
1064 
1065  TI_DbgPrint(MID_TRACE,("About to query buffer %x\n", Irp->MdlAddress));
1066 
1067  NdisQueryBuffer( (PNDIS_BUFFER)Irp->MdlAddress,
1068  &DataBuffer,
1069  &BufferSize );
1070 
1071  /* FIXME: DgramInfo->SendDatagramInformation->RemoteAddress
1072  must be of type PTDI_ADDRESS_IP */
1074  ("About to call send routine %x\n",
1075  (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)));
1076 
1077  if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send != NULL) )
1078  {
1079  ULONG DataUsed = 0;
1080  Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)(
1081  Request.Handle.AddressHandle,
1082  DgramInfo->SendDatagramInformation,
1083  DataBuffer,
1084  BufferSize,
1085  &DataUsed);
1086  Irp->IoStatus.Information = DataUsed;
1087  }
1088  else {
1090  ASSERT(FALSE);
1091  }
1092  }
1093 
1094 done:
1095  if (Status != STATUS_PENDING) {
1096  DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
1097  }
1098 
1099  TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));
1100 
1101  return STATUS_PENDING;
1102 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
#define MID_TRACE
Definition: debug.h:15
union _TRANSPORT_CONTEXT::@1013 Handle
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
MDL * PNDIS_BUFFER
Definition: ndis.h:343
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
HANDLE AddressHandle
Definition: titypes.h:311
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
struct _ADDRESS_FILE * PADDRESS_FILE
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _TDI_REQUEST_KERNEL_SENDDG * PTDI_REQUEST_KERNEL_SENDDG
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
VOID EXPORT NdisQueryBuffer(IN PNDIS_BUFFER Buffer, OUT PVOID *VirtualAddress OPTIONAL, OUT PUINT Length)
Definition: buffer.c:955
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
IoMarkIrpPending(Irp)
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by TiDispatchInternal().

◆ DispTdiSetEventHandler()

NTSTATUS DispTdiSetEventHandler ( PIRP  Irp)

Definition at line 1105 of file dispatch.c.

1113 {
1115  PTRANSPORT_CONTEXT TranContext;
1117  PADDRESS_FILE AddrFile;
1118  NTSTATUS Status;
1119  KIRQL OldIrql;
1120 
1121  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1122 
1124 
1125  /* Get associated address file object. Quit if none exists */
1126 
1127  TranContext = IrpSp->FileObject->FsContext;
1128  if (!TranContext) {
1129  TI_DbgPrint(MIN_TRACE, ("Bad transport context.\n"));
1130  return STATUS_INVALID_PARAMETER;
1131  }
1132 
1133  AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
1134  if (!AddrFile) {
1135  TI_DbgPrint(MIN_TRACE, ("No address file object.\n"));
1136  return STATUS_INVALID_PARAMETER;
1137  }
1138 
1141 
1142  LockObject(AddrFile, &OldIrql);
1143 
1144  /* Set the event handler. if an event handler is associated with
1145  a specific event, it's flag (RegisteredXxxHandler) is TRUE.
1146  If an event handler is not used it's flag is FALSE */
1147  switch (Parameters->EventType) {
1148  case TDI_EVENT_CONNECT:
1149  if (!Parameters->EventHandler) {
1150  AddrFile->ConnectHandlerContext = NULL;
1151  AddrFile->RegisteredConnectHandler = FALSE;
1152  } else {
1153  AddrFile->ConnectHandler =
1154  (PTDI_IND_CONNECT)Parameters->EventHandler;
1155  AddrFile->ConnectHandlerContext = Parameters->EventContext;
1156  AddrFile->RegisteredConnectHandler = TRUE;
1157  }
1158  break;
1159 
1160  case TDI_EVENT_DISCONNECT:
1161  if (!Parameters->EventHandler) {
1162  AddrFile->DisconnectHandlerContext = NULL;
1163  AddrFile->RegisteredDisconnectHandler = FALSE;
1164  } else {
1165  AddrFile->DisconnectHandler =
1166  (PTDI_IND_DISCONNECT)Parameters->EventHandler;
1167  AddrFile->DisconnectHandlerContext = Parameters->EventContext;
1168  AddrFile->RegisteredDisconnectHandler = TRUE;
1169  }
1170  break;
1171 
1172  case TDI_EVENT_ERROR:
1173  if (Parameters->EventHandler == NULL) {
1174  AddrFile->ErrorHandlerContext = NULL;
1175  AddrFile->RegisteredErrorHandler = FALSE;
1176  } else {
1177  AddrFile->ErrorHandler =
1178  (PTDI_IND_ERROR)Parameters->EventHandler;
1179  AddrFile->ErrorHandlerContext = Parameters->EventContext;
1180  AddrFile->RegisteredErrorHandler = TRUE;
1181  }
1182  break;
1183 
1184  case TDI_EVENT_RECEIVE:
1185  if (Parameters->EventHandler == NULL) {
1186  AddrFile->ReceiveHandlerContext = NULL;
1187  AddrFile->RegisteredReceiveHandler = FALSE;
1188  } else {
1189  AddrFile->ReceiveHandler =
1190  (PTDI_IND_RECEIVE)Parameters->EventHandler;
1191  AddrFile->ReceiveHandlerContext = Parameters->EventContext;
1192  AddrFile->RegisteredReceiveHandler = TRUE;
1193  }
1194  break;
1195 
1197  if (Parameters->EventHandler == NULL) {
1198  AddrFile->ReceiveDatagramHandlerContext = NULL;
1200  } else {
1201  AddrFile->ReceiveDatagramHandler =
1202  (PTDI_IND_RECEIVE_DATAGRAM)Parameters->EventHandler;
1203  AddrFile->ReceiveDatagramHandlerContext = Parameters->EventContext;
1205  }
1206  break;
1207 
1209  if (Parameters->EventHandler == NULL) {
1212  } else {
1213  AddrFile->ExpeditedReceiveHandler =
1214  (PTDI_IND_RECEIVE_EXPEDITED)Parameters->EventHandler;
1215  AddrFile->ExpeditedReceiveHandlerContext = Parameters->EventContext;
1217  }
1218  break;
1219 
1221  if (Parameters->EventHandler == NULL) {
1222  AddrFile->ChainedReceiveHandlerContext = NULL;
1224  } else {
1225  AddrFile->ChainedReceiveHandler =
1226  (PTDI_IND_CHAINED_RECEIVE)Parameters->EventHandler;
1227  AddrFile->ChainedReceiveHandlerContext = Parameters->EventContext;
1229  }
1230  break;
1231 
1233  if (Parameters->EventHandler == NULL) {
1236  } else {
1237  AddrFile->ChainedReceiveDatagramHandler =
1239  AddrFile->ChainedReceiveDatagramHandlerContext = Parameters->EventContext;
1241  }
1242  break;
1243 
1245  if (Parameters->EventHandler == NULL) {
1248  } else {
1249  AddrFile->ChainedReceiveExpeditedHandler =
1251  AddrFile->ChainedReceiveExpeditedHandlerContext = Parameters->EventContext;
1253  }
1254  break;
1255 
1256  default:
1257  TI_DbgPrint(MIN_TRACE, ("Unknown event type (0x%X).\n",
1258  Parameters->EventType));
1259 
1261  }
1262 
1263  UnlockObject(AddrFile, OldIrql);
1264 
1265  return Status;
1266 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
PTDI_IND_DISCONNECT DisconnectHandler
Definition: titypes.h:168
PVOID ChainedReceiveExpeditedHandlerContext
Definition: titypes.h:198
BOOLEAN RegisteredReceiveDatagramHandler
Definition: titypes.h:183
union _TRANSPORT_CONTEXT::@1013 Handle
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG ReceiveLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:352
PVOID ChainedReceiveDatagramHandlerContext
Definition: titypes.h:194
NTSTATUS(NTAPI * PTDI_IND_DISCONNECT)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ LONG DisconnectDataLength, _In_reads_bytes_opt_(DisconnectDataLength) PVOID DisconnectData, _In_ LONG DisconnectInformationLength, _In_reads_bytes_opt_(DisconnectInformationLength) PVOID DisconnectInformation, _In_ ULONG DisconnectFlags)
Definition: tdikrnl.h:185
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
struct _TDI_REQUEST_KERNEL_SET_EVENT * PTDI_REQUEST_KERNEL_SET_EVENT
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
BOOLEAN RegisteredExpeditedReceiveHandler
Definition: titypes.h:187
LONG NTSTATUS
Definition: precomp.h:26
#define TDI_EVENT_RECEIVE_EXPEDITED
Definition: tdikrnl.h:151
#define TDI_EVENT_DISCONNECT
Definition: tdikrnl.h:147
PVOID ReceiveHandlerContext
Definition: titypes.h:178
PTDI_IND_RECEIVE ReceiveHandler
Definition: titypes.h:177
if(dx==0 &&dy==0)
Definition: linetemp.h:174
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(_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 ReceiveDatagramLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:324
NTSTATUS(NTAPI * PTDI_IND_ERROR)(_In_opt_ PVOID TdiEventContext, _In_ NTSTATUS Status)
Definition: tdikrnl.h:207
HANDLE AddressHandle
Definition: titypes.h:311
#define LockObject(Object, Irql)
Definition: titypes.h:34
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN RegisteredErrorHandler
Definition: titypes.h:175
#define TDI_EVENT_RECEIVE
Definition: tdikrnl.h:149
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
BOOLEAN RegisteredChainedReceiveDatagramHandler
Definition: titypes.h:195
#define UnlockObject(Object, OldIrql)
Definition: titypes.h:54
struct _ADDRESS_FILE * PADDRESS_FILE
#define TDI_EVENT_CHAINED_RECEIVE
Definition: tdikrnl.h:153
#define DEBUG_IRP
Definition: debug.h:19
PTDI_IND_RECEIVE_DATAGRAM ReceiveDatagramHandler
Definition: titypes.h:181
BOOLEAN RegisteredChainedReceiveHandler
Definition: titypes.h:191
BOOLEAN RegisteredConnectHandler
Definition: titypes.h:166
PVOID ReceiveDatagramHandlerContext
Definition: titypes.h:182
Status
Definition: gdiplustypes.h:24
#define TDI_EVENT_CONNECT
Definition: tdikrnl.h:146
PTDI_IND_ERROR ErrorHandler
Definition: titypes.h:172
BOOLEAN RegisteredChainedReceiveExpeditedHandler
Definition: titypes.h:199
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG ReceiveLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:302
NTSTATUS(NTAPI * PTDI_IND_RECEIVE_DATAGRAM)(_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 *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:249
NTSTATUS(NTAPI * PTDI_IND_CONNECT)(_In_opt_ PVOID TdiEventContext, _In_ LONG RemoteAddressLength, _In_reads_bytes_(RemoteAddressLength) PVOID RemoteAddress, _In_ LONG UserDataLength, _In_reads_bytes_opt_(UserDataLength) PVOID UserData, _In_ LONG OptionsLength, _In_reads_bytes_opt_(OptionsLength) PVOID Options, _Out_ CONNECTION_CONTEXT *ConnectionContext, _Out_ PIRP *AcceptIrp)
Definition: tdikrnl.h:159
PTDI_IND_CHAINED_RECEIVE_DATAGRAM ChainedReceiveDatagramHandler
Definition: titypes.h:193
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
PTDI_IND_CHAINED_RECEIVE_EXPEDITED ChainedReceiveExpeditedHandler
Definition: titypes.h:197
#define TDI_EVENT_RECEIVE_DATAGRAM
Definition: tdikrnl.h:150
PVOID ExpeditedReceiveHandlerContext
Definition: titypes.h:186
#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM
Definition: tdikrnl.h:154
PVOID ConnectHandlerContext
Definition: titypes.h:165
PTDI_IND_CHAINED_RECEIVE ChainedReceiveHandler
Definition: titypes.h:189
BOOLEAN RegisteredDisconnectHandler
Definition: titypes.h:170
PTDI_IND_CONNECT ConnectHandler
Definition: titypes.h:164
PVOID ErrorHandlerContext
Definition: titypes.h:173
PVOID ChainedReceiveHandlerContext
Definition: titypes.h:190
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
NTSTATUS(NTAPI * PTDI_IND_RECEIVE_EXPEDITED)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:278
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED
Definition: tdikrnl.h:155
#define NULL
Definition: types.h:112
PVOID DisconnectHandlerContext
Definition: titypes.h:169
#define MIN_TRACE
Definition: debug.h:14
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3127
PTDI_IND_RECEIVE_EXPEDITED ExpeditedReceiveHandler
Definition: titypes.h:185
BOOLEAN RegisteredReceiveHandler
Definition: titypes.h:179
NTSTATUS(NTAPI * PTDI_IND_RECEIVE)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:225
#define TDI_EVENT_ERROR
Definition: tdikrnl.h:148

Referenced by TiDispatchInternal().

◆ DispTdiSetInformation()

NTSTATUS DispTdiSetInformation ( PIRP  Irp)

Definition at line 1269 of file dispatch.c.

1278 {
1279  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1280 
1281  return STATUS_NOT_IMPLEMENTED;
1282 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
return STATUS_NOT_IMPLEMENTED
#define DEBUG_IRP
Definition: debug.h:19

Referenced by TiDispatchInternal().

◆ DispTdiSetInformationEx()

NTSTATUS DispTdiSetInformationEx ( PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 1505 of file dispatch.c.

1516 {
1517  PTRANSPORT_CONTEXT TranContext;
1521 
1522  TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1523 
1524  TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
1525  Info = (PTCP_REQUEST_SET_INFORMATION_EX)Irp->AssociatedIrp.SystemBuffer;
1526 
1527  switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
1529  Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1530  break;
1531 
1532  case TDI_CONNECTION_FILE:
1533  Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
1534  break;
1535 
1537  Request.Handle.ControlChannel = TranContext->Handle.ControlChannel;
1538  break;
1539 
1540  default:
1541  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
1542  Irp->IoStatus.Information = 0;
1543 
1544  TI_DbgPrint(DEBUG_IRP, ("Completing IRP at (0x%X).\n", Irp));
1545 
1546  return Irp->IoStatus.Status;
1547  }
1548 
1549  Request.RequestNotifyObject = NULL;
1550  Request.RequestContext = NULL;
1551 
1553  &Info->Buffer, Info->BufferSize);
1554 
1555  return Status;
1556 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
union _TRANSPORT_CONTEXT::@1013 Handle
HANDLE ControlChannel
Definition: titypes.h:313
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TDI_CONNECTION_FILE
Definition: tdikrnl.h:66
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
LONG TDI_STATUS
Definition: tdi.h:36
HANDLE AddressHandle
Definition: titypes.h:311
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
_In_ PIRP Irp
Definition: csq.h:116
#define DEBUG_IRP
Definition: debug.h:19
Status
Definition: gdiplustypes.h:24
#define TDI_TRANSPORT_ADDRESS_FILE
Definition: tdikrnl.h:65
PFILE_OBJECT FileObject
Definition: iotypes.h:3168
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:312
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
struct _TRANSPORT_CONTEXT * PTRANSPORT_CONTEXT
TDI_STATUS InfoTdiSetInformationEx(PTDI_REQUEST Request, TDIObjectID *ID, PVOID Buffer, UINT BufferSize)
Definition: info.c:383
#define TDI_CONTROL_CHANNEL_FILE
Definition: tdikrnl.h:67

Referenced by TiDispatch().

◆ DispTdiSetIPAddress()

NTSTATUS DispTdiSetIPAddress ( PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)

Definition at line 1564 of file dispatch.c.

1564  {
1566  PIP_SET_ADDRESS IpAddrChange =
1567  (PIP_SET_ADDRESS)Irp->AssociatedIrp.SystemBuffer;
1568  IF_LIST_ITER(IF);
1569 
1570  TI_DbgPrint(MID_TRACE,("Setting IP Address for adapter %d\n",
1571  IpAddrChange->NteIndex));
1572 
1573  ForEachInterface(IF) {
1574  TI_DbgPrint(MID_TRACE,("Looking at adapter %d\n", IF->Index));
1575 
1576  if( IF->Unicast.Address.IPv4Address == IpAddrChange->Address ) {
1578  break;
1579  }
1580  if( IF->Index == IpAddrChange->NteIndex ) {
1581  IPRemoveInterfaceRoute( IF );
1582 
1583  IF->Unicast.Type = IP_ADDRESS_V4;
1584  IF->Unicast.Address.IPv4Address = IpAddrChange->Address;
1585 
1586  IF->Netmask.Type = IP_ADDRESS_V4;
1587  IF->Netmask.Address.IPv4Address = IpAddrChange->Netmask;
1588 
1589  IF->Broadcast.Type = IP_ADDRESS_V4;
1590  IF->Broadcast.Address.IPv4Address =
1591  IF->Unicast.Address.IPv4Address |
1592  ~IF->Netmask.Address.IPv4Address;
1593 
1594  TI_DbgPrint(MID_TRACE,("New Unicast Address: %x\n",
1595  IF->Unicast.Address.IPv4Address));
1596  TI_DbgPrint(MID_TRACE,("New Netmask : %x\n",
1597  IF->Netmask.Address.IPv4Address));
1598 
1599  IPAddInterfaceRoute( IF );
1600 
1601  IpAddrChange->Address = IF->Index;
1603  Irp->IoStatus.Information = IF->Index;
1604  break;
1605  }
1606  } EndFor(IF);
1607 
1608  Irp->IoStatus.Status = Status;
1609  return Status;
1610 }
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
IPv4_RAW_ADDRESS Netmask
Definition: ip.h:176
#define MID_TRACE
Definition: debug.h:15
struct _IP_SET_ADDRESS * PIP_SET_ADDRESS
LONG NTSTATUS
Definition: precomp.h:26
#define IF_LIST_ITER(n)
Definition: tilists.h:5
ULONG NteIndex
Definition: ip.h:174
_In_ PIRP Irp
Definition: csq.h:116
#define IP_ADDRESS_V4
Definition: ip.h:32
#define ForEachInterface(n)
Definition: tilists.h:9
Status
Definition: gdiplustypes.h:24
VOID IPAddInterfaceRoute(PIP_INTERFACE IF)
Definition: ip.c:266
IPv4_RAW_ADDRESS Address
Definition: ip.h:175
#define EndFor(n)
Definition: tilists.h:20
VOID IPRemoveInterfaceRoute(PIP_INTERFACE IF)
Definition: ip.c:335
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_DUPLICATE_OBJECTID
Definition: ntstatus.h:686

Referenced by TiDispatch().

◆ IRPFinish()

NTSTATUS IRPFinish ( PIRP  Irp,
NTSTATUS  Status 
)

Definition at line 26 of file dispatch.c.

26  {
27  KIRQL OldIrql;
28 
29  if (Status != STATUS_PENDING) {
30  Irp->IoStatus.Status = Status;
34 
36  }
37 
38  return Status;
39 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
IoSetCancelRoutine(Irp, CancelRoutine)
UCHAR KIRQL
Definition: env_spec_w32.h:591
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
Status
Definition: gdiplustypes.h:24
#define STATUS_PENDING
Definition: ntstatus.h:82
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
#define NULL
Definition: types.h:112

Referenced by DispCancelListenRequest(), DispCancelRequest(), DispDataRequestComplete(), TiDispatch(), TiDispatchInternal(), TiDispatchOpenClose(), and WaitForHwAddress().