]> wimlib.net Git - wimlib/blob - include/wimlib/win32_common.h
win32_common.c: Refactor dll loading
[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 #include <ntstatus.h>
13 #include <winternl.h>
14
15 extern void
16 set_errno_from_GetLastError(void);
17
18 extern void
19 set_errno_from_win32_error(DWORD err);
20
21 extern void
22 set_errno_from_nt_status(NTSTATUS status);
23
24 extern bool
25 win32_path_is_root_of_drive(const wchar_t *path);
26
27 extern int
28 win32_get_vol_flags(const wchar_t *path, unsigned *vol_flags_ret,
29                     bool *supports_SetFileShortName_ret);
30
31 extern HANDLE
32 win32_open_existing_file(const wchar_t *path, DWORD dwDesiredAccess);
33
34 /* Vista and later */
35 extern BOOL (WINAPI *func_CreateSymbolicLinkW)(const wchar_t *lpSymlinkFileName,
36                                                const wchar_t *lpTargetFileName,
37                                                DWORD dwFlags);
38
39 /* ntdll functions  */
40
41 extern NTSTATUS (WINAPI *func_NtQueryInformationFile)(HANDLE FileHandle,
42                                                       PIO_STATUS_BLOCK IoStatusBlock,
43                                                       PVOID FileInformation,
44                                                       ULONG Length,
45                                                       FILE_INFORMATION_CLASS FileInformationClass);
46
47 extern NTSTATUS (WINAPI *func_NtQuerySecurityObject)(HANDLE handle,
48                                                      SECURITY_INFORMATION SecurityInformation,
49                                                      PSECURITY_DESCRIPTOR SecurityDescriptor,
50                                                      ULONG Length,
51                                                      PULONG LengthNeeded);
52
53 extern NTSTATUS (WINAPI *func_NtQueryDirectoryFile) (HANDLE FileHandle,
54                                                      HANDLE Event,
55                                                      PIO_APC_ROUTINE ApcRoutine,
56                                                      PVOID ApcContext,
57                                                      PIO_STATUS_BLOCK IoStatusBlock,
58                                                      PVOID FileInformation,
59                                                      ULONG Length,
60                                                      FILE_INFORMATION_CLASS FileInformationClass,
61                                                      BOOLEAN ReturnSingleEntry,
62                                                      PUNICODE_STRING FileName,
63                                                      BOOLEAN RestartScan);
64
65
66 extern NTSTATUS (WINAPI *func_NtSetSecurityObject)(HANDLE Handle,
67                                                    SECURITY_INFORMATION SecurityInformation,
68                                                    PSECURITY_DESCRIPTOR SecurityDescriptor);
69
70 extern DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status);
71
72 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
73                         (PCUNICODE_STRING VolumeRootPath);
74
75
76 extern bool
77 windows_version_is_at_least(unsigned major, unsigned minor);
78
79 #define running_on_windows_xp_or_later() \
80                         windows_version_is_at_least(5, 1)
81
82 #define running_on_windows_vista_or_later() \
83                         windows_version_is_at_least(6, 0)
84
85 #define running_on_windows_7_or_later() \
86                         windows_version_is_at_least(6, 1)
87
88
89
90 #endif /* _WIMLIB_WIN32_COMMON_H */