ReactOS 0.4.16-dev-2293-g4d8327b
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)
 Connect a connection endpoint to a remote peer.
 
NTSTATUS TdiOpenConnectionEndpointFile (PUNICODE_STRING DeviceName, PHANDLE ConnectionHandle, PFILE_OBJECT *ConnectionObject)
 Opens a connection endpoint file object.
 
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)
 Query for information.
 
NTSTATUS TdiSetEventHandler (PFILE_OBJECT FileObject, LONG EventType, PVOID Handler, PVOID Context)
 Sets or resets an event handler.
 
NTSTATUS TdiQueryDeviceControl (PFILE_OBJECT FileObject, ULONG IoControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, PULONG Return)
 Queries a device for information.
 

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 Irp,
PFILE_OBJECT  ConnectionObject,
PTDI_CONNECTION_INFORMATION  ConnectionCallInfo,
PTDI_CONNECTION_INFORMATION  ConnectionReturnInfo,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Connect a connection endpoint to a remote peer.

Parameters
ConnectionObject= Pointer to connection endpoint file object
RemoteAddress= Pointer to remote address
Returns
Status of operation

Definition at line 311 of file tdi.c.

326{
328
329 DPRINT("Called\n");
330
331 if (!ConnectionObject) {
332 DPRINT("Bad connection object.\n");
334 }
335
336 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
337 if (!DeviceObject) {
338 DPRINT("Bad device object.\n");
340 }
341
344 ConnectionObject,
345 NULL,
346 NULL);
347 if (!*Irp) {
349 }
350
353 ConnectionObject,
356 NULL,
357 ConnectionCallInfo,
358 ConnectionReturnInfo);
359
360 return TdiCall(*Irp, DeviceObject, NULL, NULL);
361}
_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)
Calls a transport driver device.
Definition: tdi.c:26
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define DPRINT
Definition: sndvol32.h:73
#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:2061
_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(), AfdStreamSocketSuperConnect(), and WskConnect().

◆ 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 1260 of file tdi.c.

1268 {
1270
1271 if (!TransportObject) {
1272 DPRINT("Bad transport object.\n");
1274 }
1275
1276 DPRINT("Called(TransportObject %p)\n", TransportObject);
1277
1278 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1279 if (!DeviceObject) {
1280 DPRINT("Bad device object.\n");
1282 }
1283
1286 TransportObject,
1287 NULL,
1288 NULL);
1289
1290 if (!*Irp) {
1291 DPRINT("Insufficient resources.\n");
1293 }
1294
1297 TransportObject,
1300 Time,
1301 Flags,
1302 RequestConnectionInfo,
1303 ReturnConnectionInfo);
1304
1306
1307 return STATUS_PENDING;
1308}
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
#define STATUS_PENDING
Definition: telnetd.h:14
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by DoDisconnect().

◆ TdiOpenConnectionEndpointFile()

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

Opens a connection endpoint file object.

Parameters
DeviceName= Pointer to counted string with name of device
ConnectionHandle= Address of buffer to place connection endpoint file handle
ConnectionObject= Address of buffer to place connection endpoint file object
Returns
Status of operation

Definition at line 258 of file tdi.c.

271{
273 PVOID *ContextArea;
276
277 DPRINT("Called. DeviceName (%wZ)\n", DeviceName);
278
279 /* EaName must be 0-terminated, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */
282 sizeof(PVOID) + 1;
283
285 EaLength,
287 if (!EaInfo)
289
290 RtlZeroMemory(EaInfo, EaLength);
292 /* Don't copy the terminating 0; we have already zeroed it */
293 RtlCopyMemory(EaInfo->EaName,
296 EaInfo->EaValueLength = sizeof(PVOID);
297 ContextArea = (PVOID*)(EaInfo->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1); /* 0-terminated */
298 /* FIXME: Allocate context area */
299 *ContextArea = NULL;
301 EaLength,
302 EaInfo,
305 ConnectionObject);
307 return Status;
308}
#define TAG_AFD_EA_INFO
Definition: afd.h:51
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)
Opens a device.
Definition: tdi.c:68
#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:879
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
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define AFD_SHARE_UNIQUE
Definition: netio.c:67
#define TDI_CONNECTION_CONTEXT_LENGTH
Definition: tdi.h:373
#define TdiConnectionContext
Definition: tdi.h:371
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281

Referenced by WarmSocketForConnection(), and WskSocket().

◆ TdiQueryDeviceControl()

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

Queries a device for information.

Parameters
FileObject= Pointer to file object
IoControlCode= I/O control code
InputBuffer= Pointer to buffer with input data
InputBufferLength= Length of InputBuffer
OutputBuffer= Address of buffer to place output data
OutputBufferLength= Length of OutputBuffer
Returns
Status of operation

Definition at line 630 of file tdi.c.

650{
655 PIRP Irp;
656
657 if (!FileObject) {
658 DPRINT("Bad file object.\n");
660 }
661
663 if (!DeviceObject) {
664 DPRINT("Bad device object.\n");
666 }
667
669
676 FALSE,
677 &Event,
678 &Iosb);
679 if (!Irp)
681
683
684 if (Return)
685 *Return = Iosb.Information;
686
687 return Status;
688}
#define FALSE
Definition: types.h:117
return Iosb
Definition: create.c:4403
#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 
)

Query for information.

Parameters
FileObject= Pointer to file object
QueryType= Query type
MdlBuffer= Pointer to MDL buffer specific for query type
Returns
Status of operation

Definition at line 691 of file tdi.c.

704{
708 PIRP Irp;
709
710 if (!FileObject) {
711 DPRINT("Bad file object.\n");
713 }
714
716 if (!DeviceObject) {
717 DPRINT("Bad device object.\n");
719 }
720
722
725 ConnectionObject,
726 &Event,
727 &Iosb);
728 if (!Irp) {
730 }
731
735 NULL,
736 NULL,
737 QueryType,
738 MdlBuffer);
739
740 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
741}
_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 
)

Sets or resets an event handler.

Parameters
FileObject= Pointer to file object
EventType= Event code
Handler= Event handler to be called when the event occurs
Context= Context input to handler when the event occurs
Returns
Status of operation

Specify NULL for Handler to stop calling event handler

Definition at line 569 of file tdi.c.

586{
590 PIRP Irp;
591
592 DPRINT("Called\n");
593
594 if (!FileObject) {
595 DPRINT("Bad file object.\n");
597 }
598
600 if (!DeviceObject) {
601 DPRINT("Bad device object.\n");
603 }
604
606
610 &Event,
611 &Iosb);
612 if (!Irp)
614
615
616
620 NULL,
621 NULL,
622 EventType,
623 Handler,
624 Context);
625
626 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
627}
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().