]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix Windows NT API usage in VS 6
authorBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:25 +0000 (08:15 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:25 +0000 (08:15 -0500)
VS 6 warns verbosely when WINVER >= 0x0500.  Avoid defining WINVER and
_WIN32_WINNT to higher than 0x0400 on VS 6.  Provide missing API
declarations in archive_windows.h when we do not get them from
<windows.h>.  Provide GetVolumePathNameW because VS 6 does not declare
it regardless of the API version.

SVN-Revision: 4129

CMakeLists.txt
libarchive/archive_windows.h

index a675f4d886ed3d8f907bfc9e599549e7b3f356e0..207d72f0c3544878c03f5c27f5811f8864654845 100644 (file)
@@ -74,8 +74,12 @@ IF(ENABLE_TEST)
 ENDIF(ENABLE_TEST)
 
 IF(WIN32)
-  SET(_WIN32_WINNT 0x0500 CACHE INTERNAL "Setting _WIN32_WINNT to 0x0500 for Windows 2000 APIs")
-  SET(WINVER 0x0500 CACHE INTERNAL "Setting WINVER to 0x0500 for Windows 2000 APIs")
+  IF(MSVC60)
+    SET(WINVER 0x0400)
+  ELSE()
+    SET(WINVER 0x0500)
+  ENDIF()
+  SET(_WIN32_WINNT ${WINVER})
 ENDIF(WIN32)
 
 #
index 033d620dd9bf8295b02436be8f6caaacd7a04f62..31288c1250bf4486a7dc7192a20199851da0dc03 100644 (file)
@@ -275,4 +275,22 @@ typedef int mbstate_t;
 size_t wcrtomb(char *, wchar_t, mbstate_t *);
 #endif
 
+#if defined(_MSC_VER) && _MSC_VER < 1300
+WINBASEAPI BOOL WINAPI GetVolumePathNameW(
+       LPCWSTR lpszFileName,
+       LPWSTR lpszVolumePathName,
+       DWORD cchBufferLength
+       );
+# if _WIN32_WINNT < 0x0500 /* windows.h not providing 0x500 API */
+typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
+       LARGE_INTEGER FileOffset;
+       LARGE_INTEGER Length;
+} FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
+#  define FSCTL_SET_SPARSE \
+     CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA)
+#  define FSCTL_QUERY_ALLOCATED_RANGES \
+     CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51,  METHOD_NEITHER, FILE_READ_DATA)
+# endif
+#endif
+
 #endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */