rpcrt4: Dynamically load iphlpapi

Rob Shearman robertshearman at gmail.com
Sun Aug 10 03:52:42 CDT 2008


2008/8/5 Juan Lang <juan.lang at gmail.com>:
> This has a similar motivation to the last patch I sent.  In rpcrt4's
> case, iphlpapi is needed at most once per process, so dynamically load
> it rather than keeping it around all the time.

> @@ -304,18 +304,23 @@ #define ADDRESS_BYTES_NEEDED 6
>
>  static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
>  {
> +    static const WCHAR iphlpapi[] = { 'i','p','h','l','p','a','p','i',0 };
>      int i;
>      DWORD status = RPC_S_OK;
>
>      ULONG buflen = sizeof(IP_ADAPTER_INFO);
>      PIP_ADAPTER_INFO adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
> +    HMODULE lib = LoadLibraryW(iphlpapi);
> +    DWORD (WINAPI *pGetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG) = NULL;

Hi Juan,

Why manually load iphlpapi here instead of using the automatic delayed
import mechanism like you used for ws2_32? I assume it was because you
reasoned that a hard dependency was unnecessary because the code has a
fallback path, but I think you needed to make this clear in the
changelog.

-- 
Rob Shearman



More information about the wine-devel mailing list