ReactOS 0.4.15-dev-7918-g2a2556c
iphlpapi_main.c File Reference
#include <config.h>
#include "iphlpapi_private.h"
#include <strsafe.h>
#include <psapi.h>
Include dependency graph for iphlpapi_main.c:

Go to the source code of this file.

Classes

struct  _NAME_SERVER_LIST_CONTEXT
 

Macros

#define DEBUG
 

Typedefs

typedef struct _NAME_SERVER_LIST_CONTEXT NAME_SERVER_LIST_CONTEXT
 
typedef struct _NAME_SERVER_LIST_CONTEXTPNAME_SERVER_LIST_CONTEXT
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (iphlpapi)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
DWORD WINAPI AddIPAddress (IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
 
DWORD getInterfaceGatewayByIndex (DWORD index)
 
DWORD WINAPI AllocateAndGetIfTableFromStack (PMIB_IFTABLE *ppIfTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetIpAddrTableFromStack (PMIB_IPADDRTABLE *ppIpAddrTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetIpForwardTableFromStack (PMIB_IPFORWARDTABLE *ppIpForwardTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetIpNetTableFromStack (PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetTcpTableFromStack (PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetTcpExTableFromStack (PVOID *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags, DWORD family)
 
DWORD WINAPI AllocateAndGetTcpExTable2FromStack (PVOID *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags, DWORD family, TCP_TABLE_CLASS class)
 
DWORD WINAPI AllocateAndGetUdpTableFromStack (PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags)
 
DWORD WINAPI AllocateAndGetUdpExTableFromStack (PVOID *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags, DWORD family)
 
DWORD WINAPI AllocateAndGetUdpExTable2FromStack (PVOID *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags, DWORD family, UDP_TABLE_CLASS class)
 
DWORD WINAPI CreateIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 
DWORD WINAPI CreateIpNetEntry (PMIB_IPNETROW pArpEntry)
 
DWORD WINAPI CreateProxyArpEntry (DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex)
 
DWORD WINAPI DeleteIPAddress (ULONG NTEContext)
 
DWORD WINAPI DeleteIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 
DWORD WINAPI DeleteIpNetEntry (PMIB_IPNETROW pArpEntry)
 
DWORD WINAPI DeleteProxyArpEntry (DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex)
 
DWORD WINAPI EnableRouter (HANDLE *pHandle, OVERLAPPED *pOverlapped)
 
DWORD WINAPI FlushIpNetTable (DWORD dwIfIndex)
 
DWORD WINAPI GetAdapterIndex (LPWSTR AdapterName, PULONG IfIndex)
 
DWORD WINAPI GetAdaptersInfo (PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
 
DWORD WINAPI GetBestInterface (IPAddr dwDestAddr, PDWORD pdwBestIfIndex)
 
DWORD WINAPI GetBestRoute (DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDROW pBestRoute)
 
static int TcpTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetExtendedTcpTable (PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, TCP_TABLE_CLASS TableClass, ULONG Reserved)
 
static int UdpTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetExtendedUdpTable (PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, UDP_TABLE_CLASS TableClass, ULONG Reserved)
 
DWORD WINAPI GetFriendlyIfIndex (DWORD IfIndex)
 
DWORD WINAPI GetIcmpStatistics (PMIB_ICMP pStats)
 
DWORD WINAPI GetIfEntry (PMIB_IFROW pIfRow)
 
static int IfTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetIfTable (PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
 
DWORD WINAPI GetInterfaceInfo (PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
 
static int IpAddrTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetIpAddrTable (PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder)
 
static int IpForwardTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetIpForwardTable (PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
 
static int IpNetTableSorter (const void *a, const void *b)
 
DWORD WINAPI GetIpNetTable (PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOrder)
 
DWORD WINAPI GetIpStatistics (PMIB_IPSTATS pStats)
 
DWORD WINAPI GetIpStatisticsEx (PMIB_IPSTATS pStats, DWORD dwFamily)
 
DWORD WINAPI GetNetworkParams (PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
 
DWORD WINAPI GetNumberOfInterfaces (PDWORD pdwNumIf)
 
static DWORD GetOwnerModuleFromPidEntry (DWORD OwningPid, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
 
static DWORD GetOwnerModuleFromTagEntry (DWORD OwningPid, DWORD OwningTag, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
 
DWORD WINAPI GetOwnerModuleFromTcpEntry (PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
 
DWORD WINAPI GetOwnerModuleFromUdpEntry (PMIB_UDPROW_OWNER_MODULE pUdpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
 
static void CreateNameServerListEnumNamesFunc (PWCHAR Interface, PWCHAR Server, PVOID Data)
 
DWORD WINAPI GetPerAdapterInfo (ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
 
BOOL WINAPI GetRTTAndHopCount (IPAddr DestIpAddress, PULONG HopCount, ULONG MaxHops, PULONG RTT)
 
DWORD WINAPI GetTcpStatisticsEx (PMIB_TCPSTATS pStats, DWORD dwFamily)
 
DWORD WINAPI GetTcpStatistics (PMIB_TCPSTATS pStats)
 
DWORD WINAPI GetTcpTable (PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder)
 
DWORD WINAPI GetUdpStatisticsEx (PMIB_UDPSTATS pStats, DWORD dwFamily)
 
DWORD WINAPI GetUdpStatistics (PMIB_UDPSTATS pStats)
 
DWORD WINAPI GetUdpTable (PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder)
 
DWORD WINAPI GetUniDirectionalAdapterInfo (PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo, PULONG dwOutBufLen)
 
DWORD WINAPI IpReleaseAddress (PIP_ADAPTER_INDEX_MAP AdapterInfo)
 
DWORD WINAPI IpRenewAddress (PIP_ADAPTER_INDEX_MAP AdapterInfo)
 
DWORD WINAPI NotifyAddrChange (PHANDLE Handle, LPOVERLAPPED overlapped)
 
DWORD WINAPI NotifyRouteChange (PHANDLE Handle, LPOVERLAPPED overlapped)
 
DWORD WINAPI SendARP (IPAddr DestIP, IPAddr SrcIP, PULONG pMacAddr, PULONG PhyAddrLen)
 
DWORD WINAPI SetIfEntry (PMIB_IFROW pIfRow)
 
DWORD WINAPI SetIpForwardEntry (PMIB_IPFORWARDROW pRoute)
 
DWORD WINAPI SetIpNetEntry (PMIB_IPNETROW pArpEntry)
 
DWORD WINAPI SetIpStatistics (PMIB_IPSTATS pIpStats)
 
DWORD WINAPI SetIpTTL (UINT nTTL)
 
DWORD WINAPI SetTcpEntry (PMIB_TCPROW pTcpRow)
 
DWORD WINAPI UnenableRouter (OVERLAPPED *pOverlapped, LPDWORD lpdwEnableCount)
 
DWORD WINAPI GetIpErrorString (IP_STATUS ErrorCode, PWCHAR Buffer, PDWORD Size)
 
PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap (VOID)
 
BOOL WINAPI CancelIPChangeNotify (LPOVERLAPPED notifyOverlapped)
 
DWORD WINAPI GetBestInterfaceEx (struct sockaddr *pDestAddr, PDWORD pdwBestIfIndex)
 
DWORD WINAPI NhpAllocateAndGetInterfaceInfoFromStack (IP_INTERFACE_NAME_INFO **ppTable, PDWORD pdwCount, BOOL bOrder, HANDLE hHeap, DWORD dwFlags)
 
DWORD WINAPI GetIcmpStatisticsEx (PMIB_ICMP_EX pStats, DWORD dwFamily)
 
DWORD WINAPI SetIpForwardEntryToStack (PMIB_IPFORWARDROW pRoute)
 
DWORD GetInterfaceNameInternal (_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen)
 
DWORD WINAPI NhGetInterfaceNameFromDeviceGuid (_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen, DWORD dwUnknown4, DWORD dwUnknown5)
 
DWORD WINAPI NhGetInterfaceNameFromGuid (_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen, DWORD dwUnknown4, DWORD dwUnknown5)
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG

Definition at line 22 of file iphlpapi_main.c.

Typedef Documentation

◆ NAME_SERVER_LIST_CONTEXT

◆ PNAME_SERVER_LIST_CONTEXT

Function Documentation

◆ AddIPAddress()

DWORD WINAPI AddIPAddress ( IPAddr  Address,
IPMask  Netmask,
DWORD  IfIndex,
PULONG  NteContext,
PULONG  NteInstance 
)

Definition at line 67 of file iphlpapi_main.c.

68{
69 return RtlNtStatusToDosError(addIPAddress(Address, Netmask, IfIndex, NteContext, NteInstance));
70}
NTSTATUS addIPAddress(IPAddr Address, IPMask Mask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static WCHAR Address[46]
Definition: ping.c:68

Referenced by DSStaticRefreshParams(), INetCfgComponentControl_fnApplyRegistryChanges(), setup_adapter(), and state_panic().

◆ AllocateAndGetIfTableFromStack()

DWORD WINAPI AllocateAndGetIfTableFromStack ( PMIB_IFTABLE ppIfTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 100 of file iphlpapi_main.c.

102{
103 DWORD ret;
104
105 TRACE("ppIfTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n", ppIfTable,
106 (DWORD)bOrder, heap, flags);
107 if (!ppIfTable)
109 else {
110 DWORD dwSize = 0;
111
112 *ppIfTable = NULL;
113 ret = GetIfTable(*ppIfTable, &dwSize, bOrder);
115 *ppIfTable = (PMIB_IFTABLE)HeapAlloc(heap, flags, dwSize);
116 ret = GetIfTable(*ppIfTable, &dwSize, bOrder);
117 if (ret != NO_ERROR) {
118 HeapFree(heap, flags, *ppIfTable);
119 *ppIfTable = NULL;
120 }
121 }
122 }
123 TRACE("returning %ld\n", ret);
124 return ret;
125}
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
struct _MIB_IFTABLE * PMIB_IFTABLE
DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HANDLE heap
Definition: heap.c:65
#define TRACE(s)
Definition: solgame.cpp:4
int ret

◆ AllocateAndGetIpAddrTableFromStack()

DWORD WINAPI AllocateAndGetIpAddrTableFromStack ( PMIB_IPADDRTABLE ppIpAddrTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 140 of file iphlpapi_main.c.

142{
143 DWORD ret;
144
145 TRACE("ppIpAddrTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n",
146 ppIpAddrTable, (DWORD)bOrder, heap, flags);
147 if (!ppIpAddrTable)
149 else {
150 DWORD dwSize = 0;
151
152 *ppIpAddrTable = NULL;
153 ret = GetIpAddrTable(*ppIpAddrTable, &dwSize, bOrder);
155 *ppIpAddrTable = (PMIB_IPADDRTABLE)HeapAlloc(heap, flags, dwSize);
156 ret = GetIpAddrTable(*ppIpAddrTable, &dwSize, bOrder);
157 if (ret != NO_ERROR) {
158 HeapFree(heap, flags, *ppIpAddrTable);
159 *ppIpAddrTable = NULL;
160 }
161 }
162 }
163 TRACE("returning %ld\n", ret);
164 return ret;
165}
DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder)
struct _MIB_IPADDRTABLE * PMIB_IPADDRTABLE

◆ AllocateAndGetIpForwardTableFromStack()

DWORD WINAPI AllocateAndGetIpForwardTableFromStack ( PMIB_IPFORWARDTABLE ppIpForwardTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 180 of file iphlpapi_main.c.

182{
183 DWORD ret;
184
185 TRACE("ppIpForwardTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n",
186 ppIpForwardTable, (DWORD)bOrder, heap, flags);
187 if (!ppIpForwardTable)
189 else {
190 DWORD dwSize = 0;
191
192 *ppIpForwardTable = NULL;
193 ret = GetIpForwardTable(*ppIpForwardTable, &dwSize, bOrder);
195 *ppIpForwardTable = (PMIB_IPFORWARDTABLE)HeapAlloc(heap, flags, dwSize);
196 ret = GetIpForwardTable(*ppIpForwardTable, &dwSize, bOrder);
197 if (ret != NO_ERROR) {
198 HeapFree(heap, flags, *ppIpForwardTable);
199 *ppIpForwardTable = NULL;
200 }
201 }
202 }
203 TRACE("returning %ld\n", ret);
204 return ret;
205}
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
struct _MIB_IPFORWARDTABLE * PMIB_IPFORWARDTABLE

Referenced by GetBestRoute().

◆ AllocateAndGetIpNetTableFromStack()

DWORD WINAPI AllocateAndGetIpNetTableFromStack ( PMIB_IPNETTABLE ppIpNetTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 220 of file iphlpapi_main.c.

222{
223 DWORD ret;
224
225 TRACE("ppIpNetTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n",
226 ppIpNetTable, (DWORD)bOrder, heap, flags);
227 if (!ppIpNetTable)
229 else {
230 DWORD dwSize = 0;
231
232 *ppIpNetTable = NULL;
233 ret = GetIpNetTable(*ppIpNetTable, &dwSize, bOrder);
235 *ppIpNetTable = (PMIB_IPNETTABLE)HeapAlloc(heap, flags, dwSize);
236 ret = GetIpNetTable(*ppIpNetTable, &dwSize, bOrder);
237 if (ret != NO_ERROR) {
238 HeapFree(heap, flags, *ppIpNetTable);
239 *ppIpNetTable = NULL;
240 }
241 }
242 }
243 TRACE("returning %ld\n", ret);
244 return ret;
245}
DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOrder)
struct _MIB_IPNETTABLE * PMIB_IPNETTABLE

◆ AllocateAndGetTcpExTable2FromStack()

DWORD WINAPI AllocateAndGetTcpExTable2FromStack ( PVOID ppTcpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags,
DWORD  family,
TCP_TABLE_CLASS  class 
)

Definition at line 343 of file iphlpapi_main.c.

345{
346 DWORD ret;
347
348 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx, family %ld, class %ld\n",
349 ppTcpTable, (DWORD)bOrder, heap, flags, family, class);
350 if (!ppTcpTable)
352 else {
353 DWORD dwSize = 0;
354
355 *ppTcpTable = NULL;
356 ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family, class, 0);
358 *ppTcpTable = HeapAlloc(heap, flags, dwSize);
359 ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family, class, 0);
360 if (ret != NO_ERROR) {
361 HeapFree(heap, flags, *ppTcpTable);
362 *ppTcpTable = NULL;
363 }
364 }
365 }
366 TRACE("returning %ld\n", ret);
367 return ret;
368}
DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, TCP_TABLE_CLASS TableClass, ULONG Reserved)

◆ AllocateAndGetTcpExTableFromStack()

DWORD WINAPI AllocateAndGetTcpExTableFromStack ( PVOID ppTcpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags,
DWORD  family 
)

Definition at line 301 of file iphlpapi_main.c.

303{
304 DWORD ret;
305
306 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx, family 0x%08lx\n",
307 ppTcpTable, (DWORD)bOrder, heap, flags, family);
308 if (!ppTcpTable)
310 else {
311 DWORD dwSize = 0;
312
313 *ppTcpTable = NULL;
314 ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family, TCP_TABLE_OWNER_PID_ALL, 0);
317 ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family, TCP_TABLE_OWNER_PID_ALL, 0);
318 if (ret != NO_ERROR) {
319 HeapFree(heap, flags, *ppTcpTable);
320 *ppTcpTable = NULL;
321 }
322 }
323 }
324 TRACE("returning %ld\n", ret);
325 return ret;
326}
@ TCP_TABLE_OWNER_PID_ALL
Definition: iprtrmib.h:35
struct _MIB_TCPTABLE_OWNER_PID * PMIB_TCPTABLE_OWNER_PID

◆ AllocateAndGetTcpTableFromStack()

DWORD WINAPI AllocateAndGetTcpTableFromStack ( PMIB_TCPTABLE ppTcpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 260 of file iphlpapi_main.c.

262{
263 DWORD ret;
264
265 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n",
266 ppTcpTable, (DWORD)bOrder, heap, flags);
267 if (!ppTcpTable)
269 else {
270 DWORD dwSize = 0;
271
272 *ppTcpTable = NULL;
273 ret = GetTcpTable(*ppTcpTable, &dwSize, bOrder);
275 *ppTcpTable = (PMIB_TCPTABLE)HeapAlloc(heap, flags, dwSize);
276 ret = GetTcpTable(*ppTcpTable, &dwSize, bOrder);
277 if (ret != NO_ERROR) {
278 HeapFree(heap, flags, *ppTcpTable);
279 *ppTcpTable = NULL;
280 }
281 }
282 }
283 TRACE("returning %ld\n", ret);
284 return ret;
285}
DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder)
struct _MIB_TCPTABLE * PMIB_TCPTABLE

◆ AllocateAndGetUdpExTable2FromStack()

DWORD WINAPI AllocateAndGetUdpExTable2FromStack ( PVOID ppUdpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags,
DWORD  family,
UDP_TABLE_CLASS  class 
)

Definition at line 466 of file iphlpapi_main.c.

468{
469 DWORD ret;
470
471 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx, family %ld, class %ld\n",
472 ppUdpTable, (DWORD)bOrder, heap, flags, family, class);
473 if (!ppUdpTable)
475 else {
476 DWORD dwSize = 0;
477
478 *ppUdpTable = NULL;
479 ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, class, 0);
481 *ppUdpTable = HeapAlloc(heap, flags, dwSize);
482 ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, class, 0);
483 if (ret != NO_ERROR) {
484 HeapFree(heap, flags, *ppUdpTable);
485 *ppUdpTable = NULL;
486 }
487 }
488 }
489 TRACE("returning %ld\n", ret);
490 return ret;
491}
DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, UDP_TABLE_CLASS TableClass, ULONG Reserved)

◆ AllocateAndGetUdpExTableFromStack()

DWORD WINAPI AllocateAndGetUdpExTableFromStack ( PVOID ppUdpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags,
DWORD  family 
)

Definition at line 424 of file iphlpapi_main.c.

426{
427 DWORD ret;
428
429 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx, family 0x%08lx\n",
430 ppUdpTable, (DWORD)bOrder, heap, flags, family);
431 if (!ppUdpTable)
433 else {
434 DWORD dwSize = 0;
435
436 *ppUdpTable = NULL;
437 ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, UDP_TABLE_OWNER_PID, 0);
440 ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, UDP_TABLE_OWNER_PID, 0);
441 if (ret != NO_ERROR) {
442 HeapFree(heap, flags, *ppUdpTable);
443 *ppUdpTable = NULL;
444 }
445 }
446 }
447 TRACE("returning %ld\n", ret);
448 return ret;
449}
@ UDP_TABLE_OWNER_PID
Definition: iprtrmib.h:44
struct _MIB_UDPTABLE_OWNER_PID * PMIB_UDPTABLE_OWNER_PID

◆ AllocateAndGetUdpTableFromStack()

DWORD WINAPI AllocateAndGetUdpTableFromStack ( PMIB_UDPTABLE ppUdpTable,
BOOL  bOrder,
HANDLE  heap,
DWORD  flags 
)

Definition at line 383 of file iphlpapi_main.c.

385{
386 DWORD ret;
387
388 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%p, flags 0x%08lx\n",
389 ppUdpTable, (DWORD)bOrder, heap, flags);
390 if (!ppUdpTable)
392 else {
393 DWORD dwSize = 0;
394
395 *ppUdpTable = NULL;
396 ret = GetUdpTable(*ppUdpTable, &dwSize, bOrder);
398 *ppUdpTable = (PMIB_UDPTABLE)HeapAlloc(heap, flags, dwSize);
399 ret = GetUdpTable(*ppUdpTable, &dwSize, bOrder);
400 if (ret != NO_ERROR) {
401 HeapFree(heap, flags, *ppUdpTable);
402 *ppUdpTable = NULL;
403 }
404 }
405 }
406 TRACE("returning %ld\n", ret);
407 return ret;
408}
DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder)
struct _MIB_UDPTABLE * PMIB_UDPTABLE

◆ CancelIPChangeNotify()

BOOL WINAPI CancelIPChangeNotify ( LPOVERLAPPED  notifyOverlapped)

Definition at line 3189 of file iphlpapi_main.c.

3190{
3191 FIXME(":stub\n");
3192 return 0L;
3193}
#define FIXME(fmt,...)
Definition: debug.h:111
#define L(x)
Definition: ntvdm.h:50

◆ CreateIpForwardEntry()

DWORD WINAPI CreateIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 503 of file iphlpapi_main.c.

504{
505 return createIpForwardEntry( pRoute );
506}
DWORD createIpForwardEntry(PMIB_IPFORWARDROW pRoute)
Definition: route.c:52

Referenced by add_route(), INetCfgComponentControl_fnApplyRegistryChanges(), and setup_adapter().

◆ CreateIpNetEntry()

DWORD WINAPI CreateIpNetEntry ( PMIB_IPNETROW  pArpEntry)

Definition at line 518 of file iphlpapi_main.c.

519{
520 TRACE("pArpEntry %p\n", pArpEntry);
521 /* could use SIOCSARP on systems that support it, not sure I want to */
522 FIXME(":stub\n");
523 return (DWORD) 0;
524}

◆ CreateNameServerListEnumNamesFunc()

static void CreateNameServerListEnumNamesFunc ( PWCHAR  Interface,
PWCHAR  Server,
PVOID  Data 
)
static

Definition at line 2366 of file iphlpapi_main.c.

2367{
2368 IP_ADDR_STRING *pNext;
2370
2371 if (!Context->NumServers)
2372 {
2373 if (Context->uSizeAvailable >= Context->uSizeRequired)
2374 {
2375 WideCharToMultiByte(CP_ACP, 0, Server, -1, Context->pData->DnsServerList.IpAddress.String, 16, NULL, NULL);
2376 Context->pData->DnsServerList.IpAddress.String[15] = '\0';
2377 Context->pLastAddr = &Context->pData->DnsServerList;
2378 }
2379 }
2380 else
2381 {
2382 Context->uSizeRequired += sizeof(IP_ADDR_STRING);
2383 if (Context->uSizeAvailable >= Context->uSizeRequired)
2384 {
2385 pNext = (IP_ADDR_STRING*)(((char*)Context->pLastAddr) + sizeof(IP_ADDR_STRING));
2386 WideCharToMultiByte(CP_ACP, 0, Server, -1, pNext->IpAddress.String, 16, NULL, NULL);
2387 pNext->IpAddress.String[15] = '\0';
2388 Context->pLastAddr->Next = pNext;
2389 Context->pLastAddr = pNext;
2390 pNext->Next = NULL;
2391 }
2392 }
2393 Context->NumServers++;
2394}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
struct _NAME_SERVER_LIST_CONTEXT * PNAME_SERVER_LIST_CONTEXT
struct _IP_ADDR_STRING IP_ADDR_STRING
static void Server(int port)
Definition: srltest.c:69
char String[4 *4]
Definition: iptypes.h:42
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47

Referenced by GetPerAdapterInfo().

◆ CreateProxyArpEntry()

DWORD WINAPI CreateProxyArpEntry ( DWORD  dwAddress,
DWORD  dwMask,
DWORD  dwIfIndex 
)

Definition at line 538 of file iphlpapi_main.c.

539{
540 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress,
541 dwMask, dwIfIndex);
542 FIXME(":stub\n");
543 /* marking Win2K+ functions not supported */
544 return ERROR_NOT_SUPPORTED;
545}
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100

◆ DeleteIPAddress()

DWORD WINAPI DeleteIPAddress ( ULONG  NTEContext)

Definition at line 557 of file iphlpapi_main.c.

558{
559 TRACE("NTEContext %ld\n", NTEContext);
560 return RtlNtStatusToDosError(deleteIpAddress(NTEContext));
561}
NTSTATUS deleteIpAddress(ULONG NteContext)

Referenced by DSReleaseIpAddressLease(), DSStaticRefreshParams(), INetCfgComponentControl_fnApplyRegistryChanges(), send_request(), and setup_adapter().

◆ DeleteIpForwardEntry()

DWORD WINAPI DeleteIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 573 of file iphlpapi_main.c.

574{
575 return deleteIpForwardEntry( pRoute );
576}
DWORD deleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
Definition: route.c:64

Referenced by del_route(), DSReleaseIpAddressLease(), DSStaticRefreshParams(), INetCfgComponentControl_fnApplyRegistryChanges(), and setup_adapter().

◆ DeleteIpNetEntry()

DWORD WINAPI DeleteIpNetEntry ( PMIB_IPNETROW  pArpEntry)

Definition at line 588 of file iphlpapi_main.c.

589{
590 TRACE("pArpEntry %p\n", pArpEntry);
591 /* could use SIOCDARP on systems that support it, not sure I want to */
592 FIXME(":stub\n");
593 return (DWORD) 0;
594}

Referenced by Deletehost().

◆ DeleteProxyArpEntry()

DWORD WINAPI DeleteProxyArpEntry ( DWORD  dwAddress,
DWORD  dwMask,
DWORD  dwIfIndex 
)

Definition at line 608 of file iphlpapi_main.c.

609{
610 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress,
611 dwMask, dwIfIndex);
612 FIXME(":stub\n");
613 /* marking Win2K+ functions not supported */
614 return ERROR_NOT_SUPPORTED;
615}

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 39 of file iphlpapi_main.c.

40{
41 switch (fdwReason) {
43 DisableThreadLibraryCalls( hinstDLL );
45 break;
46
49 break;
50 }
51 return TRUE;
52}
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
void interfaceMapFree(void)
void interfaceMapInit(void)

◆ EnableRouter()

DWORD WINAPI EnableRouter ( HANDLE pHandle,
OVERLAPPED pOverlapped 
)

Definition at line 627 of file iphlpapi_main.c.

628{
629 TRACE("pHandle %p, pOverlapped %p\n", pHandle, pOverlapped);
630 FIXME(":stub\n");
631 /* could echo "1" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
632 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
633 marking Win2K+ functions not supported */
634 return ERROR_NOT_SUPPORTED;
635}

◆ FlushIpNetTable()

DWORD WINAPI FlushIpNetTable ( DWORD  dwIfIndex)

Definition at line 647 of file iphlpapi_main.c.

648{
649 TRACE("dwIfIndex 0x%08lx\n", dwIfIndex);
650 FIXME(":stub\n");
651 /* this flushes the arp cache of the given index
652 marking Win2K+ functions not supported */
653 return ERROR_NOT_SUPPORTED;
654}

Referenced by Deletehost().

◆ GetAdapterIndex()

DWORD WINAPI GetAdapterIndex ( LPWSTR  AdapterName,
PULONG  IfIndex 
)

Definition at line 667 of file iphlpapi_main.c.

668{
669 TRACE("AdapterName %p, IfIndex %p\n", AdapterName, IfIndex);
670 FIXME(":stub\n");
671 /* marking Win2K+ functions not supported */
672 return ERROR_NOT_SUPPORTED;
673}
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT _In_ NDIS_HANDLE _In_ NDIS_HANDLE _In_ PNDIS_STRING AdapterName
Definition: ndis.h:6016

◆ GetAdapterOrderMap()

PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap ( VOID  )

Definition at line 2982 of file iphlpapi_main.c.

2983{
2984 FIXME(":stub\n");
2985 return 0L;
2986}

◆ GetAdaptersInfo()

DWORD WINAPI GetAdaptersInfo ( PIP_ADAPTER_INFO  pAdapterInfo,
PULONG  pOutBufLen 
)

Definition at line 686 of file iphlpapi_main.c.

687{
688 DWORD ret;
689 BOOL dhcpEnabled;
690 DWORD dhcpServer;
691
692 TRACE("pAdapterInfo %p, pOutBufLen %p\n", pAdapterInfo, pOutBufLen);
693 if (!pOutBufLen)
695 else {
696 DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces();
697
698 if (numNonLoopbackInterfaces > 0) {
699 /* this calculation assumes only one address in the IP_ADDR_STRING lists.
700 that's okay, because:
701 - we don't get multiple addresses per adapter anyway
702 - we don't know about per-adapter gateways
703 - DHCP and WINS servers can have max one entry per list */
704 ULONG size = sizeof(IP_ADAPTER_INFO) * numNonLoopbackInterfaces;
705
706 if (!pAdapterInfo || *pOutBufLen < size) {
707 *pOutBufLen = size;
709 }
710 else {
712
713 if (table) {
714 size = sizeof(IP_ADAPTER_INFO) * table->numIndexes;
715 if (*pOutBufLen < size) {
716 *pOutBufLen = size;
718 }
719 else {
720 DWORD ndx;
721 HKEY hKey;
722 BOOL winsEnabled = FALSE;
723 IP_ADDRESS_STRING primaryWINS, secondaryWINS;
724
725 memset(pAdapterInfo, 0, size);
726 /* @@ Wine registry key: HKCU\Software\Wine\Network */
727 if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Network", &hKey) == ERROR_SUCCESS) {
728 DWORD size = sizeof(primaryWINS.String);
729 unsigned long addr;
730
731 RegQueryValueExA(hKey, "WinsServer", NULL, NULL,
732 (PBYTE)primaryWINS.String, &size);
733 addr = inet_addr(primaryWINS.String);
734 if (addr != INADDR_NONE && addr != INADDR_ANY)
735 winsEnabled = TRUE;
736 size = sizeof(secondaryWINS.String);
737 RegQueryValueExA(hKey, "BackupWinsServer", NULL, NULL,
738 (PBYTE)secondaryWINS.String, &size);
739 addr = inet_addr(secondaryWINS.String);
740 if (addr != INADDR_NONE && addr != INADDR_ANY)
741 winsEnabled = TRUE;
743 }
744 TRACE("num of index is %lu\n", table->numIndexes);
745 for (ndx = 0; ndx < table->numIndexes; ndx++) {
746 PIP_ADAPTER_INFO ptr = &pAdapterInfo[ndx];
747 DWORD addrLen = sizeof(ptr->Address), type;
748 const char *ifname =
749 getInterfaceNameByIndex(table->indexes[ndx]);
750 if (!ifname) {
752 break;
753 }
754
755 /* on Win98 this is left empty, but whatever */
756 strncpy(ptr->AdapterName,ifname,sizeof(ptr->AdapterName));
757 consumeInterfaceName(ifname);
758 ptr->AdapterName[MAX_ADAPTER_NAME_LENGTH] = '\0';
759 getInterfacePhysicalByIndex(table->indexes[ndx], &addrLen,
760 ptr->Address, &type);
761 /* MS defines address length and type as UINT in some places and
762 DWORD in others, **sigh**. Don't want to assume that PUINT and
763 PDWORD are equiv (64-bit?) */
764 ptr->AddressLength = addrLen;
765 ptr->Type = type;
766 ptr->Index = table->indexes[ndx];
768 ptr->IpAddressList.IpAddress.String);
770 ptr->IpAddressList.IpMask.String);
771 ptr->IpAddressList.Context = ptr->Index;
773 ptr->GatewayList.IpAddress.String);
774 getDhcpInfoForAdapter(table->indexes[ndx], &dhcpEnabled,
775 &dhcpServer, &ptr->LeaseObtained,
776 &ptr->LeaseExpires);
777 ptr->DhcpEnabled = (DWORD) dhcpEnabled;
778 toIPAddressString(dhcpServer,
779 ptr->DhcpServer.IpAddress.String);
780 if (winsEnabled) {
781 ptr->HaveWins = TRUE;
782 memcpy(ptr->PrimaryWinsServer.IpAddress.String,
783 primaryWINS.String, sizeof(primaryWINS.String));
784 memcpy(ptr->SecondaryWinsServer.IpAddress.String,
785 secondaryWINS.String, sizeof(secondaryWINS.String));
786 }
787 if (ndx < table->numIndexes - 1)
788 ptr->Next = &pAdapterInfo[ndx + 1];
789 else
790 ptr->Next = NULL;
791 }
792 ret = NO_ERROR;
793 }
794 free(table);
795 }
796 else
798 }
799 }
800 else
802 }
803 TRACE("returning %ld\n", ret);
804 return ret;
805}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define INADDR_NONE
Definition: tcp.c:42
#define RegCloseKey(hKey)
Definition: registry.h:49
#define free
Definition: debug_ros.c:5
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
DWORD getDhcpInfoForAdapter(DWORD AdapterIndex, PBOOL DhcpEnabled, PDWORD DhcpServer, time_t *LeaseObtained, time_t *LeaseExpires)
Definition: dhcp_reactos.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLvoid * addr
Definition: glext.h:9621
DWORD getInterfacePhysicalByIndex(DWORD index, PDWORD len, PBYTE addr, PDWORD type)
DWORD getNumNonLoopbackInterfaces(void)
DWORD getInterfaceMaskByIndex(DWORD index)
InterfaceIndexTable * getNonLoopbackInterfaceIndexTable(void)
const char * getInterfaceNameByIndex(DWORD index)
char * toIPAddressString(unsigned int addr, char string[16])
DWORD getInterfaceIPAddrByIndex(DWORD index)
void consumeInterfaceName(const char *ifname)
DWORD getInterfaceGatewayByIndex(DWORD index)
Definition: iphlpapi_main.c:72
#define MAX_ADAPTER_NAME_LENGTH
Definition: iptypes.h:27
struct _IP_ADAPTER_INFO IP_ADAPTER_INFO
#define inet_addr(cp)
Definition: inet.h:98
#define INADDR_ANY
Definition: inet.h:53
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
#define DWORD
Definition: nt_native.h:44
BYTE * PBYTE
Definition: pedump.c:66
#define memset(x, y, z)
Definition: compat.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define ERROR_NO_DATA
Definition: winerror.h:284
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by CNetConnectionManager::EnumerateINetConnections(), Initialize(), InitializePropertyDialog(), IsReconnectHackNeeded(), LANStatusUiDetailsDlg(), PrintRoutes(), Release(), Renew(), RPC_UuidGetNodeAddress(), ShowInfo(), and TestUM().

◆ GetBestInterface()

DWORD WINAPI GetBestInterface ( IPAddr  dwDestAddr,
PDWORD  pdwBestIfIndex 
)

Definition at line 818 of file iphlpapi_main.c.

819{
820 DWORD ret;
821
822 TRACE("dwDestAddr 0x%08lx, pdwBestIfIndex %p\n", dwDestAddr, pdwBestIfIndex);
823 if (!pdwBestIfIndex)
825 else {
826 MIB_IPFORWARDROW ipRow;
827
828 ret = GetBestRoute(dwDestAddr, 0, &ipRow);
829 if (ret == ERROR_SUCCESS)
830 *pdwBestIfIndex = ipRow.dwForwardIfIndex;
831 }
832 TRACE("returning %ld\n", ret);
833 return ret;
834}
DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDROW pBestRoute)
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75

◆ GetBestInterfaceEx()

DWORD WINAPI GetBestInterfaceEx ( struct sockaddr pDestAddr,
PDWORD  pdwBestIfIndex 
)

Definition at line 3198 of file iphlpapi_main.c.

3199{
3200 FIXME(":stub\n");
3201 return 0L;
3202}

◆ GetBestRoute()

DWORD WINAPI GetBestRoute ( DWORD  dwDestAddr,
DWORD  dwSourceAddr,
PMIB_IPFORWARDROW  pBestRoute 
)

Definition at line 848 of file iphlpapi_main.c.

849{
851 DWORD ret;
852
853 TRACE("dwDestAddr 0x%08lx, dwSourceAddr 0x%08lx, pBestRoute %p\n", dwDestAddr,
854 dwSourceAddr, pBestRoute);
855 if (!pBestRoute)
857
859 if (table) {
860 DWORD ndx, minMaskSize, matchedNdx = 0;
861
862 for (ndx = 0, minMaskSize = 255; ndx < table->dwNumEntries; ndx++) {
863 if ((dwDestAddr & table->table[ndx].dwForwardMask) ==
864 (table->table[ndx].dwForwardDest & table->table[ndx].dwForwardMask)) {
865 DWORD hostMaskSize;
866
867 if (!_BitScanForward(&hostMaskSize, ntohl(table->table[ndx].dwForwardMask)))
868 {
869 hostMaskSize = 32;
870 }
871 if (hostMaskSize < minMaskSize) {
872 minMaskSize = hostMaskSize;
873 matchedNdx = ndx;
874 }
875 }
876 }
877 memcpy(pBestRoute, &table->table[matchedNdx], sizeof(MIB_IPFORWARDROW));
880 }
881 else
883 TRACE("returning %ld\n", ret);
884 return ret;
885}
#define GetProcessHeap()
Definition: compat.h:736
unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:57
DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForwardTable, BOOL bOrder, HANDLE heap, DWORD flags)
#define ntohl(x)
Definition: module.h:205

Referenced by GetBestInterface().

◆ GetExtendedTcpTable()

DWORD WINAPI GetExtendedTcpTable ( PVOID  pTcpTable,
PDWORD  pdwSize,
BOOL  bOrder,
ULONG  ulAf,
TCP_TABLE_CLASS  TableClass,
ULONG  Reserved 
)

Definition at line 926 of file iphlpapi_main.c.

927{
928 DWORD i, count, size;
930
931 if (!pdwSize)
932 {
934 }
935
936 if (ulAf != AF_INET)
937 {
940 }
941
942 switch (TableClass)
943 {
945 {
946 PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic);
947 PMIB_TCPTABLE pTheirTcpTable = pTcpTable;
948
949 if (pOurTcpTable)
950 {
951 size = FIELD_OFFSET(MIB_TCPTABLE, table) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW);
952 if (size > *pdwSize || !pTheirTcpTable)
953 {
954 *pdwSize = size;
956 }
957 else
958 {
959 memcpy(pTheirTcpTable, pOurTcpTable, size);
960
961 if (bOrder)
962 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
963 sizeof(MIB_TCPROW), TcpTableSorter);
964 }
965
966 HeapFree(GetProcessHeap(),0, pOurTcpTable);
967 }
968 }
969 break;
970
972 {
973 PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic);
974 PMIB_TCPTABLE pTheirTcpTable = pTcpTable;
975
976 if (pOurTcpTable)
977 {
978 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
979 {
980 if (pOurTcpTable->table[i].State != MIB_TCP_STATE_LISTEN)
981 {
982 ++count;
983 }
984 }
985
987 if (size > *pdwSize || !pTheirTcpTable)
988 {
989 *pdwSize = size;
991 }
992 else
993 {
994 pTheirTcpTable->dwNumEntries = count;
995
996 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
997 {
998 if (pOurTcpTable->table[i].State != MIB_TCP_STATE_LISTEN)
999 {
1000 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW));
1001 ++count;
1002 }
1003 }
1004 ASSERT(count == pTheirTcpTable->dwNumEntries);
1005
1006 if (bOrder)
1007 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1008 sizeof(MIB_TCPROW), TcpTableSorter);
1009 }
1010
1011 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1012 }
1013 }
1014 break;
1015
1017 {
1018 PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic);
1019 PMIB_TCPTABLE pTheirTcpTable = pTcpTable;
1020
1021 if (pOurTcpTable)
1022 {
1023 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1024 {
1025 if (pOurTcpTable->table[i].State == MIB_TCP_STATE_LISTEN)
1026 {
1027 ++count;
1028 }
1029 }
1030
1032 if (size > *pdwSize || !pTheirTcpTable)
1033 {
1034 *pdwSize = size;
1036 }
1037 else
1038 {
1039 pTheirTcpTable->dwNumEntries = count;
1040
1041 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1042 {
1043 if (pOurTcpTable->table[i].State == MIB_TCP_STATE_LISTEN)
1044 {
1045 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW));
1046 ++count;
1047 }
1048 }
1049 ASSERT(count == pTheirTcpTable->dwNumEntries);
1050
1051 if (bOrder)
1052 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1053 sizeof(MIB_TCPROW), TcpTableSorter);
1054 }
1055
1056 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1057 }
1058 }
1059 break;
1060
1062 {
1064 PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable;
1065
1066 if (pOurTcpTable)
1067 {
1069 if (size > *pdwSize || !pTheirTcpTable)
1070 {
1071 *pdwSize = size;
1073 }
1074 else
1075 {
1076 memcpy(pTheirTcpTable, pOurTcpTable, size);
1077
1078 /* Don't sort on PID, so use basic helper */
1079 if (bOrder)
1080 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1082 }
1083
1084 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1085 }
1086 }
1087 break;
1088
1090 {
1092 PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable;
1093
1094 if (pOurTcpTable)
1095 {
1096 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1097 {
1098 if (pOurTcpTable->table[i].dwState != MIB_TCP_STATE_LISTEN)
1099 {
1100 ++count;
1101 }
1102 }
1103
1105 if (size > *pdwSize || !pTheirTcpTable)
1106 {
1107 *pdwSize = size;
1109 }
1110 else
1111 {
1112 pTheirTcpTable->dwNumEntries = count;
1113
1114 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1115 {
1116 if (pOurTcpTable->table[i].dwState != MIB_TCP_STATE_LISTEN)
1117 {
1118 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW_OWNER_PID));
1119 ++count;
1120 }
1121 }
1122 ASSERT(count == pTheirTcpTable->dwNumEntries);
1123
1124 /* Don't sort on PID, so use basic helper */
1125 if (bOrder)
1126 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1128 }
1129
1130 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1131 }
1132 }
1133 break;
1134
1136 {
1138 PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable;
1139
1140 if (pOurTcpTable)
1141 {
1142 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1143 {
1144 if (pOurTcpTable->table[i].dwState == MIB_TCP_STATE_LISTEN)
1145 {
1146 ++count;
1147 }
1148 }
1149
1151 if (size > *pdwSize || !pTheirTcpTable)
1152 {
1153 *pdwSize = size;
1155 }
1156 else
1157 {
1158 pTheirTcpTable->dwNumEntries = count;
1159
1160 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1161 {
1162 if (pOurTcpTable->table[i].dwState == MIB_TCP_STATE_LISTEN)
1163 {
1164 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW_OWNER_PID));
1165 ++count;
1166 }
1167 }
1168 ASSERT(count == pTheirTcpTable->dwNumEntries);
1169
1170 /* Don't sort on PID, so use basic helper */
1171 if (bOrder)
1172 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1174 }
1175
1176 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1177 }
1178 }
1179 break;
1180
1182 {
1184 PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable;
1185
1186 if (pOurTcpTable)
1187 {
1189 if (size > *pdwSize || !pTheirTcpTable)
1190 {
1191 *pdwSize = size;
1193 }
1194 else
1195 {
1196 memcpy(pTheirTcpTable, pOurTcpTable, size);
1197
1198 /* Don't sort on PID, so use basic helper */
1199 if (bOrder)
1200 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1202 }
1203
1204 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1205 }
1206 }
1207 break;
1208
1210 {
1212 PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable;
1213
1214 if (pOurTcpTable)
1215 {
1216 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1217 {
1218 if (pOurTcpTable->table[i].dwState != MIB_TCP_STATE_LISTEN)
1219 {
1220 ++count;
1221 }
1222 }
1223
1225 if (size > *pdwSize || !pTheirTcpTable)
1226 {
1227 *pdwSize = size;
1229 }
1230 else
1231 {
1232 pTheirTcpTable->dwNumEntries = count;
1233
1234 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1235 {
1236 if (pOurTcpTable->table[i].dwState != MIB_TCP_STATE_LISTEN)
1237 {
1238 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW_OWNER_MODULE));
1239 ++count;
1240 }
1241 }
1242 ASSERT(count == pTheirTcpTable->dwNumEntries);
1243
1244 /* Don't sort on PID, so use basic helper */
1245 if (bOrder)
1246 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1248 }
1249
1250 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1251 }
1252 }
1253 break;
1254
1256 {
1258 PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable;
1259
1260 if (pOurTcpTable)
1261 {
1262 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1263 {
1264 if (pOurTcpTable->table[i].dwState == MIB_TCP_STATE_LISTEN)
1265 {
1266 ++count;
1267 }
1268 }
1269
1271 if (size > *pdwSize || !pTheirTcpTable)
1272 {
1273 *pdwSize = size;
1275 }
1276 else
1277 {
1278 pTheirTcpTable->dwNumEntries = count;
1279
1280 for (i = 0, count = 0; i < pOurTcpTable->dwNumEntries; ++i)
1281 {
1282 if (pOurTcpTable->table[i].dwState == MIB_TCP_STATE_LISTEN)
1283 {
1284 memcpy(&pTheirTcpTable->table[count], &pOurTcpTable->table[i], sizeof(MIB_TCPROW_OWNER_MODULE));
1285 ++count;
1286 }
1287 }
1288 ASSERT(count == pTheirTcpTable->dwNumEntries);
1289
1290 /* Don't sort on PID, so use basic helper */
1291 if (bOrder)
1292 qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
1294 }
1295
1296 HeapFree(GetProcessHeap(), 0, pOurTcpTable);
1297 }
1298 }
1299 break;
1300
1301 default:
1303 break;
1304 }
1305
1306 return ret;
1307}
#define UNIMPLEMENTED
Definition: debug.h:115
#define AF_INET
Definition: tcpip.h:117
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int TcpTableSorter(const void *a, const void *b)
@ TCP_TABLE_OWNER_MODULE_CONNECTIONS
Definition: iprtrmib.h:37
@ TCP_TABLE_BASIC_CONNECTIONS
Definition: iprtrmib.h:31
@ TCP_TABLE_BASIC_LISTENER
Definition: iprtrmib.h:30
@ TCP_TABLE_OWNER_MODULE_ALL
Definition: iprtrmib.h:38
@ TCP_TABLE_OWNER_PID_LISTENER
Definition: iprtrmib.h:33
@ TCP_TABLE_BASIC_ALL
Definition: iprtrmib.h:32
@ TCP_TABLE_OWNER_PID_CONNECTIONS
Definition: iprtrmib.h:34
@ TCP_TABLE_OWNER_MODULE_LISTENER
Definition: iprtrmib.h:36
PVOID getTcpTable(CLASS_TABLE Class)
@ ClassModulePid
Definition: ipstats.h:81
@ ClassBasic
Definition: ipstats.h:80
@ ClassModule
Definition: ipstats.h:82
#define ASSERT(a)
Definition: mode.c:44
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
MIB_TCP_STATE State
Definition: tcpmib.h:56
MIB_TCPROW_OWNER_MODULE table[1]
Definition: tcpmib.h:133
MIB_TCPROW_OWNER_PID table[1]
Definition: tcpmib.h:115
DWORD dwNumEntries
Definition: tcpmib.h:66
MIB_TCPROW table[1]
Definition: tcpmib.h:67
struct _MIB_TCPROW MIB_TCPROW
struct _MIB_TCPROW_OWNER_PID MIB_TCPROW_OWNER_PID
@ MIB_TCP_STATE_LISTEN
Definition: tcpmib.h:29
struct _MIB_TCPROW_OWNER_MODULE MIB_TCPROW_OWNER_MODULE
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by AllocateAndGetTcpExTable2FromStack(), AllocateAndGetTcpExTableFromStack(), GetExtendedTcpTableWithAlloc(), GetTcpTable(), and ShowTcpTable().

◆ GetExtendedUdpTable()

DWORD WINAPI GetExtendedUdpTable ( PVOID  pUdpTable,
PDWORD  pdwSize,
BOOL  bOrder,
ULONG  ulAf,
UDP_TABLE_CLASS  TableClass,
ULONG  Reserved 
)

Definition at line 1342 of file iphlpapi_main.c.

1343{
1344 DWORD size;
1345 DWORD ret = NO_ERROR;
1346
1347 if (!pdwSize)
1348 {
1350 }
1351
1352 if (ulAf != AF_INET)
1353 {
1356 }
1357
1358 switch (TableClass)
1359 {
1360 case UDP_TABLE_BASIC:
1361 {
1362 PMIB_UDPTABLE pOurUdpTable = getUdpTable(ClassBasic);
1363 PMIB_UDPTABLE pTheirUdpTable = pUdpTable;
1364
1365 if (pOurUdpTable)
1366 {
1367 size = FIELD_OFFSET(MIB_UDPTABLE, table) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW);
1368 if (size > *pdwSize || !pTheirUdpTable)
1369 {
1370 *pdwSize = size;
1372 }
1373 else
1374 {
1375 memcpy(pTheirUdpTable, pOurUdpTable, size);
1376
1377 if (bOrder)
1378 qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries,
1379 sizeof(MIB_UDPROW), UdpTableSorter);
1380 }
1381
1382 HeapFree(GetProcessHeap(), 0, pOurUdpTable);
1383 }
1384 }
1385 break;
1386
1388 {
1390 PMIB_UDPTABLE_OWNER_PID pTheirUdpTable = pUdpTable;
1391
1392 if (pOurUdpTable)
1393 {
1395 if (size > *pdwSize || !pTheirUdpTable)
1396 {
1397 *pdwSize = size;
1399 }
1400 else
1401 {
1402 memcpy(pTheirUdpTable, pOurUdpTable, size);
1403
1404 if (bOrder)
1405 qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries,
1407 }
1408
1409 HeapFree(GetProcessHeap(), 0, pOurUdpTable);
1410 }
1411 }
1412 break;
1413
1415 {
1417 PMIB_UDPTABLE_OWNER_MODULE pTheirUdpTable = pUdpTable;
1418
1419 if (pOurUdpTable)
1420 {
1422 if (size > *pdwSize || !pTheirUdpTable)
1423 {
1424 *pdwSize = size;
1426 }
1427 else
1428 {
1429 memcpy(pTheirUdpTable, pOurUdpTable, size);
1430
1431 if (bOrder)
1432 qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries,
1434 }
1435
1436 HeapFree(GetProcessHeap(), 0, pOurUdpTable);
1437 }
1438 }
1439 break;
1440
1441 default:
1443 break;
1444 }
1445
1446 return ret;
1447}
static int UdpTableSorter(const void *a, const void *b)
@ UDP_TABLE_BASIC
Definition: iprtrmib.h:43
@ UDP_TABLE_OWNER_MODULE
Definition: iprtrmib.h:45
PVOID getUdpTable(CLASS_TABLE Class)
MIB_UDPROW_OWNER_MODULE table[1]
Definition: udpmib.h:71
MIB_UDPROW_OWNER_PID table[1]
Definition: udpmib.h:48
DWORD dwNumEntries
Definition: udpmib.h:34
MIB_UDPROW table[1]
Definition: udpmib.h:35
struct _MIB_UDPROW_OWNER_MODULE MIB_UDPROW_OWNER_MODULE
struct _MIB_UDPROW_OWNER_PID MIB_UDPROW_OWNER_PID
struct _MIB_UDPROW MIB_UDPROW

Referenced by AllocateAndGetUdpExTable2FromStack(), AllocateAndGetUdpExTableFromStack(), GetExtendedUdpTableWithAlloc(), GetUdpTable(), and ShowUdpTable().

◆ GetFriendlyIfIndex()

DWORD WINAPI GetFriendlyIfIndex ( DWORD  IfIndex)

Definition at line 1459 of file iphlpapi_main.c.

1460{
1461 /* windows doesn't validate these, either, just makes sure the top byte is
1462 cleared. I assume my ifenum module never gives an index with the top
1463 byte set. */
1464 TRACE("returning %ld\n", IfIndex);
1465 return IfIndex;
1466}

◆ GetIcmpStatistics()

DWORD WINAPI GetIcmpStatistics ( PMIB_ICMP  pStats)

Definition at line 1478 of file iphlpapi_main.c.

1479{
1480 DWORD ret;
1481
1482 TRACE("pStats %p\n", pStats);
1483 ret = getICMPStats(pStats);
1484 TRACE("returning %ld\n", ret);
1485 return ret;
1486}
DWORD getICMPStats(MIB_ICMP *stats)

Referenced by mib2IcmpInit(), and ShowIcmpStatistics().

◆ GetIcmpStatisticsEx()

DWORD WINAPI GetIcmpStatisticsEx ( PMIB_ICMP_EX  pStats,
DWORD  dwFamily 
)

Definition at line 3216 of file iphlpapi_main.c.

3217{
3218 FIXME(":stub\n");
3219
3220 if (!pStats)
3222
3223 if (dwFamily != AF_INET && dwFamily != AF_INET6)
3225
3226 return 0L;
3227}
#define AF_INET6
Definition: winsock.h:369

◆ GetIfEntry()

DWORD WINAPI GetIfEntry ( PMIB_IFROW  pIfRow)

Definition at line 1498 of file iphlpapi_main.c.

1499{
1500 DWORD ret;
1501 const char *name;
1502
1503 TRACE("pIfRow %p\n", pIfRow);
1504 if (!pIfRow)
1506
1508 if (name) {
1509 ret = getInterfaceEntryByIndex(pIfRow->dwIndex, pIfRow);
1510 if (ret == NO_ERROR)
1511 ret = getInterfaceStatsByName(name, pIfRow);
1513 }
1514 else
1516 TRACE("returning %ld\n", ret);
1517 return ret;
1518}
DWORD getInterfaceEntryByIndex(DWORD index, PMIB_IFROW entry)
DWORD getInterfaceStatsByName(const char *name, PMIB_IFROW entry)
DWORD dwIndex
Definition: ifmib.h:38
Definition: name.c:39
#define ERROR_INVALID_DATA
Definition: winerror.h:116

Referenced by CNetConnectionManager::EnumerateINetConnections(), GetIfTable(), CNetConnection::GetProperties(), NetBTAstat(), Release(), Renew(), ShowInfo(), UpdateLanStatus(), and WkstaEnumAdaptersCallback().

◆ GetIfTable()

DWORD WINAPI GetIfTable ( PMIB_IFTABLE  pIfTable,
PULONG  pdwSize,
BOOL  bOrder 
)

Definition at line 1544 of file iphlpapi_main.c.

1545{
1546 DWORD ret;
1547
1548 TRACE("pIfTable %p, pdwSize %p, bOrder %ld\n", pdwSize, pdwSize,
1549 (DWORD)bOrder);
1550 if (!pdwSize)
1552 else {
1553 DWORD numInterfaces = getNumInterfaces();
1554 ULONG size;
1555 TRACE("GetIfTable: numInterfaces = %d\n", (int)numInterfaces);
1556 size = sizeof(MIB_IFTABLE) + (numInterfaces - 1) * sizeof(MIB_IFROW);
1557
1558 if (!pIfTable || *pdwSize < size) {
1559 *pdwSize = size;
1561 }
1562 else {
1564
1565 if (table) {
1566 size = sizeof(MIB_IFTABLE) + (table->numIndexes - 1) *
1567 sizeof(MIB_IFROW);
1568 if (*pdwSize < size) {
1569 *pdwSize = size;
1571 }
1572 else {
1573 DWORD ndx;
1574
1575 pIfTable->dwNumEntries = 0;
1576 for (ndx = 0; ndx < table->numIndexes; ndx++) {
1577 pIfTable->table[ndx].dwIndex = table->indexes[ndx];
1578 GetIfEntry(&pIfTable->table[ndx]);
1579 pIfTable->dwNumEntries++;
1580 }
1581 if (bOrder)
1582 qsort(pIfTable->table, pIfTable->dwNumEntries, sizeof(MIB_IFROW),
1584 ret = NO_ERROR;
1585 }
1586 free(table);
1587 }
1588 else
1590 }
1591 }
1592 TRACE("returning %ld\n", ret);
1593 return ret;
1594}
DWORD getNumInterfaces(void)
InterfaceIndexTable * getInterfaceIndexTable(void)
struct _MIB_IFTABLE MIB_IFTABLE
struct _MIB_IFROW MIB_IFROW
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
static int IfTableSorter(const void *a, const void *b)
MIB_IFROW table[1]
Definition: ifmib.h:66
DWORD dwNumEntries
Definition: ifmib.h:65

Referenced by AdapterDiscoveryThread(), AllocateAndGetIfTableFromStack(), CNetConnectionManager::EnumerateINetConnections(), mib2IfNumberInit(), and ShowEthernetStatistics().

◆ getInterfaceGatewayByIndex()

DWORD getInterfaceGatewayByIndex ( DWORD  index)

Definition at line 72 of file iphlpapi_main.c.

73{
74 DWORD ndx, retVal = 0, numRoutes = getNumRoutes();
76 if (!table) return 0;
77
78 for (ndx = 0; ndx < numRoutes; ndx++)
79 {
80 if ((table->routes[ndx].ifIndex == (index)) && (table->routes[ndx].dest == 0))
81 retVal = table->routes[ndx].gateway;
82 }
84 return retVal;
85}
GLuint index
Definition: glext.h:6031
RouteTable * getRouteTable(void)
DWORD getNumRoutes(void)

Referenced by GetAdaptersInfo().

◆ GetInterfaceInfo()

DWORD WINAPI GetInterfaceInfo ( PIP_INTERFACE_INFO  pIfTable,
PULONG  dwOutBufLen 
)

Definition at line 1607 of file iphlpapi_main.c.

1608{
1609 DWORD ret;
1610
1611 TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable, dwOutBufLen);
1612 if (!dwOutBufLen)
1614 else {
1615 DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces();
1616 ULONG size;
1617 TRACE("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces);
1618 size = sizeof(IP_INTERFACE_INFO) + (numNonLoopbackInterfaces) *
1619 sizeof(IP_ADAPTER_INDEX_MAP);
1620
1621 if (!pIfTable || *dwOutBufLen < size) {
1622 *dwOutBufLen = size;
1624 }
1625 else {
1627
1628 if (table) {
1629 TRACE("table->numIndexes == 0x%x\n", table->numIndexes);
1630 size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes) *
1631 sizeof(IP_ADAPTER_INDEX_MAP);
1632 if (*dwOutBufLen < size) {
1633 *dwOutBufLen = size;
1635 }
1636 else {
1637 DWORD ndx;
1638
1639 pIfTable->NumAdapters = 0;
1640 for (ndx = 0; ndx < table->numIndexes; ndx++) {
1641 const char *walker, *name;
1642 WCHAR *assigner;
1643
1644 pIfTable->Adapter[ndx].Index = table->indexes[ndx];
1645 name = getInterfaceNameByIndex(table->indexes[ndx]);
1646 wcscpy(pIfTable->Adapter[ndx].Name, L"\\DEVICE\\TCPIP_");
1647 for (walker = name, assigner = &pIfTable->Adapter[ndx].Name[14];
1648 walker && *walker &&
1649 assigner - pIfTable->Adapter[ndx].Name < MAX_ADAPTER_NAME - 1 - 14;
1650 walker++, assigner++)
1651 *assigner = *walker;
1652 *assigner = 0;
1654 pIfTable->NumAdapters++;
1655 }
1656 ret = NO_ERROR;
1657 }
1658 free(table);
1659 }
1660 else
1662 }
1663 }
1664 TRACE("returning %ld\n", ret);
1665 return ret;
1666}
#define MAX_ADAPTER_NAME
Definition: ipexport.h:143
struct _IP_ADAPTER_INDEX_MAP IP_ADAPTER_INDEX_MAP
struct _IP_INTERFACE_INFO IP_INTERFACE_INFO
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
WCHAR Name[MAX_ADAPTER_NAME]
Definition: ipexport.h:147
IP_ADAPTER_INDEX_MAP Adapter[1]
Definition: ipexport.h:152
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by OpenAdapterHandle(), and test_GetInterfaceName().

◆ GetInterfaceNameInternal()

DWORD GetInterfaceNameInternal ( _In_ const GUID pInterfaceGUID,
_Out_writes_bytes_to_ *, *pOutBufLen PWCHAR  pInterfaceName,
_Inout_ PULONG  pOutBufLen 
)

Definition at line 3236 of file iphlpapi_main.c.

3239{
3241 DWORD result, type;
3242 WCHAR szKeyName[2*MAX_PATH];
3243 HRESULT hr;
3244 HKEY hKey;
3245
3246 if (pInterfaceGUID == NULL || pOutBufLen == NULL)
3248
3249 result = RtlStringFromGUID(pInterfaceGUID, &GuidString);
3250
3251 if (!NT_SUCCESS(result))
3252 {
3253 // failed to convert guid to string
3255 }
3256
3257 hr = StringCbPrintfW(szKeyName, sizeof(szKeyName), L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", GuidString.Buffer);
3259
3260 if (FAILED(hr))
3261 {
3262 // key name is too long
3263 return ERROR_BUFFER_OVERFLOW;
3264 }
3265
3267
3268 if (result != ERROR_SUCCESS)
3269 {
3270 // failed to find adapter entry
3271 return ERROR_NOT_FOUND;
3272 }
3273
3274 result = RegQueryValueExW(hKey, L"Name", NULL, &type, (PVOID)pInterfaceName, pOutBufLen);
3275
3277
3278 if (result == ERROR_MORE_DATA)
3279 {
3280 *pOutBufLen = MAX_INTERFACE_NAME_LEN * 2;
3282 }
3283
3284 if (result != ERROR_SUCCESS || type != REG_SZ)
3285 {
3286 // failed to read adapter name
3287 return ERROR_NO_DATA;
3288 }
3289 return ERROR_SUCCESS;
3290}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define MAX_PATH
Definition: compat.h:34
GLuint64EXT * result
Definition: glext.h:11304
#define MAX_INTERFACE_NAME_LEN
Definition: ifmib.h:31
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define FAILED(hr)
Definition: intsafe.h:51
#define REG_SZ
Definition: layer.c:22
static PWSTR GuidString
Definition: apphelp.c:93
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define ERROR_NOT_FOUND
Definition: winerror.h:690
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by NhGetInterfaceNameFromDeviceGuid(), and NhGetInterfaceNameFromGuid().

◆ GetIpAddrTable()

DWORD WINAPI GetIpAddrTable ( PMIB_IPADDRTABLE  pIpAddrTable,
PULONG  pdwSize,
BOOL  bOrder 
)

Definition at line 1692 of file iphlpapi_main.c.

1693{
1694 DWORD ret;
1695
1696 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable, pdwSize,
1697 (DWORD)bOrder);
1698 if (!pdwSize)
1700 else {
1701 DWORD numInterfaces = getNumInterfaces();
1702 ULONG size = sizeof(MIB_IPADDRTABLE) + (numInterfaces - 1) *
1703 sizeof(MIB_IPADDRROW);
1704
1705 if (!pIpAddrTable || *pdwSize < size) {
1706 *pdwSize = size;
1708 }
1709 else {
1711
1712 if (table) {
1713 size = sizeof(MIB_IPADDRTABLE) + (table->numIndexes - 1) *
1714 sizeof(MIB_IPADDRROW);
1715 if (*pdwSize < size) {
1716 *pdwSize = size;
1718 }
1719 else {
1720 DWORD ndx, bcast;
1721
1722 pIpAddrTable->dwNumEntries = 0;
1723 for (ndx = 0; ndx < table->numIndexes; ndx++) {
1724 pIpAddrTable->table[ndx].dwIndex = table->indexes[ndx];
1725 pIpAddrTable->table[ndx].dwAddr =
1726 getInterfaceIPAddrByIndex(table->indexes[ndx]);
1727 pIpAddrTable->table[ndx].dwMask =
1728 getInterfaceMaskByIndex(table->indexes[ndx]);
1729 /* the dwBCastAddr member isn't the broadcast address, it indicates
1730 * whether the interface uses the 1's broadcast address (1) or the
1731 * 0's broadcast address (0).
1732 */
1733 bcast = getInterfaceBCastAddrByIndex(table->indexes[ndx]);
1734 pIpAddrTable->table[ndx].dwBCastAddr =
1735 (bcast & pIpAddrTable->table[ndx].dwMask) ? 1 : 0;
1736 /* FIXME: hardcoded reasm size, not sure where to get it */
1737 pIpAddrTable->table[ndx].dwReasmSize = 65535;
1738 pIpAddrTable->table[ndx].unused1 = 0;
1739 pIpAddrTable->table[ndx].wType = 0; /* aka unused2 */
1740 pIpAddrTable->dwNumEntries++;
1741 }
1742 if (bOrder)
1743 qsort(pIpAddrTable->table, pIpAddrTable->dwNumEntries,
1745 ret = NO_ERROR;
1746 }
1747 free(table);
1748 }
1749 else
1751 }
1752 }
1753 TRACE("returning %ld\n", ret);
1754 return ret;
1755}
DWORD getInterfaceBCastAddrByIndex(DWORD index)
static int IpAddrTableSorter(const void *a, const void *b)
struct _MIB_IPADDRROW MIB_IPADDRROW
struct _MIB_IPADDRTABLE MIB_IPADDRTABLE
unsigned short unused1
Definition: ipmib.h:41
DWORD dwReasmSize
Definition: ipmib.h:40
DWORD dwBCastAddr
Definition: ipmib.h:39
DWORD dwMask
Definition: ipmib.h:38
DWORD dwAddr
Definition: ipmib.h:36
IF_INDEX dwIndex
Definition: ipmib.h:37
unsigned short wType
Definition: ipmib.h:42
MIB_IPADDRROW table[1]
Definition: ipmib.h:48
DWORD dwNumEntries
Definition: ipmib.h:47

Referenced by AllocateAndGetIpAddrTableFromStack(), DisplayArpEntries(), mib2IpAddrInit(), NetBTEnum(), and Test_WSAIoctl_InitTest().

◆ GetIpErrorString()

DWORD WINAPI GetIpErrorString ( IP_STATUS  ErrorCode,
PWCHAR  Buffer,
PDWORD  Size 
)

Definition at line 2972 of file iphlpapi_main.c.

2973{
2974 FIXME(":stub\n");
2975 return 0L;
2976}

◆ GetIpForwardTable()

DWORD WINAPI GetIpForwardTable ( PMIB_IPFORWARDTABLE  pIpForwardTable,
PULONG  pdwSize,
BOOL  bOrder 
)

Definition at line 1792 of file iphlpapi_main.c.

1793{
1794 DWORD ret;
1795
1796 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable,
1797 pdwSize, (DWORD)bOrder);
1798 if (!pdwSize)
1800 else {
1801 DWORD numRoutes = getNumRoutes();
1802 ULONG sizeNeeded = sizeof(MIB_IPFORWARDTABLE) + (numRoutes - 1) *
1803 sizeof(MIB_IPFORWARDROW);
1804
1805 if (!pIpForwardTable || *pdwSize < sizeNeeded) {
1806 *pdwSize = sizeNeeded;
1808 }
1809 else {
1811 if (table) {
1812 sizeNeeded = sizeof(MIB_IPFORWARDTABLE) + (table->numRoutes - 1) *
1813 sizeof(MIB_IPFORWARDROW);
1814 if (*pdwSize < sizeNeeded) {
1815 *pdwSize = sizeNeeded;
1817 }
1818 else {
1819 DWORD ndx;
1820
1821 pIpForwardTable->dwNumEntries = table->numRoutes;
1822 for (ndx = 0; ndx < numRoutes; ndx++) {
1823 pIpForwardTable->table[ndx].dwForwardIfIndex =
1824 table->routes[ndx].ifIndex;
1825 pIpForwardTable->table[ndx].dwForwardDest =
1826 table->routes[ndx].dest;
1827 pIpForwardTable->table[ndx].dwForwardMask =
1828 table->routes[ndx].mask;
1829 pIpForwardTable->table[ndx].dwForwardPolicy = 0;
1830 pIpForwardTable->table[ndx].dwForwardNextHop =
1831 table->routes[ndx].gateway;
1832 /* FIXME: this type is appropriate for local interfaces; may not
1833 always be appropriate */
1834 pIpForwardTable->table[ndx].dwForwardType = MIB_IPROUTE_TYPE_DIRECT;
1835 /* FIXME: other protos might be appropriate, e.g. the default route
1836 is typically set with MIB_IPPROTO_NETMGMT instead */
1837 pIpForwardTable->table[ndx].dwForwardProto = MIB_IPPROTO_LOCAL;
1838 /* punt on age and AS */
1839 pIpForwardTable->table[ndx].dwForwardAge = 0;
1840 pIpForwardTable->table[ndx].dwForwardNextHopAS = 0;
1841 pIpForwardTable->table[ndx].dwForwardMetric1 =
1842 table->routes[ndx].metric;
1843 /* rest of the metrics are 0.. */
1844 pIpForwardTable->table[ndx].dwForwardMetric2 = 0;
1845 pIpForwardTable->table[ndx].dwForwardMetric3 = 0;
1846 pIpForwardTable->table[ndx].dwForwardMetric4 = 0;
1847 pIpForwardTable->table[ndx].dwForwardMetric5 = 0;
1848 }
1849 if (bOrder)
1850 qsort(pIpForwardTable->table, pIpForwardTable->dwNumEntries,
1852 ret = NO_ERROR;
1853 }
1855 }
1856 else
1858 }
1859 }
1860 TRACE("returning %ld\n", ret);
1861 return ret;
1862}
static int IpForwardTableSorter(const void *a, const void *b)
@ MIB_IPROUTE_TYPE_DIRECT
Definition: ipmib.h:63
struct _MIB_IPFORWARDTABLE MIB_IPFORWARDTABLE
struct _MIB_IPFORWARDROW MIB_IPFORWARDROW
DWORD dwForwardMetric5
Definition: ipmib.h:92
DWORD dwForwardNextHop
Definition: ipmib.h:74
DWORD dwForwardMetric2
Definition: ipmib.h:89
DWORD dwForwardPolicy
Definition: ipmib.h:73
DWORD dwForwardMetric3
Definition: ipmib.h:90
DWORD dwForwardProto
Definition: ipmib.h:83
DWORD dwForwardMetric1
Definition: ipmib.h:88
DWORD dwForwardNextHopAS
Definition: ipmib.h:87
DWORD dwForwardDest
Definition: ipmib.h:71
DWORD dwForwardMask
Definition: ipmib.h:72
DWORD dwForwardMetric4
Definition: ipmib.h:91
DWORD dwForwardAge
Definition: ipmib.h:86
DWORD dwForwardType
Definition: ipmib.h:78
DWORD dwNumEntries
Definition: ipmib.h:97
MIB_IPFORWARDROW table[1]
Definition: ipmib.h:98

Referenced by AllocateAndGetIpForwardTableFromStack(), fill_ip4routetable(), INetCfgComponentControl_fnApplyRegistryChanges(), mib2IpRouteInit(), and PrintRoutes().

◆ GetIpNetTable()

DWORD WINAPI GetIpNetTable ( PMIB_IPNETTABLE  pIpNetTable,
PULONG  pdwSize,
BOOL  bOrder 
)

Definition at line 1888 of file iphlpapi_main.c.

1889{
1890 DWORD ret = NO_ERROR;
1891
1892 TRACE("pIpNetTable %p, pdwSize %p, bOrder %d\n", pIpNetTable, pdwSize,
1893 (DWORD)bOrder);
1894 if (!pdwSize)
1896 else {
1897 DWORD numEntries = getNumArpEntries();
1898 ULONG size = sizeof(MIB_IPNETTABLE);
1899
1900 if (numEntries > 1)
1901 size += (numEntries - 1) * sizeof(MIB_IPNETROW);
1902 if (!pIpNetTable || *pdwSize < size) {
1903 *pdwSize = size;
1905 }
1906 else {
1908 if (table) {
1909 size = sizeof(MIB_IPNETTABLE);
1910 if (table->dwNumEntries > 1)
1911 size += (table->dwNumEntries - 1) * sizeof(MIB_IPNETROW);
1912 if (*pdwSize < size) {
1913 *pdwSize = size;
1915 }
1916 else {
1917 *pdwSize = size;
1918 memcpy(pIpNetTable, table, size);
1919 if (bOrder)
1920 qsort(pIpNetTable->table, pIpNetTable->dwNumEntries,
1922 ret = NO_ERROR;
1923 }
1925 }
1926 }
1927 }
1928 TRACE("returning %d\n", ret);
1929 return ret;
1930}
static int IpNetTableSorter(const void *a, const void *b)
struct _MIB_IPNETTABLE MIB_IPNETTABLE
DWORD getNumArpEntries(void)
PMIB_IPNETTABLE getArpTable(void)
DWORD dwNumEntries
Definition: ipmib.h:127
MIB_IPNETROW table[1]
Definition: ipmib.h:128

Referenced by Addhost(), AllocateAndGetIpNetTableFromStack(), Deletehost(), DisplayArpEntries(), and mib2IpNetInit().

◆ GetIpStatistics()

DWORD WINAPI GetIpStatistics ( PMIB_IPSTATS  pStats)

Definition at line 1942 of file iphlpapi_main.c.

1943{
1944 return GetIpStatisticsEx(pStats, PF_INET);
1945}
DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS pStats, DWORD dwFamily)
#define PF_INET
Definition: winsock.h:373

Referenced by mib2IpStatsInit(), and ShowIpStatistics().

◆ GetIpStatisticsEx()

DWORD WINAPI GetIpStatisticsEx ( PMIB_IPSTATS  pStats,
DWORD  dwFamily 
)

Definition at line 1957 of file iphlpapi_main.c.

1958{
1959 DWORD ret;
1960
1961 TRACE("pStats %p\n", pStats);
1962 ret = getIPStats(pStats, dwFamily);
1963 TRACE("returning %ld\n", ret);
1964 return ret;
1965}
DWORD getIPStats(PMIB_IPSTATS stats, DWORD family)

Referenced by GetIpStatistics().

◆ GetNetworkParams()

DWORD WINAPI GetNetworkParams ( PFIXED_INFO  pFixedInfo,
PULONG  pOutBufLen 
)

Definition at line 1977 of file iphlpapi_main.c.

1978{
1979 DWORD ret, size, type;
1980 LONG regReturn;
1981 HKEY hKey;
1982 PIPHLP_RES_INFO resInfo;
1983
1984 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo, pOutBufLen);
1985 if (!pOutBufLen)
1987
1988 resInfo = getResInfo();
1989 if (!resInfo)
1990 return ERROR_OUTOFMEMORY;
1991
1992 size = sizeof(FIXED_INFO) + (resInfo->riCount > 1 ? (resInfo->riCount-1) *
1993 sizeof(IP_ADDR_STRING) : 0);
1994 if (!pFixedInfo || *pOutBufLen < size) {
1995 *pOutBufLen = size;
1996 disposeResInfo( resInfo );
1997 return ERROR_BUFFER_OVERFLOW;
1998 }
1999
2000 memset(pFixedInfo, 0, size);
2001 /* Check for DhcpHostname and DhcpDomain first */
2003 "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
2004 0,
2005 KEY_READ,
2006 &hKey);
2007 if (regReturn == ERROR_SUCCESS) {
2008 /* Windows doesn't honor DHCP option 12 even if RFC requires it if it is returned by DHCP server! */
2009#if 0
2010 type = REG_SZ;
2011 size = sizeof(pFixedInfo->HostName);
2012 regReturn = RegQueryValueExA(hKey,
2013 "DhcpHostname",
2014 NULL,
2015 &type,
2016 (LPBYTE)pFixedInfo->HostName,
2017 &size);
2018 if (regReturn == ERROR_FILE_NOT_FOUND || (regReturn == ERROR_SUCCESS && size < 1))
2019 {
2020#endif
2021 type = REG_SZ;
2022 size = sizeof(pFixedInfo->HostName);
2023 regReturn = RegQueryValueExA(hKey,
2024 "Hostname",
2025 NULL,
2026 &type,
2027 (LPBYTE)pFixedInfo->HostName,
2028 &size);
2029#if 0
2030 }
2031#endif
2032
2033 type = REG_SZ;
2034 size = sizeof(pFixedInfo->DomainName);
2035 regReturn = RegQueryValueExA(hKey,
2036 "DhcpDomain",
2037 NULL,
2038 &type,
2039 (LPBYTE)pFixedInfo->DomainName,
2040 &size);
2041 if (regReturn == ERROR_FILE_NOT_FOUND || (regReturn == ERROR_SUCCESS && size < 1))
2042 {
2043 type = REG_SZ;
2044 size = sizeof(pFixedInfo->DomainName);
2045 regReturn = RegQueryValueExA(hKey,
2046 "Domain",
2047 NULL,
2048 &type,
2049 (LPBYTE)pFixedInfo->DomainName,
2050 &size);
2051 }
2053 }
2054
2055 TRACE("GetComputerNameExA: %s\n", pFixedInfo->DomainName);
2056
2057 if (resInfo->riCount > 0)
2058 {
2059 CopyMemory(&pFixedInfo->DnsServerList, resInfo->DnsList, sizeof(IP_ADDR_STRING));
2060 if (resInfo->riCount > 1)
2061 {
2062 IP_ADDR_STRING *pSrc = resInfo->DnsList->Next;
2063 IP_ADDR_STRING *pTarget = (struct _IP_ADDR_STRING*)((char*)pFixedInfo + sizeof(FIXED_INFO));
2064
2065 pFixedInfo->DnsServerList.Next = pTarget;
2066
2067 do
2068 {
2069 CopyMemory(pTarget, pSrc, sizeof(IP_ADDR_STRING));
2070 resInfo->riCount--;
2071 if (resInfo->riCount > 1)
2072 {
2073 pTarget->Next = (IP_ADDR_STRING*)((char*)pTarget + sizeof(IP_ADDR_STRING));
2074 pTarget = pTarget->Next;
2075 pSrc = pSrc->Next;
2076 }
2077 else
2078 {
2079 pTarget->Next = NULL;
2080 break;
2081 }
2082 }
2083 while(TRUE);
2084 }
2085 else
2086 {
2087 pFixedInfo->DnsServerList.Next = NULL;
2088 }
2089 }
2090
2091 pFixedInfo->NodeType = HYBRID_NODETYPE;
2093 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ, &hKey);
2094 if (regReturn != ERROR_SUCCESS)
2096 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ,
2097 &hKey);
2098 if (regReturn == ERROR_SUCCESS)
2099 {
2100 DWORD size = sizeof(pFixedInfo->ScopeId);
2101
2102 RegQueryValueExA(hKey, "ScopeID", NULL, NULL, (PBYTE)pFixedInfo->ScopeId, &size);
2104 }
2105
2106 disposeResInfo( resInfo );
2107 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
2108 I suppose could also check for a listener on port 53 to set EnableDns */
2109 ret = NO_ERROR;
2110 TRACE("returning %ld\n", ret);
2111
2112 return ret;
2113}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
#define HYBRID_NODETYPE
Definition: iptypes.h:39
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
long LONG
Definition: pedump.c:60
VOID disposeResInfo(PIPHLP_RES_INFO InfoPtr)
Definition: resinfo.c:60
PIPHLP_RES_INFO getResInfo()
Definition: resinfo.c:54
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
char HostName[MAX_HOSTNAME_LEN+4]
Definition: iptypes.h:81
UINT NodeType
Definition: iptypes.h:85
char ScopeId[MAX_SCOPE_ID_LEN+4]
Definition: iptypes.h:86
char DomainName[MAX_DOMAIN_NAME_LEN+4]
Definition: iptypes.h:82
IP_ADDR_STRING * DnsList
Definition: resinfo.h:26
DWORD riCount
Definition: resinfo.h:25
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CopyMemory
Definition: winbase.h:1710

Referenced by getdomainname(), main(), Query_Main(), ShowInfo(), test_GetNetworkParams(), and TestHostName().

◆ GetNumberOfInterfaces()

DWORD WINAPI GetNumberOfInterfaces ( PDWORD  pdwNumIf)

Definition at line 2125 of file iphlpapi_main.c.

2126{
2127 DWORD ret;
2128
2129 TRACE("pdwNumIf %p\n", pdwNumIf);
2130 if (!pdwNumIf)
2132 else {
2133 *pdwNumIf = getNumInterfaces();
2134 ret = NO_ERROR;
2135 }
2136 TRACE("returning %ld\n", ret);
2137 return ret;
2138}

Referenced by _RpcEnumInterfaces().

◆ GetOwnerModuleFromPidEntry()

static DWORD GetOwnerModuleFromPidEntry ( DWORD  OwningPid,
TCPIP_OWNER_MODULE_INFO_CLASS  Class,
PVOID  Buffer,
PDWORD  pdwSize 
)
static

Definition at line 2141 of file iphlpapi_main.c.

2142{
2144 DWORD FileLen, PathLen, Error;
2147
2148 if (IsBadWritePtr(pdwSize, sizeof(DWORD)) ||
2149 IsBadWritePtr(Buffer, *pdwSize))
2150 {
2152 }
2153
2154 if (OwningPid == 0)
2155 {
2156 return ERROR_NOT_FOUND;
2157 }
2158
2160 if (Process == NULL)
2161 {
2162 return GetLastError();
2163 }
2164
2166 if (FileLen != 0)
2167 {
2169 if (PathLen == 0)
2170 {
2172 return GetLastError();
2173 }
2174
2175 /* Add NULL char */
2176 ++FileLen;
2177 ++PathLen;
2178 PathLen *= sizeof(WCHAR);
2179 FileLen *= sizeof(WCHAR);
2180 }
2181 else
2182 {
2183 Error = GetLastError();
2184
2186 {
2187 wcscpy(File, L"System");
2188 wcscpy(Path, L"System");
2189
2190 PathLen = sizeof(L"System");
2191 FileLen = sizeof(L"System");
2192 }
2193 else
2194 {
2196 return Error;
2197 }
2198 }
2199
2201
2202 if (*pdwSize < sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen)
2203 {
2204 *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen;
2206 }
2207
2208 BasicInfo = Buffer;
2209 BasicInfo->pModuleName = (PVOID)((ULONG_PTR)BasicInfo + sizeof(TCPIP_OWNER_MODULE_BASIC_INFO));
2210 BasicInfo->pModulePath = (PVOID)((ULONG_PTR)BasicInfo->pModuleName + FileLen);
2211 wcscpy(BasicInfo->pModuleName, File);
2212 wcscpy(BasicInfo->pModulePath, Path);
2213 *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen;
2214
2215 return NO_ERROR;
2216}
PRTL_UNICODE_STRING_BUFFER Path
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
Definition: File.h:16
#define CloseHandle
Definition: compat.h:739
#define GetModuleFileNameExW(w, x, y, z)
Definition: compat.h:922
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:883
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule, LPWSTR lpBaseName, DWORD nSize)
Definition: psapi.c:914
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define PROCESS_VM_READ
Definition: pstypes.h:161
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
struct _TCPIP_OWNER_MODULE_BASIC_INFO TCPIP_OWNER_MODULE_BASIC_INFO
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_PARTIAL_COPY
Definition: winerror.h:303

Referenced by GetOwnerModuleFromTcpEntry(), and GetOwnerModuleFromUdpEntry().

◆ GetOwnerModuleFromTagEntry()

static DWORD GetOwnerModuleFromTagEntry ( DWORD  OwningPid,
DWORD  OwningTag,
TCPIP_OWNER_MODULE_INFO_CLASS  Class,
PVOID  Buffer,
PDWORD  pdwSize 
)
static

Definition at line 2218 of file iphlpapi_main.c.

2219{
2220 UINT Size;
2221 HRESULT Res;
2222 HANDLE hAdvapi32;
2223 WCHAR SysDir[MAX_PATH];
2225 ULONG (NTAPI *_I_QueryTagInformation)(PVOID, DWORD, PVOID);
2226 struct
2227 {
2230 DWORD TagType;
2231 PWSTR Buffer;
2232 } ServiceQuery;
2233
2234 if (IsBadWritePtr(pdwSize, sizeof(DWORD)) ||
2235 IsBadWritePtr(Buffer, *pdwSize))
2236 {
2238 }
2239
2240 /* First, secure (avoid injections) load advapi32.dll */
2242 if (Size == 0)
2243 {
2244 return GetLastError();
2245 }
2246
2247 Res = StringCchCatW(&SysDir[Size], MAX_PATH - Size, L"\\advapi32.dll");
2248 if (FAILED(Res))
2249 {
2250 return Res;
2251 }
2252
2253 hAdvapi32 = GetModuleHandleW(SysDir);
2254 if (hAdvapi32 == NULL)
2255 {
2256 return GetLastError();
2257 }
2258
2259 /* Now, we'll query the service associated with the tag */
2260 _I_QueryTagInformation = (PVOID)GetProcAddress(hAdvapi32, "I_QueryTagInformation");
2261 if (_I_QueryTagInformation == NULL)
2262 {
2263 return GetLastError();
2264 }
2265
2266 /* Set tag and PID for the query */
2267 ServiceQuery.ProcessId = OwningPid;
2268 ServiceQuery.ServiceTag = OwningTag;
2269 ServiceQuery.TagType = 0;
2270 ServiceQuery.Buffer = NULL;
2271
2272 /* And query */
2273 Res = _I_QueryTagInformation(NULL, 1, &ServiceQuery);
2274 if (Res != ERROR_SUCCESS)
2275 {
2276 return Res;
2277 }
2278
2279 /* Compute service name length */
2280 Size = wcslen(ServiceQuery.Buffer) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
2281
2282 /* We'll copy it twice, so make sure we have enough room */
2283 if (*pdwSize < sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + 2 * Size)
2284 {
2285 *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + 2 * Size;
2286 LocalFree(ServiceQuery.Buffer);
2288 }
2289
2290 /* Copy back data */
2291 BasicInfo = Buffer;
2292 BasicInfo->pModuleName = (PVOID)((ULONG_PTR)BasicInfo + sizeof(TCPIP_OWNER_MODULE_BASIC_INFO));
2293 BasicInfo->pModulePath = (PVOID)((ULONG_PTR)BasicInfo->pModuleName + Size);
2294 wcscpy(BasicInfo->pModuleName, ServiceQuery.Buffer);
2295 wcscpy(BasicInfo->pModulePath, ServiceQuery.Buffer);
2296 *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + 2 * Size;
2297 LocalFree(ServiceQuery.Buffer);
2298
2299 return NO_ERROR;
2300}
static DWORD ServiceTag
Definition: database.c:34
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2711
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int UINT
Definition: ndis.h:50
#define UNICODE_NULL
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
uint16_t * PWSTR
Definition: typedefs.h:56
#define NTAPI
Definition: typedefs.h:36
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by GetOwnerModuleFromTcpEntry(), and GetOwnerModuleFromUdpEntry().

◆ GetOwnerModuleFromTcpEntry()

DWORD WINAPI GetOwnerModuleFromTcpEntry ( PMIB_TCPROW_OWNER_MODULE  pTcpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS  Class,
PVOID  Buffer,
PDWORD  pdwSize 
)

Definition at line 2321 of file iphlpapi_main.c.

2322{
2323 /* If we have a service tag, that's a service connection */
2324 if (pTcpEntry->OwningModuleInfo[0] != 0)
2325 {
2326 return GetOwnerModuleFromTagEntry(pTcpEntry->dwOwningPid, (DWORD)(pTcpEntry->OwningModuleInfo[0]), Class, Buffer, pdwSize);
2327 }
2328 else
2329 {
2330 return GetOwnerModuleFromPidEntry(pTcpEntry->dwOwningPid, Class, Buffer, pdwSize);
2331 }
2332}
static DWORD GetOwnerModuleFromPidEntry(DWORD OwningPid, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
static DWORD GetOwnerModuleFromTagEntry(DWORD OwningPid, DWORD OwningTag, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE]
Definition: tcpmib.h:127

Referenced by START_TEST(), and test_tcp().

◆ GetOwnerModuleFromUdpEntry()

DWORD WINAPI GetOwnerModuleFromUdpEntry ( PMIB_UDPROW_OWNER_MODULE  pUdpEntry,
TCPIP_OWNER_MODULE_INFO_CLASS  Class,
PVOID  Buffer,
PDWORD  pdwSize 
)

Definition at line 2353 of file iphlpapi_main.c.

2354{
2355 /* If we have a service tag, that's a service connection */
2356 if (pUdpEntry->OwningModuleInfo[0] != 0)
2357 {
2358 return GetOwnerModuleFromTagEntry(pUdpEntry->dwOwningPid, (DWORD)(pUdpEntry->OwningModuleInfo[0]), Class, Buffer, pdwSize);
2359 }
2360 else
2361 {
2362 return GetOwnerModuleFromPidEntry(pUdpEntry->dwOwningPid, Class, Buffer, pdwSize);
2363 }
2364}
ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE]
Definition: udpmib.h:65

Referenced by START_TEST(), and test_udp().

◆ GetPerAdapterInfo()

DWORD WINAPI GetPerAdapterInfo ( ULONG  IfIndex,
PIP_PER_ADAPTER_INFO  pPerAdapterInfo,
PULONG  pOutBufLen 
)

Definition at line 2407 of file iphlpapi_main.c.

2408{
2409 HKEY hkey;
2410 DWORD dwSize = 0;
2411 const char *ifName;
2413 WCHAR keyname[200] = L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
2414
2415 if (!pOutBufLen)
2417
2418 if (!pPerAdapterInfo || *pOutBufLen < sizeof(IP_PER_ADAPTER_INFO))
2419 {
2420 *pOutBufLen = sizeof(IP_PER_ADAPTER_INFO);
2421 return ERROR_BUFFER_OVERFLOW;
2422 }
2423
2424 ifName = getInterfaceNameByIndex(IfIndex);
2425 if (!ifName)
2427
2428 MultiByteToWideChar(CP_ACP, 0, ifName, -1, &keyname[62], sizeof(keyname)/sizeof(WCHAR) - 63);
2429 HeapFree(GetProcessHeap(), 0, (LPVOID)ifName);
2430
2431 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyname, 0, KEY_READ, &hkey) != ERROR_SUCCESS)
2432 {
2433 return ERROR_NOT_SUPPORTED;
2434 }
2435 Context.NumServers = 0;
2436 Context.uSizeAvailable = *pOutBufLen;
2437 Context.uSizeRequired = sizeof(IP_PER_ADAPTER_INFO);
2438 Context.pData = pPerAdapterInfo;
2439
2440 if (*pOutBufLen >= sizeof(IP_PER_ADAPTER_INFO))
2441 ZeroMemory(pPerAdapterInfo, sizeof(IP_PER_ADAPTER_INFO));
2442
2444
2445 if (Context.uSizeRequired > Context.uSizeAvailable)
2446 {
2447 *pOutBufLen = Context.uSizeRequired;
2448 RegCloseKey(hkey);
2449 return ERROR_BUFFER_OVERFLOW;
2450 }
2451
2452 if(RegQueryValueExW(hkey, L"NameServer", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2453 {
2454 pPerAdapterInfo->AutoconfigActive = FALSE;
2455 }
2456 else
2457 {
2458 pPerAdapterInfo->AutoconfigActive = TRUE;
2459 }
2460
2461 RegCloseKey(hkey);
2462 return NOERROR;
2463}
#define MultiByteToWideChar
Definition: compat.h:110
static void CreateNameServerListEnumNamesFunc(PWCHAR Interface, PWCHAR Server, PVOID Data)
LSTATUS EnumNameServers(HKEY RegHandle, LPWSTR Interface, PVOID Data, EnumNameServersFunc cb)
struct _IP_PER_ADAPTER_INFO IP_PER_ADAPTER_INFO
#define ZeroMemory
Definition: winbase.h:1712
#define NOERROR
Definition: winerror.h:2354

Referenced by Initialize(), LANStatusUiDetailsDlg(), and ShowInfo().

◆ GetRTTAndHopCount()

BOOL WINAPI GetRTTAndHopCount ( IPAddr  DestIpAddress,
PULONG  HopCount,
ULONG  MaxHops,
PULONG  RTT 
)

Definition at line 2478 of file iphlpapi_main.c.

2479{
2480 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
2481 DestIpAddress, HopCount, MaxHops, RTT);
2482 FIXME(":stub\n");
2483 return (BOOL) 0;
2484}

◆ GetTcpStatistics()

DWORD WINAPI GetTcpStatistics ( PMIB_TCPSTATS  pStats)

Definition at line 2516 of file iphlpapi_main.c.

2517{
2518 return GetTcpStatisticsEx(pStats, PF_INET);
2519}
DWORD WINAPI GetTcpStatisticsEx(PMIB_TCPSTATS pStats, DWORD dwFamily)

Referenced by mib2TcpInit(), and ShowTcpStatistics().

◆ GetTcpStatisticsEx()

DWORD WINAPI GetTcpStatisticsEx ( PMIB_TCPSTATS  pStats,
DWORD  dwFamily 
)

Definition at line 2497 of file iphlpapi_main.c.

2498{
2499 DWORD ret;
2500
2501 TRACE("pStats %p\n", pStats);
2502 ret = getTCPStats(pStats, dwFamily);
2503 TRACE("returning %ld\n", ret);
2504 return ret;
2505}
DWORD getTCPStats(MIB_TCPSTATS *stats, DWORD family)

Referenced by GetTcpStatistics().

◆ GetTcpTable()

DWORD WINAPI GetTcpTable ( PMIB_TCPTABLE  pTcpTable,
PDWORD  pdwSize,
BOOL  bOrder 
)

Definition at line 2544 of file iphlpapi_main.c.

2545{
2546 return GetExtendedTcpTable(pTcpTable, pdwSize, bOrder, AF_INET, TCP_TABLE_BASIC_ALL, 0);
2547}

Referenced by AllocateAndGetTcpTableFromStack().

◆ GetUdpStatistics()

DWORD WINAPI GetUdpStatistics ( PMIB_UDPSTATS  pStats)

Definition at line 2579 of file iphlpapi_main.c.

2580{
2581 return GetUdpStatisticsEx(pStats, PF_INET);
2582}
DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS pStats, DWORD dwFamily)

Referenced by mib2UdpInit(), and ShowUdpStatistics().

◆ GetUdpStatisticsEx()

DWORD WINAPI GetUdpStatisticsEx ( PMIB_UDPSTATS  pStats,
DWORD  dwFamily 
)

Definition at line 2560 of file iphlpapi_main.c.

2561{
2562 DWORD ret;
2563
2564 TRACE("pStats %p\n", pStats);
2565 ret = getUDPStats(pStats, dwFamily);
2566 TRACE("returning %ld\n", ret);
2567 return ret;
2568}
DWORD getUDPStats(MIB_UDPSTATS *stats, DWORD family)

Referenced by GetUdpStatistics().

◆ GetUdpTable()

DWORD WINAPI GetUdpTable ( PMIB_UDPTABLE  pUdpTable,
PDWORD  pdwSize,
BOOL  bOrder 
)

Definition at line 2596 of file iphlpapi_main.c.

2597{
2598 return GetExtendedUdpTable(pUdpTable, pdwSize, bOrder, AF_INET, UDP_TABLE_BASIC, 0);
2599}

Referenced by AllocateAndGetUdpTableFromStack(), and mib2UdpEntryInit().

◆ GetUniDirectionalAdapterInfo()

DWORD WINAPI GetUniDirectionalAdapterInfo ( PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS  pIPIfInfo,
PULONG  dwOutBufLen 
)

Definition at line 2620 of file iphlpapi_main.c.

2621{
2622 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo, dwOutBufLen);
2623 /* a unidirectional adapter?? not bloody likely! */
2624 return ERROR_NOT_SUPPORTED;
2625}

◆ IfTableSorter()

static int IfTableSorter ( const void a,
const void b 
)
static

Definition at line 1521 of file iphlpapi_main.c.

1522{
1523 int ret;
1524
1525 if (a && b)
1526 ret = ((PMIB_IFROW)a)->dwIndex - ((PMIB_IFROW)b)->dwIndex;
1527 else
1528 ret = 0;
1529 return ret;
1530}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
struct _MIB_IFROW * PMIB_IFROW

Referenced by GetIfTable().

◆ IpAddrTableSorter()

static int IpAddrTableSorter ( const void a,
const void b 
)
static

Definition at line 1669 of file iphlpapi_main.c.

1670{
1671 int ret;
1672
1673 if (a && b)
1674 ret = ((PMIB_IPADDRROW)a)->dwAddr - ((PMIB_IPADDRROW)b)->dwAddr;
1675 else
1676 ret = 0;
1677 return ret;
1678}
struct _MIB_IPADDRROW * PMIB_IPADDRROW

Referenced by GetIpAddrTable().

◆ IpForwardTableSorter()

static int IpForwardTableSorter ( const void a,
const void b 
)
static

Definition at line 1758 of file iphlpapi_main.c.

1759{
1760 int ret;
1761
1762 if (a && b) {
1764
1765 ret = rowA->dwForwardDest - rowB->dwForwardDest;
1766 if (ret == 0) {
1767 ret = rowA->dwForwardProto - rowB->dwForwardProto;
1768 if (ret == 0) {
1769 ret = rowA->dwForwardPolicy - rowB->dwForwardPolicy;
1770 if (ret == 0)
1771 ret = rowA->dwForwardNextHop - rowB->dwForwardNextHop;
1772 }
1773 }
1774 }
1775 else
1776 ret = 0;
1777 return ret;
1778}
struct _MIB_IPFORWARDROW * PMIB_IPFORWARDROW
#define b
Definition: ke_i.h:79

Referenced by GetIpForwardTable().

◆ IpNetTableSorter()

static int IpNetTableSorter ( const void a,
const void b 
)
static

Definition at line 1865 of file iphlpapi_main.c.

1866{
1867 int ret;
1868
1869 if (a && b)
1870 ret = ((PMIB_IPNETROW)a)->dwAddr - ((PMIB_IPNETROW)b)->dwAddr;
1871 else
1872 ret = 0;
1873 return ret;
1874}
struct _MIB_IPNETROW * PMIB_IPNETROW

Referenced by GetIpNetTable().

◆ IpReleaseAddress()

DWORD WINAPI IpReleaseAddress ( PIP_ADAPTER_INDEX_MAP  AdapterInfo)

Definition at line 2640 of file iphlpapi_main.c.

2641{
2642 DWORD Status, Version = 0;
2643
2644 if (!AdapterInfo)
2646
2647 /* Maybe we should do this in DllMain */
2649 return ERROR_PROC_NOT_FOUND;
2650
2651 if (DhcpReleaseIpAddressLease(AdapterInfo->Index))
2653 else
2655
2657
2658 return Status;
2659}
void WINAPI DhcpCApiCleanup(void)
Definition: dhcpcsvc.c:71
DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version)
Definition: dhcpcsvc.c:26
DWORD APIENTRY DhcpReleaseIpAddressLease(DWORD AdapterIndex)
Definition: dhcpcsvc.c:139
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
#define ERROR_PROC_NOT_FOUND
Definition: winerror.h:199

Referenced by Release(), and WlanDisconnect().

◆ IpRenewAddress()

DWORD WINAPI IpRenewAddress ( PIP_ADAPTER_INDEX_MAP  AdapterInfo)

Definition at line 2674 of file iphlpapi_main.c.

2675{
2676 DWORD Status, Version = 0;
2677
2678 if (!AdapterInfo)
2680
2681 /* Maybe we should do this in DllMain */
2683 return ERROR_PROC_NOT_FOUND;
2684
2685 if (DhcpRenewIpAddressLease(AdapterInfo->Index))
2687 else
2689
2691
2692 return Status;
2693}
DWORD APIENTRY DhcpRenewIpAddressLease(DWORD AdapterIndex)
Definition: dhcpcsvc.c:165

Referenced by Renew().

◆ NhGetInterfaceNameFromDeviceGuid()

DWORD WINAPI NhGetInterfaceNameFromDeviceGuid ( _In_ const GUID pInterfaceGUID,
_Out_writes_bytes_to_ *, *pOutBufLen PWCHAR  pInterfaceName,
_Inout_ PULONG  pOutBufLen,
DWORD  dwUnknown4,
DWORD  dwUnknown5 
)

Definition at line 3293 of file iphlpapi_main.c.

3298{
3300
3301 if (pInterfaceName == NULL)
3303
3304 return GetInterfaceNameInternal(pInterfaceGUID, pInterfaceName, pOutBufLen);
3305}
#define SetLastError(x)
Definition: compat.h:752
DWORD GetInterfaceNameInternal(_In_ const GUID *pInterfaceGUID, _Out_writes_bytes_to_(*pOutBufLen, *pOutBufLen) PWCHAR pInterfaceName, _Inout_ PULONG pOutBufLen)

◆ NhGetInterfaceNameFromGuid()

DWORD WINAPI NhGetInterfaceNameFromGuid ( _In_ const GUID pInterfaceGUID,
_Out_writes_bytes_to_ *, *pOutBufLen PWCHAR  pInterfaceName,
_Inout_ PULONG  pOutBufLen,
DWORD  dwUnknown4,
DWORD  dwUnknown5 
)

Definition at line 3308 of file iphlpapi_main.c.

3313{
3314 DWORD result;
3315
3316 result = GetInterfaceNameInternal(pInterfaceGUID, pInterfaceName, pOutBufLen);
3317
3318 if (result == ERROR_NOT_FOUND)
3320
3321 return result;
3322}
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

◆ NhpAllocateAndGetInterfaceInfoFromStack()

DWORD WINAPI NhpAllocateAndGetInterfaceInfoFromStack ( IP_INTERFACE_NAME_INFO **  ppTable,
PDWORD  pdwCount,
BOOL  bOrder,
HANDLE  hHeap,
DWORD  dwFlags 
)

Definition at line 3207 of file iphlpapi_main.c.

3208{
3209 FIXME(":stub\n");
3210 return 0L;
3211}

◆ NotifyAddrChange()

DWORD WINAPI NotifyAddrChange ( PHANDLE  Handle,
LPOVERLAPPED  overlapped 
)

Definition at line 2712 of file iphlpapi_main.c.

2713{
2714 FIXME("(Handle %p, overlapped %p): stub\n", Handle, overlapped);
2717 return ERROR_IO_PENDING;
2718}
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
ULONG Handle
Definition: gdb_input.c:15
#define STATUS_PENDING
Definition: ntstatus.h:82
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
Definition: sock.c:81

Referenced by AdapterDiscoveryThread(), and detectChange().

◆ NotifyRouteChange()

DWORD WINAPI NotifyRouteChange ( PHANDLE  Handle,
LPOVERLAPPED  overlapped 
)

Definition at line 2737 of file iphlpapi_main.c.

2738{
2739 FIXME("(Handle %p, overlapped %p): stub\n", Handle, overlapped);
2740 return ERROR_NOT_SUPPORTED;
2741}

◆ SendARP()

DWORD WINAPI SendARP ( IPAddr  DestIP,
IPAddr  SrcIP,
PULONG  pMacAddr,
PULONG  PhyAddrLen 
)

Definition at line 2758 of file iphlpapi_main.c.

2759{
2760 IPAddr IPs[2];
2761 ULONG Size;
2762
2763 if (IsBadWritePtr(pMacAddr, sizeof(ULONG)) || IsBadWritePtr(PhyAddrLen, sizeof(ULONG)))
2765
2766 IPs[0] = DestIP;
2767 IPs[1] = SrcIP;
2768 Size = sizeof(IPs);
2769 return TCPSendIoctl(INVALID_HANDLE_VALUE, IOCTL_QUERY_IP_HW_ADDRESS, IPs, &Size, pMacAddr, PhyAddrLen);
2770}
DWORD TCPSendIoctl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, PULONG pInBufferSize, LPVOID lpOutBuffer, PULONG pOutBufferSize)
ULONG IPAddr
Definition: pfhook.h:35
#define IOCTL_QUERY_IP_HW_ADDRESS
Definition: tcpioctl.h:40

Referenced by Ping(), state_panic(), and TestUM().

◆ SetIfEntry()

DWORD WINAPI SetIfEntry ( PMIB_IFROW  pIfRow)

Definition at line 2788 of file iphlpapi_main.c.

2789{
2790 FIXME("(pIfRow %p): stub\n", pIfRow);
2791 /* this is supposed to set an interface administratively up or down.
2792 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
2793 this sort of down is indistinguishable from other sorts of down (e.g. no
2794 link). */
2795 return ERROR_NOT_SUPPORTED;
2796}

◆ SetIpForwardEntry()

DWORD WINAPI SetIpForwardEntry ( PMIB_IPFORWARDROW  pRoute)

Definition at line 2811 of file iphlpapi_main.c.

2812{
2813 return setIpForwardEntry( pRoute );
2814}
DWORD setIpForwardEntry(PMIB_IPFORWARDROW pRoute)
Definition: route.c:59

◆ SetIpForwardEntryToStack()

DWORD WINAPI SetIpForwardEntryToStack ( PMIB_IPFORWARDROW  pRoute)

Definition at line 3230 of file iphlpapi_main.c.

3231{
3232 FIXME("SetIpForwardEntryToStack() stub\n");
3233 return 0L;
3234}

◆ SetIpNetEntry()

DWORD WINAPI SetIpNetEntry ( PMIB_IPNETROW  pArpEntry)

Definition at line 2829 of file iphlpapi_main.c.

2830{
2831 HANDLE tcpFile;
2836 DWORD returnSize;
2837 PMIB_IPNETROW arpBuff;
2838
2839 if (!pArpEntry)
2841
2843 return ERROR_NOT_SUPPORTED;
2844
2845 if (!NT_SUCCESS(getNthIpEntity( tcpFile, pArpEntry->dwIndex, &id )))
2846 {
2847 closeTcpFile(tcpFile);
2849 }
2850
2854 req.Req.ID.toi_entity.tei_instance = id.tei_instance;
2856 req.Req.BufferSize = sizeof(MIB_IPNETROW);
2857 arpBuff = (PMIB_IPNETROW)&req.Req.Buffer[0];
2858
2859 RtlCopyMemory(arpBuff, pArpEntry, sizeof(MIB_IPNETROW));
2860
2861 status = DeviceIoControl( tcpFile,
2863 &req,
2864 sizeof(req),
2865 NULL,
2866 0,
2867 &returnSize,
2868 NULL );
2869
2870 closeTcpFile(tcpFile);
2871
2872 if (status)
2873 return NO_ERROR;
2874 else
2876}
LONG NTSTATUS
Definition: precomp.h:26
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
GLuint id
Definition: glext.h:5910
NTSTATUS getNthIpEntity(HANDLE tcpFile, DWORD index, TDIEntityID *ent)
#define TCP_REQUEST_SET_INFORMATION_INIT
struct _MIB_IPNETROW MIB_IPNETROW
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSTATUS openTcpFile(PHANDLE tcpFile, ACCESS_MASK DesiredAccess)
Definition: handle.c:12
VOID closeTcpFile(HANDLE h)
Definition: handle.c:43
DWORD dwIndex
Definition: ipmib.h:114
unsigned char Buffer[1]
Definition: tdiinfo.h:97
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
Definition: ps.c:97
#define IP_MIB_ARPTABLE_ENTRY_ID
Definition: tcpioctl.h:54
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
#define AT_ENTITY
Definition: tdiinfo.h:41
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
#define IOCTL_TCP_SET_INFORMATION_EX
Definition: tditest.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
TCP_REQUEST_SET_INFORMATION_EX Req

Referenced by Addhost().

◆ SetIpStatistics()

DWORD WINAPI SetIpStatistics ( PMIB_IPSTATS  pIpStats)

Definition at line 2894 of file iphlpapi_main.c.

2895{
2896 FIXME("(pIpStats %p): stub\n", pIpStats);
2897 return 0;
2898}

◆ SetIpTTL()

DWORD WINAPI SetIpTTL ( UINT  nTTL)

Definition at line 2916 of file iphlpapi_main.c.

2917{
2918 FIXME("(nTTL %d): stub\n", nTTL);
2919 return 0;
2920}

◆ SetTcpEntry()

DWORD WINAPI SetTcpEntry ( PMIB_TCPROW  pTcpRow)

Definition at line 2938 of file iphlpapi_main.c.

2939{
2940 FIXME("(pTcpRow %p): stub\n", pTcpRow);
2941 return 0;
2942}

◆ TcpTableSorter()

static int TcpTableSorter ( const void a,
const void b 
)
static

Definition at line 887 of file iphlpapi_main.c.

888{
889 int ret;
890
891 if (a && b) {
892 PMIB_TCPROW rowA = (PMIB_TCPROW)a, rowB = (PMIB_TCPROW)b;
893
894 ret = rowA->dwLocalAddr - rowB->dwLocalAddr;
895 if (ret == 0) {
896 ret = rowA->dwLocalPort - rowB->dwLocalPort;
897 if (ret == 0) {
898 ret = rowA->dwRemoteAddr - rowB->dwRemoteAddr;
899 if (ret == 0)
900 ret = rowA->dwRemotePort - rowB->dwRemotePort;
901 }
902 }
903 }
904 else
905 ret = 0;
906 return ret;
907}
DWORD dwLocalPort
Definition: tcpmib.h:59
DWORD dwLocalAddr
Definition: tcpmib.h:58
DWORD dwRemotePort
Definition: tcpmib.h:61
DWORD dwRemoteAddr
Definition: tcpmib.h:60
struct _MIB_TCPROW * PMIB_TCPROW

Referenced by GetExtendedTcpTable().

◆ UdpTableSorter()

static int UdpTableSorter ( const void a,
const void b 
)
static

Definition at line 1309 of file iphlpapi_main.c.

1310{
1311 int ret;
1312
1313 if (a && b) {
1314 PMIB_UDPROW rowA = (PMIB_UDPROW)a, rowB = (PMIB_UDPROW)b;
1315
1316 ret = rowA->dwLocalAddr - rowB->dwLocalAddr;
1317 if (ret == 0)
1318 ret = rowA->dwLocalPort - rowB->dwLocalPort;
1319 }
1320 else
1321 ret = 0;
1322 return ret;
1323}
DWORD dwLocalAddr
Definition: udpmib.h:28
DWORD dwLocalPort
Definition: udpmib.h:29
struct _MIB_UDPROW * PMIB_UDPROW

Referenced by GetExtendedUdpTable().

◆ UnenableRouter()

DWORD WINAPI UnenableRouter ( OVERLAPPED pOverlapped,
LPDWORD  lpdwEnableCount 
)

Definition at line 2962 of file iphlpapi_main.c.

2963{
2964 FIXME("(pOverlapped %p, lpdwEnableCount %p): stub\n", pOverlapped,
2965 lpdwEnableCount);
2966 return ERROR_NOT_SUPPORTED;
2967}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( iphlpapi  )