From ee49c7a2b67e7d7b0245023408c7d2448287edb5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 1 Dec 2011 15:47:49 +0100 Subject: [PATCH] Fix MinGW and MinGW-w64 builds Closes GH-222 and GH-267. Thanks Yuki Okumura and Yasuhiro Matsumoto for providing fixes. --- include/uv-private/uv-win.h | 4 +++- src/win/winapi.h | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/uv-private/uv-win.h b/include/uv-private/uv-win.h index b17ee015..1fdc5827 100644 --- a/include/uv-private/uv-win.h +++ b/include/uv-private/uv-win.h @@ -142,7 +142,9 @@ typedef HANDLE uv_thread_t; typedef CRITICAL_SECTION uv_mutex_t; typedef union { - SRWLOCK srwlock_; + /* srwlock_ has type SRWLOCK, but not all toolchains define this type in */ + /* windows.h. */ + void* srwlock_; struct { uv_mutex_t read_mutex_; uv_mutex_t write_mutex_; diff --git a/src/win/winapi.h b/src/win/winapi.h index 81449399..a1cd7c73 100644 --- a/src/win/winapi.h +++ b/src/win/winapi.h @@ -4080,7 +4080,7 @@ /* from ntifs.h */ /* MinGW already has it */ -#ifndef __MINGW32__ +#if defined(_MSC_VER) || defined(__MINGW64__) typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; USHORT ReparseDataLength; @@ -4281,6 +4281,10 @@ typedef enum _FILE_INFORMATION_CLASS { FILE_SPECIAL_ACCESS) #endif +#ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif + typedef VOID (NTAPI *PIO_APC_ROUTINE) (PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, @@ -4333,6 +4337,24 @@ typedef NTSTATUS (NTAPI *sNtSetInformationFile) } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; #endif +#ifdef __MINGW32__ + typedef PVOID RTL_SRWLOCK; + typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif + +/* from wincon.h */ +#ifndef ENABLE_INSERT_MODE +# define ENABLE_INSERT_MODE 0x20 +#endif + +#ifndef ENABLE_QUICK_EDIT_MODE +# define ENABLE_QUICK_EDIT_MODE 0x40 +#endif + +#ifndef ENABLE_EXTENDED_FLAGS +# define ENABLE_EXTENDED_FLAGS 0x80 +#endif + typedef BOOL (WINAPI *sGetQueuedCompletionStatusEx) (HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries, @@ -4371,6 +4393,7 @@ typedef VOID (WINAPI* sReleaseSRWLockShared) typedef VOID (WINAPI* sReleaseSRWLockExclusive) (PSRWLOCK SRWLock); + /* Ntapi function pointers */ extern sRtlNtStatusToDosError pRtlNtStatusToDosError; extern sNtDeviceIoControlFile pNtDeviceIoControlFile;