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
)
617 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
618 PIP_ADAPTER_INFO ptr
= &pAdapterInfo
[ndx
];
619 DWORD addrLen
= sizeof(ptr
->Address
), type
;
621 getInterfaceNameByIndex(table
->indexes
[ndx
]);
623 /* on Win98 this is left empty, but whatever */
625 strncpy(ptr
->AdapterName
,ifname
,sizeof(ptr
->AdapterName
));
626 consumeInterfaceName(ifname
);
627 ptr
->AdapterName
[MAX_ADAPTER_NAME_LENGTH
] = '\0';
628 getInterfacePhysicalByIndex(table
->indexes
[ndx
], &addrLen
,
629 ptr
->Address
, &type
);
630 /* MS defines address length and type as UINT in some places and
631 DWORD in others, **sigh**. Don't want to assume that PUINT and
632 PDWORD are equiv (64-bit?) */
633 ptr
->AddressLength
= addrLen
;
635 ptr
->Index
= table
->indexes
[ndx
];
636 toIPAddressString(getInterfaceIPAddrByIndex(table
->indexes
[ndx
]),
637 ptr
->IpAddressList
.IpAddress
.String
);
638 toIPAddressString(getInterfaceMaskByIndex(table
->indexes
[ndx
]),
639 ptr
->IpAddressList
.IpMask
.String
);
641 ptr
->HaveWins
= TRUE
;
642 memcpy(ptr
->PrimaryWinsServer
.IpAddress
.String
,
643 primaryWINS
.String
, sizeof(primaryWINS
.String
));
644 memcpy(ptr
->SecondaryWinsServer
.IpAddress
.String
,
645 secondaryWINS
.String
, sizeof(secondaryWINS
.String
));
647 if (ndx
< table
->numIndexes
- 1)
648 ptr
->Next
= &pAdapterInfo
[ndx
+ 1];
657 ret
= ERROR_OUTOFMEMORY
;
663 TRACE("returning %ld\n", ret
);
668 /******************************************************************
669 * GetBestInterface (IPHLPAPI.@)
675 * pdwBestIfIndex [In/Out]
682 DWORD WINAPI
GetBestInterface(IPAddr dwDestAddr
, PDWORD pdwBestIfIndex
)
686 TRACE("dwDestAddr 0x%08lx, pdwBestIfIndex %p\n", dwDestAddr
, pdwBestIfIndex
);
688 ret
= ERROR_INVALID_PARAMETER
;
690 MIB_IPFORWARDROW ipRow
;
692 ret
= GetBestRoute(dwDestAddr
, 0, &ipRow
);
693 if (ret
== ERROR_SUCCESS
)
694 *pdwBestIfIndex
= ipRow
.dwForwardIfIndex
;
696 TRACE("returning %ld\n", ret
);
701 /******************************************************************
702 * GetBestRoute (IPHLPAPI.@)
716 DWORD WINAPI
GetBestRoute(DWORD dwDestAddr
, DWORD dwSourceAddr
, PMIB_IPFORWARDROW pBestRoute
)
718 PMIB_IPFORWARDTABLE table
;
721 TRACE("dwDestAddr 0x%08lx, dwSourceAddr 0x%08lx, pBestRoute %p\n", dwDestAddr
,
722 dwSourceAddr
, pBestRoute
);
724 return ERROR_INVALID_PARAMETER
;
726 AllocateAndGetIpForwardTableFromStack(&table
, FALSE
, GetProcessHeap(), 0);
728 DWORD ndx
, matchedBits
, matchedNdx
= 0;
730 for (ndx
= 0, matchedBits
= 0; ndx
< table
->dwNumEntries
; ndx
++) {
731 if ((dwDestAddr
& table
->table
[ndx
].dwForwardMask
) ==
732 (table
->table
[ndx
].dwForwardDest
& table
->table
[ndx
].dwForwardMask
)) {
733 DWORD numShifts
, mask
;
735 for (numShifts
= 0, mask
= table
->table
[ndx
].dwForwardMask
;
736 mask
&& !(mask
& 1); mask
>>= 1, numShifts
++)
738 if (numShifts
> matchedBits
) {
739 matchedBits
= numShifts
;
744 memcpy(pBestRoute
, &table
->table
[matchedNdx
], sizeof(MIB_IPFORWARDROW
));
745 HeapFree(GetProcessHeap(), 0, table
);
749 ret
= ERROR_OUTOFMEMORY
;
750 TRACE("returning %ld\n", ret
);
755 /******************************************************************
756 * GetFriendlyIfIndex (IPHLPAPI.@)
768 DWORD WINAPI
GetFriendlyIfIndex(DWORD IfIndex
)
770 /* windows doesn't validate these, either, just makes sure the top byte is
771 cleared. I assume my ifenum module never gives an index with the top
773 TRACE("returning %ld\n", IfIndex
);
778 /******************************************************************
779 * GetIcmpStatistics (IPHLPAPI.@)
791 DWORD WINAPI
GetIcmpStatistics(PMIB_ICMP pStats
)
795 TRACE("pStats %p\n", pStats
);
796 ret
= getICMPStats(pStats
);
797 TRACE("returning %ld\n", ret
);
802 /******************************************************************
803 * GetIfEntry (IPHLPAPI.@)
815 DWORD WINAPI
GetIfEntry(PMIB_IFROW pIfRow
)
820 TRACE("pIfRow %p\n", pIfRow
);
822 return ERROR_INVALID_PARAMETER
;
824 name
= getInterfaceNameByIndex(pIfRow
->dwIndex
);
826 ret
= getInterfaceEntryByIndex(pIfRow
->dwIndex
, pIfRow
);
828 ret
= getInterfaceStatsByName(name
, pIfRow
);
829 consumeInterfaceName(name
);
832 ret
= ERROR_INVALID_DATA
;
833 TRACE("returning %ld\n", ret
);
838 static int IfTableSorter(const void *a
, const void *b
)
843 ret
= ((PMIB_IFROW
)a
)->dwIndex
- ((PMIB_IFROW
)b
)->dwIndex
;
850 /******************************************************************
851 * GetIfTable (IPHLPAPI.@)
865 DWORD WINAPI
GetIfTable(PMIB_IFTABLE pIfTable
, PULONG pdwSize
, BOOL bOrder
)
869 TRACE("pIfTable %p, pdwSize %p, bOrder %ld\n", pdwSize
, pdwSize
,
872 ret
= ERROR_INVALID_PARAMETER
;
874 DWORD numInterfaces
= getNumInterfaces();
875 TRACE("GetIfTable: numInterfaces = %d\n", (int)numInterfaces
);
876 ULONG size
= sizeof(MIB_IFTABLE
) + (numInterfaces
- 1) * sizeof(MIB_IFROW
);
878 if (!pIfTable
|| *pdwSize
< size
) {
880 ret
= ERROR_INSUFFICIENT_BUFFER
;
883 InterfaceIndexTable
*table
= getInterfaceIndexTable();
886 size
= sizeof(MIB_IFTABLE
) + (table
->numIndexes
- 1) *
888 if (*pdwSize
< size
) {
890 ret
= ERROR_INSUFFICIENT_BUFFER
;
895 pIfTable
->dwNumEntries
= 0;
896 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
897 pIfTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
898 GetIfEntry(&pIfTable
->table
[ndx
]);
899 pIfTable
->dwNumEntries
++;
902 qsort(pIfTable
->table
, pIfTable
->dwNumEntries
, sizeof(MIB_IFROW
),
909 ret
= ERROR_OUTOFMEMORY
;
912 TRACE("returning %ld\n", ret
);
917 /******************************************************************
918 * GetInterfaceInfo (IPHLPAPI.@)
924 * dwOutBufLen [In/Out]
931 DWORD WINAPI
GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable
, PULONG dwOutBufLen
)
935 TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable
, dwOutBufLen
);
937 ret
= ERROR_INVALID_PARAMETER
;
939 DWORD numNonLoopbackInterfaces
= getNumNonLoopbackInterfaces();
940 DPRINT("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces
);
941 ULONG size
= sizeof(IP_INTERFACE_INFO
) + (numNonLoopbackInterfaces
) *
942 sizeof(IP_ADAPTER_INDEX_MAP
);
944 if (!pIfTable
|| *dwOutBufLen
< size
) {
946 ret
= ERROR_INSUFFICIENT_BUFFER
;
949 InterfaceIndexTable
*table
= getNonLoopbackInterfaceIndexTable();
950 DPRINT("table->numIndexes == 0x%x\n", table
->numIndexes
);
953 size
= sizeof(IP_INTERFACE_INFO
) + (table
->numIndexes
) *
954 sizeof(IP_ADAPTER_INDEX_MAP
);
955 if (*dwOutBufLen
< size
) {
957 ret
= ERROR_INSUFFICIENT_BUFFER
;
962 pIfTable
->NumAdapters
= 0;
963 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
964 const char *walker
, *name
;
967 pIfTable
->Adapter
[ndx
].Index
= table
->indexes
[ndx
];
968 name
= getInterfaceNameByIndex(table
->indexes
[ndx
]);
969 for (walker
= name
, assigner
= pIfTable
->Adapter
[ndx
].Name
;
971 assigner
- pIfTable
->Adapter
[ndx
].Name
< MAX_ADAPTER_NAME
- 1;
972 walker
++, assigner
++)
975 consumeInterfaceName(name
);
976 pIfTable
->NumAdapters
++;
983 ret
= ERROR_OUTOFMEMORY
;
986 TRACE("returning %ld\n", ret
);
991 static int IpAddrTableSorter(const void *a
, const void *b
)
996 ret
= ((PMIB_IPADDRROW
)a
)->dwAddr
- ((PMIB_IPADDRROW
)b
)->dwAddr
;
1003 /******************************************************************
1004 * GetIpAddrTable (IPHLPAPI.@)
1009 * pIpAddrTable [In/Out]
1018 DWORD WINAPI
GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable
, PULONG pdwSize
, BOOL bOrder
)
1022 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable
, pdwSize
,
1025 ret
= ERROR_INVALID_PARAMETER
;
1027 DWORD numInterfaces
= getNumInterfaces();
1028 ULONG size
= sizeof(MIB_IPADDRTABLE
) + (numInterfaces
- 1) *
1029 sizeof(MIB_IPADDRROW
);
1031 if (!pIpAddrTable
|| *pdwSize
< size
) {
1033 ret
= ERROR_INSUFFICIENT_BUFFER
;
1036 InterfaceIndexTable
*table
= getInterfaceIndexTable();
1039 size
= sizeof(MIB_IPADDRTABLE
) + (table
->numIndexes
- 1) *
1040 sizeof(MIB_IPADDRROW
);
1041 if (*pdwSize
< size
) {
1043 ret
= ERROR_INSUFFICIENT_BUFFER
;
1048 pIpAddrTable
->dwNumEntries
= 0;
1049 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
1050 pIpAddrTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
1051 pIpAddrTable
->table
[ndx
].dwAddr
=
1052 getInterfaceIPAddrByIndex(table
->indexes
[ndx
]);
1053 pIpAddrTable
->table
[ndx
].dwMask
=
1054 getInterfaceMaskByIndex(table
->indexes
[ndx
]);
1055 /* the dwBCastAddr member isn't the broadcast address, it indicates
1056 * whether the interface uses the 1's broadcast address (1) or the
1057 * 0's broadcast address (0).
1059 bcast
= getInterfaceBCastAddrByIndex(table
->indexes
[ndx
]);
1060 pIpAddrTable
->table
[ndx
].dwBCastAddr
=
1061 (bcast
& pIpAddrTable
->table
[ndx
].dwMask
) ? 1 : 0;
1062 /* FIXME: hardcoded reasm size, not sure where to get it */
1063 pIpAddrTable
->table
[ndx
].dwReasmSize
= 65535;
1064 pIpAddrTable
->table
[ndx
].unused1
= 0;
1065 pIpAddrTable
->table
[ndx
].wType
= 0; /* aka unused2 */
1066 pIpAddrTable
->dwNumEntries
++;
1069 qsort(pIpAddrTable
->table
, pIpAddrTable
->dwNumEntries
,
1070 sizeof(MIB_IPADDRROW
), IpAddrTableSorter
);
1076 ret
= ERROR_OUTOFMEMORY
;
1079 TRACE("returning %ld\n", ret
);
1084 static int IpForwardTableSorter(const void *a
, const void *b
)
1089 PMIB_IPFORWARDROW rowA
= (PMIB_IPFORWARDROW
)a
, rowB
= (PMIB_IPFORWARDROW
)b
;
1091 ret
= rowA
->dwForwardDest
- rowB
->dwForwardDest
;
1093 ret
= rowA
->dwForwardProto
- rowB
->dwForwardProto
;
1095 ret
= rowA
->dwForwardPolicy
- rowB
->dwForwardPolicy
;
1097 ret
= rowA
->dwForwardNextHop
- rowB
->dwForwardNextHop
;
1107 /******************************************************************
1108 * GetIpForwardTable (IPHLPAPI.@)
1113 * pIpForwardTable [In/Out]
1122 DWORD WINAPI
GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable
, PULONG pdwSize
, BOOL bOrder
)
1126 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable
,
1127 pdwSize
, (DWORD
)bOrder
);
1129 ret
= ERROR_INVALID_PARAMETER
;
1131 DWORD numRoutes
= getNumRoutes();
1132 ULONG sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (numRoutes
- 1) *
1133 sizeof(MIB_IPFORWARDROW
);
1135 if (!pIpForwardTable
|| *pdwSize
< sizeNeeded
) {
1136 *pdwSize
= sizeNeeded
;
1137 ret
= ERROR_INSUFFICIENT_BUFFER
;
1140 RouteTable
*table
= getRouteTable();
1142 sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (table
->numRoutes
- 1) *
1143 sizeof(MIB_IPFORWARDROW
);
1144 if (*pdwSize
< sizeNeeded
) {
1145 *pdwSize
= sizeNeeded
;
1146 ret
= ERROR_INSUFFICIENT_BUFFER
;
1151 pIpForwardTable
->dwNumEntries
= table
->numRoutes
;
1152 for (ndx
= 0; ndx
< numRoutes
; ndx
++) {
1153 pIpForwardTable
->table
[ndx
].dwForwardIfIndex
=
1154 table
->routes
[ndx
].ifIndex
;
1155 pIpForwardTable
->table
[ndx
].dwForwardDest
=
1156 table
->routes
[ndx
].dest
;
1157 pIpForwardTable
->table
[ndx
].dwForwardMask
=
1158 table
->routes
[ndx
].mask
;
1159 pIpForwardTable
->table
[ndx
].dwForwardPolicy
= 0;
1160 pIpForwardTable
->table
[ndx
].dwForwardNextHop
=
1161 table
->routes
[ndx
].gateway
;
1162 /* FIXME: this type is appropriate for local interfaces; may not
1163 always be appropriate */
1164 pIpForwardTable
->table
[ndx
].dwForwardType
= MIB_IPROUTE_TYPE_DIRECT
;
1165 /* FIXME: other protos might be appropriate, e.g. the default route
1166 is typically set with MIB_IPPROTO_NETMGMT instead */
1167 pIpForwardTable
->table
[ndx
].dwForwardProto
= MIB_IPPROTO_LOCAL
;
1168 /* punt on age and AS */
1169 pIpForwardTable
->table
[ndx
].dwForwardAge
= 0;
1170 pIpForwardTable
->table
[ndx
].dwForwardNextHopAS
= 0;
1171 pIpForwardTable
->table
[ndx
].dwForwardMetric1
=
1172 table
->routes
[ndx
].metric
;
1173 /* rest of the metrics are 0.. */
1174 pIpForwardTable
->table
[ndx
].dwForwardMetric2
= 0;
1175 pIpForwardTable
->table
[ndx
].dwForwardMetric3
= 0;
1176 pIpForwardTable
->table
[ndx
].dwForwardMetric4
= 0;
1177 pIpForwardTable
->table
[ndx
].dwForwardMetric5
= 0;
1180 qsort(pIpForwardTable
->table
, pIpForwardTable
->dwNumEntries
,
1181 sizeof(MIB_IPFORWARDROW
), IpForwardTableSorter
);
1187 ret
= ERROR_OUTOFMEMORY
;
1190 TRACE("returning %ld\n", ret
);
1195 static int IpNetTableSorter(const void *a
, const void *b
)
1200 ret
= ((PMIB_IPNETROW
)a
)->dwAddr
- ((PMIB_IPNETROW
)b
)->dwAddr
;
1207 /******************************************************************
1208 * GetIpNetTable (IPHLPAPI.@)
1213 * pIpNetTable [In/Out]
1222 DWORD WINAPI
GetIpNetTable(PMIB_IPNETTABLE pIpNetTable
, PULONG pdwSize
, BOOL bOrder
)
1226 TRACE("pIpNetTable %p, pdwSize %p, bOrder %ld\n", pIpNetTable
, pdwSize
,
1229 ret
= ERROR_INVALID_PARAMETER
;
1231 DWORD numEntries
= getNumArpEntries();
1232 ULONG size
= sizeof(MIB_IPNETTABLE
) + (numEntries
- 1) *
1233 sizeof(MIB_IPNETROW
);
1235 if (!pIpNetTable
|| *pdwSize
< size
) {
1237 ret
= ERROR_INSUFFICIENT_BUFFER
;
1240 PMIB_IPNETTABLE table
= getArpTable();
1243 size
= sizeof(MIB_IPNETTABLE
) + (table
->dwNumEntries
- 1) *
1244 sizeof(MIB_IPNETROW
);
1245 if (*pdwSize
< size
) {
1247 ret
= ERROR_INSUFFICIENT_BUFFER
;
1250 memcpy(pIpNetTable
, table
, size
);
1252 qsort(pIpNetTable
->table
, pIpNetTable
->dwNumEntries
,
1253 sizeof(MIB_IPNETROW
), IpNetTableSorter
);
1259 ret
= ERROR_OUTOFMEMORY
;
1262 TRACE("returning %ld\n", ret
);
1267 /******************************************************************
1268 * GetIpStatistics (IPHLPAPI.@)
1280 DWORD WINAPI
GetIpStatistics(PMIB_IPSTATS pStats
)
1282 return GetIpStatisticsEx(pStats
, PF_INET
);
1285 /******************************************************************
1286 * GetIpStatisticsEx (IPHLPAPI.@)
1299 DWORD WINAPI
GetIpStatisticsEx(PMIB_IPSTATS pStats
, DWORD dwFamily
)
1303 TRACE("pStats %p\n", pStats
);
1304 ret
= getIPStats(pStats
, dwFamily
);
1305 TRACE("returning %ld\n", ret
);
1309 /******************************************************************
1310 * GetNetworkParams (IPHLPAPI.@)
1315 * pFixedInfo [In/Out]
1316 * pOutBufLen [In/Out]
1323 DWORD WINAPI
GetNetworkParams(PFIXED_INFO pFixedInfo
, PULONG pOutBufLen
)
1328 PIPHLP_RES_INFO resInfo
;
1330 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo
, pOutBufLen
);
1332 return ERROR_INVALID_PARAMETER
;
1334 resInfo
= getResInfo();
1336 return ERROR_OUTOFMEMORY
;
1338 size
= sizeof(FIXED_INFO
) + (resInfo
->riCount
> 0 ? (resInfo
->riCount
- 1) *
1339 sizeof(IP_ADDR_STRING
) : 0);
1340 if (!pFixedInfo
|| *pOutBufLen
< size
) {
1342 disposeResInfo( resInfo
);
1343 return ERROR_BUFFER_OVERFLOW
;
1346 memset(pFixedInfo
, 0, size
);
1347 size
= sizeof(pFixedInfo
->HostName
);
1348 GetComputerNameExA(ComputerNameDnsHostname
, pFixedInfo
->HostName
, &size
);
1349 size
= sizeof(pFixedInfo
->DomainName
);
1350 GetComputerNameExA(ComputerNameDnsDomain
, pFixedInfo
->DomainName
, &size
);
1352 TRACE("GetComputerNameExA: %s\n", pFixedInfo
->DomainName
);
1354 if (resInfo
->riCount
> 0) {
1355 PIP_ADDR_STRING ptr
;
1358 for (i
= 0, ptr
= &pFixedInfo
->DnsServerList
; i
< resInfo
->riCount
&& ptr
;
1359 i
++, ptr
= ptr
->Next
) {
1360 struct sockaddr_in
*addr_v4
=
1361 (struct sockaddr_in
*)&resInfo
->riAddressList
[i
];
1363 (addr_v4
->sin_addr
.s_addr
,
1364 ptr
->IpAddress
.String
);
1365 if (i
== resInfo
->riCount
- 1)
1368 ptr
->Next
= (PIP_ADDR_STRING
)((LPBYTE
)pFixedInfo
+ sizeof(FIXED_INFO
));
1370 ptr
->Next
= (PIP_ADDR_STRING
)((PBYTE
)ptr
+ sizeof(IP_ADDR_STRING
));
1373 pFixedInfo
->NodeType
= HYBRID_NODETYPE
;
1374 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1375 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ
, &hKey
);
1376 if (regReturn
!= ERROR_SUCCESS
)
1377 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1378 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ
,
1380 if (regReturn
== ERROR_SUCCESS
)
1382 DWORD size
= sizeof(pFixedInfo
->ScopeId
);
1384 RegQueryValueExA(hKey
, "ScopeID", NULL
, NULL
, pFixedInfo
->ScopeId
, &size
);
1388 disposeResInfo( resInfo
);
1389 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
1390 I suppose could also check for a listener on port 53 to set EnableDns */
1392 TRACE("returning %ld\n", ret
);
1398 /******************************************************************
1399 * GetNumberOfInterfaces (IPHLPAPI.@)
1411 DWORD WINAPI
GetNumberOfInterfaces(PDWORD pdwNumIf
)
1415 TRACE("pdwNumIf %p\n", pdwNumIf
);
1417 ret
= ERROR_INVALID_PARAMETER
;
1419 *pdwNumIf
= getNumInterfaces();
1422 TRACE("returning %ld\n", ret
);
1427 /******************************************************************
1428 * GetPerAdapterInfo (IPHLPAPI.@)
1434 * pPerAdapterInfo [In/Out]
1435 * pOutBufLen [In/Out]
1442 DWORD WINAPI
GetPerAdapterInfo(ULONG IfIndex
, PIP_PER_ADAPTER_INFO pPerAdapterInfo
, PULONG pOutBufLen
)
1444 TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex
,
1445 pPerAdapterInfo
, pOutBufLen
);
1447 /* marking Win2K+ functions not supported */
1448 return ERROR_NOT_SUPPORTED
;
1452 /******************************************************************
1453 * GetRTTAndHopCount (IPHLPAPI.@)
1458 * DestIpAddress [In]
1468 BOOL WINAPI
GetRTTAndHopCount(IPAddr DestIpAddress
, PULONG HopCount
, ULONG MaxHops
, PULONG RTT
)
1470 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
1471 DestIpAddress
, HopCount
, MaxHops
, RTT
);
1477 /******************************************************************
1478 * GetTcpStatisticsEx (IPHLPAPI.@)
1491 DWORD WINAPI
GetTcpStatisticsEx(PMIB_TCPSTATS pStats
, DWORD dwFamily
)
1495 TRACE("pStats %p\n", pStats
);
1496 ret
= getTCPStats(pStats
, dwFamily
);
1497 TRACE("returning %ld\n", ret
);
1501 /******************************************************************
1502 * GetTcpStatistics (IPHLPAPI.@)
1514 DWORD WINAPI
GetTcpStatistics(PMIB_TCPSTATS pStats
)
1516 return GetTcpStatisticsEx(pStats
, PF_INET
);
1520 static int TcpTableSorter(const void *a
, const void *b
)
1525 PMIB_TCPROW rowA
= (PMIB_TCPROW
)a
, rowB
= (PMIB_TCPROW
)b
;
1527 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1529 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1531 ret
= rowA
->dwRemoteAddr
- rowB
->dwRemoteAddr
;
1533 ret
= rowA
->dwRemotePort
- rowB
->dwRemotePort
;
1543 /******************************************************************
1544 * GetTcpTable (IPHLPAPI.@)
1549 * pTcpTable [In/Out]
1558 DWORD WINAPI
GetTcpTable(PMIB_TCPTABLE pTcpTable
, PDWORD pdwSize
, BOOL bOrder
)
1562 TRACE("pTcpTable %p, pdwSize %p, bOrder %ld\n", pTcpTable
, pdwSize
,
1565 ret
= ERROR_INVALID_PARAMETER
;
1567 DWORD numEntries
= getNumTcpEntries();
1568 ULONG size
= sizeof(MIB_TCPTABLE
) + (numEntries
- 1) * sizeof(MIB_TCPROW
);
1570 if (!pTcpTable
|| *pdwSize
< size
) {
1572 ret
= ERROR_INSUFFICIENT_BUFFER
;
1575 PMIB_TCPTABLE table
= getTcpTable();
1578 size
= sizeof(MIB_TCPTABLE
) + (table
->dwNumEntries
- 1) *
1580 if (*pdwSize
< size
) {
1582 ret
= ERROR_INSUFFICIENT_BUFFER
;
1585 memcpy(pTcpTable
, table
, size
);
1587 qsort(pTcpTable
->table
, pTcpTable
->dwNumEntries
,
1588 sizeof(MIB_TCPROW
), TcpTableSorter
);
1594 ret
= ERROR_OUTOFMEMORY
;
1597 TRACE("returning %ld\n", ret
);
1602 /******************************************************************
1603 * GetUdpStatisticsEx (IPHLPAPI.@)
1616 DWORD WINAPI
GetUdpStatisticsEx(PMIB_UDPSTATS pStats
, DWORD dwFamily
)
1620 TRACE("pStats %p\n", pStats
);
1621 ret
= getUDPStats(pStats
, dwFamily
);
1622 TRACE("returning %ld\n", ret
);
1626 /******************************************************************
1627 * GetUdpStatistics (IPHLPAPI.@)
1639 DWORD WINAPI
GetUdpStatistics(PMIB_UDPSTATS pStats
)
1641 return GetUdpStatisticsEx(pStats
, PF_INET
);
1645 static int UdpTableSorter(const void *a
, const void *b
)
1650 PMIB_UDPROW rowA
= (PMIB_UDPROW
)a
, rowB
= (PMIB_UDPROW
)b
;
1652 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1654 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1662 /******************************************************************
1663 * GetUdpTable (IPHLPAPI.@)
1668 * pUdpTable [In/Out]
1677 DWORD WINAPI
GetUdpTable(PMIB_UDPTABLE pUdpTable
, PDWORD pdwSize
, BOOL bOrder
)
1681 TRACE("pUdpTable %p, pdwSize %p, bOrder %ld\n", pUdpTable
, pdwSize
,
1684 ret
= ERROR_INVALID_PARAMETER
;
1686 DWORD numEntries
= getNumUdpEntries();
1687 ULONG size
= sizeof(MIB_UDPTABLE
) + (numEntries
- 1) * sizeof(MIB_UDPROW
);
1689 if (!pUdpTable
|| *pdwSize
< size
) {
1691 ret
= ERROR_INSUFFICIENT_BUFFER
;
1694 PMIB_UDPTABLE table
= getUdpTable();
1697 size
= sizeof(MIB_UDPTABLE
) + (table
->dwNumEntries
- 1) *
1699 if (*pdwSize
< size
) {
1701 ret
= ERROR_INSUFFICIENT_BUFFER
;
1704 memcpy(pUdpTable
, table
, size
);
1706 qsort(pUdpTable
->table
, pUdpTable
->dwNumEntries
,
1707 sizeof(MIB_UDPROW
), UdpTableSorter
);
1713 ret
= ERROR_OUTOFMEMORY
;
1716 TRACE("returning %ld\n", ret
);
1721 /******************************************************************
1722 * GetUniDirectionalAdapterInfo (IPHLPAPI.@)
1727 * pIPIfInfo [In/Out]
1728 * dwOutBufLen [In/Out]
1735 DWORD WINAPI
GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo
, PULONG dwOutBufLen
)
1737 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo
, dwOutBufLen
);
1738 /* a unidirectional adapter?? not bloody likely! */
1739 return ERROR_NOT_SUPPORTED
;
1743 /******************************************************************
1744 * IpReleaseAddress (IPHLPAPI.@)
1749 * AdapterInfo [In/Out]
1756 DWORD WINAPI
IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1758 TRACE("AdapterInfo %p\n", AdapterInfo
);
1759 /* not a stub, never going to support this (and I never mark an adapter as
1760 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1761 return ERROR_NOT_SUPPORTED
;
1765 /******************************************************************
1766 * IpRenewAddress (IPHLPAPI.@)
1771 * AdapterInfo [In/Out]
1778 DWORD WINAPI
IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1780 TRACE("AdapterInfo %p\n", AdapterInfo
);
1781 /* not a stub, never going to support this (and I never mark an adapter as
1782 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1783 return ERROR_NOT_SUPPORTED
;
1787 /******************************************************************
1788 * NotifyAddrChange (IPHLPAPI.@)
1794 * overlapped [In/Out]
1801 DWORD WINAPI
NotifyAddrChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1803 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1805 /* marking Win2K+ functions not supported */
1806 return ERROR_NOT_SUPPORTED
;
1810 /******************************************************************
1811 * NotifyRouteChange (IPHLPAPI.@)
1817 * overlapped [In/Out]
1824 DWORD WINAPI
NotifyRouteChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1826 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1828 /* marking Win2K+ functions not supported */
1829 return ERROR_NOT_SUPPORTED
;
1833 /******************************************************************
1834 * SendARP (IPHLPAPI.@)
1842 * PhyAddrLen [In/Out]
1849 DWORD WINAPI
SendARP(IPAddr DestIP
, IPAddr SrcIP
, PULONG pMacAddr
, PULONG PhyAddrLen
)
1851 TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP
,
1852 SrcIP
, pMacAddr
, PhyAddrLen
);
1854 /* marking Win2K+ functions not supported */
1855 return ERROR_NOT_SUPPORTED
;
1859 /******************************************************************
1860 * SetIfEntry (IPHLPAPI.@)
1872 DWORD WINAPI
SetIfEntry(PMIB_IFROW pIfRow
)
1874 TRACE("pIfRow %p\n", pIfRow
);
1875 /* this is supposed to set an administratively interface up or down.
1876 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
1877 this sort of down is indistinguishable from other sorts of down (e.g. no
1880 return ERROR_NOT_SUPPORTED
;
1884 /******************************************************************
1885 * SetIpForwardEntry (IPHLPAPI.@)
1897 DWORD WINAPI
SetIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
1899 return setIpForwardEntry( pRoute
);
1903 /******************************************************************
1904 * SetIpNetEntry (IPHLPAPI.@)
1909 * pArpEntry [In/Out]
1916 DWORD WINAPI
SetIpNetEntry(PMIB_IPNETROW pArpEntry
)
1918 TRACE("pArpEntry %p\n", pArpEntry
);
1919 /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */
1925 /******************************************************************
1926 * SetIpStatistics (IPHLPAPI.@)
1938 DWORD WINAPI
SetIpStatistics(PMIB_IPSTATS pIpStats
)
1940 TRACE("pIpStats %p\n", pIpStats
);
1946 /******************************************************************
1947 * SetIpTTL (IPHLPAPI.@)
1959 DWORD WINAPI
SetIpTTL(UINT nTTL
)
1961 TRACE("nTTL %d\n", nTTL
);
1962 /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I
1963 want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */
1969 /******************************************************************
1970 * SetTcpEntry (IPHLPAPI.@)
1982 DWORD WINAPI
SetTcpEntry(PMIB_TCPROW pTcpRow
)
1984 TRACE("pTcpRow %p\n", pTcpRow
);
1990 /******************************************************************
1991 * UnenableRouter (IPHLPAPI.@)
1996 * pOverlapped [In/Out]
1997 * lpdwEnableCount [In/Out]
2004 DWORD WINAPI
UnenableRouter(OVERLAPPED
* pOverlapped
, LPDWORD lpdwEnableCount
)
2006 TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped
, lpdwEnableCount
);
2008 /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
2009 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
2010 marking Win2K+ functions not supported */
2011 return ERROR_NOT_SUPPORTED
;
2017 DWORD WINAPI
GetIpErrorString(IP_STATUS ErrorCode
,PWCHAR Buffer
,PDWORD Size
)
2027 PIP_ADAPTER_ORDER_MAP WINAPI
GetAdapterOrderMap(VOID
)
2036 DWORD WINAPI
GetAdaptersAddresses(ULONG Family
,DWORD Flags
,PVOID Reserved
,PIP_ADAPTER_ADDRESSES pAdapterAddresses
,PULONG pOutBufLen
)
2045 BOOL WINAPI
CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped
)
2054 DWORD WINAPI
GetBestInterfaceEx(struct sockaddr
*pDestAddr
,PDWORD pdwBestIfIndex
)
2063 DWORD WINAPI
NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO
**ppTable
,PDWORD pdwCount
,BOOL bOrder
,HANDLE hHeap
,DWORD dwFlags
)
2072 DWORD WINAPI
GetIcmpStatisticsEx(PMIB_ICMP_EX pStats
,DWORD dwFamily
)