From e318e001ea74a8a6f5cb69dce32d7c3ac42c192b Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 28 May 2018 22:27:06 -0700 Subject: [PATCH] Revert "win: add Windows XP support to uv_if_indextoname()" Libuv is not supported on Windows XP, as stated in the SUPPORTED_PLATFORMS document. It also can't possibly work because `ReOpenFile()` in src/win/fs.c is not weakly linked, so any executable that links libuv would simply fail to load on XP. This reverts commit 17eaa956bde35daad99b36b820daf8e8227add74. Refs: https://github.com/libuv/libuv/pull/1810 PR-URL: https://github.com/libuv/libuv/pull/1854 Reviewed-By: Bartosz Sosnowski Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/win/getaddrinfo.c | 10 ++-------- src/win/winapi.c | 11 ----------- src/win/winapi.h | 15 --------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/win/getaddrinfo.c b/src/win/getaddrinfo.c index 4ce98826..063b4937 100644 --- a/src/win/getaddrinfo.c +++ b/src/win/getaddrinfo.c @@ -391,21 +391,15 @@ int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) { DWORD bufsize; int r; - uv__once_init(); - if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL; - if (pConvertInterfaceIndexToLuid == NULL) - return UV_ENOSYS; - r = pConvertInterfaceIndexToLuid(ifindex, &luid); + r = ConvertInterfaceIndexToLuid(ifindex, &luid); if (r != 0) return uv_translate_sys_error(r); - if (pConvertInterfaceLuidToNameW == NULL) - return UV_ENOSYS; - r = pConvertInterfaceLuidToNameW(&luid, wname, ARRAY_SIZE(wname)); + r = ConvertInterfaceLuidToNameW(&luid, wname, ARRAY_SIZE(wname)); if (r != 0) return uv_translate_sys_error(r); diff --git a/src/win/winapi.c b/src/win/winapi.c index c2097373..f12f207f 100644 --- a/src/win/winapi.c +++ b/src/win/winapi.c @@ -53,16 +53,12 @@ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; /* User32.dll function pointer */ sSetWinEventHook pSetWinEventHook; -/* iphlpapi.dll function pointer */ -sConvertInterfaceIndexToLuid pConvertInterfaceIndexToLuid = NULL; -sConvertInterfaceLuidToNameW pConvertInterfaceLuidToNameW = NULL; void uv_winapi_init(void) { HMODULE ntdll_module; HMODULE kernel32_module; HMODULE powrprof_module; HMODULE user32_module; - HMODULE iphlpapi_module; ntdll_module = GetModuleHandleA("ntdll.dll"); if (ntdll_module == NULL) { @@ -162,11 +158,4 @@ void uv_winapi_init(void) { GetProcAddress(user32_module, "SetWinEventHook"); } - iphlpapi_module = LoadLibraryA("iphlpapi.dll"); - if (iphlpapi_module != NULL) { - pConvertInterfaceIndexToLuid = (sConvertInterfaceIndexToLuid) - GetProcAddress(iphlpapi_module, "ConvertInterfaceIndexToLuid"); - pConvertInterfaceLuidToNameW = (sConvertInterfaceLuidToNameW) - GetProcAddress(iphlpapi_module, "ConvertInterfaceLuidToNameW"); - } } diff --git a/src/win/winapi.h b/src/win/winapi.h index be3529ff..51808882 100644 --- a/src/win/winapi.h +++ b/src/win/winapi.h @@ -4766,19 +4766,4 @@ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotifi /* User32.dll function pointer */ extern sSetWinEventHook pSetWinEventHook; -/* iphlpapi.dll function pointer */ -union _NET_LUID_LH; -typedef DWORD (WINAPI *sConvertInterfaceIndexToLuid)( - ULONG InterfaceIndex, - union _NET_LUID_LH *InterfaceLuid); - -typedef DWORD (WINAPI *sConvertInterfaceLuidToNameW)( - const union _NET_LUID_LH *InterfaceLuid, - PWSTR InterfaceName, - size_t Length); - -extern sConvertInterfaceIndexToLuid pConvertInterfaceIndexToLuid; -extern sConvertInterfaceLuidToNameW pConvertInterfaceLuidToNameW; - - #endif /* UV_WIN_WINAPI_H_ */