ReactOS 0.4.15-dev-5666-gc548b97
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)
167
168 return STATUS_SUCCESS;
169}
ULONG Handle
Definition: gdb_input.c:15
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define ObDereferenceObject
Definition: obfuncs.h:203

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
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 MIN_TRACE
Definition: debug.h:14
#define MAX_TRACE
Definition: debug.h:16
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
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
#define ASSERT(a)
Definition: mode.c:44
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define STATUS_PENDING
Definition: ntstatus.h:82
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
#define TDI_CONNECT
Definition: tdikrnl.h:49
#define TdiBuildConnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:494
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:898
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:895

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"));
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"));
1271 }
1272
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 MID_TRACE
Definition: debug.h:15
static PLARGE_INTEGER Time
Definition: time.c:105
#define TdiBuildDisconnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, Flags, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:545
#define TDI_DISCONNECT
Definition: tdikrnl.h:52
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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;
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 TAG_AFD_EA_INFO
Definition: afd.h:50
LONG NTSTATUS
Definition: precomp.h:26
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 ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:878
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION
Status
Definition: gdiplustypes.h:25
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4538
void * PVOID
Definition: retypes.h:9
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define AFD_SHARE_UNIQUE
Definition: shared.h:191
#define TDI_CONNECTION_CONTEXT_LENGTH
Definition: tdi.h:373
#define TdiConnectionContext
Definition: tdi.h:371
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275

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{
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
653 FALSE,
654 &Event,
655 &Iosb);
656 if (!Irp)
658
660
661 if (Return)
662 *Return = Iosb.Information;
663
664 return Status;
665}
#define FALSE
Definition: types.h:117
return Iosb
Definition: create.c:4402
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ NotificationEvent
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
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953

Referenced by TdiQueryInformationEx().

◆ TdiQueryInformation()

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

Definition at line 668 of file tdi.c.

681{
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
712 NULL,
713 NULL,
714 QueryType,
715 MdlBuffer);
716
717 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
718}
_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

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{
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
597 NULL,
598 NULL,
599 EventType,
600 Handler,
601 Context);
602
603 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
604}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:672
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
#define TdiBuildSetEventHandler( Irp, DevObj, FileObj, CompRoutine, Contxt, InEventType, InEventHandler, InEventContext)
Definition: tdikrnl.h:791
#define TDI_SET_EVENT_HANDLER
Definition: tdikrnl.h:57

Referenced by AfdDeregisterEventHandlers(), and AfdRegisterEventHandlers().