2 * iphlpapi dll implementation
4 * Copyright (C) 2003 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "iphlpapi_private.h"
26 #include <sys/types.h>
27 #ifdef HAVE_NETINET_IN_H
28 # include <netinet/in.h>
30 #ifdef HAVE_ARPA_INET_H
31 # include <arpa/inet.h>
33 #ifdef HAVE_ARPA_NAMESER_H
34 # include <arpa/nameser.h>
49 #include "wine/debug.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi
);
53 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
56 case DLL_PROCESS_ATTACH
:
57 DisableThreadLibraryCalls( hinstDLL
);
61 case DLL_PROCESS_DETACH
:
68 /******************************************************************
69 * AddIPAddress (IPHLPAPI.@)
78 * NTEInstance [In/Out]
85 DWORD WINAPI
AddIPAddress(IPAddr Address
, IPMask IpMask
, DWORD IfIndex
, PULONG NTEContext
, PULONG NTEInstance
)
88 /* marking Win2K+ functions not supported */
89 return ERROR_NOT_SUPPORTED
;
93 /******************************************************************
94 * AllocateAndGetIfTableFromStack (IPHLPAPI.@)
99 * ppIfTable [Out] -- pointer into which the MIB_IFTABLE is
100 * allocated and returned.
101 * bOrder [In] -- passed to GetIfTable to order the table
102 * heap [In] -- heap from which the table is allocated
103 * flags [In] -- flags to HeapAlloc
105 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
106 * GetIfTable returns otherwise
109 DWORD WINAPI
AllocateAndGetIfTableFromStack(PMIB_IFTABLE
*ppIfTable
,
110 BOOL bOrder
, HANDLE heap
, DWORD flags
)
114 TRACE("ppIfTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n", ppIfTable
,
115 (DWORD
)bOrder
, (DWORD
)heap
, flags
);
117 ret
= ERROR_INVALID_PARAMETER
;
121 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
122 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
123 *ppIfTable
= (PMIB_IFTABLE
)HeapAlloc(heap
, flags
, dwSize
);
124 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
127 TRACE("returning %ld\n", ret
);
132 /******************************************************************
133 * AllocateAndGetIpAddrTableFromStack (IPHLPAPI.@)
138 * ppIpAddrTable [Out]
139 * bOrder [In] -- passed to GetIpAddrTable to order the table
140 * heap [In] -- heap from which the table is allocated
141 * flags [In] -- flags to HeapAlloc
148 DWORD WINAPI
AllocateAndGetIpAddrTableFromStack(PMIB_IPADDRTABLE
*ppIpAddrTable
,
149 BOOL bOrder
, HANDLE heap
, DWORD flags
)
153 TRACE("ppIpAddrTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
154 ppIpAddrTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
156 ret
= ERROR_INVALID_PARAMETER
;
160 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
161 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
162 *ppIpAddrTable
= (PMIB_IPADDRTABLE
)HeapAlloc(heap
, flags
, dwSize
);
163 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
166 TRACE("returning %ld\n", ret
);
171 /******************************************************************
172 * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@)
175 * ppIpForwardTable [Out] -- pointer into which the MIB_IPFORWARDTABLE is
176 * allocated and returned.
177 * bOrder [In] -- passed to GetIfTable to order the table
178 * heap [In] -- heap from which the table is allocated
179 * flags [In] -- flags to HeapAlloc
181 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
182 * GetIpForwardTable returns otherwise
185 DWORD WINAPI
AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE
*
186 ppIpForwardTable
, BOOL bOrder
, HANDLE heap
, DWORD flags
)
190 TRACE("ppIpForwardTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
191 ppIpForwardTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
192 if (!ppIpForwardTable
)
193 ret
= ERROR_INVALID_PARAMETER
;
197 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
198 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
199 *ppIpForwardTable
= (PMIB_IPFORWARDTABLE
)HeapAlloc(heap
, flags
, dwSize
);
200 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
203 TRACE("returning %ld\n", ret
);
208 /******************************************************************
209 * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@)
215 * bOrder [In] -- passed to GetIpNetTable to order the table
216 * heap [In] -- heap from which the table is allocated
217 * flags [In] -- flags to HeapAlloc
224 DWORD WINAPI
AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE
*ppIpNetTable
,
225 BOOL bOrder
, HANDLE heap
, DWORD flags
)
229 TRACE("ppIpNetTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
230 ppIpNetTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
232 ret
= ERROR_INVALID_PARAMETER
;
236 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
237 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
238 *ppIpNetTable
= (PMIB_IPNETTABLE
)HeapAlloc(heap
, flags
, dwSize
);
239 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
242 TRACE("returning %ld\n", ret
);
247 /******************************************************************
248 * AllocateAndGetTcpTableFromStack (IPHLPAPI.@)
254 * bOrder [In] -- passed to GetTcpTable to order the table
255 * heap [In] -- heap from which the table is allocated
256 * flags [In] -- flags to HeapAlloc
263 DWORD WINAPI
AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE
*ppTcpTable
,
264 BOOL bOrder
, HANDLE heap
, DWORD flags
)
268 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
269 ppTcpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
271 ret
= ERROR_INVALID_PARAMETER
;
275 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
276 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
277 *ppTcpTable
= (PMIB_TCPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
278 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
281 TRACE("returning %ld\n", ret
);
286 /******************************************************************
287 * AllocateAndGetUdpTableFromStack (IPHLPAPI.@)
293 * bOrder [In] -- passed to GetUdpTable to order the table
294 * heap [In] -- heap from which the table is allocated
295 * flags [In] -- flags to HeapAlloc
302 DWORD WINAPI
AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE
*ppUdpTable
,
303 BOOL bOrder
, HANDLE heap
, DWORD flags
)
307 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
308 ppUdpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
310 ret
= ERROR_INVALID_PARAMETER
;
314 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
315 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
316 *ppUdpTable
= (PMIB_UDPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
317 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
320 TRACE("returning %ld\n", ret
);
325 /******************************************************************
326 * CreateIpForwardEntry (IPHLPAPI.@)
338 DWORD WINAPI
CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
340 return createIpForwardEntry( pRoute
);
344 /******************************************************************
345 * CreateIpNetEntry (IPHLPAPI.@)
357 DWORD WINAPI
CreateIpNetEntry(PMIB_IPNETROW pArpEntry
)
359 TRACE("pArpEntry %p\n", pArpEntry
);
360 /* could use SIOCSARP on systems that support it, not sure I want to */
366 /******************************************************************
367 * CreateProxyArpEntry (IPHLPAPI.@)
381 DWORD WINAPI
CreateProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
383 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
386 /* marking Win2K+ functions not supported */
387 return ERROR_NOT_SUPPORTED
;
391 /******************************************************************
392 * DeleteIPAddress (IPHLPAPI.@)
404 DWORD WINAPI
DeleteIPAddress(ULONG NTEContext
)
406 TRACE("NTEContext %ld\n", NTEContext
);
408 /* marking Win2K+ functions not supported */
409 return ERROR_NOT_SUPPORTED
;
413 /******************************************************************
414 * DeleteIpForwardEntry (IPHLPAPI.@)
426 DWORD WINAPI
DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
428 return deleteIpForwardEntry( pRoute
);
432 /******************************************************************
433 * DeleteIpNetEntry (IPHLPAPI.@)
445 DWORD WINAPI
DeleteIpNetEntry(PMIB_IPNETROW pArpEntry
)
447 TRACE("pArpEntry %p\n", pArpEntry
);
448 /* could use SIOCDARP on systems that support it, not sure I want to */
454 /******************************************************************
455 * DeleteProxyArpEntry (IPHLPAPI.@)
469 DWORD WINAPI
DeleteProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
471 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
474 /* marking Win2K+ functions not supported */
475 return ERROR_NOT_SUPPORTED
;
478 /******************************************************************
479 * EnableRouter (IPHLPAPI.@)
485 * pOverlapped [In/Out]
492 DWORD WINAPI
EnableRouter(HANDLE
* pHandle
, OVERLAPPED
* pOverlapped
)
494 TRACE("pHandle %p, pOverlapped %p\n", pHandle
, pOverlapped
);
496 /* could echo "1" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
497 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
498 marking Win2K+ functions not supported */
499 return ERROR_NOT_SUPPORTED
;
503 /******************************************************************
504 * FlushIpNetTable (IPHLPAPI.@)
516 DWORD WINAPI
FlushIpNetTable(DWORD dwIfIndex
)
518 TRACE("dwIfIndex 0x%08lx\n", dwIfIndex
);
520 /* this flushes the arp cache of the given index
521 marking Win2K+ functions not supported */
522 return ERROR_NOT_SUPPORTED
;
526 /******************************************************************
527 * GetAdapterIndex (IPHLPAPI.@)
532 * AdapterName [In/Out]
540 DWORD WINAPI
GetAdapterIndex(LPWSTR AdapterName
, PULONG IfIndex
)
542 TRACE("AdapterName %p, IfIndex %p\n", AdapterName
, IfIndex
);
544 /* marking Win2K+ functions not supported */
545 return ERROR_NOT_SUPPORTED
;
549 /******************************************************************
550 * GetAdaptersInfo (IPHLPAPI.@)
555 * pAdapterInfo [In/Out]
556 * pOutBufLen [In/Out]
563 DWORD WINAPI
GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo
, PULONG pOutBufLen
)
567 TRACE("pAdapterInfo %p, pOutBufLen %p\n", pAdapterInfo
, pOutBufLen
);
569 ret
= ERROR_INVALID_PARAMETER
;
571 DWORD numNonLoopbackInterfaces
= getNumNonLoopbackInterfaces();
573 if (numNonLoopbackInterfaces
> 0) {
574 /* this calculation assumes only one address in the IP_ADDR_STRING lists.
575 that's okay, because:
576 - we don't get multiple addresses per adapter anyway
577 - we don't know about per-adapter gateways
578 - DHCP and WINS servers can have max one entry per list */
579 ULONG size
= sizeof(IP_ADAPTER_INFO
) * numNonLoopbackInterfaces
;
581 if (!pAdapterInfo
|| *pOutBufLen
< size
) {
583 ret
= ERROR_BUFFER_OVERFLOW
;
586 InterfaceIndexTable
*table
= getNonLoopbackInterfaceIndexTable();
589 size
= sizeof(IP_ADAPTER_INFO
) * table
->numIndexes
;
590 if (*pOutBufLen
< size
) {
592 ret
= ERROR_INSUFFICIENT_BUFFER
;
597 BOOL winsEnabled
= FALSE
;
598 IP_ADDRESS_STRING primaryWINS
, secondaryWINS
;
600 memset(pAdapterInfo
, 0, size
);
601 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
602 "Software\\Wine\\Wine\\Config\\Network", 0, KEY_READ
,
603 &hKey
) == ERROR_SUCCESS
) {
604 DWORD size
= sizeof(primaryWINS
.String
);
607 RegQueryValueExA(hKey
, "WinsServer", NULL
, NULL
,
608 primaryWINS
.String
, &size
);
609 addr
= inet_addr(primaryWINS
.String
);
610 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
612 size
= sizeof(secondaryWINS
.String
);
613 RegQueryValueExA(hKey
, "BackupWinsServer", NULL
, NULL
,
614 secondaryWINS
.String
, &size
);
615 addr
= inet_addr(secondaryWINS
.String
);
616 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
620 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
621 PIP_ADAPTER_INFO ptr
= &pAdapterInfo
[ndx
];
622 DWORD addrLen
= sizeof(ptr
->Address
), type
;
624 getInterfaceNameByIndex(table
->indexes
[ndx
]);
626 /* on Win98 this is left empty, but whatever */
628 strncpy(ptr
->AdapterName
,ifname
,sizeof(ptr
->AdapterName
));
629 consumeInterfaceName(ifname
);
630 ptr
->AdapterName
[MAX_ADAPTER_NAME_LENGTH
] = '\0';
631 getInterfacePhysicalByIndex(table
->indexes
[ndx
], &addrLen
,
632 ptr
->Address
, &type
);
633 /* MS defines address length and type as UINT in some places and
634 DWORD in others, **sigh**. Don't want to assume that PUINT and
635 PDWORD are equiv (64-bit?) */
636 ptr
->AddressLength
= addrLen
;
638 ptr
->Index
= table
->indexes
[ndx
];
639 toIPAddressString(getInterfaceIPAddrByIndex(table
->indexes
[ndx
]),
640 ptr
->IpAddressList
.IpAddress
.String
);
641 toIPAddressString(getInterfaceMaskByIndex(table
->indexes
[ndx
]),
642 ptr
->IpAddressList
.IpMask
.String
);
644 ptr
->HaveWins
= TRUE
;
645 memcpy(ptr
->PrimaryWinsServer
.IpAddress
.String
,
646 primaryWINS
.String
, sizeof(primaryWINS
.String
));
647 memcpy(ptr
->SecondaryWinsServer
.IpAddress
.String
,
648 secondaryWINS
.String
, sizeof(secondaryWINS
.String
));
650 if (ndx
< table
->numIndexes
- 1)
651 ptr
->Next
= &pAdapterInfo
[ndx
+ 1];
660 ret
= ERROR_OUTOFMEMORY
;
666 TRACE("returning %ld\n", ret
);
671 /******************************************************************
672 * GetBestInterface (IPHLPAPI.@)
678 * pdwBestIfIndex [In/Out]
685 DWORD WINAPI
GetBestInterface(IPAddr dwDestAddr
, PDWORD pdwBestIfIndex
)
689 TRACE("dwDestAddr 0x%08lx, pdwBestIfIndex %p\n", dwDestAddr
, pdwBestIfIndex
);
691 ret
= ERROR_INVALID_PARAMETER
;
693 MIB_IPFORWARDROW ipRow
;
695 ret
= GetBestRoute(dwDestAddr
, 0, &ipRow
);
696 if (ret
== ERROR_SUCCESS
)
697 *pdwBestIfIndex
= ipRow
.dwForwardIfIndex
;
699 TRACE("returning %ld\n", ret
);
704 /******************************************************************
705 * GetBestRoute (IPHLPAPI.@)
719 DWORD WINAPI
GetBestRoute(DWORD dwDestAddr
, DWORD dwSourceAddr
, PMIB_IPFORWARDROW pBestRoute
)
721 PMIB_IPFORWARDTABLE table
;
724 TRACE("dwDestAddr 0x%08lx, dwSourceAddr 0x%08lx, pBestRoute %p\n", dwDestAddr
,
725 dwSourceAddr
, pBestRoute
);
727 return ERROR_INVALID_PARAMETER
;
729 AllocateAndGetIpForwardTableFromStack(&table
, FALSE
, GetProcessHeap(), 0);
731 DWORD ndx
, matchedBits
, matchedNdx
= 0;
733 for (ndx
= 0, matchedBits
= 0; ndx
< table
->dwNumEntries
; ndx
++) {
734 if ((dwDestAddr
& table
->table
[ndx
].dwForwardMask
) ==
735 (table
->table
[ndx
].dwForwardDest
& table
->table
[ndx
].dwForwardMask
)) {
736 DWORD numShifts
, mask
;
738 for (numShifts
= 0, mask
= table
->table
[ndx
].dwForwardMask
;
739 mask
&& !(mask
& 1); mask
>>= 1, numShifts
++)
741 if (numShifts
> matchedBits
) {
742 matchedBits
= numShifts
;
747 memcpy(pBestRoute
, &table
->table
[matchedNdx
], sizeof(MIB_IPFORWARDROW
));
748 HeapFree(GetProcessHeap(), 0, table
);
752 ret
= ERROR_OUTOFMEMORY
;
753 TRACE("returning %ld\n", ret
);
758 /******************************************************************
759 * GetFriendlyIfIndex (IPHLPAPI.@)
771 DWORD WINAPI
GetFriendlyIfIndex(DWORD IfIndex
)
773 /* windows doesn't validate these, either, just makes sure the top byte is
774 cleared. I assume my ifenum module never gives an index with the top
776 TRACE("returning %ld\n", IfIndex
);
781 /******************************************************************
782 * GetIcmpStatistics (IPHLPAPI.@)
794 DWORD WINAPI
GetIcmpStatistics(PMIB_ICMP pStats
)
798 TRACE("pStats %p\n", pStats
);
799 ret
= getICMPStats(pStats
);
800 TRACE("returning %ld\n", ret
);
805 /******************************************************************
806 * GetIfEntry (IPHLPAPI.@)
818 DWORD WINAPI
GetIfEntry(PMIB_IFROW pIfRow
)
823 TRACE("pIfRow %p\n", pIfRow
);
825 return ERROR_INVALID_PARAMETER
;
827 name
= getInterfaceNameByIndex(pIfRow
->dwIndex
);
829 ret
= getInterfaceEntryByIndex(pIfRow
->dwIndex
, pIfRow
);
831 ret
= getInterfaceStatsByName(name
, pIfRow
);
832 consumeInterfaceName(name
);
835 ret
= ERROR_INVALID_DATA
;
836 TRACE("returning %ld\n", ret
);
841 static int IfTableSorter(const void *a
, const void *b
)
846 ret
= ((PMIB_IFROW
)a
)->dwIndex
- ((PMIB_IFROW
)b
)->dwIndex
;
853 /******************************************************************
854 * GetIfTable (IPHLPAPI.@)
868 DWORD WINAPI
GetIfTable(PMIB_IFTABLE pIfTable
, PULONG pdwSize
, BOOL bOrder
)
872 TRACE("pIfTable %p, pdwSize %p, bOrder %ld\n", pdwSize
, pdwSize
,
875 ret
= ERROR_INVALID_PARAMETER
;
877 DWORD numInterfaces
= getNumInterfaces();
878 TRACE("GetIfTable: numInterfaces = %d\n", (int)numInterfaces
);
879 ULONG size
= sizeof(MIB_IFTABLE
) + (numInterfaces
- 1) * sizeof(MIB_IFROW
);
881 if (!pIfTable
|| *pdwSize
< size
) {
883 ret
= ERROR_INSUFFICIENT_BUFFER
;
886 InterfaceIndexTable
*table
= getInterfaceIndexTable();
889 size
= sizeof(MIB_IFTABLE
) + (table
->numIndexes
- 1) *
891 if (*pdwSize
< size
) {
893 ret
= ERROR_INSUFFICIENT_BUFFER
;
898 pIfTable
->dwNumEntries
= 0;
899 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
900 pIfTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
901 GetIfEntry(&pIfTable
->table
[ndx
]);
902 pIfTable
->dwNumEntries
++;
905 qsort(pIfTable
->table
, pIfTable
->dwNumEntries
, sizeof(MIB_IFROW
),
912 ret
= ERROR_OUTOFMEMORY
;
915 TRACE("returning %ld\n", ret
);
920 /******************************************************************
921 * GetInterfaceInfo (IPHLPAPI.@)
927 * dwOutBufLen [In/Out]
934 DWORD WINAPI
GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable
, PULONG dwOutBufLen
)
938 TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable
, dwOutBufLen
);
940 ret
= ERROR_INVALID_PARAMETER
;
942 DWORD numInterfaces
= getNumInterfaces();
943 ULONG size
= sizeof(IP_INTERFACE_INFO
) + (numInterfaces
- 1) *
944 sizeof(IP_ADAPTER_INDEX_MAP
);
946 if (!pIfTable
|| *dwOutBufLen
< size
) {
948 ret
= ERROR_INSUFFICIENT_BUFFER
;
951 InterfaceIndexTable
*table
= getInterfaceIndexTable();
954 size
= sizeof(IP_INTERFACE_INFO
) + (table
->numIndexes
- 1) *
955 sizeof(IP_ADAPTER_INDEX_MAP
);
956 if (*dwOutBufLen
< size
) {
958 ret
= ERROR_INSUFFICIENT_BUFFER
;
963 pIfTable
->NumAdapters
= 0;
964 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
965 const char *walker
, *name
;
968 pIfTable
->Adapter
[ndx
].Index
= table
->indexes
[ndx
];
969 name
= getInterfaceNameByIndex(table
->indexes
[ndx
]);
970 for (walker
= name
, assigner
= pIfTable
->Adapter
[ndx
].Name
;
972 assigner
- pIfTable
->Adapter
[ndx
].Name
< MAX_ADAPTER_NAME
- 1;
973 walker
++, assigner
++)
976 consumeInterfaceName(name
);
977 pIfTable
->NumAdapters
++;
984 ret
= ERROR_OUTOFMEMORY
;
987 TRACE("returning %ld\n", ret
);
992 static int IpAddrTableSorter(const void *a
, const void *b
)
997 ret
= ((PMIB_IPADDRROW
)a
)->dwAddr
- ((PMIB_IPADDRROW
)b
)->dwAddr
;
1004 /******************************************************************
1005 * GetIpAddrTable (IPHLPAPI.@)
1010 * pIpAddrTable [In/Out]
1019 DWORD WINAPI
GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable
, PULONG pdwSize
, BOOL bOrder
)
1023 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable
, pdwSize
,
1026 ret
= ERROR_INVALID_PARAMETER
;
1028 DWORD numInterfaces
= getNumInterfaces();
1029 ULONG size
= sizeof(MIB_IPADDRTABLE
) + (numInterfaces
- 1) *
1030 sizeof(MIB_IPADDRROW
);
1032 if (!pIpAddrTable
|| *pdwSize
< size
) {
1034 ret
= ERROR_INSUFFICIENT_BUFFER
;
1037 InterfaceIndexTable
*table
= getInterfaceIndexTable();
1040 size
= sizeof(MIB_IPADDRTABLE
) + (table
->numIndexes
- 1) *
1041 sizeof(MIB_IPADDRROW
);
1042 if (*pdwSize
< size
) {
1044 ret
= ERROR_INSUFFICIENT_BUFFER
;
1049 pIpAddrTable
->dwNumEntries
= 0;
1050 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
1051 pIpAddrTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
1052 pIpAddrTable
->table
[ndx
].dwAddr
=
1053 getInterfaceIPAddrByIndex(table
->indexes
[ndx
]);
1054 pIpAddrTable
->table
[ndx
].dwMask
=
1055 getInterfaceMaskByIndex(table
->indexes
[ndx
]);
1056 /* the dwBCastAddr member isn't the broadcast address, it indicates
1057 * whether the interface uses the 1's broadcast address (1) or the
1058 * 0's broadcast address (0).
1060 bcast
= getInterfaceBCastAddrByIndex(table
->indexes
[ndx
]);
1061 pIpAddrTable
->table
[ndx
].dwBCastAddr
=
1062 (bcast
& pIpAddrTable
->table
[ndx
].dwMask
) ? 1 : 0;
1063 /* FIXME: hardcoded reasm size, not sure where to get it */
1064 pIpAddrTable
->table
[ndx
].dwReasmSize
= 65535;
1065 pIpAddrTable
->table
[ndx
].unused1
= 0;
1066 pIpAddrTable
->table
[ndx
].wType
= 0; /* aka unused2 */
1067 pIpAddrTable
->dwNumEntries
++;
1070 qsort(pIpAddrTable
->table
, pIpAddrTable
->dwNumEntries
,
1071 sizeof(MIB_IPADDRROW
), IpAddrTableSorter
);
1077 ret
= ERROR_OUTOFMEMORY
;
1080 TRACE("returning %ld\n", ret
);
1085 static int IpForwardTableSorter(const void *a
, const void *b
)
1090 PMIB_IPFORWARDROW rowA
= (PMIB_IPFORWARDROW
)a
, rowB
= (PMIB_IPFORWARDROW
)b
;
1092 ret
= rowA
->dwForwardDest
- rowB
->dwForwardDest
;
1094 ret
= rowA
->dwForwardProto
- rowB
->dwForwardProto
;
1096 ret
= rowA
->dwForwardPolicy
- rowB
->dwForwardPolicy
;
1098 ret
= rowA
->dwForwardNextHop
- rowB
->dwForwardNextHop
;
1108 /******************************************************************
1109 * GetIpForwardTable (IPHLPAPI.@)
1114 * pIpForwardTable [In/Out]
1123 DWORD WINAPI
GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable
, PULONG pdwSize
, BOOL bOrder
)
1127 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable
,
1128 pdwSize
, (DWORD
)bOrder
);
1130 ret
= ERROR_INVALID_PARAMETER
;
1132 DWORD numRoutes
= getNumRoutes();
1133 ULONG sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (numRoutes
- 1) *
1134 sizeof(MIB_IPFORWARDROW
);
1136 if (!pIpForwardTable
|| *pdwSize
< sizeNeeded
) {
1137 *pdwSize
= sizeNeeded
;
1138 ret
= ERROR_INSUFFICIENT_BUFFER
;
1141 RouteTable
*table
= getRouteTable();
1143 sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (table
->numRoutes
- 1) *
1144 sizeof(MIB_IPFORWARDROW
);
1145 if (*pdwSize
< sizeNeeded
) {
1146 *pdwSize
= sizeNeeded
;
1147 ret
= ERROR_INSUFFICIENT_BUFFER
;
1152 pIpForwardTable
->dwNumEntries
= table
->numRoutes
;
1153 for (ndx
= 0; ndx
< numRoutes
; ndx
++) {
1154 pIpForwardTable
->table
[ndx
].dwForwardIfIndex
=
1155 table
->routes
[ndx
].ifIndex
;
1156 pIpForwardTable
->table
[ndx
].dwForwardDest
=
1157 table
->routes
[ndx
].dest
;
1158 pIpForwardTable
->table
[ndx
].dwForwardMask
=
1159 table
->routes
[ndx
].mask
;
1160 pIpForwardTable
->table
[ndx
].dwForwardPolicy
= 0;
1161 pIpForwardTable
->table
[ndx
].dwForwardNextHop
=
1162 table
->routes
[ndx
].gateway
;
1163 /* FIXME: this type is appropriate for local interfaces; may not
1164 always be appropriate */
1165 pIpForwardTable
->table
[ndx
].dwForwardType
= MIB_IPROUTE_TYPE_DIRECT
;
1166 /* FIXME: other protos might be appropriate, e.g. the default route
1167 is typically set with MIB_IPPROTO_NETMGMT instead */
1168 pIpForwardTable
->table
[ndx
].dwForwardProto
= MIB_IPPROTO_LOCAL
;
1169 /* punt on age and AS */
1170 pIpForwardTable
->table
[ndx
].dwForwardAge
= 0;
1171 pIpForwardTable
->table
[ndx
].dwForwardNextHopAS
= 0;
1172 pIpForwardTable
->table
[ndx
].dwForwardMetric1
=
1173 table
->routes
[ndx
].metric
;
1174 /* rest of the metrics are 0.. */
1175 pIpForwardTable
->table
[ndx
].dwForwardMetric2
= 0;
1176 pIpForwardTable
->table
[ndx
].dwForwardMetric3
= 0;
1177 pIpForwardTable
->table
[ndx
].dwForwardMetric4
= 0;
1178 pIpForwardTable
->table
[ndx
].dwForwardMetric5
= 0;
1181 qsort(pIpForwardTable
->table
, pIpForwardTable
->dwNumEntries
,
1182 sizeof(MIB_IPFORWARDROW
), IpForwardTableSorter
);
1188 ret
= ERROR_OUTOFMEMORY
;
1191 TRACE("returning %ld\n", ret
);
1196 static int IpNetTableSorter(const void *a
, const void *b
)
1201 ret
= ((PMIB_IPNETROW
)a
)->dwAddr
- ((PMIB_IPNETROW
)b
)->dwAddr
;
1208 /******************************************************************
1209 * GetIpNetTable (IPHLPAPI.@)
1214 * pIpNetTable [In/Out]
1223 DWORD WINAPI
GetIpNetTable(PMIB_IPNETTABLE pIpNetTable
, PULONG pdwSize
, BOOL bOrder
)
1227 TRACE("pIpNetTable %p, pdwSize %p, bOrder %ld\n", pIpNetTable
, pdwSize
,
1230 ret
= ERROR_INVALID_PARAMETER
;
1232 DWORD numEntries
= getNumArpEntries();
1233 ULONG size
= sizeof(MIB_IPNETTABLE
) + (numEntries
- 1) *
1234 sizeof(MIB_IPNETROW
);
1236 if (!pIpNetTable
|| *pdwSize
< size
) {
1238 ret
= ERROR_INSUFFICIENT_BUFFER
;
1241 PMIB_IPNETTABLE table
= getArpTable();
1244 size
= sizeof(MIB_IPNETTABLE
) + (table
->dwNumEntries
- 1) *
1245 sizeof(MIB_IPNETROW
);
1246 if (*pdwSize
< size
) {
1248 ret
= ERROR_INSUFFICIENT_BUFFER
;
1251 memcpy(pIpNetTable
, table
, size
);
1253 qsort(pIpNetTable
->table
, pIpNetTable
->dwNumEntries
,
1254 sizeof(MIB_IPNETROW
), IpNetTableSorter
);
1260 ret
= ERROR_OUTOFMEMORY
;
1263 TRACE("returning %ld\n", ret
);
1268 /******************************************************************
1269 * GetIpStatistics (IPHLPAPI.@)
1281 DWORD WINAPI
GetIpStatistics(PMIB_IPSTATS pStats
)
1283 return GetIpStatisticsEx(pStats
, PF_INET
);
1286 /******************************************************************
1287 * GetIpStatisticsEx (IPHLPAPI.@)
1300 DWORD WINAPI
GetIpStatisticsEx(PMIB_IPSTATS pStats
, DWORD dwFamily
)
1304 TRACE("pStats %p\n", pStats
);
1305 ret
= getIPStats(pStats
, dwFamily
);
1306 TRACE("returning %ld\n", ret
);
1310 /******************************************************************
1311 * GetNetworkParams (IPHLPAPI.@)
1316 * pFixedInfo [In/Out]
1317 * pOutBufLen [In/Out]
1324 DWORD WINAPI
GetNetworkParams(PFIXED_INFO pFixedInfo
, PULONG pOutBufLen
)
1329 PIPHLP_RES_INFO resInfo
;
1331 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo
, pOutBufLen
);
1333 return ERROR_INVALID_PARAMETER
;
1335 resInfo
= getResInfo();
1337 return ERROR_OUTOFMEMORY
;
1339 size
= sizeof(FIXED_INFO
) + (resInfo
->riCount
> 0 ? (resInfo
->riCount
- 1) *
1340 sizeof(IP_ADDR_STRING
) : 0);
1341 if (!pFixedInfo
|| *pOutBufLen
< size
) {
1343 disposeResInfo( resInfo
);
1344 return ERROR_BUFFER_OVERFLOW
;
1347 memset(pFixedInfo
, 0, size
);
1348 size
= sizeof(pFixedInfo
->HostName
);
1349 GetComputerNameExA(ComputerNameDnsHostname
, pFixedInfo
->HostName
, &size
);
1350 size
= sizeof(pFixedInfo
->DomainName
);
1351 GetComputerNameExA(ComputerNameDnsDomain
, pFixedInfo
->DomainName
, &size
);
1353 TRACE("GetComputerNameExA: %s\n", pFixedInfo
->DomainName
);
1355 if (resInfo
->riCount
> 0) {
1356 PIP_ADDR_STRING ptr
;
1359 for (i
= 0, ptr
= &pFixedInfo
->DnsServerList
; i
< resInfo
->riCount
&& ptr
;
1360 i
++, ptr
= ptr
->Next
) {
1361 struct sockaddr_in
*addr_v4
=
1362 (struct sockaddr_in
*)&resInfo
->riAddressList
[i
];
1364 (addr_v4
->sin_addr
.s_addr
,
1365 ptr
->IpAddress
.String
);
1366 if (i
== resInfo
->riCount
- 1)
1369 ptr
->Next
= (PIP_ADDR_STRING
)((LPBYTE
)pFixedInfo
+ sizeof(FIXED_INFO
));
1371 ptr
->Next
= (PIP_ADDR_STRING
)((PBYTE
)ptr
+ sizeof(IP_ADDR_STRING
));
1374 pFixedInfo
->NodeType
= HYBRID_NODETYPE
;
1375 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1376 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ
, &hKey
);
1377 if (regReturn
!= ERROR_SUCCESS
)
1378 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1379 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ
,
1381 if (regReturn
== ERROR_SUCCESS
)
1383 DWORD size
= sizeof(pFixedInfo
->ScopeId
);
1385 RegQueryValueExA(hKey
, "ScopeID", NULL
, NULL
, pFixedInfo
->ScopeId
, &size
);
1389 disposeResInfo( resInfo
);
1390 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
1391 I suppose could also check for a listener on port 53 to set EnableDns */
1393 TRACE("returning %ld\n", ret
);
1399 /******************************************************************
1400 * GetNumberOfInterfaces (IPHLPAPI.@)
1412 DWORD WINAPI
GetNumberOfInterfaces(PDWORD pdwNumIf
)
1416 TRACE("pdwNumIf %p\n", pdwNumIf
);
1418 ret
= ERROR_INVALID_PARAMETER
;
1420 *pdwNumIf
= getNumInterfaces();
1423 TRACE("returning %ld\n", ret
);
1428 /******************************************************************
1429 * GetPerAdapterInfo (IPHLPAPI.@)
1435 * pPerAdapterInfo [In/Out]
1436 * pOutBufLen [In/Out]
1443 DWORD WINAPI
GetPerAdapterInfo(ULONG IfIndex
, PIP_PER_ADAPTER_INFO pPerAdapterInfo
, PULONG pOutBufLen
)
1445 TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex
,
1446 pPerAdapterInfo
, pOutBufLen
);
1448 /* marking Win2K+ functions not supported */
1449 return ERROR_NOT_SUPPORTED
;
1453 /******************************************************************
1454 * GetRTTAndHopCount (IPHLPAPI.@)
1459 * DestIpAddress [In]
1469 BOOL WINAPI
GetRTTAndHopCount(IPAddr DestIpAddress
, PULONG HopCount
, ULONG MaxHops
, PULONG RTT
)
1471 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
1472 DestIpAddress
, HopCount
, MaxHops
, RTT
);
1478 /******************************************************************
1479 * GetTcpStatisticsEx (IPHLPAPI.@)
1492 DWORD WINAPI
GetTcpStatisticsEx(PMIB_TCPSTATS pStats
, DWORD dwFamily
)
1496 TRACE("pStats %p\n", pStats
);
1497 ret
= getTCPStats(pStats
, dwFamily
);
1498 TRACE("returning %ld\n", ret
);
1502 /******************************************************************
1503 * GetTcpStatistics (IPHLPAPI.@)
1515 DWORD WINAPI
GetTcpStatistics(PMIB_TCPSTATS pStats
)
1517 return GetTcpStatisticsEx(pStats
, PF_INET
);
1521 static int TcpTableSorter(const void *a
, const void *b
)
1526 PMIB_TCPROW rowA
= (PMIB_TCPROW
)a
, rowB
= (PMIB_TCPROW
)b
;
1528 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1530 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1532 ret
= rowA
->dwRemoteAddr
- rowB
->dwRemoteAddr
;
1534 ret
= rowA
->dwRemotePort
- rowB
->dwRemotePort
;
1544 /******************************************************************
1545 * GetTcpTable (IPHLPAPI.@)
1550 * pTcpTable [In/Out]
1559 DWORD WINAPI
GetTcpTable(PMIB_TCPTABLE pTcpTable
, PDWORD pdwSize
, BOOL bOrder
)
1563 TRACE("pTcpTable %p, pdwSize %p, bOrder %ld\n", pTcpTable
, pdwSize
,
1566 ret
= ERROR_INVALID_PARAMETER
;
1568 DWORD numEntries
= getNumTcpEntries();
1569 ULONG size
= sizeof(MIB_TCPTABLE
) + (numEntries
- 1) * sizeof(MIB_TCPROW
);
1571 if (!pTcpTable
|| *pdwSize
< size
) {
1573 ret
= ERROR_INSUFFICIENT_BUFFER
;
1576 PMIB_TCPTABLE table
= getTcpTable();
1579 size
= sizeof(MIB_TCPTABLE
) + (table
->dwNumEntries
- 1) *
1581 if (*pdwSize
< size
) {
1583 ret
= ERROR_INSUFFICIENT_BUFFER
;
1586 memcpy(pTcpTable
, table
, size
);
1588 qsort(pTcpTable
->table
, pTcpTable
->dwNumEntries
,
1589 sizeof(MIB_TCPROW
), TcpTableSorter
);
1595 ret
= ERROR_OUTOFMEMORY
;
1598 TRACE("returning %ld\n", ret
);
1603 /******************************************************************
1604 * GetUdpStatisticsEx (IPHLPAPI.@)
1617 DWORD WINAPI
GetUdpStatisticsEx(PMIB_UDPSTATS pStats
, DWORD dwFamily
)
1621 TRACE("pStats %p\n", pStats
);
1622 ret
= getUDPStats(pStats
, dwFamily
);
1623 TRACE("returning %ld\n", ret
);
1627 /******************************************************************
1628 * GetUdpStatistics (IPHLPAPI.@)
1640 DWORD WINAPI
GetUdpStatistics(PMIB_UDPSTATS pStats
)
1642 return GetUdpStatisticsEx(pStats
, PF_INET
);
1646 static int UdpTableSorter(const void *a
, const void *b
)
1651 PMIB_UDPROW rowA
= (PMIB_UDPROW
)a
, rowB
= (PMIB_UDPROW
)b
;
1653 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1655 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1663 /******************************************************************
1664 * GetUdpTable (IPHLPAPI.@)
1669 * pUdpTable [In/Out]
1678 DWORD WINAPI
GetUdpTable(PMIB_UDPTABLE pUdpTable
, PDWORD pdwSize
, BOOL bOrder
)
1682 TRACE("pUdpTable %p, pdwSize %p, bOrder %ld\n", pUdpTable
, pdwSize
,
1685 ret
= ERROR_INVALID_PARAMETER
;
1687 DWORD numEntries
= getNumUdpEntries();
1688 ULONG size
= sizeof(MIB_UDPTABLE
) + (numEntries
- 1) * sizeof(MIB_UDPROW
);
1690 if (!pUdpTable
|| *pdwSize
< size
) {
1692 ret
= ERROR_INSUFFICIENT_BUFFER
;
1695 PMIB_UDPTABLE table
= getUdpTable();
1698 size
= sizeof(MIB_UDPTABLE
) + (table
->dwNumEntries
- 1) *
1700 if (*pdwSize
< size
) {
1702 ret
= ERROR_INSUFFICIENT_BUFFER
;
1705 memcpy(pUdpTable
, table
, size
);
1707 qsort(pUdpTable
->table
, pUdpTable
->dwNumEntries
,
1708 sizeof(MIB_UDPROW
), UdpTableSorter
);
1714 ret
= ERROR_OUTOFMEMORY
;
1717 TRACE("returning %ld\n", ret
);
1722 /******************************************************************
1723 * GetUniDirectionalAdapterInfo (IPHLPAPI.@)
1728 * pIPIfInfo [In/Out]
1729 * dwOutBufLen [In/Out]
1736 DWORD WINAPI
GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo
, PULONG dwOutBufLen
)
1738 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo
, dwOutBufLen
);
1739 /* a unidirectional adapter?? not bloody likely! */
1740 return ERROR_NOT_SUPPORTED
;
1744 /******************************************************************
1745 * IpReleaseAddress (IPHLPAPI.@)
1750 * AdapterInfo [In/Out]
1757 DWORD WINAPI
IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1759 TRACE("AdapterInfo %p\n", AdapterInfo
);
1760 /* not a stub, never going to support this (and I never mark an adapter as
1761 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1762 return ERROR_NOT_SUPPORTED
;
1766 /******************************************************************
1767 * IpRenewAddress (IPHLPAPI.@)
1772 * AdapterInfo [In/Out]
1779 DWORD WINAPI
IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1781 TRACE("AdapterInfo %p\n", AdapterInfo
);
1782 /* not a stub, never going to support this (and I never mark an adapter as
1783 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1784 return ERROR_NOT_SUPPORTED
;
1788 /******************************************************************
1789 * NotifyAddrChange (IPHLPAPI.@)
1795 * overlapped [In/Out]
1802 DWORD WINAPI
NotifyAddrChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1804 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1806 /* marking Win2K+ functions not supported */
1807 return ERROR_NOT_SUPPORTED
;
1811 /******************************************************************
1812 * NotifyRouteChange (IPHLPAPI.@)
1818 * overlapped [In/Out]
1825 DWORD WINAPI
NotifyRouteChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1827 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1829 /* marking Win2K+ functions not supported */
1830 return ERROR_NOT_SUPPORTED
;
1834 /******************************************************************
1835 * SendARP (IPHLPAPI.@)
1843 * PhyAddrLen [In/Out]
1850 DWORD WINAPI
SendARP(IPAddr DestIP
, IPAddr SrcIP
, PULONG pMacAddr
, PULONG PhyAddrLen
)
1852 TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP
,
1853 SrcIP
, pMacAddr
, PhyAddrLen
);
1855 /* marking Win2K+ functions not supported */
1856 return ERROR_NOT_SUPPORTED
;
1860 /******************************************************************
1861 * SetIfEntry (IPHLPAPI.@)
1873 DWORD WINAPI
SetIfEntry(PMIB_IFROW pIfRow
)
1875 TRACE("pIfRow %p\n", pIfRow
);
1876 /* this is supposed to set an administratively interface up or down.
1877 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
1878 this sort of down is indistinguishable from other sorts of down (e.g. no
1881 return ERROR_NOT_SUPPORTED
;
1885 /******************************************************************
1886 * SetIpForwardEntry (IPHLPAPI.@)
1898 DWORD WINAPI
SetIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
1900 return setIpForwardEntry( pRoute
);
1904 /******************************************************************
1905 * SetIpNetEntry (IPHLPAPI.@)
1910 * pArpEntry [In/Out]
1917 DWORD WINAPI
SetIpNetEntry(PMIB_IPNETROW pArpEntry
)
1919 TRACE("pArpEntry %p\n", pArpEntry
);
1920 /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */
1926 /******************************************************************
1927 * SetIpStatistics (IPHLPAPI.@)
1939 DWORD WINAPI
SetIpStatistics(PMIB_IPSTATS pIpStats
)
1941 TRACE("pIpStats %p\n", pIpStats
);
1947 /******************************************************************
1948 * SetIpTTL (IPHLPAPI.@)
1960 DWORD WINAPI
SetIpTTL(UINT nTTL
)
1962 TRACE("nTTL %d\n", nTTL
);
1963 /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I
1964 want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */
1970 /******************************************************************
1971 * SetTcpEntry (IPHLPAPI.@)
1983 DWORD WINAPI
SetTcpEntry(PMIB_TCPROW pTcpRow
)
1985 TRACE("pTcpRow %p\n", pTcpRow
);
1991 /******************************************************************
1992 * UnenableRouter (IPHLPAPI.@)
1997 * pOverlapped [In/Out]
1998 * lpdwEnableCount [In/Out]
2005 DWORD WINAPI
UnenableRouter(OVERLAPPED
* pOverlapped
, LPDWORD lpdwEnableCount
)
2007 TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped
, lpdwEnableCount
);
2009 /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
2010 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
2011 marking Win2K+ functions not supported */
2012 return ERROR_NOT_SUPPORTED
;
2018 DWORD WINAPI
GetIpErrorString(IP_STATUS ErrorCode
,PWCHAR Buffer
,PDWORD Size
)
2028 PIP_ADAPTER_ORDER_MAP WINAPI
GetAdapterOrderMap(VOID
)
2037 DWORD WINAPI
GetAdaptersAddresses(ULONG Family
,DWORD Flags
,PVOID Reserved
,PIP_ADAPTER_ADDRESSES pAdapterAddresses
,PULONG pOutBufLen
)
2046 BOOL WINAPI
CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped
)
2055 DWORD WINAPI
GetBestInterfaceEx(struct sockaddr
*pDestAddr
,PDWORD pdwBestIfIndex
)
2064 DWORD WINAPI
NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO
**ppTable
,PDWORD pdwCount
,BOOL bOrder
,HANDLE hHeap
,DWORD dwFlags
)
2073 DWORD WINAPI
GetIcmpStatisticsEx(PMIB_ICMP_EX pStats
,DWORD dwFamily
)