ReactOS  0.4.14-dev-317-g96040ec
iflist.c File Reference
#include "wshtcpip.h"
#include <windows.h>
#include <ntndk.h>
#include <iptypes.h>
#include <wine/list.h>
#include <debug.h>
Include dependency graph for iflist.c:

Go to the source code of this file.

Classes

struct  _IntfIDItem
 

Macros

#define WIN32_NO_STATUS   /* Tell Windows headers you'll use ntstatus.s from NDK */
 
#define NDEBUG
 

Typedefs

typedef struct _IntfIDItem IntfIDItem
 

Functions

BOOL AllocAndGetEntityArray (IN HANDLE TcpFile, IN HANDLE hHeap, OUT TDIEntityID **ppEntities, OUT PDWORD idCount)
 
INT GetIPSNMPInfo (IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT IPSNMPInfo *outIPSNMPInfo)
 
INT GetTdiEntityType (IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT PULONG pType)
 
INT GetIFEntry (IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT IFEntry *pIFEntry, IN ULONG IFEntryLen)
 
INT WSHIoctl_GetInterfaceList (IN LPVOID OutputBuffer, IN DWORD OutputBufferLength, OUT LPDWORD NumberOfBytesReturned, OUT LPBOOL NeedsCompletion)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file iflist.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS   /* Tell Windows headers you'll use ntstatus.s from NDK */

Definition at line 11 of file iflist.c.

Typedef Documentation

◆ IntfIDItem

Function Documentation

◆ AllocAndGetEntityArray()

BOOL AllocAndGetEntityArray ( IN HANDLE  TcpFile,
IN HANDLE  hHeap,
OUT TDIEntityID **  ppEntities,
OUT PDWORD  idCount 
)

Definition at line 21 of file iflist.c.

26 {
27  BOOL result = FALSE;
28  int callsLeft;
29  ULONG outBufLen, outBufLenNeeded;
30  void* outBuf = NULL;
33  TDIEntityID *pEntities;
34 
35  /* Set up Request */
36  RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
38  inTcpReq.ID.toi_entity.tei_instance = 0;
39  inTcpReq.ID.toi_class = INFO_CLASS_GENERIC;
40  inTcpReq.ID.toi_type = INFO_TYPE_PROVIDER;
41  inTcpReq.ID.toi_id = ENTITY_LIST_ID;
42  DPRINT("inBufLen %ux\n", sizeof(inTcpReq));// 0x24;
43 
44  outBufLenNeeded = sizeof(TDIEntityID) * MAX_TDI_ENTITIES;
45  /* MSDN says, that only the the result is okay if the outputLen is greater
46  or equal to the inputLen. Normally only one call is needed. Only if
47  a entry is added during calling a second call will be done.
48  To prevent a endless-loop because of memory corruption literation
49  count will be limited to 4 loops. */
50  for (callsLeft = 4; callsLeft > 0; callsLeft++)
51  {
52  /* maybe free old buffer ... */
53  if (outBuf != NULL)
54  {
55  HeapFree(hHeap, 0, outBuf);
56  outBuf = NULL;
57  }
58 
59  outBufLen = outBufLenNeeded;
60  DPRINT("outBufLen %lx\n", outBufLen);// 0x24;
61  outBuf = HeapAlloc(hHeap, 0, outBufLen);
62  if (outBuf == NULL)
63  break;
64 
65  Status = NO_ERROR;
66  if (!DeviceIoControl(
67  TcpFile,
69  &inTcpReq,
70  sizeof(inTcpReq),
71  outBuf,
72  outBufLen,
73  &outBufLenNeeded,
74  NULL))
75  Status = GetLastError();
76 
77  /* We need TDI_SUCCESS and the outBufLenNeeded must be equal or smaller
78  than our buffer (outBufLen). */
79  if (Status != NO_ERROR)
80  {
81  HeapFree(hHeap, 0, outBuf);
82  break;
83  }
84  /* status = Success; was the buffer large enough? */
85  if (outBufLenNeeded <= outBufLen)
86  {
87  result = TRUE;
88  break;
89  }
90  }
91 
92  if (result)
93  {
94  int i1;
95  *idCount = (outBufLenNeeded / sizeof(TDIEntityID));
96  *ppEntities = (TDIEntityID*)outBuf;
97 
98  DPRINT("TcpFile %p\n", TcpFile);
99 
100  DPRINT("idCount %lx\n", *idCount);// 0x24;
101 
102  pEntities = *ppEntities;
103  for (i1 = 0; i1 < *idCount; i1++)
104  {
105  DPRINT("outIfInfo->tei_entity %x\n", (UINT)pEntities->tei_entity);
106  DPRINT("outIfInfo->tei_instance %x\n", (UINT)pEntities->tei_instance);
107  pEntities++;
108  }
109  }
110 
111  return result;
112 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define MAX_TDI_ENTITIES
Definition: tdiinfo.h:35
#define TRUE
Definition: types.h:120
ULONG toi_class
Definition: tdiinfo.h:75
struct _TDIEntityID TDIEntityID
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
#define NO_ERROR
Definition: dderror.h:5
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
ULONG tei_entity
Definition: tdiinfo.h:31
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define INFO_CLASS_GENERIC
Definition: tdiinfo.h:64
ULONG tei_instance
Definition: tdiinfo.h:32
Status
Definition: gdiplustypes.h:24
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define ENTITY_LIST_ID
Definition: tdiinfo.h:38
unsigned int UINT
Definition: ndis.h:50
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define GENERIC_ENTITY
Definition: tdiinfo.h:37
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394
ULONG toi_type
Definition: tdiinfo.h:76

Referenced by WSHIoctl_GetInterfaceList().

◆ GetIFEntry()

INT GetIFEntry ( IN HANDLE  TcpFile,
IN TDIEntityID pEntityID,
OUT IFEntry pIFEntry,
IN ULONG  IFEntryLen 
)

Definition at line 174 of file iflist.c.

179 {
181  ULONG BufLenNeeded;
182 
183  RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
184  inTcpReq.ID.toi_entity = *pEntityID;
185  inTcpReq.ID.toi_class = INFO_CLASS_PROTOCOL;
186  inTcpReq.ID.toi_type = INFO_TYPE_PROVIDER;
187  inTcpReq.ID.toi_id = IP_MIB_STATS_ID;
188  if (!DeviceIoControl(
189  TcpFile,
191  &inTcpReq,
192  sizeof(inTcpReq),
193  pIFEntry,
194  IFEntryLen,
195  &BufLenNeeded,
196  NULL))
197  {
198  DPRINT("DeviceIoControl (IFEntry) failed, Status %li!\n", GetLastError());
199  return WSAEFAULT;
200  }
201 
202  return NO_ERROR;
203 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define WSAEFAULT
Definition: winerror.h:1945
ULONG toi_class
Definition: tdiinfo.h:75
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
#define NO_ERROR
Definition: dderror.h:5
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define IP_MIB_STATS_ID
Definition: afd.h:35
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG toi_type
Definition: tdiinfo.h:76
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65

Referenced by WSHIoctl_GetInterfaceList().

◆ GetIPSNMPInfo()

INT GetIPSNMPInfo ( IN HANDLE  TcpFile,
IN TDIEntityID pEntityID,
OUT IPSNMPInfo outIPSNMPInfo 
)

Definition at line 114 of file iflist.c.

118 {
120  ULONG BufLenNeeded;
121 
122  RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
123  inTcpReq.ID.toi_entity = *pEntityID;
124  inTcpReq.ID.toi_class = INFO_CLASS_PROTOCOL;
125  inTcpReq.ID.toi_type = INFO_TYPE_PROVIDER;
126  inTcpReq.ID.toi_id = IP_MIB_STATS_ID;
127  if (!DeviceIoControl(
128  TcpFile,
130  &inTcpReq,
131  sizeof(inTcpReq),
132  outIPSNMPInfo,
133  sizeof(*outIPSNMPInfo),
134  &BufLenNeeded,
135  NULL))
136  {
137  DPRINT("DeviceIoControl (IPSNMPInfo) failed, Status %li!\n", GetLastError());
138  return WSAEFAULT;
139  }
140 
141  return NO_ERROR;
142 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define WSAEFAULT
Definition: winerror.h:1945
ULONG toi_class
Definition: tdiinfo.h:75
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
#define NO_ERROR
Definition: dderror.h:5
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define IP_MIB_STATS_ID
Definition: afd.h:35
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG toi_type
Definition: tdiinfo.h:76
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65

Referenced by WSHIoctl_GetInterfaceList().

◆ GetTdiEntityType()

INT GetTdiEntityType ( IN HANDLE  TcpFile,
IN TDIEntityID pEntityID,
OUT PULONG  pType 
)

Definition at line 144 of file iflist.c.

148 {
150  ULONG BufLenNeeded;
151 
152  RtlZeroMemory(&inTcpReq, sizeof(inTcpReq));
153  inTcpReq.ID.toi_entity = *pEntityID;
154  inTcpReq.ID.toi_class = INFO_CLASS_GENERIC;
155  inTcpReq.ID.toi_type = INFO_TYPE_PROVIDER;
156  inTcpReq.ID.toi_id = ENTITY_TYPE_ID;
157  if (!DeviceIoControl(
158  TcpFile,
160  &inTcpReq,
161  sizeof(inTcpReq),
162  pType,
163  sizeof(*pType),
164  &BufLenNeeded,
165  NULL))
166  {
167  DPRINT("DeviceIoControl (TdiEntityType) failed, Status %li!\n", GetLastError());
168  return WSAEFAULT;
169  }
170 
171  return NO_ERROR;
172 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define WSAEFAULT
Definition: winerror.h:1945
ULONG toi_class
Definition: tdiinfo.h:75
#define ENTITY_TYPE_ID
Definition: tdiinfo.h:39
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
#define NO_ERROR
Definition: dderror.h:5
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define INFO_CLASS_GENERIC
Definition: tdiinfo.h:64
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG toi_type
Definition: tdiinfo.h:76

Referenced by WSHIoctl_GetInterfaceList().

◆ WSHIoctl_GetInterfaceList()

INT WSHIoctl_GetInterfaceList ( IN LPVOID  OutputBuffer,
IN DWORD  OutputBufferLength,
OUT LPDWORD  NumberOfBytesReturned,
OUT LPBOOL  NeedsCompletion 
)

Definition at line 216 of file iflist.c.

221 {
222  IntfIDItem *IntfIDList;
223  IntfIDItem *pIntfIDItem, *pIntfIDNext;
225  TDIEntityID *outEntityID, *pEntityID;
226  IPSNMPInfo outIPSNMPInfo;
227  IPAddrEntry *pIPAddrEntry;
228  IFEntry *pIFEntry = NULL;
229  LPINTERFACE_INFO pIntfInfo;
230  DWORD outIDCount, i1, iAddr;
231  DWORD bCastAddr, outNumberOfBytes;
232  ULONG BufLenNeeded, BufLen, IFEntryLen, TdiType;
233  HANDLE TcpFile = 0;
234  HANDLE hHeap = GetProcessHeap();
235  DWORD LastErr;
236  INT res = -1;
237 
238  /* Init Interface-ID-List */
239  IntfIDList = HeapAlloc(hHeap, 0, sizeof(*IntfIDList));
240  list_init(&IntfIDList->entry);
241 
242  /* open tcp-driver */
243  LastErr = openTcpFile(&TcpFile, FILE_READ_DATA | FILE_WRITE_DATA);
244  if (!NT_SUCCESS(LastErr))
245  {
246  res = (INT)LastErr;
247  goto cleanup;
248  }
249 
250  DPRINT("TcpFile %p\n", TcpFile);
251 
252  if (!AllocAndGetEntityArray(TcpFile,hHeap,&outEntityID,&outIDCount))
253  {
254  DPRINT("ERROR in AllocAndGetEntityArray: out of memory!\n");
256  goto cleanup;
257  }
258 
259  IFEntryLen = sizeof(IFEntry) + MAX_ADAPTER_DESCRIPTION_LENGTH + 1;
260  pIFEntry = HeapAlloc(hHeap, 0, IFEntryLen);
261  if (pIFEntry == 0)
262  {
263  DPRINT("ERROR\n");
265  goto cleanup;
266  }
267 
268  /* get addresses */
269  pEntityID = outEntityID;
270  for (i1 = 0; i1 < outIDCount; i1++)
271  {
272  /* we are only interessted in network layers */
273  if ( (pEntityID->tei_entity != CL_NL_ENTITY) &&
274  (pEntityID->tei_entity != CO_NL_ENTITY) )
275  {
276  pEntityID++;
277  continue;
278  }
279  /* Get IPSNMPInfo */
280  res = GetIPSNMPInfo(TcpFile, pEntityID, &outIPSNMPInfo);
281  if (res != NO_ERROR)
282  goto cleanup;
283 
284  /* add to array */
285  pIntfIDItem = (IntfIDItem*)HeapAlloc(hHeap, 0, sizeof(IntfIDItem));
286  list_add_head(&IntfIDList->entry, &pIntfIDItem->entry);
287  pIntfIDItem->id = *pEntityID;
288  pIntfIDItem->numaddr = outIPSNMPInfo.ipsi_numaddr;
289  /* filled later */
290  pIntfIDItem->pIPAddrEntry0 = NULL;
291 
292  pEntityID++;
293  }
294 
295  /* Calculate needed size */
296  outNumberOfBytes = 0;
297  LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
298  {
299  outNumberOfBytes += (pIntfIDItem->numaddr * sizeof(INTERFACE_INFO));
300  }
301  DPRINT("Buffer size needed: %lu\n", outNumberOfBytes);
302  if (outNumberOfBytes > OutputBufferLength)
303  {
304  /* Buffer to small */
305  if (NumberOfBytesReturned)
306  *NumberOfBytesReturned = 0;
307  res = WSAEFAULT;
308  goto cleanup;
309  }
310 
311  /* Get address info */
312  RtlZeroMemory(&inTcpReq1,sizeof(inTcpReq1));
313  inTcpReq1.ID.toi_class = INFO_CLASS_PROTOCOL;
314  inTcpReq1.ID.toi_type = INFO_TYPE_PROVIDER;
315  inTcpReq1.ID.toi_id = IP_MIB_ADDRTABLE_ENTRY_ID;
316  LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
317  {
318  inTcpReq1.ID.toi_entity = pIntfIDItem->id;
319 
320  BufLen = sizeof(IPAddrEntry) * pIntfIDItem->numaddr;
321  pIntfIDItem->pIPAddrEntry0 = HeapAlloc(hHeap, 0, BufLen);
322 
323  if (!DeviceIoControl(
324  TcpFile,
326  &inTcpReq1,
327  sizeof(inTcpReq1),
328  pIntfIDItem->pIPAddrEntry0,
329  BufLen,
330  &BufLenNeeded,
331  NULL))
332  {
333  LastErr = GetLastError();
334  DPRINT("DeviceIoControl failed, Status %li!\n", LastErr);
335  res = WSAEFAULT;
336  goto cleanup;
337  }
338  }
339 
340  /* build result */
341  pIntfInfo = (LPINTERFACE_INFO)OutputBuffer;
342  LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
343  {
344  DPRINT("Number of addresses %d\n", pIntfIDItem->numaddr);
345 
346  pIPAddrEntry = pIntfIDItem->pIPAddrEntry0;
347  for (iAddr = 0; iAddr < pIntfIDItem->numaddr; iAddr++)
348  {
349  DPRINT("BufLen %lu\n",BufLenNeeded);
350  DPRINT("pIPAddrEntry->iae_addr %lx\n",pIPAddrEntry->iae_addr);
351  DPRINT("pIPAddrEntry->iae_bcastaddr %lx\n",pIPAddrEntry->iae_bcastaddr);
352  DPRINT("pIPAddrEntry->iae_mask %lx\n",pIPAddrEntry->iae_mask);
353  DPRINT("pIPAddrEntry->iae_reasmsize %lx\n",pIPAddrEntry->iae_reasmsize);
354 
355  pIntfInfo->iiAddress.AddressIn.sin_family = AF_INET;
356  pIntfInfo->iiAddress.AddressIn.sin_port = 0;
357  pIntfInfo->iiAddress.AddressIn.sin_addr.s_addr = pIPAddrEntry->iae_addr;
358 
359  pIntfInfo->iiBroadcastAddress.AddressIn.sin_family = AF_INET;
360  pIntfInfo->iiBroadcastAddress.AddressIn.sin_port = 0;
361  bCastAddr = (pIPAddrEntry->iae_bcastaddr == 0) ? 0 : 0xffffffff;
362  pIntfInfo->iiBroadcastAddress.AddressIn.sin_addr.s_addr = bCastAddr;
363 
364  pIntfInfo->iiNetmask.AddressIn.sin_family = AF_INET;
365  pIntfInfo->iiNetmask.AddressIn.sin_port = 0;
366  pIntfInfo->iiNetmask.AddressIn.sin_addr.s_addr = pIPAddrEntry->iae_mask;
367 
368  pIntfInfo->iiFlags = IFF_BROADCAST | IFF_MULTICAST;
369  if (pIPAddrEntry->iae_addr == ntohl(INADDR_LOOPBACK))
370  pIntfInfo->iiFlags |= IFF_LOOPBACK;
371 
372  pIPAddrEntry++;
373  pIntfInfo++;
374  }
375  res = NO_ERROR;
376  }
377 
378  /* Get Interface up/down-state and patch pIntfInfo->iiFlags */
379  pEntityID = outEntityID;
380  for (i1 = 0; i1 < outIDCount; i1++)
381  {
382  res = GetTdiEntityType(TcpFile, pEntityID, &TdiType);
383  if (res != NO_ERROR)
384  goto cleanup;
385 
386  if (TdiType != IF_MIB)
387  {
388  pEntityID++;
389  continue;
390  }
391 
392  res = GetIFEntry(TcpFile, pEntityID, pIFEntry, IFEntryLen);
393  if (res != NO_ERROR)
394  goto cleanup;
395 
396  /* if network isn't up -> no patch needed */
398  {
399  pEntityID++;
400  continue;
401  }
402 
403  /* patching ... if interface-index matches */
404  pIntfInfo = (LPINTERFACE_INFO)OutputBuffer;
405  LIST_FOR_EACH_ENTRY(pIntfIDItem, &IntfIDList->entry, struct _IntfIDItem, entry)
406  {
407  pIPAddrEntry = pIntfIDItem->pIPAddrEntry0;
408  for (iAddr = 0; iAddr < pIntfIDItem->numaddr; iAddr++)
409  {
410  if (pIPAddrEntry->iae_index == pIFEntry->if_index)
411  pIntfInfo->iiFlags |= IFF_UP;
412 
413  pIPAddrEntry++;
414  pIntfInfo++;
415  }
416  }
417 
418  pEntityID++;
419  }
420 
421  if (NumberOfBytesReturned)
422  *NumberOfBytesReturned = outNumberOfBytes;
423  if (NeedsCompletion != NULL)
424  *NeedsCompletion = FALSE;
425 
426  res = NO_ERROR;
427 cleanup:
428  DPRINT("WSHIoctl_GetInterfaceList - CLEANUP\n");
429  if (TcpFile != 0)
430  NtClose(TcpFile);
431  if (pIFEntry != NULL)
432  HeapFree(hHeap, 0, pIFEntry);
433  LIST_FOR_EACH_ENTRY_SAFE_REV(pIntfIDItem, pIntfIDNext,
434  &IntfIDList->entry, struct _IntfIDItem, entry)
435  {
436  if (pIntfIDItem->pIPAddrEntry0 != NULL)
437  HeapFree(hHeap, 0, pIntfIDItem->pIPAddrEntry0);
438  list_remove(&pIntfIDItem->entry);
439  HeapFree(hHeap, 0, pIntfIDItem);
440  }
441  HeapFree(hHeap, 0, IntfIDList);
442  return res;
443 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
BOOL AllocAndGetEntityArray(IN HANDLE TcpFile, IN HANDLE hHeap, OUT TDIEntityID **ppEntities, OUT PDWORD idCount)
Definition: iflist.c:21
ULONG ipsi_numaddr
Definition: tcpioctl.h:153
struct _INTERFACE_INFO INTERFACE_INFO
#define WSAEFAULT
Definition: winerror.h:1945
IPAddrEntry * pIPAddrEntry0
Definition: iflist.c:212
ULONG toi_class
Definition: tdiinfo.h:75
#define BufLen
Definition: fatfs.h:167
#define IFF_UP
Definition: ws2ipdef.h:21
#define INT
Definition: polytest.cpp:20
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
ULONG if_index
Definition: tcpioctl.h:105
ULONG if_operstatus
Definition: tcpioctl.h:112
ULONG iae_bcastaddr
Definition: tcpioctl.h:162
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
sockaddr_gen iiAddress
Definition: ws2ipdef.h:166
#define NO_ERROR
Definition: dderror.h:5
int32_t INT
Definition: typedefs.h:56
struct _INTERFACE_INFO * LPINTERFACE_INFO
ULONG iae_reasmsize
Definition: tcpioctl.h:163
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define IFF_BROADCAST
Definition: ws2ipdef.h:22
#define FILE_READ_DATA
Definition: nt_native.h:628
ULONG toi_id
Definition: tdiinfo.h:77
INT GetTdiEntityType(IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT PULONG pType)
Definition: iflist.c:144
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
#define FILE_WRITE_DATA
Definition: nt_native.h:631
sockaddr_gen iiNetmask
Definition: ws2ipdef.h:168
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
ULONG tei_entity
Definition: tdiinfo.h:31
ULONG iae_index
Definition: tcpioctl.h:160
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CO_NL_ENTITY
Definition: tdiinfo.h:44
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
ULONG iae_mask
Definition: tcpioctl.h:161
ULONG iae_addr
Definition: tcpioctl.h:159
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
sockaddr_gen iiBroadcastAddress
Definition: ws2ipdef.h:167
struct list entry
Definition: iflist.c:207
struct IFEntry IFEntry
uint32_t entry
Definition: isohybrid.c:63
INT GetIPSNMPInfo(IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT IPSNMPInfo *outIPSNMPInfo)
Definition: iflist.c:114
#define LIST_FOR_EACH_ENTRY_SAFE_REV(cursor, cursor2, list, type, field)
Definition: list.h:228
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
#define MAX_ADAPTER_DESCRIPTION_LENGTH
Definition: iinfo.c:16
GLuint res
Definition: glext.h:9613
#define IFF_MULTICAST
Definition: ws2ipdef.h:25
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
unsigned int ULONG
Definition: retypes.h:1
#define AF_INET
Definition: tcpip.h:117
#define INADDR_LOOPBACK
Definition: winsock.h:312
#define IF_MIB
Definition: tdiinfo.h:61
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
INT GetIFEntry(IN HANDLE TcpFile, IN TDIEntityID *pEntityID, OUT IFEntry *pIFEntry, IN ULONG IFEntryLen)
Definition: iflist.c:174
char * cleanup(char *str)
Definition: wpickclick.c:99
int numaddr
Definition: iflist.c:210
TDIEntityID id
Definition: iflist.c:208
#define IP_MIB_ADDRTABLE_ENTRY_ID
Definition: afd.h:36
struct sockaddr_in AddressIn
Definition: ws2ipdef.h:160
#define HeapFree(x, y, z)
Definition: compat.h:394
ULONG toi_type
Definition: tdiinfo.h:76
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
struct IPAddrEntry IPAddrEntry
#define IFF_LOOPBACK
Definition: ws2ipdef.h:23
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
#define ntohl(x)
Definition: module.h:203

Referenced by WSHIoctl().