2008/8/5 Juan Lang <juan.lang(a)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
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.
I can try to make the changelog clearer, but that wasn't my motivation. As I mentioned in the email with the patch, iphlpapi is only needed once per process by rpcrt4, so I manually load it so that I can also unload it as soon as it's done. This is in contrast to ws2_32, where iphlpapi may be needed more than once. --Juan
2008/8/10 Juan Lang <juan.lang(a)gmail.com>:
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.
I can try to make the changelog clearer, but that wasn't my motivation. As I mentioned in the email with the patch, iphlpapi is only needed once per process by rpcrt4, so I manually load it so that I can also unload it as soon as it's done. This is in contrast to ws2_32, where iphlpapi may be needed more than once.
Ah, yes, I missed that part. The patch is fine with me. -- Rob Shearman
participants (2)
-
Juan Lang -
Rob Shearman