WIMBoot: Update WimOverlay.dat directly when WOF not running
[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 #ifdef WITH_NTDLL
13 #  include <ntstatus.h>
14 #  include <winternl.h>
15 #endif
16
17 extern void
18 set_errno_from_GetLastError(void);
19
20 extern void
21 set_errno_from_win32_error(DWORD err);
22
23 #ifdef WITH_NTDLL
24 extern void
25 set_errno_from_nt_status(NTSTATUS status);
26 #endif
27
28 extern bool
29 win32_path_is_root_of_drive(const wchar_t *path);
30
31 extern int
32 win32_get_vol_flags(const wchar_t *path, unsigned *vol_flags_ret,
33                     bool *supports_SetFileShortName_ret);
34
35 extern HANDLE
36 win32_open_existing_file(const wchar_t *path, DWORD dwDesiredAccess);
37
38 /* Vista and later */
39 extern HANDLE (WINAPI *win32func_FindFirstStreamW)(LPCWSTR lpFileName,
40                                                    STREAM_INFO_LEVELS InfoLevel,
41                                                    LPVOID lpFindStreamData,
42                                                    DWORD dwFlags);
43
44 /* Vista and later */
45 extern BOOL (WINAPI *win32func_FindNextStreamW)(HANDLE hFindStream,
46                                                 LPVOID lpFindStreamData);
47
48 /* Vista and later */
49 extern BOOL (WINAPI *win32func_CreateSymbolicLinkW)(const wchar_t *lpSymlinkFileName,
50                                                     const wchar_t *lpTargetFileName,
51                                                     DWORD dwFlags);
52
53 /* ntdll functions  */
54
55 #ifdef WITH_NTDLL
56
57 extern NTSTATUS (WINAPI *func_NtQueryInformationFile)(HANDLE FileHandle,
58                                                       PIO_STATUS_BLOCK IoStatusBlock,
59                                                       PVOID FileInformation,
60                                                       ULONG Length,
61                                                       FILE_INFORMATION_CLASS FileInformationClass);
62
63 extern NTSTATUS (WINAPI *func_NtQuerySecurityObject)(HANDLE handle,
64                                                      SECURITY_INFORMATION SecurityInformation,
65                                                      PSECURITY_DESCRIPTOR SecurityDescriptor,
66                                                      ULONG Length,
67                                                      PULONG LengthNeeded);
68
69 extern NTSTATUS (WINAPI *func_NtQueryDirectoryFile) (HANDLE FileHandle,
70                                                      HANDLE Event,
71                                                      PIO_APC_ROUTINE ApcRoutine,
72                                                      PVOID ApcContext,
73                                                      PIO_STATUS_BLOCK IoStatusBlock,
74                                                      PVOID FileInformation,
75                                                      ULONG Length,
76                                                      FILE_INFORMATION_CLASS FileInformationClass,
77                                                      BOOLEAN ReturnSingleEntry,
78                                                      PUNICODE_STRING FileName,
79                                                      BOOLEAN RestartScan);
80
81
82 extern NTSTATUS (WINAPI *func_NtSetSecurityObject)(HANDLE Handle,
83                                                    SECURITY_INFORMATION SecurityInformation,
84                                                    PSECURITY_DESCRIPTOR SecurityDescriptor);
85
86 extern DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status);
87
88 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
89                         (PCUNICODE_STRING VolumeRootPath);
90 #endif
91
92
93
94 extern bool
95 windows_version_is_at_least(unsigned major, unsigned minor);
96
97 #define running_on_windows_xp_or_later() \
98                         windows_version_is_at_least(5, 1)
99
100 #define running_on_windows_vista_or_later() \
101                         windows_version_is_at_least(6, 0)
102
103 #define running_on_windows_7_or_later() \
104                         windows_version_is_at_least(6, 1)
105
106
107
108 #endif /* _WIMLIB_WIN32_COMMON_H */