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
25 #include <sys/types.h>
26 #ifdef HAVE_NETINET_IN_H
27 # include <netinet/in.h>
29 #ifdef HAVE_ARPA_INET_H
30 # include <arpa/inet.h>
32 #ifdef HAVE_ARPA_NAMESER_H
33 # include <arpa/nameser.h>
45 #include "wine/debug.h"
47 WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi
);
50 #define INADDR_NONE ~0UL
53 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
56 case DLL_PROCESS_ATTACH
:
57 DisableThreadLibraryCalls( hinstDLL
);
61 case DLL_PROCESS_DETACH
:
68 /******************************************************************
69 * AddIPAddress (IPHLPAPI.@)
78 * NTEInstance [In/Out]
85 DWORD WINAPI
AddIPAddress(IPAddr Address
, IPMask IpMask
, DWORD IfIndex
, PULONG NTEContext
, PULONG NTEInstance
)
88 /* marking Win2K+ functions not supported */
89 return ERROR_NOT_SUPPORTED
;
93 /******************************************************************
94 * AllocateAndGetIfTableFromStack (IPHLPAPI.@)
99 * ppIfTable [Out] -- pointer into which the MIB_IFTABLE is
100 * allocated and returned.
101 * bOrder [In] -- passed to GetIfTable to order the table
102 * heap [In] -- heap from which the table is allocated
103 * flags [In] -- flags to HeapAlloc
105 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
106 * GetIfTable returns otherwise
109 DWORD WINAPI
AllocateAndGetIfTableFromStack(PMIB_IFTABLE
*ppIfTable
,
110 BOOL bOrder
, HANDLE heap
, DWORD flags
)
114 TRACE("ppIfTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n", ppIfTable
,
115 (DWORD
)bOrder
, (DWORD
)heap
, flags
);
117 ret
= ERROR_INVALID_PARAMETER
;
121 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
122 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
123 *ppIfTable
= (PMIB_IFTABLE
)HeapAlloc(heap
, flags
, dwSize
);
124 ret
= GetIfTable(*ppIfTable
, &dwSize
, bOrder
);
127 TRACE("returning %ld\n", ret
);
132 /******************************************************************
133 * AllocateAndGetIpAddrTableFromStack (IPHLPAPI.@)
138 * ppIpAddrTable [Out]
139 * bOrder [In] -- passed to GetIpAddrTable to order the table
140 * heap [In] -- heap from which the table is allocated
141 * flags [In] -- flags to HeapAlloc
148 DWORD WINAPI
AllocateAndGetIpAddrTableFromStack(PMIB_IPADDRTABLE
*ppIpAddrTable
,
149 BOOL bOrder
, HANDLE heap
, DWORD flags
)
153 TRACE("ppIpAddrTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
154 ppIpAddrTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
156 ret
= ERROR_INVALID_PARAMETER
;
160 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
161 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
162 *ppIpAddrTable
= (PMIB_IPADDRTABLE
)HeapAlloc(heap
, flags
, dwSize
);
163 ret
= GetIpAddrTable(*ppIpAddrTable
, &dwSize
, bOrder
);
166 TRACE("returning %ld\n", ret
);
171 /******************************************************************
172 * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@)
175 * ppIpForwardTable [Out] -- pointer into which the MIB_IPFORWARDTABLE is
176 * allocated and returned.
177 * bOrder [In] -- passed to GetIfTable to order the table
178 * heap [In] -- heap from which the table is allocated
179 * flags [In] -- flags to HeapAlloc
181 * RETURNS -- ERROR_INVALID_PARAMETER if ppIfTable is NULL, whatever
182 * GetIpForwardTable returns otherwise
185 DWORD WINAPI
AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE
*
186 ppIpForwardTable
, BOOL bOrder
, HANDLE heap
, DWORD flags
)
190 TRACE("ppIpForwardTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
191 ppIpForwardTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
192 if (!ppIpForwardTable
)
193 ret
= ERROR_INVALID_PARAMETER
;
197 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
198 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
199 *ppIpForwardTable
= (PMIB_IPFORWARDTABLE
)HeapAlloc(heap
, flags
, dwSize
);
200 ret
= GetIpForwardTable(*ppIpForwardTable
, &dwSize
, bOrder
);
203 TRACE("returning %ld\n", ret
);
208 /******************************************************************
209 * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@)
215 * bOrder [In] -- passed to GetIpNetTable to order the table
216 * heap [In] -- heap from which the table is allocated
217 * flags [In] -- flags to HeapAlloc
224 DWORD WINAPI
AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE
*ppIpNetTable
,
225 BOOL bOrder
, HANDLE heap
, DWORD flags
)
229 TRACE("ppIpNetTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
230 ppIpNetTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
232 ret
= ERROR_INVALID_PARAMETER
;
236 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
237 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
238 *ppIpNetTable
= (PMIB_IPNETTABLE
)HeapAlloc(heap
, flags
, dwSize
);
239 ret
= GetIpNetTable(*ppIpNetTable
, &dwSize
, bOrder
);
242 TRACE("returning %ld\n", ret
);
247 /******************************************************************
248 * AllocateAndGetTcpTableFromStack (IPHLPAPI.@)
254 * bOrder [In] -- passed to GetTcpTable to order the table
255 * heap [In] -- heap from which the table is allocated
256 * flags [In] -- flags to HeapAlloc
263 DWORD WINAPI
AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE
*ppTcpTable
,
264 BOOL bOrder
, HANDLE heap
, DWORD flags
)
268 TRACE("ppTcpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
269 ppTcpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
271 ret
= ERROR_INVALID_PARAMETER
;
275 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
276 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
277 *ppTcpTable
= (PMIB_TCPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
278 ret
= GetTcpTable(*ppTcpTable
, &dwSize
, bOrder
);
281 TRACE("returning %ld\n", ret
);
286 /******************************************************************
287 * AllocateAndGetUdpTableFromStack (IPHLPAPI.@)
293 * bOrder [In] -- passed to GetUdpTable to order the table
294 * heap [In] -- heap from which the table is allocated
295 * flags [In] -- flags to HeapAlloc
302 DWORD WINAPI
AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE
*ppUdpTable
,
303 BOOL bOrder
, HANDLE heap
, DWORD flags
)
307 TRACE("ppUdpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx\n",
308 ppUdpTable
, (DWORD
)bOrder
, (DWORD
)heap
, flags
);
310 ret
= ERROR_INVALID_PARAMETER
;
314 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
315 if (ret
== ERROR_INSUFFICIENT_BUFFER
) {
316 *ppUdpTable
= (PMIB_UDPTABLE
)HeapAlloc(heap
, flags
, dwSize
);
317 ret
= GetUdpTable(*ppUdpTable
, &dwSize
, bOrder
);
320 TRACE("returning %ld\n", ret
);
325 /******************************************************************
326 * CreateIpForwardEntry (IPHLPAPI.@)
338 DWORD WINAPI
CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
340 TRACE("pRoute %p\n", pRoute
);
341 /* could use SIOCADDRT, not sure I want to */
347 /******************************************************************
348 * CreateIpNetEntry (IPHLPAPI.@)
360 DWORD WINAPI
CreateIpNetEntry(PMIB_IPNETROW pArpEntry
)
362 TRACE("pArpEntry %p\n", pArpEntry
);
363 /* could use SIOCSARP on systems that support it, not sure I want to */
369 /******************************************************************
370 * CreateProxyArpEntry (IPHLPAPI.@)
384 DWORD WINAPI
CreateProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
386 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
389 /* marking Win2K+ functions not supported */
390 return ERROR_NOT_SUPPORTED
;
394 /******************************************************************
395 * DeleteIPAddress (IPHLPAPI.@)
407 DWORD WINAPI
DeleteIPAddress(ULONG NTEContext
)
409 TRACE("NTEContext %ld\n", NTEContext
);
411 /* marking Win2K+ functions not supported */
412 return ERROR_NOT_SUPPORTED
;
416 /******************************************************************
417 * DeleteIpForwardEntry (IPHLPAPI.@)
429 DWORD WINAPI
DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
431 TRACE("pRoute %p\n", pRoute
);
432 /* could use SIOCDELRT, not sure I want to */
438 /******************************************************************
439 * DeleteIpNetEntry (IPHLPAPI.@)
451 DWORD WINAPI
DeleteIpNetEntry(PMIB_IPNETROW pArpEntry
)
453 TRACE("pArpEntry %p\n", pArpEntry
);
454 /* could use SIOCDARP on systems that support it, not sure I want to */
460 /******************************************************************
461 * DeleteProxyArpEntry (IPHLPAPI.@)
475 DWORD WINAPI
DeleteProxyArpEntry(DWORD dwAddress
, DWORD dwMask
, DWORD dwIfIndex
)
477 TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress
,
480 /* marking Win2K+ functions not supported */
481 return ERROR_NOT_SUPPORTED
;
485 /******************************************************************
486 * EnableRouter (IPHLPAPI.@)
492 * pOverlapped [In/Out]
499 DWORD WINAPI
EnableRouter(HANDLE
* pHandle
, OVERLAPPED
* pOverlapped
)
501 TRACE("pHandle %p, pOverlapped %p\n", pHandle
, pOverlapped
);
503 /* could echo "1" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
504 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
505 marking Win2K+ functions not supported */
506 return ERROR_NOT_SUPPORTED
;
510 /******************************************************************
511 * FlushIpNetTable (IPHLPAPI.@)
523 DWORD WINAPI
FlushIpNetTable(DWORD dwIfIndex
)
525 TRACE("dwIfIndex 0x%08lx\n", dwIfIndex
);
527 /* this flushes the arp cache of the given index
528 marking Win2K+ functions not supported */
529 return ERROR_NOT_SUPPORTED
;
533 /******************************************************************
534 * GetAdapterIndex (IPHLPAPI.@)
539 * AdapterName [In/Out]
547 DWORD WINAPI
GetAdapterIndex(LPWSTR AdapterName
, PULONG IfIndex
)
549 TRACE("AdapterName %p, IfIndex %p\n", AdapterName
, IfIndex
);
551 /* marking Win2K+ functions not supported */
552 return ERROR_NOT_SUPPORTED
;
556 /******************************************************************
557 * GetAdaptersInfo (IPHLPAPI.@)
562 * pAdapterInfo [In/Out]
563 * pOutBufLen [In/Out]
570 DWORD WINAPI
GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo
, PULONG pOutBufLen
)
574 TRACE("pAdapterInfo %p, pOutBufLen %p\n", pAdapterInfo
, pOutBufLen
);
576 ret
= ERROR_INVALID_PARAMETER
;
578 DWORD numNonLoopbackInterfaces
= getNumNonLoopbackInterfaces();
580 if (numNonLoopbackInterfaces
> 0) {
581 /* this calculation assumes only one address in the IP_ADDR_STRING lists.
582 that's okay, because:
583 - we don't get multiple addresses per adapter anyway
584 - we don't know about per-adapter gateways
585 - DHCP and WINS servers can have max one entry per list */
586 ULONG size
= sizeof(IP_ADAPTER_INFO
) * numNonLoopbackInterfaces
;
588 if (!pAdapterInfo
|| *pOutBufLen
< size
) {
590 ret
= ERROR_BUFFER_OVERFLOW
;
593 InterfaceIndexTable
*table
= getNonLoopbackInterfaceIndexTable();
596 size
= sizeof(IP_ADAPTER_INFO
) * table
->numIndexes
;
597 if (*pOutBufLen
< size
) {
599 ret
= ERROR_INSUFFICIENT_BUFFER
;
604 BOOL winsEnabled
= FALSE
;
605 IP_ADDRESS_STRING primaryWINS
, secondaryWINS
;
607 memset(pAdapterInfo
, 0, size
);
608 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
609 "Software\\Wine\\Wine\\Config\\Network", 0, KEY_READ
,
610 &hKey
) == ERROR_SUCCESS
) {
611 DWORD size
= sizeof(primaryWINS
.String
);
614 RegQueryValueExA(hKey
, "WinsServer", NULL
, NULL
,
615 primaryWINS
.String
, &size
);
616 addr
= inet_addr(primaryWINS
.String
);
617 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
619 size
= sizeof(secondaryWINS
.String
);
620 RegQueryValueExA(hKey
, "BackupWinsServer", NULL
, NULL
,
621 secondaryWINS
.String
, &size
);
622 addr
= inet_addr(secondaryWINS
.String
);
623 if (addr
!= INADDR_NONE
&& addr
!= INADDR_ANY
)
627 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
628 PIP_ADAPTER_INFO ptr
= &pAdapterInfo
[ndx
];
629 DWORD addrLen
= sizeof(ptr
->Address
), type
;
631 /* on Win98 this is left empty, but whatever */
632 strncpy(ptr
->AdapterName
,
633 getInterfaceNameByIndex(table
->indexes
[ndx
]),
634 sizeof(ptr
->AdapterName
));
635 ptr
->AdapterName
[MAX_ADAPTER_NAME_LENGTH
] = '\0';
636 getInterfacePhysicalByIndex(table
->indexes
[ndx
], &addrLen
,
637 ptr
->Address
, &type
);
638 /* MS defines address length and type as UINT in some places and
639 DWORD in others, **sigh**. Don't want to assume that PUINT and
640 PDWORD are equiv (64-bit?) */
641 ptr
->AddressLength
= addrLen
;
643 ptr
->Index
= table
->indexes
[ndx
];
644 toIPAddressString(getInterfaceIPAddrByIndex(table
->indexes
[ndx
]),
645 ptr
->IpAddressList
.IpAddress
.String
);
646 toIPAddressString(getInterfaceMaskByIndex(table
->indexes
[ndx
]),
647 ptr
->IpAddressList
.IpMask
.String
);
649 ptr
->HaveWins
= TRUE
;
650 memcpy(ptr
->PrimaryWinsServer
.IpAddress
.String
,
651 primaryWINS
.String
, sizeof(primaryWINS
.String
));
652 memcpy(ptr
->SecondaryWinsServer
.IpAddress
.String
,
653 secondaryWINS
.String
, sizeof(secondaryWINS
.String
));
655 if (ndx
< table
->numIndexes
- 1)
656 ptr
->Next
= &pAdapterInfo
[ndx
+ 1];
665 ret
= ERROR_OUTOFMEMORY
;
671 TRACE("returning %ld\n", ret
);
676 /******************************************************************
677 * GetBestInterface (IPHLPAPI.@)
683 * pdwBestIfIndex [In/Out]
690 DWORD WINAPI
GetBestInterface(IPAddr dwDestAddr
, PDWORD pdwBestIfIndex
)
694 TRACE("dwDestAddr 0x%08lx, pdwBestIfIndex %p\n", dwDestAddr
, pdwBestIfIndex
);
696 ret
= ERROR_INVALID_PARAMETER
;
698 MIB_IPFORWARDROW ipRow
;
700 ret
= GetBestRoute(dwDestAddr
, 0, &ipRow
);
701 if (ret
== ERROR_SUCCESS
)
702 *pdwBestIfIndex
= ipRow
.dwForwardIfIndex
;
704 TRACE("returning %ld\n", ret
);
709 /******************************************************************
710 * GetBestRoute (IPHLPAPI.@)
724 DWORD WINAPI
GetBestRoute(DWORD dwDestAddr
, DWORD dwSourceAddr
, PMIB_IPFORWARDROW pBestRoute
)
726 PMIB_IPFORWARDTABLE table
;
729 TRACE("dwDestAddr 0x%08lx, dwSourceAddr 0x%08lx, pBestRoute %p\n", dwDestAddr
,
730 dwSourceAddr
, pBestRoute
);
732 return ERROR_INVALID_PARAMETER
;
734 AllocateAndGetIpForwardTableFromStack(&table
, FALSE
, GetProcessHeap(), 0);
736 DWORD ndx
, matchedBits
, matchedNdx
= 0;
738 for (ndx
= 0, matchedBits
= 0; ndx
< table
->dwNumEntries
; ndx
++) {
739 if ((dwDestAddr
& table
->table
[ndx
].dwForwardMask
) ==
740 (table
->table
[ndx
].dwForwardDest
& table
->table
[ndx
].dwForwardMask
)) {
741 DWORD numShifts
, mask
;
743 for (numShifts
= 0, mask
= table
->table
[ndx
].dwForwardMask
;
744 mask
&& !(mask
& 1); mask
>>= 1, numShifts
++)
746 if (numShifts
> matchedBits
) {
747 matchedBits
= numShifts
;
752 memcpy(pBestRoute
, &table
->table
[matchedNdx
], sizeof(MIB_IPFORWARDROW
));
753 HeapFree(GetProcessHeap(), 0, table
);
757 ret
= ERROR_OUTOFMEMORY
;
758 TRACE("returning %ld\n", ret
);
763 /******************************************************************
764 * GetFriendlyIfIndex (IPHLPAPI.@)
776 DWORD WINAPI
GetFriendlyIfIndex(DWORD IfIndex
)
778 /* windows doesn't validate these, either, just makes sure the top byte is
779 cleared. I assume my ifenum module never gives an index with the top
781 TRACE("returning %ld\n", IfIndex
);
786 /******************************************************************
787 * GetIcmpStatistics (IPHLPAPI.@)
799 DWORD WINAPI
GetIcmpStatistics(PMIB_ICMP pStats
)
803 TRACE("pStats %p\n", pStats
);
804 ret
= getICMPStats(pStats
);
805 TRACE("returning %ld\n", ret
);
810 /******************************************************************
811 * GetIfEntry (IPHLPAPI.@)
823 DWORD WINAPI
GetIfEntry(PMIB_IFROW pIfRow
)
828 TRACE("pIfRow %p\n", pIfRow
);
830 return ERROR_INVALID_PARAMETER
;
832 name
= getInterfaceNameByIndex(pIfRow
->dwIndex
);
834 ret
= getInterfaceEntryByName(name
, pIfRow
);
836 ret
= getInterfaceStatsByName(name
, pIfRow
);
839 ret
= ERROR_INVALID_DATA
;
840 TRACE("returning %ld\n", ret
);
845 static int IfTableSorter(const void *a
, const void *b
)
850 ret
= ((PMIB_IFROW
)a
)->dwIndex
- ((PMIB_IFROW
)b
)->dwIndex
;
857 /******************************************************************
858 * GetIfTable (IPHLPAPI.@)
872 DWORD WINAPI
GetIfTable(PMIB_IFTABLE pIfTable
, PULONG pdwSize
, BOOL bOrder
)
876 TRACE("pIfTable %p, pdwSize %p, bOrder %ld\n", pdwSize
, pdwSize
,
879 ret
= ERROR_INVALID_PARAMETER
;
881 DWORD numInterfaces
= getNumInterfaces();
882 ULONG size
= sizeof(MIB_IFTABLE
) + (numInterfaces
- 1) * sizeof(MIB_IFROW
);
884 if (!pIfTable
|| *pdwSize
< size
) {
886 ret
= ERROR_INSUFFICIENT_BUFFER
;
889 InterfaceIndexTable
*table
= getInterfaceIndexTable();
892 size
= sizeof(MIB_IFTABLE
) + (table
->numIndexes
- 1) *
894 if (*pdwSize
< size
) {
896 ret
= ERROR_INSUFFICIENT_BUFFER
;
901 pIfTable
->dwNumEntries
= 0;
902 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
903 pIfTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
904 GetIfEntry(&pIfTable
->table
[ndx
]);
905 pIfTable
->dwNumEntries
++;
908 qsort(pIfTable
->table
, pIfTable
->dwNumEntries
, sizeof(MIB_IFROW
),
915 ret
= ERROR_OUTOFMEMORY
;
918 TRACE("returning %ld\n", ret
);
923 /******************************************************************
924 * GetInterfaceInfo (IPHLPAPI.@)
930 * dwOutBufLen [In/Out]
937 DWORD WINAPI
GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable
, PULONG dwOutBufLen
)
941 TRACE("pIfTable %p, dwOutBufLen %p\n", pIfTable
, dwOutBufLen
);
943 ret
= ERROR_INVALID_PARAMETER
;
945 DWORD numInterfaces
= getNumInterfaces();
946 ULONG size
= sizeof(IP_INTERFACE_INFO
) + (numInterfaces
- 1) *
947 sizeof(IP_ADAPTER_INDEX_MAP
);
949 if (!pIfTable
|| *dwOutBufLen
< size
) {
951 ret
= ERROR_INSUFFICIENT_BUFFER
;
954 InterfaceIndexTable
*table
= getInterfaceIndexTable();
957 size
= sizeof(IP_INTERFACE_INFO
) + (table
->numIndexes
- 1) *
958 sizeof(IP_ADAPTER_INDEX_MAP
);
959 if (*dwOutBufLen
< size
) {
961 ret
= ERROR_INSUFFICIENT_BUFFER
;
966 pIfTable
->NumAdapters
= 0;
967 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
968 const char *walker
, *name
;
971 pIfTable
->Adapter
[ndx
].Index
= table
->indexes
[ndx
];
972 name
= getInterfaceNameByIndex(table
->indexes
[ndx
]);
973 for (walker
= name
, assigner
= pIfTable
->Adapter
[ndx
].Name
;
975 assigner
- pIfTable
->Adapter
[ndx
].Name
< MAX_ADAPTER_NAME
- 1;
976 walker
++, assigner
++)
979 pIfTable
->NumAdapters
++;
986 ret
= ERROR_OUTOFMEMORY
;
989 TRACE("returning %ld\n", ret
);
994 static int IpAddrTableSorter(const void *a
, const void *b
)
999 ret
= ((PMIB_IPADDRROW
)a
)->dwAddr
- ((PMIB_IPADDRROW
)b
)->dwAddr
;
1006 /******************************************************************
1007 * GetIpAddrTable (IPHLPAPI.@)
1012 * pIpAddrTable [In/Out]
1021 DWORD WINAPI
GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable
, PULONG pdwSize
, BOOL bOrder
)
1025 TRACE("pIpAddrTable %p, pdwSize %p, bOrder %ld\n", pIpAddrTable
, pdwSize
,
1028 ret
= ERROR_INVALID_PARAMETER
;
1030 DWORD numInterfaces
= getNumInterfaces();
1031 ULONG size
= sizeof(MIB_IPADDRTABLE
) + (numInterfaces
- 1) *
1032 sizeof(MIB_IPADDRROW
);
1034 if (!pIpAddrTable
|| *pdwSize
< size
) {
1036 ret
= ERROR_INSUFFICIENT_BUFFER
;
1039 InterfaceIndexTable
*table
= getInterfaceIndexTable();
1042 size
= sizeof(MIB_IPADDRTABLE
) + (table
->numIndexes
- 1) *
1043 sizeof(MIB_IPADDRROW
);
1044 if (*pdwSize
< size
) {
1046 ret
= ERROR_INSUFFICIENT_BUFFER
;
1051 pIpAddrTable
->dwNumEntries
= 0;
1052 for (ndx
= 0; ndx
< table
->numIndexes
; ndx
++) {
1053 pIpAddrTable
->table
[ndx
].dwIndex
= table
->indexes
[ndx
];
1054 pIpAddrTable
->table
[ndx
].dwAddr
=
1055 getInterfaceIPAddrByIndex(table
->indexes
[ndx
]);
1056 pIpAddrTable
->table
[ndx
].dwMask
=
1057 getInterfaceMaskByIndex(table
->indexes
[ndx
]);
1058 /* the dwBCastAddr member isn't the broadcast address, it indicates
1059 * whether the interface uses the 1's broadcast address (1) or the
1060 * 0's broadcast address (0).
1062 bcast
= getInterfaceBCastAddrByIndex(table
->indexes
[ndx
]);
1063 pIpAddrTable
->table
[ndx
].dwBCastAddr
=
1064 (bcast
& pIpAddrTable
->table
[ndx
].dwMask
) ? 1 : 0;
1065 /* FIXME: hardcoded reasm size, not sure where to get it */
1066 pIpAddrTable
->table
[ndx
].dwReasmSize
= 65535;
1067 pIpAddrTable
->table
[ndx
].unused1
= 0;
1068 pIpAddrTable
->table
[ndx
].wType
= 0; /* aka unused2 */
1069 pIpAddrTable
->dwNumEntries
++;
1072 qsort(pIpAddrTable
->table
, pIpAddrTable
->dwNumEntries
,
1073 sizeof(MIB_IPADDRROW
), IpAddrTableSorter
);
1079 ret
= ERROR_OUTOFMEMORY
;
1082 TRACE("returning %ld\n", ret
);
1087 static int IpForwardTableSorter(const void *a
, const void *b
)
1092 PMIB_IPFORWARDROW rowA
= (PMIB_IPFORWARDROW
)a
, rowB
= (PMIB_IPFORWARDROW
)b
;
1094 ret
= rowA
->dwForwardDest
- rowB
->dwForwardDest
;
1096 ret
= rowA
->dwForwardProto
- rowB
->dwForwardProto
;
1098 ret
= rowA
->dwForwardPolicy
- rowB
->dwForwardPolicy
;
1100 ret
= rowA
->dwForwardNextHop
- rowB
->dwForwardNextHop
;
1110 /******************************************************************
1111 * GetIpForwardTable (IPHLPAPI.@)
1116 * pIpForwardTable [In/Out]
1125 DWORD WINAPI
GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable
, PULONG pdwSize
, BOOL bOrder
)
1129 TRACE("pIpForwardTable %p, pdwSize %p, bOrder %ld\n", pIpForwardTable
,
1130 pdwSize
, (DWORD
)bOrder
);
1132 ret
= ERROR_INVALID_PARAMETER
;
1134 DWORD numRoutes
= getNumRoutes();
1135 ULONG sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (numRoutes
- 1) *
1136 sizeof(MIB_IPFORWARDROW
);
1138 if (!pIpForwardTable
|| *pdwSize
< sizeNeeded
) {
1139 *pdwSize
= sizeNeeded
;
1140 ret
= ERROR_INSUFFICIENT_BUFFER
;
1143 RouteTable
*table
= getRouteTable();
1145 sizeNeeded
= sizeof(MIB_IPFORWARDTABLE
) + (table
->numRoutes
- 1) *
1146 sizeof(MIB_IPFORWARDROW
);
1147 if (*pdwSize
< sizeNeeded
) {
1148 *pdwSize
= sizeNeeded
;
1149 ret
= ERROR_INSUFFICIENT_BUFFER
;
1154 pIpForwardTable
->dwNumEntries
= table
->numRoutes
;
1155 for (ndx
= 0; ndx
< numRoutes
; ndx
++) {
1156 pIpForwardTable
->table
[ndx
].dwForwardIfIndex
=
1157 table
->routes
[ndx
].ifIndex
;
1158 pIpForwardTable
->table
[ndx
].dwForwardDest
=
1159 table
->routes
[ndx
].dest
;
1160 pIpForwardTable
->table
[ndx
].dwForwardMask
=
1161 table
->routes
[ndx
].mask
;
1162 pIpForwardTable
->table
[ndx
].dwForwardPolicy
= 0;
1163 pIpForwardTable
->table
[ndx
].dwForwardNextHop
=
1164 table
->routes
[ndx
].gateway
;
1165 /* FIXME: this type is appropriate for local interfaces; may not
1166 always be appropriate */
1167 pIpForwardTable
->table
[ndx
].dwForwardType
= MIB_IPROUTE_TYPE_DIRECT
;
1168 /* FIXME: other protos might be appropriate, e.g. the default route
1169 is typically set with MIB_IPPROTO_NETMGMT instead */
1170 pIpForwardTable
->table
[ndx
].dwForwardProto
= MIB_IPPROTO_LOCAL
;
1171 /* punt on age and AS */
1172 pIpForwardTable
->table
[ndx
].dwForwardAge
= 0;
1173 pIpForwardTable
->table
[ndx
].dwForwardNextHopAS
= 0;
1174 pIpForwardTable
->table
[ndx
].dwForwardMetric1
=
1175 table
->routes
[ndx
].metric
;
1176 /* rest of the metrics are 0.. */
1177 pIpForwardTable
->table
[ndx
].dwForwardMetric2
= 0;
1178 pIpForwardTable
->table
[ndx
].dwForwardMetric3
= 0;
1179 pIpForwardTable
->table
[ndx
].dwForwardMetric4
= 0;
1180 pIpForwardTable
->table
[ndx
].dwForwardMetric5
= 0;
1183 qsort(pIpForwardTable
->table
, pIpForwardTable
->dwNumEntries
,
1184 sizeof(MIB_IPFORWARDROW
), IpForwardTableSorter
);
1190 ret
= ERROR_OUTOFMEMORY
;
1193 TRACE("returning %ld\n", ret
);
1198 static int IpNetTableSorter(const void *a
, const void *b
)
1203 ret
= ((PMIB_IPNETROW
)a
)->dwAddr
- ((PMIB_IPNETROW
)b
)->dwAddr
;
1210 /******************************************************************
1211 * GetIpNetTable (IPHLPAPI.@)
1216 * pIpNetTable [In/Out]
1225 DWORD WINAPI
GetIpNetTable(PMIB_IPNETTABLE pIpNetTable
, PULONG pdwSize
, BOOL bOrder
)
1229 TRACE("pIpNetTable %p, pdwSize %p, bOrder %ld\n", pIpNetTable
, pdwSize
,
1232 ret
= ERROR_INVALID_PARAMETER
;
1234 DWORD numEntries
= getNumArpEntries();
1235 ULONG size
= sizeof(MIB_IPNETTABLE
) + (numEntries
- 1) *
1236 sizeof(MIB_IPNETROW
);
1238 if (!pIpNetTable
|| *pdwSize
< size
) {
1240 ret
= ERROR_INSUFFICIENT_BUFFER
;
1243 PMIB_IPNETTABLE table
= getArpTable();
1246 size
= sizeof(MIB_IPNETTABLE
) + (table
->dwNumEntries
- 1) *
1247 sizeof(MIB_IPNETROW
);
1248 if (*pdwSize
< size
) {
1250 ret
= ERROR_INSUFFICIENT_BUFFER
;
1253 memcpy(pIpNetTable
, table
, size
);
1255 qsort(pIpNetTable
->table
, pIpNetTable
->dwNumEntries
,
1256 sizeof(MIB_IPNETROW
), IpNetTableSorter
);
1262 ret
= ERROR_OUTOFMEMORY
;
1265 TRACE("returning %ld\n", ret
);
1270 /******************************************************************
1271 * GetIpStatistics (IPHLPAPI.@)
1283 DWORD WINAPI
GetIpStatistics(PMIB_IPSTATS pStats
)
1287 TRACE("pStats %p\n", pStats
);
1288 ret
= getIPStats(pStats
);
1289 TRACE("returning %ld\n", ret
);
1294 /******************************************************************
1295 * GetNetworkParams (IPHLPAPI.@)
1300 * pFixedInfo [In/Out]
1301 * pOutBufLen [In/Out]
1308 DWORD WINAPI
GetNetworkParams(PFIXED_INFO pFixedInfo
, PULONG pOutBufLen
)
1314 TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo
, pOutBufLen
);
1316 return ERROR_INVALID_PARAMETER
;
1319 size
= sizeof(FIXED_INFO
) + (_res
.nscount
> 0 ? (_res
.nscount
- 1) *
1320 sizeof(IP_ADDR_STRING
) : 0);
1321 if (!pFixedInfo
|| *pOutBufLen
< size
) {
1323 return ERROR_BUFFER_OVERFLOW
;
1326 memset(pFixedInfo
, 0, size
);
1327 size
= sizeof(pFixedInfo
->HostName
);
1328 GetComputerNameExA(ComputerNameDnsHostname
, pFixedInfo
->HostName
, &size
);
1329 size
= sizeof(pFixedInfo
->DomainName
);
1330 GetComputerNameExA(ComputerNameDnsDomain
, pFixedInfo
->DomainName
, &size
);
1331 if (_res
.nscount
> 0) {
1332 PIP_ADDR_STRING ptr
;
1335 for (i
= 0, ptr
= &pFixedInfo
->DnsServerList
; i
< _res
.nscount
&& ptr
;
1336 i
++, ptr
= ptr
->Next
) {
1337 toIPAddressString(_res
.nsaddr_list
[i
].sin_addr
.s_addr
,
1338 ptr
->IpAddress
.String
);
1339 if (i
== _res
.nscount
- 1)
1342 ptr
->Next
= (PIP_ADDR_STRING
)((LPBYTE
)pFixedInfo
+ sizeof(FIXED_INFO
));
1344 ptr
->Next
= (PIP_ADDR_STRING
)((PBYTE
)ptr
+ sizeof(IP_ADDR_STRING
));
1347 pFixedInfo
->NodeType
= HYBRID_NODETYPE
;
1348 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1349 "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ
, &hKey
);
1350 if (regReturn
!= ERROR_SUCCESS
)
1351 regReturn
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
1352 "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ
,
1354 if (regReturn
== ERROR_SUCCESS
)
1356 DWORD size
= sizeof(pFixedInfo
->ScopeId
);
1358 RegQueryValueExA(hKey
, "ScopeID", NULL
, NULL
, pFixedInfo
->ScopeId
, &size
);
1362 /* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward
1363 I suppose could also check for a listener on port 53 to set EnableDns */
1365 TRACE("returning %ld\n", ret
);
1370 /******************************************************************
1371 * GetNumberOfInterfaces (IPHLPAPI.@)
1383 DWORD WINAPI
GetNumberOfInterfaces(PDWORD pdwNumIf
)
1387 TRACE("pdwNumIf %p\n", pdwNumIf
);
1389 ret
= ERROR_INVALID_PARAMETER
;
1391 *pdwNumIf
= getNumInterfaces();
1394 TRACE("returning %ld\n", ret
);
1399 /******************************************************************
1400 * GetPerAdapterInfo (IPHLPAPI.@)
1406 * pPerAdapterInfo [In/Out]
1407 * pOutBufLen [In/Out]
1414 DWORD WINAPI
GetPerAdapterInfo(ULONG IfIndex
, PIP_PER_ADAPTER_INFO pPerAdapterInfo
, PULONG pOutBufLen
)
1416 TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex
,
1417 pPerAdapterInfo
, pOutBufLen
);
1419 /* marking Win2K+ functions not supported */
1420 return ERROR_NOT_SUPPORTED
;
1424 /******************************************************************
1425 * GetRTTAndHopCount (IPHLPAPI.@)
1430 * DestIpAddress [In]
1440 BOOL WINAPI
GetRTTAndHopCount(IPAddr DestIpAddress
, PULONG HopCount
, ULONG MaxHops
, PULONG RTT
)
1442 TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n",
1443 DestIpAddress
, HopCount
, MaxHops
, RTT
);
1449 /******************************************************************
1450 * GetTcpStatistics (IPHLPAPI.@)
1462 DWORD WINAPI
GetTcpStatistics(PMIB_TCPSTATS pStats
)
1466 TRACE("pStats %p\n", pStats
);
1467 ret
= getTCPStats(pStats
);
1468 TRACE("returning %ld\n", ret
);
1473 static int TcpTableSorter(const void *a
, const void *b
)
1478 PMIB_TCPROW rowA
= (PMIB_TCPROW
)a
, rowB
= (PMIB_TCPROW
)b
;
1480 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1482 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1484 ret
= rowA
->dwRemoteAddr
- rowB
->dwRemoteAddr
;
1486 ret
= rowA
->dwRemotePort
- rowB
->dwRemotePort
;
1496 /******************************************************************
1497 * GetTcpTable (IPHLPAPI.@)
1502 * pTcpTable [In/Out]
1511 DWORD WINAPI
GetTcpTable(PMIB_TCPTABLE pTcpTable
, PDWORD pdwSize
, BOOL bOrder
)
1515 TRACE("pTcpTable %p, pdwSize %p, bOrder %ld\n", pTcpTable
, pdwSize
,
1518 ret
= ERROR_INVALID_PARAMETER
;
1520 DWORD numEntries
= getNumTcpEntries();
1521 ULONG size
= sizeof(MIB_TCPTABLE
) + (numEntries
- 1) * sizeof(MIB_TCPROW
);
1523 if (!pTcpTable
|| *pdwSize
< size
) {
1525 ret
= ERROR_INSUFFICIENT_BUFFER
;
1528 PMIB_TCPTABLE table
= getTcpTable();
1531 size
= sizeof(MIB_TCPTABLE
) + (table
->dwNumEntries
- 1) *
1533 if (*pdwSize
< size
) {
1535 ret
= ERROR_INSUFFICIENT_BUFFER
;
1538 memcpy(pTcpTable
, table
, size
);
1540 qsort(pTcpTable
->table
, pTcpTable
->dwNumEntries
,
1541 sizeof(MIB_TCPROW
), TcpTableSorter
);
1547 ret
= ERROR_OUTOFMEMORY
;
1550 TRACE("returning %ld\n", ret
);
1555 /******************************************************************
1556 * GetUdpStatistics (IPHLPAPI.@)
1568 DWORD WINAPI
GetUdpStatistics(PMIB_UDPSTATS pStats
)
1572 TRACE("pStats %p\n", pStats
);
1573 ret
= getUDPStats(pStats
);
1574 TRACE("returning %ld\n", ret
);
1579 static int UdpTableSorter(const void *a
, const void *b
)
1584 PMIB_UDPROW rowA
= (PMIB_UDPROW
)a
, rowB
= (PMIB_UDPROW
)b
;
1586 ret
= rowA
->dwLocalAddr
- rowB
->dwLocalAddr
;
1588 ret
= rowA
->dwLocalPort
- rowB
->dwLocalPort
;
1596 /******************************************************************
1597 * GetUdpTable (IPHLPAPI.@)
1602 * pUdpTable [In/Out]
1611 DWORD WINAPI
GetUdpTable(PMIB_UDPTABLE pUdpTable
, PDWORD pdwSize
, BOOL bOrder
)
1615 TRACE("pUdpTable %p, pdwSize %p, bOrder %ld\n", pUdpTable
, pdwSize
,
1618 ret
= ERROR_INVALID_PARAMETER
;
1620 DWORD numEntries
= getNumUdpEntries();
1621 ULONG size
= sizeof(MIB_UDPTABLE
) + (numEntries
- 1) * sizeof(MIB_UDPROW
);
1623 if (!pUdpTable
|| *pdwSize
< size
) {
1625 ret
= ERROR_INSUFFICIENT_BUFFER
;
1628 PMIB_UDPTABLE table
= getUdpTable();
1631 size
= sizeof(MIB_UDPTABLE
) + (table
->dwNumEntries
- 1) *
1633 if (*pdwSize
< size
) {
1635 ret
= ERROR_INSUFFICIENT_BUFFER
;
1638 memcpy(pUdpTable
, table
, size
);
1640 qsort(pUdpTable
->table
, pUdpTable
->dwNumEntries
,
1641 sizeof(MIB_UDPROW
), UdpTableSorter
);
1647 ret
= ERROR_OUTOFMEMORY
;
1650 TRACE("returning %ld\n", ret
);
1655 /******************************************************************
1656 * GetUniDirectionalAdapterInfo (IPHLPAPI.@)
1661 * pIPIfInfo [In/Out]
1662 * dwOutBufLen [In/Out]
1669 DWORD WINAPI
GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo
, PULONG dwOutBufLen
)
1671 TRACE("pIPIfInfo %p, dwOutBufLen %p\n", pIPIfInfo
, dwOutBufLen
);
1672 /* a unidirectional adapter?? not bloody likely! */
1673 return ERROR_NOT_SUPPORTED
;
1677 /******************************************************************
1678 * IpReleaseAddress (IPHLPAPI.@)
1683 * AdapterInfo [In/Out]
1690 DWORD WINAPI
IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1692 TRACE("AdapterInfo %p\n", AdapterInfo
);
1693 /* not a stub, never going to support this (and I never mark an adapter as
1694 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1695 return ERROR_NOT_SUPPORTED
;
1699 /******************************************************************
1700 * IpRenewAddress (IPHLPAPI.@)
1705 * AdapterInfo [In/Out]
1712 DWORD WINAPI
IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo
)
1714 TRACE("AdapterInfo %p\n", AdapterInfo
);
1715 /* not a stub, never going to support this (and I never mark an adapter as
1716 DHCP enabled, see GetAdaptersInfo, so this should never get called) */
1717 return ERROR_NOT_SUPPORTED
;
1721 /******************************************************************
1722 * NotifyAddrChange (IPHLPAPI.@)
1728 * overlapped [In/Out]
1735 DWORD WINAPI
NotifyAddrChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1737 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1739 /* marking Win2K+ functions not supported */
1740 return ERROR_NOT_SUPPORTED
;
1744 /******************************************************************
1745 * NotifyRouteChange (IPHLPAPI.@)
1751 * overlapped [In/Out]
1758 DWORD WINAPI
NotifyRouteChange(PHANDLE Handle
, LPOVERLAPPED overlapped
)
1760 TRACE("Handle %p, overlapped %p\n", Handle
, overlapped
);
1762 /* marking Win2K+ functions not supported */
1763 return ERROR_NOT_SUPPORTED
;
1767 /******************************************************************
1768 * SendARP (IPHLPAPI.@)
1776 * PhyAddrLen [In/Out]
1783 DWORD WINAPI
SendARP(IPAddr DestIP
, IPAddr SrcIP
, PULONG pMacAddr
, PULONG PhyAddrLen
)
1785 TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP
,
1786 SrcIP
, pMacAddr
, PhyAddrLen
);
1788 /* marking Win2K+ functions not supported */
1789 return ERROR_NOT_SUPPORTED
;
1793 /******************************************************************
1794 * SetIfEntry (IPHLPAPI.@)
1806 DWORD WINAPI
SetIfEntry(PMIB_IFROW pIfRow
)
1808 TRACE("pIfRow %p\n", pIfRow
);
1809 /* this is supposed to set an administratively interface up or down.
1810 Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and
1811 this sort of down is indistinguishable from other sorts of down (e.g. no
1814 return ERROR_NOT_SUPPORTED
;
1818 /******************************************************************
1819 * SetIpForwardEntry (IPHLPAPI.@)
1831 DWORD WINAPI
SetIpForwardEntry(PMIB_IPFORWARDROW pRoute
)
1833 TRACE("pRoute %p\n", pRoute
);
1834 /* this is to add a route entry, how's it distinguishable from
1835 CreateIpForwardEntry?
1836 could use SIOCADDRT, not sure I want to */
1842 /******************************************************************
1843 * SetIpNetEntry (IPHLPAPI.@)
1848 * pArpEntry [In/Out]
1855 DWORD WINAPI
SetIpNetEntry(PMIB_IPNETROW pArpEntry
)
1857 TRACE("pArpEntry %p\n", pArpEntry
);
1858 /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */
1864 /******************************************************************
1865 * SetIpStatistics (IPHLPAPI.@)
1877 DWORD WINAPI
SetIpStatistics(PMIB_IPSTATS pIpStats
)
1879 TRACE("pIpStats %p\n", pIpStats
);
1885 /******************************************************************
1886 * SetIpTTL (IPHLPAPI.@)
1898 DWORD WINAPI
SetIpTTL(UINT nTTL
)
1900 TRACE("nTTL %d\n", nTTL
);
1901 /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I
1902 want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */
1908 /******************************************************************
1909 * SetTcpEntry (IPHLPAPI.@)
1921 DWORD WINAPI
SetTcpEntry(PMIB_TCPROW pTcpRow
)
1923 TRACE("pTcpRow %p\n", pTcpRow
);
1929 /******************************************************************
1930 * UnenableRouter (IPHLPAPI.@)
1935 * pOverlapped [In/Out]
1936 * lpdwEnableCount [In/Out]
1943 DWORD WINAPI
UnenableRouter(OVERLAPPED
* pOverlapped
, LPDWORD lpdwEnableCount
)
1945 TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped
, lpdwEnableCount
);
1947 /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to
1948 could map EACCESS to ERROR_ACCESS_DENIED, I suppose
1949 marking Win2K+ functions not supported */
1950 return ERROR_NOT_SUPPORTED
;