PATCH: GetAdaptersInfo

Marcus Meissner marcus at jet.franken.de
Mon Jan 30 06:19:45 CST 2006


Hi,

This increases the "guessed" sizes of necessary space
in GetAdaptersInfo() a bit.

In my case it was not taken interfaces with more than 1 
ipv4 address into account.

Ciao, Marcus

Changelog:
	Allocate space enough to handle all the possible ipv4
	addresses.

Index: dlls/iphlpapi/iphlpapi_main.c
===================================================================
RCS file: /home/wine/wine/dlls/iphlpapi/iphlpapi_main.c,v
retrieving revision 1.26
diff -u -r1.26 iphlpapi_main.c
--- dlls/iphlpapi/iphlpapi_main.c	27 Jan 2006 18:29:19 -0000	1.26
+++ dlls/iphlpapi/iphlpapi_main.c	30 Jan 2006 12:16:47 -0000
@@ -654,9 +654,7 @@
        * precisely enough space.
        */
       size = sizeof(IP_ADAPTER_INFO) * numNonLoopbackInterfaces;
-      if (numIPAddresses > numNonLoopbackInterfaces)
-        size += (numIPAddresses - numNonLoopbackInterfaces) *
-         sizeof(IP_ADDR_STRING); 
+      size += numIPAddresses  * sizeof(IP_ADDR_STRING); 
       if (!pAdapterInfo || *pOutBufLen < size) {
         *pOutBufLen = size;
         ret = ERROR_BUFFER_OVERFLOW;
@@ -670,9 +668,7 @@
           table = getNonLoopbackInterfaceIndexTable();
         if (table) {
           size = sizeof(IP_ADAPTER_INFO) * table->numIndexes;
-          if (ipAddrTable->dwNumEntries > numNonLoopbackInterfaces)
-            size += (ipAddrTable->dwNumEntries - numNonLoopbackInterfaces) *
-             sizeof(IP_ADDR_STRING); 
+          size += ipAddrTable->dwNumEntries * sizeof(IP_ADDR_STRING); 
           if (*pOutBufLen < size) {
             *pOutBufLen = size;
             ret = ERROR_INSUFFICIENT_BUFFER;



More information about the wine-patches mailing list