diff --git a/src/win/util.c b/src/win/util.c index 6ded755c..9f731ecf 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -490,11 +490,13 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, unsigned long size = 0; IP_ADAPTER_ADDRESSES* adapter_addresses; IP_ADAPTER_ADDRESSES* adapter_address; - IP_ADAPTER_UNICAST_ADDRESS_XP* unicast_address; uv_interface_address_t* address; struct sockaddr* sock_addr; int length; char* name; + /* Use IP_ADAPTER_UNICAST_ADDRESS_XP to retain backwards compatibility */ + /* with Windows XP */ + IP_ADAPTER_UNICAST_ADDRESS_XP* unicast_address; if (GetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, &size) != ERROR_BUFFER_OVERFLOW) { @@ -517,7 +519,8 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, for (adapter_address = adapter_addresses; adapter_address != NULL; adapter_address = adapter_address->Next) { - unicast_address = adapter_address->FirstUnicastAddress; + unicast_address = (IP_ADAPTER_UNICAST_ADDRESS_XP*) + adapter_address->FirstUnicastAddress; while (unicast_address) { (*count)++; unicast_address = unicast_address->Next; @@ -536,7 +539,8 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, adapter_address != NULL; adapter_address = adapter_address->Next) { name = NULL; - unicast_address = adapter_address->FirstUnicastAddress; + unicast_address = (IP_ADAPTER_UNICAST_ADDRESS_XP*) + adapter_address->FirstUnicastAddress; while (unicast_address) { sock_addr = unicast_address->Address.lpSockaddr; diff --git a/src/win/winapi.h b/src/win/winapi.h index c9552ed2..b63c02dc 100644 --- a/src/win/winapi.h +++ b/src/win/winapi.h @@ -4323,10 +4323,17 @@ typedef NTSTATUS (NTAPI *sNtSetInformationFile) /* * Kernel32 headers */ -#define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 -#define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 +#ifndef FILE_SKIP_COMPLETION_PORT_ON_SUCCESS +# define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1 +#endif -#define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1 +#ifdef FILE_SKIP_SET_EVENT_ON_HANDLE +# define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2 +#endif + +#ifndef SYMBOLIC_LINK_FLAG_DIRECTORY +# define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1 +#endif #ifdef __MINGW32__ typedef struct _OVERLAPPED_ENTRY {