Module: wine Branch: master Commit: 80969f53033c294b744eb0584be1b3d959495cbd URL: http://source.winehq.org/git/wine.git/?a=commit;h=80969f53033c294b744eb0584b...
Author: Aric Stewart aric@codeweavers.com Date: Wed Oct 24 11:15:39 2007 -0500
iphlpapi: For platforms that do not implement /proc, return Unimplemented for the functions trying to read from there.
---
dlls/iphlpapi/iphlpapi_main.c | 6 +++--- dlls/iphlpapi/ipstats.c | 27 +++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index c89af67..96e16bf 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -852,8 +852,8 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO if (!pBestRoute) return ERROR_INVALID_PARAMETER;
- AllocateAndGetIpForwardTableFromStack(&table, FALSE, GetProcessHeap(), 0); - if (table) { + ret = AllocateAndGetIpForwardTableFromStack(&table, FALSE, GetProcessHeap(), 0); + if (table && !ret) { DWORD ndx, matchedBits, matchedNdx = 0;
for (ndx = 0, matchedBits = 0; ndx < table->dwNumEntries; ndx++) { @@ -881,7 +881,7 @@ DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDRO } HeapFree(GetProcessHeap(), 0, table); } - else + else if (!ret) ret = ERROR_OUTOFMEMORY; TRACE("returning %d\n", ret); return ret; diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 69dd978..1ba57b1 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -182,7 +182,10 @@ DWORD getInterfaceStatsByName(const char *name, PMIB_IFROW entry) fclose(fp); } else + { ERR ("unimplemented!\n"); + return ERROR_NOT_SUPPORTED; + }
return NO_ERROR; } @@ -312,7 +315,10 @@ DWORD getICMPStats(MIB_ICMP *stats) fclose(fp); } else + { ERR ("unimplemented!\n"); + return ERROR_NOT_SUPPORTED; + }
return NO_ERROR; } @@ -426,7 +432,10 @@ DWORD getIPStats(PMIB_IPSTATS stats) fclose(fp); } else + { ERR ("unimplemented!\n"); + return ERROR_NOT_SUPPORTED; + }
return NO_ERROR; } @@ -519,7 +528,10 @@ DWORD getTCPStats(MIB_TCPSTATS *stats) fclose(fp); } else + { ERR ("unimplemented!\n"); + return ERROR_NOT_SUPPORTED; + }
return NO_ERROR; } @@ -575,7 +587,10 @@ DWORD getUDPStats(MIB_UDPSTATS *stats) fclose(fp); } else + { ERR ("unimplemented!\n"); + return ERROR_NOT_SUPPORTED; + }
return NO_ERROR; } @@ -963,7 +978,7 @@ DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap, else { ERR ("unimplemented!\n"); - return ERROR_INVALID_PARAMETER; + return ERROR_NOT_SUPPORTED; } #endif } @@ -984,7 +999,7 @@ DWORD getArpTable(PMIB_IPNETTABLE *ppIpNetTable, HANDLE heap, DWORD flags)
#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) ERR ("unimplemented!\n"); - return ERROR_INVALID_PARAMETER; + return ERROR_NOT_SUPPORTED; #endif
if (!ppIpNetTable) @@ -1064,6 +1079,8 @@ DWORD getArpTable(PMIB_IPNETTABLE *ppIpNetTable, HANDLE heap, DWORD flags) } fclose(fp); } + else + ret = ERROR_NOT_SUPPORTED; } else ret = ERROR_OUTOFMEMORY; @@ -1082,7 +1099,7 @@ DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags)
#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) ERR ("unimplemented!\n"); - return ERROR_INVALID_PARAMETER; + return ERROR_NOT_SUPPORTED; #endif
if (!ppUdpTable) @@ -1132,6 +1149,8 @@ DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags) } fclose(fp); } + else + ret = ERROR_NOT_SUPPORTED; } else ret = ERROR_OUTOFMEMORY; @@ -1294,7 +1313,7 @@ DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, DWORD maxEntries, HANDLE heap, /* get from /proc/net/tcp, no error if can't */ fp = fopen("/proc/net/tcp", "r"); if (!fp) - return NO_ERROR; + return ERROR_NOT_SUPPORTED;
/* skip header line */ ptr = fgets(buf, sizeof(buf), fp);