Now including <windows.h> via a common header file specifying the minimum Windows SDK version required
diff --git a/lib/zip_source_win32a.c b/lib/zip_source_win32a.c index 1ccbd5c..c84f045 100644 --- a/lib/zip_source_win32a.c +++ b/lib/zip_source_win32a.c
@@ -34,8 +34,8 @@ #include <errno.h> #include <stdio.h> -#include <windows.h> +#include "zipwin32.h" #include "zipint.h" static void * _win32_strdup_a(const void *str);
diff --git a/lib/zip_source_win32file.c b/lib/zip_source_win32file.c index 0067fad..8bb92c4 100644 --- a/lib/zip_source_win32file.c +++ b/lib/zip_source_win32file.c
@@ -32,12 +32,12 @@ */ -#include <windows.h> #include <wchar.h> #include <errno.h> #include <stdlib.h> #include <string.h> +#include "zipwin32.h" #include "zipint.h" static zip_int64_t _win32_read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd);
diff --git a/lib/zip_source_win32utf8.c b/lib/zip_source_win32utf8.c index 299a42c..55988fe 100644 --- a/lib/zip_source_win32utf8.c +++ b/lib/zip_source_win32utf8.c
@@ -34,8 +34,8 @@ #include <errno.h> #include <stdio.h> -#include <windows.h> +#include "zipwin32.h" #include "zipint.h"
diff --git a/lib/zip_source_win32w.c b/lib/zip_source_win32w.c index 326e69c..7e2dc15 100644 --- a/lib/zip_source_win32w.c +++ b/lib/zip_source_win32w.c
@@ -34,8 +34,8 @@ #include <errno.h> #include <stdio.h> -#include <windows.h> +#include "zipwin32.h" #include "zipint.h" static void *_win32_strdup_w(const void *str);
diff --git a/lib/zipwin32.h b/lib/zipwin32.h new file mode 100644 index 0000000..2f21168 --- /dev/null +++ b/lib/zipwin32.h
@@ -0,0 +1,43 @@ +#ifndef _HAD_ZIPWIN32_H +#define _HAD_ZIPWIN32_H + +/* + zipwin32.h -- Perform the necessary incantations for windows.h + Copyright (C) 1999-2014 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at <libzip@nih.at> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* Target Windows 2000 and later */ +#define WINVER 0x0500 +#define _WIN32_WINNT 0x0500 +#define _WIN32_WINDOWS 0x0500 +#include <windows.h> + +#endif /* zipwin32.h */