]> wimlib.net Git - wimlib/blob - include/wimlib/win32_common.h
499dad4faae0062543b5a3fa2614b770ec9b853f
[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 extern void
13 set_errno_from_GetLastError(void);
14
15 extern void
16 set_errno_from_win32_error(DWORD err);
17
18 #ifdef WITH_NTDLL
19 extern void
20 set_errno_from_nt_status(DWORD status);
21 #endif
22
23 extern bool
24 win32_path_is_root_of_drive(const wchar_t *path);
25
26 extern int
27 win32_get_vol_flags(const wchar_t *path, unsigned *vol_flags_ret,
28                     bool *supports_SetFileShortName_ret);
29
30 extern HANDLE
31 win32_open_existing_file(const wchar_t *path, DWORD dwDesiredAccess);
32
33 /* Vista and later */
34 extern HANDLE (WINAPI *win32func_FindFirstStreamW)(LPCWSTR lpFileName,
35                                                    STREAM_INFO_LEVELS InfoLevel,
36                                                    LPVOID lpFindStreamData,
37                                                    DWORD dwFlags);
38
39 /* Vista and later */
40 extern BOOL (WINAPI *win32func_FindNextStreamW)(HANDLE hFindStream,
41                                                 LPVOID lpFindStreamData);
42
43 /* Vista and later */
44 extern BOOL (WINAPI *win32func_CreateSymbolicLinkW)(const wchar_t *lpSymlinkFileName,
45                                                     const wchar_t *lpTargetFileName,
46                                                     DWORD dwFlags);
47
48 extern bool
49 windows_version_is_at_least(unsigned major, unsigned minor);
50
51 #define running_on_windows_xp_or_later() \
52                         windows_version_is_at_least(5, 1)
53
54 #define running_on_windows_vista_or_later() \
55                         windows_version_is_at_least(6, 0)
56
57 #define running_on_windows_7_or_later() \
58                         windows_version_is_at_least(6, 1)
59
60
61
62 #endif /* _WIMLIB_WIN32_COMMON_H */