Juan Lang : iphlpapi: Implement GetAdapterIndex.

Alexandre Julliard julliard at winehq.org
Mon Oct 15 11:28:10 CDT 2007


Module: wine
Branch: master
Commit: 72ef8729e6cedc6da525106a0dc8fbf3538e065c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=72ef8729e6cedc6da525106a0dc8fbf3538e065c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Sat Oct 13 16:39:10 2007 -0700

iphlpapi: Implement GetAdapterIndex.

---

 dlls/iphlpapi/iphlpapi_main.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index d1ef762..c89af67 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;
 }
 
 




More information about the wine-cvs mailing list