VirtualBox

Ignore:
Timestamp:
Nov 10, 2014 3:03:43 PM (10 years ago)
Author:
vboxsync
Message:

NAT: Don't retrieve the address of GetAdaptersAddresses() in icmp_init().
While we, conveniently, do have iphlpapi.dll open there, it's not a good
reason to do this lookup of completely unrealted function there.
Do this in slirp_init() instead.

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/ip_icmp.c

    r50986 r53292  
    127127            pData->pfIcmpParseReplies = (long (WINAPI *)(void *, long))RTLdrGetFunction(hLdrMod, "IcmpParseReplies");
    128128            pData->pfIcmpCloseHandle = (BOOL (WINAPI *)(HANDLE))RTLdrGetFunction(hLdrMod, "IcmpCloseHandle");
    129             rc = RTLdrGetSymbol(hLdrMod, "GetAdaptersAddresses", (void **)&pData->pfGetAdaptersAddresses);
    130             if (RT_FAILURE(rc))
    131                 LogRel(("NAT: Can't find GetAdapterAddresses in Iphlpapi.dll\n"));
    132129            RTLdrClose(hLdrMod);
    133130        }
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r52798 r53292  
    336336    {
    337337        WSADATA Data;
     338        RTLDRMOD hLdrMod;
     339
    338340        WSAStartup(MAKEWORD(2, 0), &Data);
     341
     342        rc = RTLdrLoadSystem("Iphlpapi.dll", /* :fNoUnload */ true, &hLdrMod);
     343        if (RT_SUCCESS(rc))
     344        {
     345            rc = RTLdrGetSymbol(hLdrMod, "GetAdaptersAddresses", (void **)&pData->pfGetAdaptersAddresses);
     346            if (RT_FAILURE(rc))
     347                LogRel(("NAT: Can't find GetAdapterAddresses in Iphlpapi.dll\n"));
     348
     349            RTLdrClose(hLdrMod);
     350        }
    339351    }
    340352    pData->phEvents[VBOX_SOCKET_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette