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 numInterfaces
= getNumInterfaces();
939 ULONG size
= sizeof(IP_INTERFACE_INFO
) + (numInterfaces
- 1) *
940 sizeof(IP_ADAPTER_INDEX_MAP
);
942 if (!pIfTable
|| *dwOutBufLen
< size
) {
944 ret
= ERROR_INSUFFICIENT_BUFFER
;
947 InterfaceIndexTable
*table
= getInterfaceIndexTable();
950 size
= sizeof(IP_INTERFACE_INFO
) + (table
->numIndexes
- 1) *
951 sizeof(IP_ADAPTER_INDEX_MAP
);
952 if (*dwOutBufLen
< size
) {
954 ret
= ERROR_INSUFFICIENT_BUFFER
;
959 pIfTable
->NumAdapters
= 0;
960 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
961 const char *walker
, *name
;
964 pIfTable
->Adapter
[ndx
].Index
= table
->indexes
[ndx
];
965 name
= getInterfaceNameByIndex(table
->indexes
[ndx
]);
966 for (walker
= name
, assigner
= pIfTable
->Adapter
[ndx
].Name
;
968 assigner
- pIfTable
->Adapter
[ndx
].Name
< MAX_ADAPTER_NAME
- 1;
969 walker
++, assigner
++)
972 consumeInterfaceName(name
);
973 pIfTable
->NumAdapters
++;
980 ret
= ERROR_OUTOFMEMORY
;
983 TRACE("returning %ld\n", ret
);
988 static int IpAddrTableSorter(const void *a
, const void *b
)
993 ret
= ((PMIB_IPADDRROW
)a
)->dwAddr
- ((PMIB_IPADDRROW
)b
)->dwAddr
;
1000 /******************************************************************
1001 * GetIpAddrTable (IPHLPAPI.@)
1006 * pIpAddrTable [In/Out]
1015 DWORD WINAPI
GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable
, PULONG pdwSize
, BOOL bOrder
)
1019 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable
, pdwSize
,
1022 ret
= ERROR_INVALID_PARAMETER
;
1024 DWORD numInterfaces
= getNumInterfaces();
1025 ULONG size
= sizeof(MIB_IPADDRTABLE
) + (numInterfaces
- 1) *
1026 sizeof(MIB_IPADDRROW
);
1028 if (!pIpAddrTable
|| *pdwSize
< size
) {
1030 ret
= ERROR_INSUFFICIENT_BUFFER
;
1033 InterfaceIndexTable
*table
= getInterfaceIndexTable();
1036 size
= sizeof(MIB_IPADDRTABLE
) + (table
->numIndexes
- 1) *
1037 sizeof(MIB_IPADDRROW
);
1038 if (*pdwSize
< size
) {
1040 ret
= ERROR_INSUFFICIENT_BUFFER
;
1045 pIpAddrTable
->dwNumEntries
= 0;
1046 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
1047 pIpAddrTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
1048 pIpAddrTable
->table
[ndx
].dwAddr
=
1049 getInterfaceIPAddrByIndex(table
->indexes
[ndx
]);
1050 pIpAddrTable
->table
[ndx
].dwMask
=
1051 getInterfaceMaskByIndex(table
->indexes
[ndx
]);
1052 /* the dwBCastAddr member isn't the broadcast address, it indicates
1053 * whether the interface uses the 1's broadcast address (1) or the
1054 * 0's broadcast address (0).
1056 bcast
= getInterfaceBCastAddrByIndex(table
->indexes
[ndx
]);
1057 pIpAddrTable
->table
[ndx
].dwBCastAddr
=
1058 (bcast
& pIpAddrTable
->table
[ndx
].dwMask
) ? 1 : 0;
1059 /* FIXME: hardcoded reasm size, not sure where to get it */
1060 pIpAddrTable
->table
[ndx
].dwReasmSize
= 65535;
1061 pIpAddrTable
->table
[ndx
].unused1
= 0;
1062 pIpAddrTable
->table
[ndx
].wType
= 0; /* aka unused2 */
1063 pIpAddrTable
->dwNumEntries
++;
1066 qsort(pIpAddrTable
->table
, pIpAddrTable
->dwNumEntries
,
1067 sizeof(MIB_IPADDRROW
), IpAddrTableSorter
);
1073 ret
= ERROR_OUTOFMEMORY
;
1076 TRACE("returning %ld\n", ret
);
1081 static int IpForwardTableSorter(const void *a
, const void *b
)
1086 PMIB_IPFORWARDROW rowA
= (PMIB_IPFORWARDROW
)a
, rowB
= (PMIB_IPFORWARDROW
)b
;
1088 ret
= rowA
->dwForwardDest
- rowB
->dwForwardDest
;
1090 ret
= rowA
->dwForwardProto
- rowB
->dwForwardProto
;
1092 ret
= rowA
->dwForwardPolicy
- rowB
->dwForwardPolicy
;
1094 ret
= rowA
->dwForwardNextHop
- rowB
->dwForwardNextHop
;
1104 /******************************************************************
1105 * GetIpForwardTable (IPHLPAPI.@)
1110 * pIpForwardTable [In/Out]
1119 DWORD WINAPI
GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable
, PULONG pdwSize
, BOOL bOrder
)
1123 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable
,
1124 pdwSize
, (DWORD
)bOrder
);
1126 ret
= ERROR_INVALID_PARAMETER
;
1128 DWORD numRoutes
= getNumRoutes();
1129 ULONG sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (numRoutes
- 1) *
1130 sizeof(MIB_IPFORWARDROW
);
1132 if (!pIpForwardTable
|| *pdwSize
< sizeNeeded
) {
1133 *pdwSize
= sizeNeeded
;
1134 ret
= ERROR_INSUFFICIENT_BUFFER
;
1137 RouteTable
*table
= getRouteTable();
1139 sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (table
->numRoutes
- 1) *
1140 sizeof(MIB_IPFORWARDROW
);
1141 if (*pdwSize
< sizeNeeded
) {
1142 *pdwSize
= sizeNeeded
;
1143 ret
= ERROR_INSUFFICIENT_BUFFER
;
1148 pIpForwardTable
->dwNumEntries
= table
->numRoutes
;
1149 for (ndx
= 0; ndx
< numRoutes
; ndx
++) {
1150 pIpForwardTable
->table
[ndx
].dwForwardIfIndex
=
1151 table
->routes
[ndx
].ifIndex
;
1152 pIpForwardTable
->table
[ndx
].dwForwardDest
=
1153 table
->routes
[ndx
].dest
;
1154 pIpForwardTable
->table
[ndx
].dwForwardMask
=
1155 table
->routes
[ndx
].mask
;
1156 pIpForwardTable
->table
[ndx
].dwForwardPolicy
= 0;
1157 pIpForwardTable
->table
[ndx
].dwForwardNextHop
=
1158 table
->routes
[ndx
].gateway
;
1159 /* FIXME: this type is appropriate for local interfaces; may not
1160 always be appropriate */
1161 pIpForwardTable
->table
[ndx
].dwForwardType
= MIB_IPROUTE_TYPE_DIRECT
;
1162 /* FIXME: other protos might be appropriate, e.g. the default route
1163 is typically set with MIB_IPPROTO_NETMGMT instead */
1164 pIpForwardTable
->table
[ndx
].dwForwardProto
= MIB_IPPROTO_LOCAL
;
1165 /* punt on age and AS */
1166 pIpForwardTable
->table
[ndx
].dwForwardAge
= 0;
1167 pIpForwardTable
->table
[ndx
].dwForwardNextHopAS
= 0;
1168 pIpForwardTable
->table
[ndx
].dwForwardMetric1
=
1169 table
->routes
[ndx
].metric
;
1170 /* rest of the metrics are 0.. */
1171 pIpForwardTable
->table
[ndx
].dwForwardMetric2
= 0;
1172 pIpForwardTable
->table
[ndx
].dwForwardMetric3
= 0;
1173 pIpForwardTable
->table
[ndx
].dwForwardMetric4
= 0;
1174 pIpForwardTable
->table
[ndx
].dwForwardMetric5
= 0;
1177 qsort(pIpForwardTable
->table
, pIpForwardTable
->dwNumEntries
,
1178 sizeof(MIB_IPFORWARDROW
), IpForwardTableSorter
);
1184 ret
= ERROR_OUTOFMEMORY
;
1187 TRACE("returning %ld\n", ret
);
1192 static int IpNetTableSorter(const void *a
, const void *b
)
1197 ret
= ((PMIB_IPNETROW
)a
)->dwAddr
- ((PMIB_IPNETROW
)b
)->dwAddr
;
1204 /******************************************************************
1205 * GetIpNetTable (IPHLPAPI.@)
1210 * pIpNetTable [In/Out]
1219 DWORD WINAPI
GetIpNetTable(PMIB_IPNETTABLE pIpNetTable
, PULONG pdwSize
, BOOL bOrder
)
1223 TRACE("pIpNetTable %p, pdwSize %p, bOrder %ld\n", pIpNetTable
, pdwSize
,
1226 ret
= ERROR_INVALID_PARAMETER
;
1228 DWORD numEntries
= getNumArpEntries();
1229 ULONG size
= sizeof(MIB_IPNETTABLE
) + (numEntries
- 1) *
1230 sizeof(MIB_IPNETROW
);
1232 if (!pIpNetTable
|| *pdwSize
< size
) {
1234 ret
= ERROR_INSUFFICIENT_BUFFER
;
1237 PMIB_IPNETTABLE table
= getArpTable();
1240 size
= sizeof(MIB_IPNETTABLE
) + (table
->dwNumEntries
- 1) *
1241 sizeof(MIB_IPNETROW
);
1242 if (*pdwSize
< size
) {
1244 ret
= ERROR_INSUFFICIENT_BUFFER
;
1247 memcpy(pIpNetTable
, table
, size
);
1249 qsort(pIpNetTable
->table
, pIpNetTable
->dwNumEntries
,
1250 sizeof(MIB_IPNETROW
), IpNetTableSorter
);
1256 ret
= ERROR_OUTOFMEMORY
;
1259 TRACE("returning %ld\n", ret
);
1264 /******************************************************************
1265 * GetIpStatistics (IPHLPAPI.@)
1277 DWORD WINAPI
GetIpStatistics(PMIB_IPSTATS pStats
)
1279 return GetIpStatisticsEx(pStats
, PF_INET
);
1282 /******************************************************************
1283 * GetIpStatisticsEx (IPHLPAPI.@)
1296 DWORD WINAPI
GetIpStatisticsEx(PMIB_IPSTATS pStats
, DWORD dwFamily
)
1300 TRACE("pStats %p\n", pStats
);
1301 ret
= getIPStats(pStats
, dwFamily
);
1302 TRACE("returning %ld\n", ret
);
1306 /******************************************************************
1307 * GetNetworkParams (IPHLPAPI.@)
1312 * pFixedInfo [In/Out]
1313 * pOutBufLen [In/Out]
1320 DWORD WINAPI
GetNetworkParams(PFIXED_INFO pFixedInfo
, PULONG pOutBufLen
)
1325 PIPHLP_RES_INFO resInfo
;
1327 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo
, pOutBufLen
);
1329 return ERROR_INVALID_PARAMETER
;
1331 resInfo
= getResInfo();
1333 return ERROR_OUTOFMEMORY
;
1335 size
= sizeof(FIXED_INFO
) + (resInfo
->riCount
> 0 ? (resInfo
->riCount
- 1) *
1336 sizeof(IP_ADDR_STRING
) : 0);
1337 if (!pFixedInfo
|| *pOutBufLen
< size
) {
1339 disposeResInfo( resInfo
);
1340 return ERROR_BUFFER_OVERFLOW
;
1343 memset(pFixedInfo
, 0, size
);
1344 size
= sizeof(pFixedInfo
->HostName
);
1345 GetComputerNameExA(ComputerNameDnsHostname
, pFixedInfo
->HostName
, &size
);
1346 size
= sizeof(pFixedInfo
->DomainName
);
1347 GetComputerNameExA(ComputerNameDnsDomain
, pFixedInfo
->DomainName
, &size
);
1349 TRACE("GetComputerNameExA: %s\n", pFixedInfo
->DomainName
);
1351 if (resInfo
->riCount
> 0) {
1352 PIP_ADDR_STRING ptr
;
1355 for (i
= 0, ptr
= &pFixedInfo
->DnsServerList
; i
< resInfo
->riCount
&& ptr
;
1356 i
++, ptr
= ptr
->Next
) {
1357 struct sockaddr_in
*addr_v4
=
1358 (struct sockaddr_in
*)&resInfo
->riAddressList
[i
];
1360 (addr_v4
->sin_addr
.s_addr
,
1361 ptr
->IpAddress
.String
);
1362 if (i
== resInfo
->riCount
- 1)
1365 ptr
->Next
= (PIP_ADDR_STRING
)((LPBYTE
)pFixedInfo
+ sizeof(FIXED_INFO
));
1367 ptr
->Next
= (PIP_ADDR_STRING
)((PBYTE
)ptr
+ sizeof(IP_ADDR_STRING
));
1370 pFixedInfo
->NodeType
= HYBRID_NODETYPE
;
1371 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1372 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ
, &hKey
);
1373 if (regReturn
!= ERROR_SUCCESS
)
1374 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1375 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ
,
1377 if (regReturn
== ERROR_SUCCESS
)
1379 DWORD size
= sizeof(pFixedInfo
->ScopeId
);
1381 RegQueryValueExA(hKey
, "ScopeID", NULL
, NULL
, pFixedInfo
->ScopeId
, &size
);
1385 disposeResInfo( resInfo
);
1386 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
1387 I suppose could also check for a listener on port 53 to set EnableDns */
1389 TRACE("returning %ld\n", ret
);
1395 /******************************************************************
1396 * GetNumberOfInterfaces (IPHLPAPI.@)
1408 DWORD WINAPI
GetNumberOfInterfaces(PDWORD pdwNumIf
)
1412 TRACE("pdwNumIf %p\n", pdwNumIf
);
1414 ret
= ERROR_INVALID_PARAMETER
;
1416 *pdwNumIf
= getNumInterfaces();
1419 TRACE("returning %ld\n", ret
);
1424 /******************************************************************
1425 * GetPerAdapterInfo (IPHLPAPI.@)
1431 * pPerAdapterInfo [In/Out]
1432 * pOutBufLen [In/Out]
1439 DWORD WINAPI
GetPerAdapterInfo(ULONG IfIndex
, PIP_PER_ADAPTER_INFO pPerAdapterInfo
, PULONG pOutBufLen
)
1441 TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex
,
1442 pPerAdapterInfo
, pOutBufLen
);
1444 /* marking Win2K+ functions not supported */
1445 return ERROR_NOT_SUPPORTED
;
1449 /******************************************************************
1450 * GetRTTAndHopCount (IPHLPAPI.@)
1455 * DestIpAddress [In]
1465 BOOL WINAPI
GetRTTAndHopCount(IPAddr DestIpAddress
, PULONG HopCount
, ULONG MaxHops
, PULONG RTT
)
1467 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
1468 DestIpAddress
, HopCount
, MaxHops
, RTT
);
1474 /******************************************************************
1475 * GetTcpStatisticsEx (IPHLPAPI.@)
1488 DWORD WINAPI
GetTcpStatisticsEx(PMIB_TCPSTATS pStats
, DWORD dwFamily
)
1492 TRACE("pStats %p\n", pStats
);
1493 ret
= getTCPStats(pStats
, dwFamily
);
1494 TRACE("returning %ld\n", ret
);
1498 /******************************************************************
1499 * GetTcpStatistics (IPHLPAPI.@)
1511 DWORD WINAPI
GetTcpStatistics(PMIB_TCPSTATS pStats
)
1513 return GetTcpStatisticsEx(pStats
, PF_INET
);
1517 static int TcpTableSorter(const void *a
, const void *b
)
1522 PMIB_TCPROW rowA
= (PMIB_TCPROW
)a
, rowB
= (PMIB_TCPROW
)b
;
1524 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1526 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1528 ret
= rowA
->dwRemoteAddr
- rowB
->dwRemoteAddr
;
1530 ret
= rowA
->dwRemotePort
- rowB
->dwRemotePort
;
1540 /******************************************************************
1541 * GetTcpTable (IPHLPAPI.@)
1546 * pTcpTable [In/Out]
1555 DWORD WINAPI
GetTcpTable(PMIB_TCPTABLE pTcpTable
, PDWORD pdwSize
, BOOL bOrder
)
1559 TRACE("pTcpTable %p, pdwSize %p, bOrder %ld\n", pTcpTable
, pdwSize
,
1562 ret
= ERROR_INVALID_PARAMETER
;
1564 DWORD numEntries
= getNumTcpEntries();
1565 ULONG size
= sizeof(MIB_TCPTABLE
) + (numEntries
- 1) * sizeof(MIB_TCPROW
);
1567 if (!pTcpTable
|| *pdwSize
< size
) {
1569 ret
= ERROR_INSUFFICIENT_BUFFER
;
1572 PMIB_TCPTABLE table
= getTcpTable();
1575 size
= sizeof(MIB_TCPTABLE
) + (table
->dwNumEntries
- 1) *
1577 if (*pdwSize
< size
) {
1579 ret
= ERROR_INSUFFICIENT_BUFFER
;
1582 memcpy(pTcpTable
, table
, size
);
1584 qsort(pTcpTable
->table
, pTcpTable
->dwNumEntries
,
1585 sizeof(MIB_TCPROW
), TcpTableSorter
);
1591 ret
= ERROR_OUTOFMEMORY
;
1594 TRACE("returning %ld\n", ret
);
1599 /******************************************************************
1600 * GetUdpStatisticsEx (IPHLPAPI.@)
1613 DWORD WINAPI
GetUdpStatisticsEx(PMIB_UDPSTATS pStats
, DWORD dwFamily
)
1617 TRACE("pStats %p\n", pStats
);
1618 ret
= getUDPStats(pStats
, dwFamily
);
1619 TRACE("returning %ld\n", ret
);
1623 /******************************************************************
1624 * GetUdpStatistics (IPHLPAPI.@)
1636 DWORD WINAPI
GetUdpStatistics(PMIB_UDPSTATS pStats
)
1638 return GetUdpStatisticsEx(pStats
, PF_INET
);
1642 static int UdpTableSorter(const void *a
, const void *b
)
1647 PMIB_UDPROW rowA
= (PMIB_UDPROW
)a
, rowB
= (PMIB_UDPROW
)b
;
1649 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1651 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1659 /******************************************************************
1660 * GetUdpTable (IPHLPAPI.@)
1665 * pUdpTable [In/Out]
1674 DWORD WINAPI
GetUdpTable(PMIB_UDPTABLE pUdpTable
, PDWORD pdwSize
, BOOL bOrder
)
1678 TRACE("pUdpTable %p, pdwSize %p, bOrder %ld\n", pUdpTable
, pdwSize
,
1681 ret
= ERROR_INVALID_PARAMETER
;
1683 DWORD numEntries
= getNumUdpEntries();
1684 ULONG size
= sizeof(MIB_UDPTABLE
) + (numEntries
- 1) * sizeof(MIB_UDPROW
);
1686 if (!pUdpTable
|| *pdwSize
< size
) {
1688 ret
= ERROR_INSUFFICIENT_BUFFER
;
1691 PMIB_UDPTABLE table
= getUdpTable();
1694 size
= sizeof(MIB_UDPTABLE
) + (table
->dwNumEntries
- 1) *
1696 if (*pdwSize
< size
) {
1698 ret
= ERROR_INSUFFICIENT_BUFFER
;
1701 memcpy(pUdpTable
, table
, size
);
1703 qsort(pUdpTable
->table
, pUdpTable
->dwNumEntries
,
1704 sizeof(MIB_UDPROW
), UdpTableSorter
);
1710 ret
= ERROR_OUTOFMEMORY
;
1713 TRACE("returning %ld\n", ret
);
1718 /******************************************************************
1719 * GetUniDirectionalAdapterInfo (IPHLPAPI.@)
1724 * pIPIfInfo [In/Out]
1725 * dwOutBufLen [In/Out]
1732 DWORD WINAPI
GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo
, PULONG dwOutBufLen
)
1734 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo
, dwOutBufLen
);
1735 /* a unidirectional adapter?? not bloody likely! */
1736 return ERROR_NOT_SUPPORTED
;
1740 /******************************************************************
1741 * IpReleaseAddress (IPHLPAPI.@)
1746 * AdapterInfo [In/Out]
1753 DWORD WINAPI
IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1755 TRACE("AdapterInfo %p\n", AdapterInfo
);
1756 /* not a stub, never going to support this (and I never mark an adapter as
1757 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1758 return ERROR_NOT_SUPPORTED
;
1762 /******************************************************************
1763 * IpRenewAddress (IPHLPAPI.@)
1768 * AdapterInfo [In/Out]
1775 DWORD WINAPI
IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1777 TRACE("AdapterInfo %p\n", AdapterInfo
);
1778 /* not a stub, never going to support this (and I never mark an adapter as
1779 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1780 return ERROR_NOT_SUPPORTED
;
1784 /******************************************************************
1785 * NotifyAddrChange (IPHLPAPI.@)
1791 * overlapped [In/Out]
1798 DWORD WINAPI
NotifyAddrChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1800 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1802 /* marking Win2K+ functions not supported */
1803 return ERROR_NOT_SUPPORTED
;
1807 /******************************************************************
1808 * NotifyRouteChange (IPHLPAPI.@)
1814 * overlapped [In/Out]
1821 DWORD WINAPI
NotifyRouteChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1823 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1825 /* marking Win2K+ functions not supported */
1826 return ERROR_NOT_SUPPORTED
;
1830 /******************************************************************
1831 * SendARP (IPHLPAPI.@)
1839 * PhyAddrLen [In/Out]
1846 DWORD WINAPI
SendARP(IPAddr DestIP
, IPAddr SrcIP
, PULONG pMacAddr
, PULONG PhyAddrLen
)
1848 TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP
,
1849 SrcIP
, pMacAddr
, PhyAddrLen
);
1851 /* marking Win2K+ functions not supported */
1852 return ERROR_NOT_SUPPORTED
;
1856 /******************************************************************
1857 * SetIfEntry (IPHLPAPI.@)
1869 DWORD WINAPI
SetIfEntry(PMIB_IFROW pIfRow
)
1871 TRACE("pIfRow %p\n", pIfRow
);
1872 /* this is supposed to set an administratively interface up or down.
1873 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
1874 this sort of down is indistinguishable from other sorts of down (e.g. no
1877 return ERROR_NOT_SUPPORTED
;
1881 /******************************************************************
1882 * SetIpForwardEntry (IPHLPAPI.@)
1894 DWORD WINAPI
SetIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
1896 return setIpForwardEntry( pRoute
);
1900 /******************************************************************
1901 * SetIpNetEntry (IPHLPAPI.@)
1906 * pArpEntry [In/Out]
1913 DWORD WINAPI
SetIpNetEntry(PMIB_IPNETROW pArpEntry
)
1915 TRACE("pArpEntry %p\n", pArpEntry
);
1916 /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */
1922 /******************************************************************
1923 * SetIpStatistics (IPHLPAPI.@)
1935 DWORD WINAPI
SetIpStatistics(PMIB_IPSTATS pIpStats
)
1937 TRACE("pIpStats %p\n", pIpStats
);
1943 /******************************************************************
1944 * SetIpTTL (IPHLPAPI.@)
1956 DWORD WINAPI
SetIpTTL(UINT nTTL
)
1958 TRACE("nTTL %d\n", nTTL
);
1959 /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I
1960 want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */
1966 /******************************************************************
1967 * SetTcpEntry (IPHLPAPI.@)
1979 DWORD WINAPI
SetTcpEntry(PMIB_TCPROW pTcpRow
)
1981 TRACE("pTcpRow %p\n", pTcpRow
);
1987 /******************************************************************
1988 * UnenableRouter (IPHLPAPI.@)
1993 * pOverlapped [In/Out]
1994 * lpdwEnableCount [In/Out]
2001 DWORD WINAPI
UnenableRouter(OVERLAPPED
* pOverlapped
, LPDWORD lpdwEnableCount
)
2003 TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped
, lpdwEnableCount
);
2005 /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
2006 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
2007 marking Win2K+ functions not supported */
2008 return ERROR_NOT_SUPPORTED
;
2014 DWORD WINAPI
GetIpErrorString(IP_STATUS ErrorCode
,PWCHAR Buffer
,PDWORD Size
)
2024 PIP_ADAPTER_ORDER_MAP WINAPI
GetAdapterOrderMap(VOID
)
2033 DWORD WINAPI
GetAdaptersAddresses(ULONG Family
,DWORD Flags
,PVOID Reserved
,PIP_ADAPTER_ADDRESSES pAdapterAddresses
,PULONG pOutBufLen
)
2042 BOOL WINAPI
CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped
)
2051 DWORD WINAPI
GetBestInterfaceEx(struct sockaddr
*pDestAddr
,PDWORD pdwBestIfIndex
)
2060 DWORD WINAPI
NhpAllocateAndGetInterfaceInfoFromStack(IP_INTERFACE_NAME_INFO
**ppTable
,PDWORD pdwCount
,BOOL bOrder
,HANDLE hHeap
,DWORD dwFlags
)
2069 DWORD WINAPI
GetIcmpStatisticsEx(PMIB_ICMP_EX pStats
,DWORD dwFamily
)