diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-10-07 12:45:26 (GMT) |
---|---|---|
committer | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2011-10-07 12:45:26 (GMT) |
commit | 1bfef526ef3d1deb7cf0f11dc1880f33937a85ac (patch) | |
tree | 99f12e16c210bf99ea901feed7da14d5efc32420 /src/network/kernel | |
parent | 80a8c4c8615da574b155b7624eab1c8323de3ee3 (diff) | |
download | Qt-1bfef526ef3d1deb7cf0f11dc1880f33937a85ac.zip Qt-1bfef526ef3d1deb7cf0f11dc1880f33937a85ac.tar.gz Qt-1bfef526ef3d1deb7cf0f11dc1880f33937a85ac.tar.bz2 |
use QSystemLibrary::resolve() instead of GetProcAddress() win API calls
this makes the code more consistent with similar parts and a bit more readable
Merge-request: 2655
Reviewed-by: Jan-Arve Saether <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qnetworkinterface_win.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index e8b96f6..5f273d7 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -67,19 +67,12 @@ static void resolveLibs() if (!done) { done = true; - HINSTANCE iphlpapiHnd = QSystemLibrary::load(L"iphlpapi"); - if (iphlpapiHnd == NULL) - return; - -#if defined(Q_OS_WINCE) - ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, L"GetAdaptersInfo"); - ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, L"GetAdaptersAddresses"); - ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, L"GetNetworkParams"); -#else - ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, "GetAdaptersInfo"); - ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, "GetAdaptersAddresses"); - ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, "GetNetworkParams"); -#endif + QSystemLibrary iphlpapi(QLatin1String("iphlpapi")); + if (iphlpapi.load()) { + ptrGetAdaptersInfo = (PtrGetAdaptersInfo)iphlpapi.resolve("GetAdaptersInfo"); + ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)iphlpapi.resolve("GetAdaptersAddresses"); + ptrGetNetworkParams = (PtrGetNetworkParams)iphlpapi.resolve("GetNetworkParams"); + } } } |