1 #ifndef _WIMLIB_WIN32_COMMON_H
2 #define _WIMLIB_WIN32_COMMON_H
9 #include "wimlib/types.h"
10 #include "wimlib/win32.h"
16 set_errno_from_GetLastError(void);
19 set_errno_from_win32_error(DWORD err);
22 set_errno_from_nt_status(NTSTATUS status);
26 extern NTSTATUS (WINAPI *func_NtCreateFile)(PHANDLE FileHandle,
27 ACCESS_MASK DesiredAccess,
28 POBJECT_ATTRIBUTES ObjectAttributes,
29 PIO_STATUS_BLOCK IoStatusBlock,
30 PLARGE_INTEGER AllocationSize,
33 ULONG CreateDisposition,
38 extern NTSTATUS (WINAPI *func_NtOpenFile) (PHANDLE FileHandle,
39 ACCESS_MASK DesiredAccess,
40 POBJECT_ATTRIBUTES ObjectAttributes,
41 PIO_STATUS_BLOCK IoStatusBlock,
45 extern NTSTATUS (WINAPI *func_NtReadFile) (HANDLE FileHandle,
47 PIO_APC_ROUTINE ApcRoutine,
49 PIO_STATUS_BLOCK IoStatusBlock,
52 PLARGE_INTEGER ByteOffset,
55 extern NTSTATUS (WINAPI *func_NtWriteFile) (HANDLE FileHandle,
57 PIO_APC_ROUTINE ApcRoutine,
59 PIO_STATUS_BLOCK IoStatusBlock,
62 PLARGE_INTEGER ByteOffset,
65 extern NTSTATUS (WINAPI *func_NtQueryInformationFile)(HANDLE FileHandle,
66 PIO_STATUS_BLOCK IoStatusBlock,
67 PVOID FileInformation,
69 FILE_INFORMATION_CLASS FileInformationClass);
71 extern NTSTATUS (WINAPI *func_NtQuerySecurityObject)(HANDLE handle,
72 SECURITY_INFORMATION SecurityInformation,
73 PSECURITY_DESCRIPTOR SecurityDescriptor,
77 extern NTSTATUS (WINAPI *func_NtQueryDirectoryFile) (HANDLE FileHandle,
79 PIO_APC_ROUTINE ApcRoutine,
81 PIO_STATUS_BLOCK IoStatusBlock,
82 PVOID FileInformation,
84 FILE_INFORMATION_CLASS FileInformationClass,
85 BOOLEAN ReturnSingleEntry,
86 PUNICODE_STRING FileName,
89 extern NTSTATUS (WINAPI *func_NtQueryVolumeInformationFile) (HANDLE FileHandle,
90 PIO_STATUS_BLOCK IoStatusBlock,
93 FS_INFORMATION_CLASS FsInformationClass);
95 extern NTSTATUS (WINAPI *func_NtSetInformationFile)(HANDLE FileHandle,
96 PIO_STATUS_BLOCK IoStatusBlock,
97 PVOID FileInformation,
99 FILE_INFORMATION_CLASS FileInformationClass);
101 extern NTSTATUS (WINAPI *func_NtSetSecurityObject)(HANDLE Handle,
102 SECURITY_INFORMATION SecurityInformation,
103 PSECURITY_DESCRIPTOR SecurityDescriptor);
105 extern NTSTATUS (WINAPI *func_NtFsControlFile) (HANDLE FileHandle,
107 PIO_APC_ROUTINE ApcRoutine,
109 PIO_STATUS_BLOCK IoStatusBlock,
112 ULONG InputBufferLength,
114 ULONG OutputBufferLength);
116 extern NTSTATUS (WINAPI *func_NtClose) (HANDLE Handle);
118 extern DWORD (WINAPI *func_RtlNtStatusToDosError)(NTSTATUS status);
120 typedef struct _RTLP_CURDIR_REF {
123 } RTLP_CURDIR_REF, *PRTLP_CURDIR_REF;
125 typedef struct _RTL_RELATIVE_NAME_U {
126 UNICODE_STRING RelativeName;
127 HANDLE ContainingDirectory;
128 PRTLP_CURDIR_REF CurDirRef;
129 } RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U;
131 extern BOOLEAN (WINAPI *func_RtlDosPathNameToNtPathName_U)
133 OUT PUNICODE_STRING NtName,
134 OUT PCWSTR *PartName,
135 OUT PRTL_RELATIVE_NAME_U RelativeName);
137 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
139 OUT PUNICODE_STRING NtName,
140 OUT PCWSTR *PartName,
141 OUT PRTL_RELATIVE_NAME_U RelativeName);
143 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
144 (PCUNICODE_STRING VolumeRootPath);
148 windows_version_is_at_least(unsigned major, unsigned minor);
150 #define running_on_windows_xp_or_later() \
151 windows_version_is_at_least(5, 1)
153 #define running_on_windows_vista_or_later() \
154 windows_version_is_at_least(6, 0)
156 #define running_on_windows_7_or_later() \
157 windows_version_is_at_least(6, 1)
161 #endif /* _WIMLIB_WIN32_COMMON_H */