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 #define FSCTL_SET_PERSISTENT_VOLUME_STATE 0x90238
35 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED 0x00000001
37 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION {
42 } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION;
48 NtReadFile(IN HANDLE FileHandle,
49 IN HANDLE Event OPTIONAL,
50 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
51 IN PVOID ApcContext OPTIONAL,
52 OUT PIO_STATUS_BLOCK IoStatusBlock,
55 IN PLARGE_INTEGER ByteOffset OPTIONAL,
56 IN PULONG Key OPTIONAL);
60 NtWriteFile(IN HANDLE FileHandle,
61 IN HANDLE Event OPTIONAL,
62 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
63 IN PVOID ApcContext OPTIONAL,
64 OUT PIO_STATUS_BLOCK IoStatusBlock,
67 IN PLARGE_INTEGER ByteOffset OPTIONAL,
68 IN PULONG Key OPTIONAL);
72 NtQueryDirectoryFile(IN HANDLE FileHandle,
73 IN HANDLE EventHandle OPTIONAL,
74 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
75 IN PVOID ApcContext OPTIONAL,
76 OUT PIO_STATUS_BLOCK IoStatusBlock,
77 OUT PVOID FileInformation,
79 IN FILE_INFORMATION_CLASS FileInformationClass,
80 IN BOOLEAN ReturnSingleEntry,
81 IN PUNICODE_STRING FileName OPTIONAL,
82 IN BOOLEAN RestartScan);
86 NtQuerySecurityObject(IN HANDLE Handle,
87 IN SECURITY_INFORMATION SecurityInformation,
88 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
90 OUT PULONG ResultLength);
94 NtSetSecurityObject(IN HANDLE Handle,
95 IN SECURITY_INFORMATION SecurityInformation,
96 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
100 NtOpenSymbolicLinkObject(PHANDLE LinkHandle,
101 ACCESS_MASK DesiredAccess,
102 POBJECT_ATTRIBUTES ObjectAttributes);
105 /* Dynamically loaded ntdll functions */
107 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
109 OUT PUNICODE_STRING NtName,
110 OUT PCWSTR *PartName,
111 OUT PRTL_RELATIVE_NAME_U RelativeName);
113 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
114 (PCUNICODE_STRING VolumeRootPath);
116 /* Other utility functions */
119 win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path);
122 win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]);
125 win32_try_to_attach_wof(const wchar_t *drive);
128 win32_warning(DWORD err, const wchar_t *format, ...) _cold_attribute;
131 win32_error(DWORD err, const wchar_t *format, ...) _cold_attribute;
134 winnt_warning(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
137 winnt_error(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
140 winnt_fsctl(HANDLE h, u32 code, const void *in, u32 in_size,
141 void *out, u32 out_size_avail, u32 *actual_out_size_ret);
143 #endif /* _WIMLIB_WIN32_COMMON_H */