Fix getInterfaceInfoSet so GetInterfaceInfo returns only non-loopback adapters, howev...
[reactos.git] / reactos / lib / iphlpapi / iphlpapi_main.c
index 7cb9295..7c6a20f 100644 (file)
@@ -82,11 +82,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  *  DWORD
  *
  */
-DWORD WINAPI AddIPAddress(IPAddr Address, IPMask IpMask, DWORD IfIndex, PULONG NTEContext, PULONG NTEInstance)
+DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
 {
-  FIXME(":stub\n");
-  /* marking Win2K+ functions not supported */
-  return ERROR_NOT_SUPPORTED;
+    return addIPAddress( Address, Netmask, IfIndex, NteContext, NteInstance );
 }
 
 
@@ -404,9 +402,7 @@ DWORD WINAPI CreateProxyArpEntry(DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex)
 DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
 {
   TRACE("NTEContext %ld\n", NTEContext);
-  FIXME(":stub\n");
-  /* marking Win2K+ functions not supported */
-  return ERROR_NOT_SUPPORTED;
+  return deleteIpAddress( NTEContext );
 }
 
 
@@ -939,8 +935,9 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
   if (!dwOutBufLen)
     ret = ERROR_INVALID_PARAMETER;
   else {
-    DWORD numInterfaces = getNumInterfaces();
-    ULONG size = sizeof(IP_INTERFACE_INFO) + (numInterfaces - 1) *
+    DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces();
+    DPRINT("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces);
+    ULONG size = sizeof(IP_INTERFACE_INFO) + (numNonLoopbackInterfaces) *
      sizeof(IP_ADAPTER_INDEX_MAP);
 
     if (!pIfTable || *dwOutBufLen < size) {
@@ -948,10 +945,11 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
       ret = ERROR_INSUFFICIENT_BUFFER;
     }
     else {
-      InterfaceIndexTable *table = getInterfaceIndexTable();
+      InterfaceIndexTable *table = getNonLoopbackInterfaceIndexTable();
+      DPRINT("table->numIndexes == 0x%x\n", table->numIndexes);
 
       if (table) {
-        size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes - 1) *
+        size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes) *
          sizeof(IP_ADAPTER_INDEX_MAP);
         if (*dwOutBufLen < size) {
           *dwOutBufLen = size;