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);
98 /* Dynamically loaded ntdll functions */
100 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
102 OUT PUNICODE_STRING NtName,
103 OUT PCWSTR *PartName,
104 OUT PRTL_RELATIVE_NAME_U RelativeName);
106 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
107 (PCUNICODE_STRING VolumeRootPath);
109 /* Other utility functions */
112 win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path);
115 win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]);
118 win32_try_to_attach_wof(const wchar_t *drive);
121 win32_warning(DWORD err, const wchar_t *format, ...) _cold_attribute;
124 win32_error(DWORD err, const wchar_t *format, ...) _cold_attribute;
127 winnt_warning(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
130 winnt_error(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
133 winnt_fsctl(HANDLE h, u32 code, const void *in, u32 in_size,
134 void *out, u32 out_size_avail, u32 *actual_out_size_ret);
136 #endif /* _WIMLIB_WIN32_COMMON_H */