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 Netmask
, DWORD IfIndex
, PULONG NteContext
, PULONG NteInstance
)
87 return addIPAddress( Address
, Netmask
, IfIndex
, NteContext
, NteInstance
);
91 /******************************************************************
92 * AllocateAndGetIfTableFromStack (IPHLPAPI.@)
97 * ppIfTable [Out] -- pointer into which the MIB_IFTABLE is
98 * allocated and returned.
99 * bOrder [In] -- passed to GetIfTable to order the table
100 * heap [In] -- heap from which the table is allocated
101 * flags [In] -- flags to HeapAlloc
103 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
104 * GetIfTable returns otherwise
107 DWORD WINAPI
AllocateAndGetIfTableFromStack(PMIB_IFTABLE
*ppIfTable
,
108 BOOL bOrder
, HANDLE heap
, DWORD flags
)
112 TRACE("ppIfTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n", ppIfTable
,
113 (DWORD
)bOrder
, (DWORD
)heap
, flags
);
115 ret
= ERROR_INVALID_PARAMETER
;
119 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
120 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
121 *ppIfTable
= (PMIB_IFTABLE
)HeapAlloc(heap
, flags
, dwSize
);
122 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
125 TRACE("returning %ld\n", ret
);
130 /******************************************************************
131 * AllocateAndGetIpAddrTableFromStack (IPHLPAPI.@)
136 * ppIpAddrTable [Out]
137 * bOrder [In] -- passed to GetIpAddrTable to order the table
138 * heap [In] -- heap from which the table is allocated
139 * flags [In] -- flags to HeapAlloc
146 DWORD WINAPI
AllocateAndGetIpAddrTableFromStack(PMIB_IPADDRTABLE
*ppIpAddrTable
,
147 BOOL bOrder
, HANDLE heap
, DWORD flags
)
151 TRACE("ppIpAddrTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
152 ppIpAddrTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
154 ret
= ERROR_INVALID_PARAMETER
;
158 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
159 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
160 *ppIpAddrTable
= (PMIB_IPADDRTABLE
)HeapAlloc(heap
, flags
, dwSize
);
161 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
164 TRACE("returning %ld\n", ret
);
169 /******************************************************************
170 * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@)
173 * ppIpForwardTable [Out] -- pointer into which the MIB_IPFORWARDTABLE is
174 * allocated and returned.
175 * bOrder [In] -- passed to GetIfTable to order the table
176 * heap [In] -- heap from which the table is allocated
177 * flags [In] -- flags to HeapAlloc
179 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
180 * GetIpForwardTable returns otherwise
183 DWORD WINAPI
AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE
*
184 ppIpForwardTable
, BOOL bOrder
, HANDLE heap
, DWORD flags
)
188 TRACE("ppIpForwardTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
189 ppIpForwardTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
190 if (!ppIpForwardTable
)
191 ret
= ERROR_INVALID_PARAMETER
;
195 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
196 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
197 *ppIpForwardTable
= (PMIB_IPFORWARDTABLE
)HeapAlloc(heap
, flags
, dwSize
);
198 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
201 TRACE("returning %ld\n", ret
);
206 /******************************************************************
207 * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@)
213 * bOrder [In] -- passed to GetIpNetTable to order the table
214 * heap [In] -- heap from which the table is allocated
215 * flags [In] -- flags to HeapAlloc
222 DWORD WINAPI
AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE
*ppIpNetTable
,
223 BOOL bOrder
, HANDLE heap
, DWORD flags
)
227 TRACE("ppIpNetTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
228 ppIpNetTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
230 ret
= ERROR_INVALID_PARAMETER
;
234 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
235 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
236 *ppIpNetTable
= (PMIB_IPNETTABLE
)HeapAlloc(heap
, flags
, dwSize
);
237 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
240 TRACE("returning %ld\n", ret
);
245 /******************************************************************
246 * AllocateAndGetTcpTableFromStack (IPHLPAPI.@)
252 * bOrder [In] -- passed to GetTcpTable to order the table
253 * heap [In] -- heap from which the table is allocated
254 * flags [In] -- flags to HeapAlloc
261 DWORD WINAPI
AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE
*ppTcpTable
,
262 BOOL bOrder
, HANDLE heap
, DWORD flags
)
266 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
267 ppTcpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
269 ret
= ERROR_INVALID_PARAMETER
;
273 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
274 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
275 *ppTcpTable
= (PMIB_TCPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
276 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
279 TRACE("returning %ld\n", ret
);
284 /******************************************************************
285 * AllocateAndGetUdpTableFromStack (IPHLPAPI.@)
291 * bOrder [In] -- passed to GetUdpTable to order the table
292 * heap [In] -- heap from which the table is allocated
293 * flags [In] -- flags to HeapAlloc
300 DWORD WINAPI
AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE
*ppUdpTable
,
301 BOOL bOrder
, HANDLE heap
, DWORD flags
)
305 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
306 ppUdpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
308 ret
= ERROR_INVALID_PARAMETER
;
312 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
313 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
314 *ppUdpTable
= (PMIB_UDPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
315 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
318 TRACE("returning %ld\n", ret
);
323 /******************************************************************
324 * CreateIpForwardEntry (IPHLPAPI.@)
336 DWORD WINAPI
CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
338 return createIpForwardEntry( pRoute
);
342 /******************************************************************
343 * CreateIpNetEntry (IPHLPAPI.@)
355 DWORD WINAPI
CreateIpNetEntry(PMIB_IPNETROW pArpEntry
)
357 TRACE("pArpEntry %p\n", pArpEntry
);
358 /* could use SIOCSARP on systems that support it, not sure I want to */
364 /******************************************************************
365 * CreateProxyArpEntry (IPHLPAPI.@)
379 DWORD WINAPI
CreateProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
381 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
384 /* marking Win2K+ functions not supported */
385 return ERROR_NOT_SUPPORTED
;
389 /******************************************************************
390 * DeleteIPAddress (IPHLPAPI.@)
402 DWORD WINAPI
DeleteIPAddress(ULONG NTEContext
)
404 TRACE("NTEContext %ld\n", NTEContext
);
405 return deleteIpAddress( NTEContext
);
409 /******************************************************************
410 * DeleteIpForwardEntry (IPHLPAPI.@)
422 DWORD WINAPI
DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
424 return deleteIpForwardEntry( pRoute
);
428 /******************************************************************
429 * DeleteIpNetEntry (IPHLPAPI.@)
441 DWORD WINAPI
DeleteIpNetEntry(PMIB_IPNETROW pArpEntry
)
443 TRACE("pArpEntry %p\n", pArpEntry
);
444 /* could use SIOCDARP on systems that support it, not sure I want to */
450 /******************************************************************
451 * DeleteProxyArpEntry (IPHLPAPI.@)
465 DWORD WINAPI
DeleteProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
467 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
470 /* marking Win2K+ functions not supported */
471 return ERROR_NOT_SUPPORTED
;
474 /******************************************************************
475 * EnableRouter (IPHLPAPI.@)
481 * pOverlapped [In/Out]
488 DWORD WINAPI
EnableRouter(HANDLE
* pHandle
, OVERLAPPED
* pOverlapped
)
490 TRACE("pHandle %p, pOverlapped %p\n", pHandle
, pOverlapped
);
492 /* could echo "1" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
493 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
494 marking Win2K+ functions not supported */
495 return ERROR_NOT_SUPPORTED
;
499 /******************************************************************
500 * FlushIpNetTable (IPHLPAPI.@)
512 DWORD WINAPI
FlushIpNetTable(DWORD dwIfIndex
)
514 TRACE("dwIfIndex 0x%08lx\n", dwIfIndex
);
516 /* this flushes the arp cache of the given index
517 marking Win2K+ functions not supported */
518 return ERROR_NOT_SUPPORTED
;
522 /******************************************************************
523 * GetAdapterIndex (IPHLPAPI.@)
528 * AdapterName [In/Out]
536 DWORD WINAPI
GetAdapterIndex(LPWSTR AdapterName
, PULONG IfIndex
)
538 TRACE("AdapterName %p, IfIndex %p\n", AdapterName
, IfIndex
);
540 /* marking Win2K+ functions not supported */
541 return ERROR_NOT_SUPPORTED
;
545 /******************************************************************
546 * GetAdaptersInfo (IPHLPAPI.@)
551 * pAdapterInfo [In/Out]
552 * pOutBufLen [In/Out]
559 DWORD WINAPI
GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo
, PULONG pOutBufLen
)
563 TRACE("pAdapterInfo %p, pOutBufLen %p\n", pAdapterInfo
, pOutBufLen
);
565 ret
= ERROR_INVALID_PARAMETER
;
567 DWORD numNonLoopbackInterfaces
= getNumNonLoopbackInterfaces();
569 if (numNonLoopbackInterfaces
> 0) {
570 /* this calculation assumes only one address in the IP_ADDR_STRING lists.
571 that's okay, because:
572 - we don't get multiple addresses per adapter anyway
573 - we don't know about per-adapter gateways
574 - DHCP and WINS servers can have max one entry per list */
575 ULONG size
= sizeof(IP_ADAPTER_INFO
) * numNonLoopbackInterfaces
;
577 if (!pAdapterInfo
|| *pOutBufLen
< size
) {
579 ret
= ERROR_BUFFER_OVERFLOW
;
582 InterfaceIndexTable
*table
= getNonLoopbackInterfaceIndexTable();
585 size
= sizeof(IP_ADAPTER_INFO
) * table
->numIndexes
;
586 if (*pOutBufLen
< size
) {
588 ret
= ERROR_INSUFFICIENT_BUFFER
;
593 BOOL winsEnabled
= FALSE
;
594 IP_ADDRESS_STRING primaryWINS
, secondaryWINS
;
596 memset(pAdapterInfo
, 0, size
);
597 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
598 "Software\\Wine\\Wine\\Config\\Network", 0, KEY_READ
,
599 &hKey
) == ERROR_SUCCESS
) {
600 DWORD size
= sizeof(primaryWINS
.String
);
603 RegQueryValueExA(hKey
, "WinsServer", NULL
, NULL
,
604 primaryWINS
.String
, &size
);
605 addr
= inet_addr(primaryWINS
.String
);
606 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
608 size
= sizeof(secondaryWINS
.String
);
609 RegQueryValueExA(hKey
, "BackupWinsServer", NULL
, NULL
,
610 secondaryWINS
.String
, &size
);
611 addr
= inet_addr(secondaryWINS
.String
);
612 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
616 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
617 PIP_ADAPTER_INFO ptr
= &pAdapterInfo
[ndx
];
618 DWORD addrLen
= sizeof(ptr
->Address
), type
;
620 getInterfaceNameByIndex(table
->indexes
[ndx
]);
622 /* on Win98 this is left empty, but whatever */
624 strncpy(ptr
->AdapterName
,ifname
,sizeof(ptr
->AdapterName
));
625 consumeInterfaceName(ifname
);
626 ptr
->AdapterName
[MAX_ADAPTER_NAME_LENGTH
] = '\0';
627 getInterfacePhysicalByIndex(table
->indexes
[ndx
], &addrLen
,
628 ptr
->Address
, &type
);
629 /* MS defines address length and type as UINT in some places and
630 DWORD in others, **sigh**. Don't want to assume that PUINT and
631 PDWORD are equiv (64-bit?) */
632 ptr
->AddressLength
= addrLen
;
634 ptr
->Index
= table
->indexes
[ndx
];
635 toIPAddressString(getInterfaceIPAddrByIndex(table
->indexes
[ndx
]),
636 ptr
->IpAddressList
.IpAddress
.String
);
637 toIPAddressString(getInterfaceMaskByIndex(table
->indexes
[ndx
]),
638 ptr
->IpAddressList
.IpMask
.String
);
640 ptr
->HaveWins
= TRUE
;
641 memcpy(ptr
->PrimaryWinsServer
.IpAddress
.String
,
642 primaryWINS
.String
, sizeof(primaryWINS
.String
));
643 memcpy(ptr
->SecondaryWinsServer
.IpAddress
.String
,
644 secondaryWINS
.String
, sizeof(secondaryWINS
.String
));
646 if (ndx
< table
->numIndexes
- 1)
647 ptr
->Next
= &pAdapterInfo
[ndx
+ 1];
656 ret
= ERROR_OUTOFMEMORY
;
662 TRACE("returning %ld\n", ret
);
667 /******************************************************************
668 * GetBestInterface (IPHLPAPI.@)
674 * pdwBestIfIndex [In/Out]
681 DWORD WINAPI
GetBestInterface(IPAddr dwDestAddr
, PDWORD pdwBestIfIndex
)
685 TRACE("dwDestAddr 0x%08lx, pdwBestIfIndex %p\n", dwDestAddr
, pdwBestIfIndex
);
687 ret
= ERROR_INVALID_PARAMETER
;
689 MIB_IPFORWARDROW ipRow
;
691 ret
= GetBestRoute(dwDestAddr
, 0, &ipRow
);
692 if (ret
== ERROR_SUCCESS
)
693 *pdwBestIfIndex
= ipRow
.dwForwardIfIndex
;
695 TRACE("returning %ld\n", ret
);
700 /******************************************************************
701 * GetBestRoute (IPHLPAPI.@)
715 DWORD WINAPI
GetBestRoute(DWORD dwDestAddr
, DWORD dwSourceAddr
, PMIB_IPFORWARDROW pBestRoute
)
717 PMIB_IPFORWARDTABLE table
;
720 TRACE("dwDestAddr 0x%08lx, dwSourceAddr 0x%08lx, pBestRoute %p\n", dwDestAddr
,
721 dwSourceAddr
, pBestRoute
);
723 return ERROR_INVALID_PARAMETER
;
725 AllocateAndGetIpForwardTableFromStack(&table
, FALSE
, GetProcessHeap(), 0);
727 DWORD ndx
, matchedBits
, matchedNdx
= 0;
729 for (ndx
= 0, matchedBits
= 0; ndx
< table
->dwNumEntries
; ndx
++) {
730 if ((dwDestAddr
& table
->table
[ndx
].dwForwardMask
) ==
731 (table
->table
[ndx
].dwForwardDest
& table
->table
[ndx
].dwForwardMask
)) {
732 DWORD numShifts
, mask
;
734 for (numShifts
= 0, mask
= table
->table
[ndx
].dwForwardMask
;
735 mask
&& !(mask
& 1); mask
>>= 1, numShifts
++)
737 if (numShifts
> matchedBits
) {
738 matchedBits
= numShifts
;
743 memcpy(pBestRoute
, &table
->table
[matchedNdx
], sizeof(MIB_IPFORWARDROW
));
744 HeapFree(GetProcessHeap(), 0, table
);
748 ret
= ERROR_OUTOFMEMORY
;
749 TRACE("returning %ld\n", ret
);
754 /******************************************************************
755 * GetFriendlyIfIndex (IPHLPAPI.@)
767 DWORD WINAPI
GetFriendlyIfIndex(DWORD IfIndex
)
769 /* windows doesn't validate these, either, just makes sure the top byte is
770 cleared. I assume my ifenum module never gives an index with the top
772 TRACE("returning %ld\n", IfIndex
);
777 /******************************************************************
778 * GetIcmpStatistics (IPHLPAPI.@)
790 DWORD WINAPI
GetIcmpStatistics(PMIB_ICMP pStats
)
794 TRACE("pStats %p\n", pStats
);
795 ret
= getICMPStats(pStats
);
796 TRACE("returning %ld\n", ret
);
801 /******************************************************************
802 * GetIfEntry (IPHLPAPI.@)
814 DWORD WINAPI
GetIfEntry(PMIB_IFROW pIfRow
)
819 TRACE("pIfRow %p\n", pIfRow
);
821 return ERROR_INVALID_PARAMETER
;
823 name
= getInterfaceNameByIndex(pIfRow
->dwIndex
);
825 ret
= getInterfaceEntryByIndex(pIfRow
->dwIndex
, pIfRow
);
827 ret
= getInterfaceStatsByName(name
, pIfRow
);
828 consumeInterfaceName(name
);
831 ret
= ERROR_INVALID_DATA
;
832 TRACE("returning %ld\n", ret
);
837 static int IfTableSorter(const void *a
, const void *b
)
842 ret
= ((PMIB_IFROW
)a
)->dwIndex
- ((PMIB_IFROW
)b
)->dwIndex
;
849 /******************************************************************
850 * GetIfTable (IPHLPAPI.@)
864 DWORD WINAPI
GetIfTable(PMIB_IFTABLE pIfTable
, PULONG pdwSize
, BOOL bOrder
)
868 TRACE("pIfTable %p, pdwSize %p, bOrder %ld\n", pdwSize
, pdwSize
,
871 ret
= ERROR_INVALID_PARAMETER
;
873 DWORD numInterfaces
= getNumInterfaces();
874 TRACE("GetIfTable: numInterfaces = %d\n", (int)numInterfaces
);
875 ULONG size
= sizeof(MIB_IFTABLE
) + (numInterfaces
- 1) * sizeof(MIB_IFROW
);
877 if (!pIfTable
|| *pdwSize
< size
) {
879 ret
= ERROR_INSUFFICIENT_BUFFER
;
882 InterfaceIndexTable
*table
= getInterfaceIndexTable();
885 size
= sizeof(MIB_IFTABLE
) + (table
->numIndexes
- 1) *
887 if (*pdwSize
< size
) {
889 ret
= ERROR_INSUFFICIENT_BUFFER
;
894 pIfTable
->dwNumEntries
= 0;
895 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
896 pIfTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
897 GetIfEntry(&pIfTable
->table
[ndx
]);
898 pIfTable
->dwNumEntries
++;
901 qsort(pIfTable
->table
, pIfTable
->dwNumEntries
, sizeof(MIB_IFROW
),
908 ret
= ERROR_OUTOFMEMORY
;
911 TRACE("returning %ld\n", ret
);
916 /******************************************************************
917 * GetInterfaceInfo (IPHLPAPI.@)
923 * dwOutBufLen [In/Out]
930 DWORD WINAPI
GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable
, PULONG dwOutBufLen
)
934 TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable
, dwOutBufLen
);
936 ret
= ERROR_INVALID_PARAMETER
;
938 DWORD numNonLoopbackInterfaces
= getNumNonLoopbackInterfaces();
939 DPRINT("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces
);
940 ULONG size
= sizeof(IP_INTERFACE_INFO
) + (numNonLoopbackInterfaces
) *
941 sizeof(IP_ADAPTER_INDEX_MAP
);
943 if (!pIfTable
|| *dwOutBufLen
< size
) {
945 ret
= ERROR_INSUFFICIENT_BUFFER
;
948 InterfaceIndexTable
*table
= getNonLoopbackInterfaceIndexTable();
949 DPRINT("table->numIndexes == 0x%x\n", table
->numIndexes
);
952 size
= sizeof(IP_INTERFACE_INFO
) + (table
->numIndexes
) *
953 sizeof(IP_ADAPTER_INDEX_MAP
);
954 if (*dwOutBufLen
< size
) {
956 ret
= ERROR_INSUFFICIENT_BUFFER
;
961 pIfTable
->NumAdapters
= 0;
962 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
963 const char *walker
, *name
;
966 pIfTable
->Adapter
[ndx
].Index
= table
->indexes
[ndx
];
967 name
= getInterfaceNameByIndex(table
->indexes
[ndx
]);
968 for (walker
= name
, assigner
= pIfTable
->Adapter
[ndx
].Name
;
970 assigner
- pIfTable
->Adapter
[ndx
].Name
< MAX_ADAPTER_NAME
- 1;
971 walker
++, assigner
++)
974 consumeInterfaceName(name
);
975 pIfTable
->NumAdapters
++;
982 ret
= ERROR_OUTOFMEMORY
;
985 TRACE("returning %ld\n", ret
);
990 static int IpAddrTableSorter(const void *a
, const void *b
)
995 ret
= ((PMIB_IPADDRROW
)a
)->dwAddr
- ((PMIB_IPADDRROW
)b
)->dwAddr
;
1002 /******************************************************************
1003 * GetIpAddrTable (IPHLPAPI.@)
1008 * pIpAddrTable [In/Out]
1017 DWORD WINAPI
GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable
, PULONG pdwSize
, BOOL bOrder
)
1021 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable
, pdwSize
,
1024 ret
= ERROR_INVALID_PARAMETER
;
1026 DWORD numInterfaces
= getNumInterfaces();
1027 ULONG size
= sizeof(MIB_IPADDRTABLE
) + (numInterfaces
- 1) *
1028 sizeof(MIB_IPADDRROW
);
1030 if (!pIpAddrTable
|| *pdwSize
< size
) {
1032 ret
= ERROR_INSUFFICIENT_BUFFER
;
1035 InterfaceIndexTable
*table
= getInterfaceIndexTable();
1038 size
= sizeof(MIB_IPADDRTABLE
) + (table
->numIndexes
- 1) *
1039 sizeof(MIB_IPADDRROW
);
1040 if (*pdwSize
< size
) {
1042 ret
= ERROR_INSUFFICIENT_BUFFER
;
1047 pIpAddrTable
->dwNumEntries
= 0;
1048 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
1049 pIpAddrTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
1050 pIpAddrTable
->table
[ndx
].dwAddr
=
1051 getInterfaceIPAddrByIndex(table
->indexes
[ndx
]);
1052 pIpAddrTable
->table
[ndx
].dwMask
=
1053 getInterfaceMaskByIndex(table
->indexes
[ndx
]);
1054 /* the dwBCastAddr member isn't the broadcast address, it indicates
1055 * whether the interface uses the 1's broadcast address (1) or the
1056 * 0's broadcast address (0).
1058 bcast
= getInterfaceBCastAddrByIndex(table
->indexes
[ndx
]);
1059 pIpAddrTable
->table
[ndx
].dwBCastAddr
=
1060 (bcast
& pIpAddrTable
->table
[ndx
].dwMask
) ? 1 : 0;
1061 /* FIXME: hardcoded reasm size, not sure where to get it */
1062 pIpAddrTable
->table
[ndx
].dwReasmSize
= 65535;
1063 pIpAddrTable
->table
[ndx
].unused1
= 0;
1064 pIpAddrTable
->table
[ndx
].wType
= 0; /* aka unused2 */
1065 pIpAddrTable
->dwNumEntries
++;
1068 qsort(pIpAddrTable
->table
, pIpAddrTable
->dwNumEntries
,
1069 sizeof(MIB_IPADDRROW
), IpAddrTableSorter
);
1075 ret
= ERROR_OUTOFMEMORY
;
1078 TRACE("returning %ld\n", ret
);
1083 static int IpForwardTableSorter(const void *a
, const void *b
)
1088 PMIB_IPFORWARDROW rowA
= (PMIB_IPFORWARDROW
)a
, rowB
= (PMIB_IPFORWARDROW
)b
;
1090 ret
= rowA
->dwForwardDest
- rowB
->dwForwardDest
;
1092 ret
= rowA
->dwForwardProto
- rowB
->dwForwardProto
;
1094 ret
= rowA
->dwForwardPolicy
- rowB
->dwForwardPolicy
;
1096 ret
= rowA
->dwForwardNextHop
- rowB
->dwForwardNextHop
;
1106 /******************************************************************
1107 * GetIpForwardTable (IPHLPAPI.@)
1112 * pIpForwardTable [In/Out]
1121 DWORD WINAPI
GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable
, PULONG pdwSize
, BOOL bOrder
)
1125 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable
,
1126 pdwSize
, (DWORD
)bOrder
);
1128 ret
= ERROR_INVALID_PARAMETER
;
1130 DWORD numRoutes
= getNumRoutes();
1131 ULONG sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (numRoutes
- 1) *
1132 sizeof(MIB_IPFORWARDROW
);
1134 if (!pIpForwardTable
|| *pdwSize
< sizeNeeded
) {
1135 *pdwSize
= sizeNeeded
;
1136 ret
= ERROR_INSUFFICIENT_BUFFER
;
1139 RouteTable
*table
= getRouteTable();
1141 sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (table
->numRoutes
- 1) *
1142 sizeof(MIB_IPFORWARDROW
);
1143 if (*pdwSize
< sizeNeeded
) {
1144 *pdwSize
= sizeNeeded
;
1145 ret
= ERROR_INSUFFICIENT_BUFFER
;
1150 pIpForwardTable
->dwNumEntries
= table
->numRoutes
;
1151 for (ndx
= 0; ndx
< numRoutes
; ndx
++) {
1152 pIpForwardTable
->table
[ndx
].dwForwardIfIndex
=
1153 table
->routes
[ndx
].ifIndex
;
1154 pIpForwardTable
->table
[ndx
].dwForwardDest
=
1155 table
->routes
[ndx
].dest
;
1156 pIpForwardTable
->table
[ndx
].dwForwardMask
=
1157 table
->routes
[ndx
].mask
;
1158 pIpForwardTable
->table
[ndx
].dwForwardPolicy
= 0;
1159 pIpForwardTable
->table
[ndx
].dwForwardNextHop
=
1160 table
->routes
[ndx
].gateway
;
1161 /* FIXME: this type is appropriate for local interfaces; may not
1162 always be appropriate */
1163 pIpForwardTable
->table
[ndx
].dwForwardType
= MIB_IPROUTE_TYPE_DIRECT
;
1164 /* FIXME: other protos might be appropriate, e.g. the default route
1165 is typically set with MIB_IPPROTO_NETMGMT instead */
1166 pIpForwardTable
->table
[ndx
].dwForwardProto
= MIB_IPPROTO_LOCAL
;
1167 /* punt on age and AS */
1168 pIpForwardTable
->table
[ndx
].dwForwardAge
= 0;
1169 pIpForwardTable
->table
[ndx
].dwForwardNextHopAS
= 0;
1170 pIpForwardTable
->table
[ndx
].dwForwardMetric1
=
1171 table
->routes
[ndx
].metric
;
1172 /* rest of the metrics are 0.. */
1173 pIpForwardTable
->table
[ndx
].dwForwardMetric2
= 0;
1174 pIpForwardTable
->table
[ndx
].dwForwardMetric3
= 0;
1175 pIpForwardTable
->table
[ndx
].dwForwardMetric4
= 0;
1176 pIpForwardTable
->table
[ndx
].dwForwardMetric5
= 0;
1179 qsort(pIpForwardTable
->table
, pIpForwardTable
->dwNumEntries
,
1180 sizeof(MIB_IPFORWARDROW
), IpForwardTableSorter
);
1186 ret
= ERROR_OUTOFMEMORY
;
1189 TRACE("returning %ld\n", ret
);
1194 static int IpNetTableSorter(const void *a
, const void *b
)
1199 ret
= ((PMIB_IPNETROW
)a
)->dwAddr
- ((PMIB_IPNETROW
)b
)->dwAddr
;
1206 /******************************************************************
1207 * GetIpNetTable (IPHLPAPI.@)
1212 * pIpNetTable [In/Out]
1221 DWORD WINAPI
GetIpNetTable(PMIB_IPNETTABLE pIpNetTable
, PULONG pdwSize
, BOOL bOrder
)
1225 TRACE("pIpNetTable %p, pdwSize %p, bOrder %ld\n", pIpNetTable
, pdwSize
,
1228 ret
= ERROR_INVALID_PARAMETER
;
1230 DWORD numEntries
= getNumArpEntries();
1231 ULONG size
= sizeof(MIB_IPNETTABLE
) + (numEntries
- 1) *
1232 sizeof(MIB_IPNETROW
);
1234 if (!pIpNetTable
|| *pdwSize
< size
) {
1236 ret
= ERROR_INSUFFICIENT_BUFFER
;
1239 PMIB_IPNETTABLE table
= getArpTable();
1242 size
= sizeof(MIB_IPNETTABLE
) + (table
->dwNumEntries
- 1) *
1243 sizeof(MIB_IPNETROW
);
1244 if (*pdwSize
< size
) {
1246 ret
= ERROR_INSUFFICIENT_BUFFER
;
1249 memcpy(pIpNetTable
, table
, size
);
1251 qsort(pIpNetTable
->table
, pIpNetTable
->dwNumEntries
,
1252 sizeof(MIB_IPNETROW
), IpNetTableSorter
);
1258 ret
= ERROR_OUTOFMEMORY
;
1261 TRACE("returning %ld\n", ret
);
1266 /******************************************************************
1267 * GetIpStatistics (IPHLPAPI.@)
1279 DWORD WINAPI
GetIpStatistics(PMIB_IPSTATS pStats
)
1281 return GetIpStatisticsEx(pStats
, PF_INET
);
1284 /******************************************************************
1285 * GetIpStatisticsEx (IPHLPAPI.@)
1298 DWORD WINAPI
GetIpStatisticsEx(PMIB_IPSTATS pStats
, DWORD dwFamily
)
1302 TRACE("pStats %p\n", pStats
);
1303 ret
= getIPStats(pStats
, dwFamily
);
1304 TRACE("returning %ld\n", ret
);
1308 /******************************************************************
1309 * GetNetworkParams (IPHLPAPI.@)
1314 * pFixedInfo [In/Out]
1315 * pOutBufLen [In/Out]
1322 DWORD WINAPI
GetNetworkParams(PFIXED_INFO pFixedInfo
, PULONG pOutBufLen
)
1327 PIPHLP_RES_INFO resInfo
;
1329 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo
, pOutBufLen
);
1331 return ERROR_INVALID_PARAMETER
;
1333 resInfo
= getResInfo();
1335 return ERROR_OUTOFMEMORY
;
1337 size
= sizeof(FIXED_INFO
) + (resInfo
->riCount
> 0 ? (resInfo
->riCount
- 1) *
1338 sizeof(IP_ADDR_STRING
) : 0);
1339 if (!pFixedInfo
|| *pOutBufLen
< size
) {
1341 disposeResInfo( resInfo
);
1342 return ERROR_BUFFER_OVERFLOW
;
1345 memset(pFixedInfo
, 0, size
);
1346 size
= sizeof(pFixedInfo
->HostName
);
1347 GetComputerNameExA(ComputerNameDnsHostname
, pFixedInfo
->HostName
, &size
);
1348 size
= sizeof(pFixedInfo
->DomainName
);
1349 GetComputerNameExA(ComputerNameDnsDomain
, pFixedInfo
->DomainName
, &size
);
1351 TRACE("GetComputerNameExA: %s\n", pFixedInfo
->DomainName
);
1353 if (resInfo
->riCount
> 0) {
1354 PIP_ADDR_STRING ptr
;
1357 for (i
= 0, ptr
= &pFixedInfo
->DnsServerList
; i
< resInfo
->riCount
&& ptr
;
1358 i
++, ptr
= ptr
->Next
) {
1359 struct sockaddr_in
*addr_v4
=
1360 (struct sockaddr_in
*)&resInfo
->riAddressList
[i
];
1362 (addr_v4
->sin_addr
.s_addr
,
1363 ptr
->IpAddress
.String
);
1364 if (i
== resInfo
->riCount
- 1)
1367 ptr
->Next
= (PIP_ADDR_STRING
)((LPBYTE
)pFixedInfo
+ sizeof(FIXED_INFO
));
1369 ptr
->Next
= (PIP_ADDR_STRING
)((PBYTE
)ptr
+ sizeof(IP_ADDR_STRING
));
1372 pFixedInfo
->NodeType
= HYBRID_NODETYPE
;
1373 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1374 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ
, &hKey
);
1375 if (regReturn
!= ERROR_SUCCESS
)
1376 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1377 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ
,
1379 if (regReturn
== ERROR_SUCCESS
)
1381 DWORD size
= sizeof(pFixedInfo
->ScopeId
);
1383 RegQueryValueExA(hKey
, "ScopeID", NULL
, NULL
, pFixedInfo
->ScopeId
, &size
);
1387 disposeResInfo( resInfo
);
1388 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
1389 I suppose could also check for a listener on port 53 to set EnableDns */
1391 TRACE("returning %ld\n", ret
);
1397 /******************************************************************
1398 * GetNumberOfInterfaces (IPHLPAPI.@)
1410 DWORD WINAPI
GetNumberOfInterfaces(PDWORD pdwNumIf
)
1414 TRACE("pdwNumIf %p\n", pdwNumIf
);
1416 ret
= ERROR_INVALID_PARAMETER
;
1418 *pdwNumIf
= getNumInterfaces();
1421 TRACE("returning %ld\n", ret
);
1426 /******************************************************************
1427 * GetPerAdapterInfo (IPHLPAPI.@)
1433 * pPerAdapterInfo [In/Out]
1434 * pOutBufLen [In/Out]
1441 DWORD WINAPI
GetPerAdapterInfo(ULONG IfIndex
, PIP_PER_ADAPTER_INFO pPerAdapterInfo
, PULONG pOutBufLen
)
1443 TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex
,
1444 pPerAdapterInfo
, pOutBufLen
);
1446 /* marking Win2K+ functions not supported */
1447 return ERROR_NOT_SUPPORTED
;
1451 /******************************************************************
1452 * GetRTTAndHopCount (IPHLPAPI.@)
1457 * DestIpAddress [In]
1467 BOOL WINAPI
GetRTTAndHopCount(IPAddr DestIpAddress
, PULONG HopCount
, ULONG MaxHops
, PULONG RTT
)
1469 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
1470 DestIpAddress
, HopCount
, MaxHops
, RTT
);
1476 /******************************************************************
1477 * GetTcpStatisticsEx (IPHLPAPI.@)
1490 DWORD WINAPI
GetTcpStatisticsEx(PMIB_TCPSTATS pStats
, DWORD dwFamily
)
1494 TRACE("pStats %p\n", pStats
);
1495 ret
= getTCPStats(pStats
, dwFamily
);
1496 TRACE("returning %ld\n", ret
);
1500 /******************************************************************
1501 * GetTcpStatistics (IPHLPAPI.@)
1513 DWORD WINAPI
GetTcpStatistics(PMIB_TCPSTATS pStats
)
1515 return GetTcpStatisticsEx(pStats
, PF_INET
);
1519 static int TcpTableSorter(const void *a
, const void *b
)
1524 PMIB_TCPROW rowA
= (PMIB_TCPROW
)a
, rowB
= (PMIB_TCPROW
)b
;
1526 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1528 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1530 ret
= rowA
->dwRemoteAddr
- rowB
->dwRemoteAddr
;
1532 ret
= rowA
->dwRemotePort
- rowB
->dwRemotePort
;
1542 /******************************************************************
1543 * GetTcpTable (IPHLPAPI.@)
1548 * pTcpTable [In/Out]
1557 DWORD WINAPI
GetTcpTable(PMIB_TCPTABLE pTcpTable
, PDWORD pdwSize
, BOOL bOrder
)
1561 TRACE("pTcpTable %p, pdwSize %p, bOrder %ld\n", pTcpTable
, pdwSize
,
1564 ret
= ERROR_INVALID_PARAMETER
;
1566 DWORD numEntries
= getNumTcpEntries();
1567 ULONG size
= sizeof(MIB_TCPTABLE
) + (numEntries
- 1) * sizeof(MIB_TCPROW
);
1569 if (!pTcpTable
|| *pdwSize
< size
) {
1571 ret
= ERROR_INSUFFICIENT_BUFFER
;
1574 PMIB_TCPTABLE table
= getTcpTable();
1577 size
= sizeof(MIB_TCPTABLE
) + (table
->dwNumEntries
- 1) *
1579 if (*pdwSize
< size
) {
1581 ret
= ERROR_INSUFFICIENT_BUFFER
;
1584 memcpy(pTcpTable
, table
, size
);
1586 qsort(pTcpTable
->table
, pTcpTable
->dwNumEntries
,
1587 sizeof(MIB_TCPROW
), TcpTableSorter
);
1593 ret
= ERROR_OUTOFMEMORY
;
1596 TRACE("returning %ld\n", ret
);
1601 /******************************************************************
1602 * GetUdpStatisticsEx (IPHLPAPI.@)
1615 DWORD WINAPI
GetUdpStatisticsEx(PMIB_UDPSTATS pStats
, DWORD dwFamily
)
1619 TRACE("pStats %p\n", pStats
);
1620 ret
= getUDPStats(pStats
, dwFamily
);
1621 TRACE("returning %ld\n", ret
);
1625 /******************************************************************
1626 * GetUdpStatistics (IPHLPAPI.@)
1638 DWORD WINAPI
GetUdpStatistics(PMIB_UDPSTATS pStats
)
1640 return GetUdpStatisticsEx(pStats
, PF_INET
);
1644 static int UdpTableSorter(const void *a
, const void *b
)
1649 PMIB_UDPROW rowA
= (PMIB_UDPROW
)a
, rowB
= (PMIB_UDPROW
)b
;
1651 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1653 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1661 /******************************************************************
1662 * GetUdpTable (IPHLPAPI.@)
1667 * pUdpTable [In/Out]
1676 DWORD WINAPI
GetUdpTable(PMIB_UDPTABLE pUdpTable
, PDWORD pdwSize
, BOOL bOrder
)
1680 TRACE("pUdpTable %p, pdwSize %p, bOrder %ld\n", pUdpTable
, pdwSize
,
1683 ret
= ERROR_INVALID_PARAMETER
;
1685 DWORD numEntries
= getNumUdpEntries();
1686 ULONG size
= sizeof(MIB_UDPTABLE
) + (numEntries
- 1) * sizeof(MIB_UDPROW
);
1688 if (!pUdpTable
|| *pdwSize
< size
) {
1690 ret
= ERROR_INSUFFICIENT_BUFFER
;
1693 PMIB_UDPTABLE table
= getUdpTable();
1696 size
= sizeof(MIB_UDPTABLE
) + (table
->dwNumEntries
- 1) *
1698 if (*pdwSize
< size
) {
1700 ret
= ERROR_INSUFFICIENT_BUFFER
;
1703 memcpy(pUdpTable
, table
, size
);
1705 qsort(pUdpTable
->table
, pUdpTable
->dwNumEntries
,
1706 sizeof(MIB_UDPROW
), UdpTableSorter
);
1712 ret
= ERROR_OUTOFMEMORY
;
1715 TRACE("returning %ld\n", ret
);
1720 /******************************************************************
1721 * GetUniDirectionalAdapterInfo (IPHLPAPI.@)
1726 * pIPIfInfo [In/Out]
1727 * dwOutBufLen [In/Out]
1734 DWORD WINAPI
GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo
, PULONG dwOutBufLen
)
1736 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo
, dwOutBufLen
);
1737 /* a unidirectional adapter?? not bloody likely! */
1738 return ERROR_NOT_SUPPORTED
;
1742 /******************************************************************
1743 * IpReleaseAddress (IPHLPAPI.@)
1748 * AdapterInfo [In/Out]
1755 DWORD WINAPI
IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1757 TRACE("AdapterInfo %p\n", AdapterInfo
);
1758 /* not a stub, never going to support this (and I never mark an adapter as
1759 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1760 return ERROR_NOT_SUPPORTED
;
1764 /******************************************************************
1765 * IpRenewAddress (IPHLPAPI.@)
1770 * AdapterInfo [In/Out]
1777 DWORD WINAPI
IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1779 TRACE("AdapterInfo %p\n", AdapterInfo
);
1780 /* not a stub, never going to support this (and I never mark an adapter as
1781 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1782 return ERROR_NOT_SUPPORTED
;
1786 /******************************************************************
1787 * NotifyAddrChange (IPHLPAPI.@)
1793 * overlapped [In/Out]
1800 DWORD WINAPI
NotifyAddrChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1802 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1804 /* marking Win2K+ functions not supported */
1805 return ERROR_NOT_SUPPORTED
;
1809 /******************************************************************
1810 * NotifyRouteChange (IPHLPAPI.@)
1816 * overlapped [In/Out]
1823 DWORD WINAPI
NotifyRouteChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1825 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1827 /* marking Win2K+ functions not supported */
1828 return ERROR_NOT_SUPPORTED
;
1832 /******************************************************************
1833 * SendARP (IPHLPAPI.@)
1841 * PhyAddrLen [In/Out]
1848 DWORD WINAPI
SendARP(IPAddr DestIP
, IPAddr SrcIP
, PULONG pMacAddr
, PULONG PhyAddrLen
)
1850 TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP
,
1851 SrcIP
, pMacAddr
, PhyAddrLen
);
1853 /* marking Win2K+ functions not supported */
1854 return ERROR_NOT_SUPPORTED
;
1858 /******************************************************************
1859 * SetIfEntry (IPHLPAPI.@)
1871 DWORD WINAPI
SetIfEntry(PMIB_IFROW pIfRow
)
1873 TRACE("pIfRow %p\n", pIfRow
);
1874 /* this is supposed to set an administratively interface up or down.
1875 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
1876 this sort of down is indistinguishable from other sorts of down (e.g. no
1879 return ERROR_NOT_SUPPORTED
;
1883 /******************************************************************
1884 * SetIpForwardEntry (IPHLPAPI.@)
1896 DWORD WINAPI
SetIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
1898 return setIpForwardEntry( pRoute
);
1902 /******************************************************************
1903 * SetIpNetEntry (IPHLPAPI.@)
1908 * pArpEntry [In/Out]
1915 DWORD WINAPI
SetIpNetEntry(PMIB_IPNETROW pArpEntry
)
1917 TRACE("pArpEntry %p\n", pArpEntry
);
1918 /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */
1924 /******************************************************************
1925 * SetIpStatistics (IPHLPAPI.@)
1937 DWORD WINAPI
SetIpStatistics(PMIB_IPSTATS pIpStats
)
1939 TRACE("pIpStats %p\n", pIpStats
);
1945 /******************************************************************
1946 * SetIpTTL (IPHLPAPI.@)
1958 DWORD WINAPI
SetIpTTL(UINT nTTL
)
1960 TRACE("nTTL %d\n", nTTL
);
1961 /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I
1962 want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */
1968 /******************************************************************
1969 * SetTcpEntry (IPHLPAPI.@)
1981 DWORD WINAPI
SetTcpEntry(PMIB_TCPROW pTcpRow
)
1983 TRACE("pTcpRow %p\n", pTcpRow
);
1989 /******************************************************************
1990 * UnenableRouter (IPHLPAPI.@)
1995 * pOverlapped [In/Out]
1996 * lpdwEnableCount [In/Out]
2003 DWORD WINAPI
UnenableRouter(OVERLAPPED
* pOverlapped
, LPDWORD lpdwEnableCount
)
2005 TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped
, lpdwEnableCount
);
2007 /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
2008 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
2009 marking Win2K+ functions not supported */
2010 return ERROR_NOT_SUPPORTED
;
2016 DWORD WINAPI
GetIpErrorString(IP_STATUS ErrorCode
,PWCHAR Buffer
,PDWORD Size
)
2026 PIP_ADAPTER_ORDER_MAP WINAPI
GetAdapterOrderMap(VOID
)
2035 DWORD WINAPI
GetAdaptersAddresses(ULONG Family
,DWORD Flags
,PVOID Reserved
,PIP_ADAPTER_ADDRESSES pAdapterAddresses
,PULONG pOutBufLen
)
2044 BOOL WINAPI
CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped
)
2053 DWORD WINAPI
GetBestInterfaceEx(struct sockaddr
*pDestAddr
,PDWORD pdwBestIfIndex
)
2062 DWORD WINAPI
NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO
**ppTable
,PDWORD pdwCount
,BOOL bOrder
,HANDLE hHeap
,DWORD dwFlags
)
2071 DWORD WINAPI
GetIcmpStatisticsEx(PMIB_ICMP_EX pStats
,DWORD dwFamily
)