From 72ef8729e6cedc6da525106a0dc8fbf3538e065c Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Sat, 13 Oct 2007 16:39:10 -0700 Subject: [PATCH] iphlpapi: Implement GetAdapterIndex. --- dlls/iphlpapi/iphlpapi_main.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index d1ef7626c3c..c89af67b17e 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -625,15 +625,22 @@ DWORD WINAPI FlushIpNetTable(DWORD dwIfIndex) * RETURNS * Success: NO_ERROR * Failure: error code from winerror.h - * - * FIXME - * Stub, returns ERROR_NOT_SUPPORTED. */ DWORD WINAPI GetAdapterIndex(LPWSTR AdapterName, PULONG IfIndex) { - FIXME("(AdapterName %p, IfIndex %p): stub\n", AdapterName, IfIndex); - /* FIXME: implement using getInterfaceIndexByName */ - return ERROR_NOT_SUPPORTED; + char adapterName[MAX_ADAPTER_NAME]; + int i; + DWORD ret; + + TRACE("(AdapterName %p, IfIndex %p)\n", AdapterName, IfIndex); + /* The adapter name is guaranteed not to have any unicode characters, so + * this translation is never lossy */ + for (i = 0; i < sizeof(adapterName) - 1 && AdapterName[i]; i++) + adapterName[i] = (char)AdapterName[i]; + adapterName[i] = '\0'; + ret = getInterfaceIndexByName(adapterName, IfIndex); + TRACE("returning %d\n", ret); + return ret; }