ReactOS 0.4.15-dev-7677-g8209aa5
tdilib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS openTcpFile (PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
 
VOID closeTcpFile (HANDLE tcpFile)
 
NTSTATUS tdiGetEntityIDSet (HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
 
NTSTATUS tdiGetSetOfThings (HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
 
VOID tdiFreeThingSet (PVOID things)
 

Function Documentation

◆ closeTcpFile()

◆ openTcpFile()

NTSTATUS openTcpFile ( PHANDLE  tcpFile,
ACCESS_MASK  DesiredAccess 
)

Definition at line 12 of file handle.c.

13{
14 UNICODE_STRING fileName;
15 OBJECT_ATTRIBUTES objectAttributes;
16 IO_STATUS_BLOCK ioStatusBlock;
18
20
21 InitializeObjectAttributes( &objectAttributes,
22 &fileName,
24 NULL,
25 NULL );
26
27 status = NtOpenFile( tcpFile,
29 &objectAttributes,
30 &ioStatusBlock,
33
34 /* String does not need to be freed: it points to the constant
35 * string we provided */
36
37 if (!NT_SUCCESS(status))
38 *tcpFile = INVALID_HANDLE_VALUE;
39
40 return status;
41}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_SHARE_READ
Definition: compat.h:136
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
const PWCHAR TcpFileName
Definition: handle.c:10
Definition: ps.c:97
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

Referenced by addIPAddress(), createIpForwardEntry(), deleteIpAddress(), deleteIpForwardEntry(), getAddrByIndexOrName(), getArpTable(), getInterfaceEntryByIndex(), getInterfaceEntryByName(), getInterfaceIndexByName(), getInterfaceIndexTableInt(), getInterfaceNameByIndex(), getInterfacePhysicalByIndex(), getInterfacePhysicalByName(), getNumArpEntries(), getNumInterfacesInt(), getNumRoutes(), getNumTcpEntries(), getNumUdpEntries(), getRouteTable(), getTcpTable(), getUdpTable(), SendRequest(), SetIpNetEntry(), WSHIoctl_GetInterfaceList(), and WSHNotify().

◆ tdiFreeThingSet()

◆ tdiGetEntityIDSet()

NTSTATUS tdiGetEntityIDSet ( HANDLE  tcpFile,
TDIEntityID **  entitySet,
PDWORD  numEntities 
)

Definition at line 122 of file enum.c.

124 {
130 0,
131 0,
132 sizeof(TDIEntityID),
133 (PVOID *)entitySet,
134 numEntities );
135
136 return status;
137}
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define ENTITY_LIST_ID
Definition: tdiinfo.h:38
#define INFO_CLASS_GENERIC
Definition: tdiinfo.h:64
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
#define GENERIC_ENTITY
Definition: tdiinfo.h:37

Referenced by getArpTable(), getInterfaceInfoSet(), getNthInterfaceEntity(), getNthIpEntity(), getNumArpEntries(), getNumInterfacesInt(), getNumRoutes(), getNumTcpEntries(), getNumUdpEntries(), getTcpTable(), getUdpTable(), and WSHNotify().

◆ tdiGetSetOfThings()

NTSTATUS tdiGetSetOfThings ( HANDLE  tcpFile,
DWORD  toiClass,
DWORD  toiType,
DWORD  toiId,
DWORD  teiEntity,
DWORD  teiInstance,
DWORD  fixedPart,
DWORD  entrySize,
PVOID tdiEntitySet,
PDWORD  numEntries 
)

Definition at line 24 of file enum.c.

33 {
35 PVOID entitySet = 0;
37 DWORD allocationSizeForEntityArray = entrySize * MAX_TDI_ENTITIES;
39
40 req.ID.toi_class = toiClass;
41 req.ID.toi_type = toiType;
42 req.ID.toi_id = toiId;
43 req.ID.toi_entity.tei_entity = teiEntity;
44 req.ID.toi_entity.tei_instance = teiInstance;
45
46 /* There's a subtle problem here...
47 * If an interface is added at this exact instant, (as if by a PCMCIA
48 * card insertion), the array will still not have enough entries after
49 * have allocated it after the first DeviceIoControl call.
50 *
51 * We'll get around this by repeating until the number of interfaces
52 * stabilizes.
53 */
54 do {
56 NULL,
57 NULL,
58 NULL,
59 &Iosb,
61 &req,
62 sizeof(req),
63 NULL,
64 0);
66 {
68 if (NT_SUCCESS(status)) status = Iosb.Status;
69 }
70
71 if(!NT_SUCCESS(status))
72 {
73 return status;
74 }
75
76 allocationSizeForEntityArray = Iosb.Information;
77 entitySet = HeapAlloc( GetProcessHeap(), 0, allocationSizeForEntityArray );
78
79 if( !entitySet ) {
81 return status;
82 }
83
85 NULL,
86 NULL,
87 NULL,
88 &Iosb,
90 &req,
91 sizeof(req),
92 entitySet,
93 allocationSizeForEntityArray);
95 {
97 if (NT_SUCCESS(status)) status = Iosb.Status;
98 }
99
100 /* This is why we have the loop -- we might have added an adapter */
101 if( Iosb.Information == allocationSizeForEntityArray )
102 break;
103
104 HeapFree( GetProcessHeap(), 0, entitySet );
105 entitySet = 0;
106
107 if(!NT_SUCCESS(status))
108 return status;
109 } while( TRUE ); /* We break if the array we received was the size we
110 * expected. Therefore, we got here because it wasn't */
111
112 *numEntries = (allocationSizeForEntityArray - fixedPart) / entrySize;
113 *tdiEntitySet = entitySet;
114
115 return STATUS_SUCCESS;
116}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define HeapAlloc
Definition: compat.h:733
return Iosb
Definition: create.c:4402
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TCP_REQUEST_QUERY_INFORMATION_INIT
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG tei_entity
Definition: tdiinfo.h:31
ULONG tei_instance
Definition: tdiinfo.h:32
ULONG toi_id
Definition: tdiinfo.h:77
ULONG toi_type
Definition: tdiinfo.h:76
ULONG toi_class
Definition: tdiinfo.h:75
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define MAX_TDI_ENTITIES
Definition: tdiinfo.h:35
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: tditest.h:110
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by getArpTable(), getNumArpEntries(), getNumTcpEntries(), getNumUdpEntries(), getTcpTable(), getUdpTable(), tdiGetEntityIDSet(), tdiGetIpAddrsForIpEntity(), and tdiGetRoutesForIpEntity().