2 * win32_common.h - common header for Windows-specific files. This always
3 * should be included first.
6 #ifndef _WIMLIB_WIN32_COMMON_H
7 #define _WIMLIB_WIN32_COMMON_H
16 #include "wimlib/win32.h"
18 /* ntdll definitions */
20 #define FILE_OPENED 0x00000001
22 typedef struct _RTLP_CURDIR_REF {
25 } RTLP_CURDIR_REF, *PRTLP_CURDIR_REF;
27 typedef struct _RTL_RELATIVE_NAME_U {
28 UNICODE_STRING RelativeName;
29 HANDLE ContainingDirectory;
30 PRTLP_CURDIR_REF CurDirRef;
31 } RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U;
33 #ifndef FSCTL_SET_PERSISTENT_VOLUME_STATE
34 #define FSCTL_SET_PERSISTENT_VOLUME_STATE \
35 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS)
37 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED 0x00000001
39 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION {
44 } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION;
45 #endif /* FSCTL_SET_PERSISTENT_VOLUME_STATE */
51 NtReadFile(IN HANDLE FileHandle,
52 IN HANDLE Event OPTIONAL,
53 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
54 IN PVOID ApcContext OPTIONAL,
55 OUT PIO_STATUS_BLOCK IoStatusBlock,
58 IN PLARGE_INTEGER ByteOffset OPTIONAL,
59 IN PULONG Key OPTIONAL);
63 NtWriteFile(IN HANDLE FileHandle,
64 IN HANDLE Event OPTIONAL,
65 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
66 IN PVOID ApcContext OPTIONAL,
67 OUT PIO_STATUS_BLOCK IoStatusBlock,
70 IN PLARGE_INTEGER ByteOffset OPTIONAL,
71 IN PULONG Key OPTIONAL);
75 NtQueryDirectoryFile(IN HANDLE FileHandle,
76 IN HANDLE EventHandle OPTIONAL,
77 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
78 IN PVOID ApcContext OPTIONAL,
79 OUT PIO_STATUS_BLOCK IoStatusBlock,
80 OUT PVOID FileInformation,
82 IN FILE_INFORMATION_CLASS FileInformationClass,
83 IN BOOLEAN ReturnSingleEntry,
84 IN PUNICODE_STRING FileName OPTIONAL,
85 IN BOOLEAN RestartScan);
89 NtQuerySecurityObject(IN HANDLE Handle,
90 IN SECURITY_INFORMATION SecurityInformation,
91 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
93 OUT PULONG ResultLength);
97 NtSetSecurityObject(IN HANDLE Handle,
98 IN SECURITY_INFORMATION SecurityInformation,
99 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
103 NtOpenSymbolicLinkObject(PHANDLE LinkHandle,
104 ACCESS_MASK DesiredAccess,
105 POBJECT_ATTRIBUTES ObjectAttributes);
109 NtQueryEaFile(IN HANDLE FileHandle,
110 OUT PIO_STATUS_BLOCK IoStatusBlock,
113 IN BOOLEAN ReturnSingleEntry,
114 IN PVOID EaList OPTIONAL,
115 IN ULONG EaListLength,
116 IN PULONG EaIndex OPTIONAL,
117 IN BOOLEAN RestartScan);
121 NtSetEaFile(IN HANDLE FileHandle,
122 OUT PIO_STATUS_BLOCK IoStatusBlock,
126 /* Dynamically loaded ntdll functions */
128 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
130 OUT PUNICODE_STRING NtName,
131 OUT PCWSTR *PartName,
132 OUT PRTL_RELATIVE_NAME_U RelativeName);
134 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
135 (PCUNICODE_STRING VolumeRootPath);
137 /* Other utility functions */
140 win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path);
143 win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]);
146 win32_try_to_attach_wof(const wchar_t *drive);
148 void __attribute__((cold))
149 win32_warning(DWORD err, const wchar_t *format, ...);
151 void __attribute__((cold))
152 win32_error(DWORD err, const wchar_t *format, ...);
154 void __attribute__((cold))
155 winnt_warning(NTSTATUS status, const wchar_t *format, ...);
157 void __attribute__((cold))
158 winnt_error(NTSTATUS status, const wchar_t *format, ...);
161 winnt_fsctl(HANDLE h, u32 code, const void *in, u32 in_size,
162 void *out, u32 out_size_avail, u32 *actual_out_size_ret);
164 #endif /* _WIMLIB_WIN32_COMMON_H */