Add helper for loading Windows system functions

This commit is contained in:
Chocobo1 2018-04-07 15:35:35 +08:00
parent 643a209812
commit b0e3d77975
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 27 additions and 5 deletions

View file

@ -4543,11 +4543,11 @@ namespace
return uuid.toString().toUpper(); // Libtorrent expects the GUID in uppercase
using PCONVERTIFACENAMETOLUID = NETIO_STATUS (WINAPI *)(const WCHAR *, PNET_LUID);
PCONVERTIFACENAMETOLUID ConvertIfaceNameToLuid = reinterpret_cast<PCONVERTIFACENAMETOLUID>(::GetProcAddress(::GetModuleHandleW(L"Iphlpapi.dll"), "ConvertInterfaceNameToLuidW"));
const auto ConvertIfaceNameToLuid = Utils::Misc::loadWinAPI<PCONVERTIFACENAMETOLUID>("Iphlpapi.dll", "ConvertInterfaceNameToLuidW");
if (!ConvertIfaceNameToLuid) return QString();
using PCONVERTIFACELUIDTOGUID = NETIO_STATUS (WINAPI *)(const NET_LUID *, GUID *);
PCONVERTIFACELUIDTOGUID ConvertIfaceLuidToGuid = reinterpret_cast<PCONVERTIFACELUIDTOGUID>(::GetProcAddress(::GetModuleHandleW(L"Iphlpapi.dll"), "ConvertInterfaceLuidToGuid"));
const auto ConvertIfaceLuidToGuid = Utils::Misc::loadWinAPI<PCONVERTIFACELUIDTOGUID>("Iphlpapi.dll", "ConvertInterfaceLuidToGuid");
if (!ConvertIfaceLuidToGuid) return QString();
NET_LUID luid;