ReactOS  0.4.14-dev-583-g2a1ba2c
tdi_proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS TdiConnect (PIRP *PendingIrp, PFILE_OBJECT ConnectionObject, PTDI_CONNECTION_INFORMATION ConnectionCallInfo, PTDI_CONNECTION_INFORMATION ConnectionReturnInfo, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 
NTSTATUS TdiOpenConnectionEndpointFile (PUNICODE_STRING DeviceName, PHANDLE ConnectionHandle, PFILE_OBJECT *ConnectionObject)
 
NTSTATUS TdiCloseDevice (HANDLE Handle, PFILE_OBJECT FileObject)
 
NTSTATUS TdiDisconnect (PIRP *Irp, PFILE_OBJECT TransportObject, PLARGE_INTEGER Time, USHORT Flags, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext, PTDI_CONNECTION_INFORMATION RequestConnectionInfo, PTDI_CONNECTION_INFORMATION ReturnConnectionInfo)
 
NTSTATUS TdiQueryInformation (PFILE_OBJECT FileObject, LONG QueryType, PMDL MdlBuffer)
 
NTSTATUS TdiSetEventHandler (PFILE_OBJECT FileObject, LONG EventType, PVOID Handler, PVOID Context)
 
NTSTATUS TdiQueryDeviceControl (PFILE_OBJECT FileObject, ULONG IoControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, PULONG Return)
 

Function Documentation

◆ TdiCloseDevice()

NTSTATUS TdiCloseDevice ( HANDLE  Handle,
PFILE_OBJECT  FileObject 
)

Definition at line 158 of file tditest.c.

161 {
162  if (FileObject)
164 
165  if (Handle)
166  ZwClose(Handle);
167 
168  return STATUS_SUCCESS;
169 }
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
_In_ HANDLE Handle
Definition: extypes.h:390
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by TdiUnload().

◆ TdiConnect()

NTSTATUS TdiConnect ( PIRP PendingIrp,
PFILE_OBJECT  ConnectionObject,
PTDI_CONNECTION_INFORMATION  ConnectionCallInfo,
PTDI_CONNECTION_INFORMATION  ConnectionReturnInfo,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Definition at line 334 of file tdi.c.

349 {
351 
352  AFD_DbgPrint(MAX_TRACE, ("Called\n"));
353 
354  ASSERT(*Irp == NULL);
355 
356  if (!ConnectionObject) {
357  AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
359  }
360 
361  DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
362  if (!DeviceObject) {
363  AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
365  }
366 
367  *Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
368  DeviceObject, /* Device object */
369  ConnectionObject, /* File object */
370  NULL, /* Event */
371  NULL); /* Status */
372  if (!*Irp) {
374  }
375 
376  TdiBuildConnect(*Irp, /* IRP */
377  DeviceObject, /* Device object */
378  ConnectionObject, /* File object */
379  CompletionRoutine, /* Completion routine */
380  CompletionContext, /* Completion routine context */
381  NULL, /* Time */
382  ConnectionCallInfo, /* Request connection information */
383  ConnectionReturnInfo); /* Return connection information */
384 
386 
387  return STATUS_PENDING;
388 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Definition: tdi.c:46
_Unreferenced_parameter_ PVOID * CompletionContext
Definition: cdprocs.h:1130
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
#define TDI_CONNECT
Definition: tdikrnl.h:49
smooth NULL
Definition: ftsmooth.c:416
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
#define STATUS_PENDING
Definition: ntstatus.h:82
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define TdiBuildConnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:494
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define MAX_TRACE
Definition: debug.h:16
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
#define MIN_TRACE
Definition: debug.h:14

Referenced by AfdStreamSocketConnect().

◆ TdiDisconnect()

NTSTATUS TdiDisconnect ( PIRP Irp,
PFILE_OBJECT  TransportObject,
PLARGE_INTEGER  Time,
USHORT  Flags,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext,
PTDI_CONNECTION_INFORMATION  RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION  ReturnConnectionInfo 
)

Definition at line 1249 of file tdi.c.

1257  {
1259 
1260  if (!TransportObject) {
1261  AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n"));
1262  return STATUS_INVALID_PARAMETER;
1263  }
1264 
1265  AFD_DbgPrint(MID_TRACE,("Called(TransportObject %p)\n", TransportObject));
1266 
1267  DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1268  if (!DeviceObject) {
1269  AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
1270  return STATUS_INVALID_PARAMETER;
1271  }
1272 
1273  *Irp = TdiBuildInternalDeviceControlIrp(TDI_DISCONNECT, /* Sub function */
1274  DeviceObject, /* Device object */
1275  TransportObject, /* File object */
1276  NULL, /* Event */
1277  NULL); /* Status */
1278 
1279  if (!*Irp) {
1280  AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
1282  }
1283 
1284  TdiBuildDisconnect(*Irp, /* I/O Request Packet */
1285  DeviceObject, /* Device object */
1286  TransportObject, /* File object */
1287  CompletionRoutine, /* Completion routine */
1288  CompletionContext, /* Completion context */
1289  Time, /* Time */
1290  Flags, /* Disconnect flags */
1291  RequestConnectionInfo, /* Indication of who to disconnect */
1292  ReturnConnectionInfo); /* Indication of who disconnected */
1293 
1295 
1296  return STATUS_PENDING;
1297 }
#define TdiBuildDisconnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, Flags, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:545
#define MID_TRACE
Definition: debug.h:15
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Definition: tdi.c:46
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define TDI_DISCONNECT
Definition: tdikrnl.h:52
_Unreferenced_parameter_ PVOID * CompletionContext
Definition: cdprocs.h:1130
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
#define STATUS_PENDING
Definition: ntstatus.h:82
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
#define MIN_TRACE
Definition: debug.h:14
static PLARGE_INTEGER Time
Definition: time.c:105

Referenced by DoDisconnect().

◆ TdiOpenConnectionEndpointFile()

NTSTATUS TdiOpenConnectionEndpointFile ( PUNICODE_STRING  DeviceName,
PHANDLE  ConnectionHandle,
PFILE_OBJECT ConnectionObject 
)

Definition at line 281 of file tdi.c.

294 {
296  PVOID *ContextArea;
298  ULONG EaLength;
299 
300  AFD_DbgPrint(MAX_TRACE, ("Called. DeviceName (%wZ)\n", DeviceName));
301 
302  /* EaName must be 0-terminated, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */
305  sizeof(PVOID) + 1;
306 
308  EaLength,
310  if (!EaInfo)
312 
313  RtlZeroMemory(EaInfo, EaLength);
315  /* Don't copy the terminating 0; we have already zeroed it */
316  RtlCopyMemory(EaInfo->EaName,
319  EaInfo->EaValueLength = sizeof(PVOID);
320  ContextArea = (PVOID*)(EaInfo->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1); /* 0-terminated */
321  /* FIXME: Allocate context area */
322  *ContextArea = NULL;
324  EaLength,
325  EaInfo,
328  ConnectionObject);
330  return Status;
331 }
#define AFD_SHARE_UNIQUE
Definition: shared.h:191
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_AFD_EA_INFO
Definition: afd.h:50
#define TDI_CONNECTION_CONTEXT_LENGTH
Definition: tdi.h:373
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:866
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION
Status
Definition: gdiplustypes.h:24
#define MAX_TRACE
Definition: debug.h:16
static NTSTATUS TdiOpenDevice(PUNICODE_STRING DeviceName, ULONG EaLength, PFILE_FULL_EA_INFORMATION EaInfo, ULONG ShareType, PHANDLE Handle, PFILE_OBJECT *Object)
Definition: tdi.c:88
#define TdiConnectionContext
Definition: tdi.h:371
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4536

Referenced by WarmSocketForConnection().

◆ TdiQueryDeviceControl()

NTSTATUS TdiQueryDeviceControl ( PFILE_OBJECT  FileObject,
ULONG  IoControlCode,
PVOID  InputBuffer,
ULONG  InputBufferLength,
PVOID  OutputBuffer,
ULONG  OutputBufferLength,
PULONG  Return 
)

Definition at line 607 of file tdi.c.

627 {
631  KEVENT Event;
632  PIRP Irp;
633 
634  if (!FileObject) {
635  AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
637  }
638 
640  if (!DeviceObject) {
641  AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
643  }
644 
646 
648  DeviceObject,
649  InputBuffer,
651  OutputBuffer,
653  FALSE,
654  &Event,
655  &Iosb);
656  if (!Irp)
658 
660 
661  if (Return)
662  *Return = Iosb.Information;
663 
664  return Status;
665 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
CHAR InputBuffer[80]
Definition: conmgr.c:33
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Definition: tdi.c:46
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
return Iosb
Definition: create.c:4426
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define MIN_TRACE
Definition: debug.h:14

Referenced by TdiQueryInformationEx().

◆ TdiQueryInformation()

NTSTATUS TdiQueryInformation ( PFILE_OBJECT  FileObject,
LONG  QueryType,
PMDL  MdlBuffer 
)

Definition at line 668 of file tdi.c.

681 {
684  KEVENT Event;
685  PIRP Irp;
686 
687  if (!FileObject) {
688  AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
690  }
691 
693  if (!DeviceObject) {
694  AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
696  }
697 
699 
701  DeviceObject, /* Device object */
702  ConnectionObject, /* File object */
703  &Event, /* Event */
704  &Iosb); /* Status */
705  if (!Irp) {
707  }
708 
710  DeviceObject,
711  FileObject,
712  NULL,
713  NULL,
714  QueryType,
715  MdlBuffer);
716 
717  return TdiCall(Irp, DeviceObject, &Event, &Iosb);
718 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Definition: tdi.c:46
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
return Iosb
Definition: create.c:4426
_Must_inspect_result_ _In_ KTMOBJECT_TYPE QueryType
Definition: nttmapi.h:404
#define TDI_QUERY_INFORMATION
Definition: tdikrnl.h:58
#define TdiBuildQueryInformation( Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr)
Definition: tdikrnl.h:638
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define MIN_TRACE
Definition: debug.h:14

Referenced by AfdGetSockName(), and TdiQueryMaxDatagramLength().

◆ TdiSetEventHandler()

NTSTATUS TdiSetEventHandler ( PFILE_OBJECT  FileObject,
LONG  EventType,
PVOID  Handler,
PVOID  Context 
)

Definition at line 546 of file tdi.c.

563 {
566  KEVENT Event;
567  PIRP Irp;
568 
569  AFD_DbgPrint(MAX_TRACE, ("Called\n"));
570 
571  if (!FileObject) {
572  AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
574  }
575 
577  if (!DeviceObject) {
578  AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
580  }
581 
583 
585  DeviceObject, /* Device object */
586  FileObject, /* File object */
587  &Event, /* Event */
588  &Iosb); /* Status */
589  if (!Irp)
591 
592 
593 
595  DeviceObject,
596  FileObject,
597  NULL,
598  NULL,
599  EventType,
600  Handler,
601  Context);
602 
603  return TdiCall(Irp, DeviceObject, &Event, &Iosb);
604 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define TdiBuildSetEventHandler( Irp, DevObj, FileObj, CompRoutine, Contxt, InEventType, InEventHandler, InEventContext)
Definition: tdikrnl.h:791
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Definition: tdi.c:46
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
smooth NULL
Definition: ftsmooth.c:416
#define TDI_SET_EVENT_HANDLER
Definition: tdikrnl.h:57
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
return Iosb
Definition: create.c:4426
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:668
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define MAX_TRACE
Definition: debug.h:16
#define MIN_TRACE
Definition: debug.h:14
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:165

Referenced by AfdDeregisterEventHandlers(), and AfdRegisterEventHandlers().