]> wimlib.net Git - wimlib/blob - include/wimlib/win32_common.h
Win32: Fix drive root detection with \\?\-style paths
[wimlib] / include / wimlib / win32_common.h
1 #ifndef _WIMLIB_WIN32_COMMON_H
2 #define _WIMLIB_WIN32_COMMON_H
3
4 #include <windows.h>
5 #ifdef ERROR
6 #  undef ERROR
7 #endif
8
9 #include "wimlib/types.h"
10 #include "wimlib/win32.h"
11
12
13 #ifdef ENABLE_ERROR_MESSAGES
14 extern void
15 win32_error(DWORD err_code);
16 #else
17 static inline void
18 win32_error(DWORD err_code)
19 {
20 }
21 #endif
22
23 extern void
24 set_errno_from_GetLastError(void);
25
26 extern bool
27 win32_path_is_root_of_drive(const wchar_t *path);
28
29 extern int
30 win32_error_to_errno(DWORD err_code);
31
32 extern int
33 win32_get_vol_flags(const wchar_t *path, unsigned *vol_flags_ret);
34
35 extern HANDLE
36 win32_open_existing_file(const wchar_t *path, DWORD dwDesiredAccess);
37
38 extern HANDLE
39 win32_open_file_data_only(const wchar_t *path);
40
41 extern HANDLE (WINAPI *win32func_FindFirstStreamW)(LPCWSTR lpFileName,
42                                                    STREAM_INFO_LEVELS InfoLevel,
43                                                    LPVOID lpFindStreamData,
44                                                    DWORD dwFlags);
45
46 /* Vista and later */
47 extern BOOL (WINAPI *win32func_FindNextStreamW)(HANDLE hFindStream,
48                                                 LPVOID lpFindStreamData);
49
50 extern bool
51 windows_version_is_at_least(unsigned major, unsigned minor);
52
53 #define running_on_windows_xp_or_later() \
54                         windows_version_is_at_least(5, 1)
55
56 #define running_on_windows_vista_or_later() \
57                         windows_version_is_at_least(6, 0)
58
59 #define running_on_windows_7_or_later() \
60                         windows_version_is_at_least(6, 1)
61
62
63
64 #endif /* _WIMLIB_WIN32_COMMON_H */