Module: wine Branch: master Commit: b0efe7f8b883a95e85eb247f22b8de4ba926014b URL: http://source.winehq.org/git/wine.git/?a=commit;h=b0efe7f8b883a95e85eb247f22...
Author: Juan Lang juan.lang@gmail.com Date: Fri Oct 12 16:16:35 2007 -0700
iphlpapi: Improve GetPerAdapterInfo stub.
---
dlls/iphlpapi/iphlpapi_main.c | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 2aac18d..eaccf83 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1450,13 +1450,33 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf) * Failure: error code from winerror.h * * FIXME - * Stub, returns ERROR_NOT_SUPPORTED. + * Stub, returns empty IP_PER_ADAPTER_INFO in every case. */ DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen) { + ULONG bytesNeeded = sizeof(IP_PER_ADAPTER_INFO); + DWORD ret; + TRACE("(IfIndex %d, pPerAdapterInfo %p, pOutBufLen %p)\n", IfIndex, pPerAdapterInfo, pOutBufLen); - return ERROR_NOT_SUPPORTED; + if (!pOutBufLen) + ret = ERROR_INVALID_PARAMETER; + else if (!pPerAdapterInfo) + { + *pOutBufLen = bytesNeeded; + ret = NO_ERROR; + } + else if (*pOutBufLen < bytesNeeded) + { + *pOutBufLen = bytesNeeded; + ret = ERROR_BUFFER_OVERFLOW; + } + else + { + memset(pPerAdapterInfo, 0, bytesNeeded); + ret = NO_ERROR; + } + return ret; }