]> wimlib.net Git - wimlib/blob - include/wimlib/win32_common.h
win32_apply.c: detect case-sensitive filename support
[wimlib] / include / wimlib / win32_common.h
1 /*
2  * win32_common.h - common header for Windows-specific files.  This always
3  * should be included first.
4  */
5
6 #ifndef _WIMLIB_WIN32_COMMON_H
7 #define _WIMLIB_WIN32_COMMON_H
8
9 #include <ntstatus.h>
10 #include <windows.h>
11 #include <winternl.h>
12
13 #ifdef ERROR
14 #  undef ERROR
15 #endif
16 #include "wimlib/win32.h"
17
18 /* ntdll definitions */
19
20 #define FILE_OPENED 0x00000001
21
22 typedef struct _RTLP_CURDIR_REF {
23         LONG RefCount;
24         HANDLE Handle;
25 } RTLP_CURDIR_REF, *PRTLP_CURDIR_REF;
26
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;
32
33 #define FSCTL_SET_PERSISTENT_VOLUME_STATE 0x90238
34
35 #define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED 0x00000001
36
37 typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION {
38         ULONG VolumeFlags;
39         ULONG FlagMask;
40         ULONG Version;
41         ULONG Reserved;
42 } FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION;
43
44 /* ntdll functions  */
45
46 NTSTATUS
47 NTAPI
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,
53            OUT PVOID Buffer,
54            IN ULONG Length,
55            IN PLARGE_INTEGER ByteOffset OPTIONAL,
56            IN PULONG Key OPTIONAL);
57
58 NTSTATUS
59 NTAPI
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,
65             IN PVOID Buffer,
66             IN ULONG Length,
67             IN PLARGE_INTEGER ByteOffset OPTIONAL,
68             IN PULONG Key OPTIONAL);
69
70 NTSTATUS
71 NTAPI
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,
78                      IN ULONG Length,
79                      IN FILE_INFORMATION_CLASS FileInformationClass,
80                      IN BOOLEAN ReturnSingleEntry,
81                      IN PUNICODE_STRING FileName OPTIONAL,
82                      IN BOOLEAN RestartScan);
83
84 NTSTATUS
85 NTAPI
86 NtQuerySecurityObject(IN HANDLE Handle,
87                       IN SECURITY_INFORMATION SecurityInformation,
88                       OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
89                       IN ULONG Length,
90                       OUT PULONG ResultLength);
91
92 NTSTATUS
93 NTAPI
94 NtSetSecurityObject(IN HANDLE Handle,
95                     IN SECURITY_INFORMATION SecurityInformation,
96                     IN PSECURITY_DESCRIPTOR SecurityDescriptor);
97
98 NTSTATUS
99 NTAPI
100 NtOpenSymbolicLinkObject(PHANDLE LinkHandle,
101                          ACCESS_MASK DesiredAccess,
102                          POBJECT_ATTRIBUTES ObjectAttributes);
103
104
105 /* Dynamically loaded ntdll functions */
106
107 extern NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus)
108                 (IN PCWSTR DosName,
109                  OUT PUNICODE_STRING NtName,
110                  OUT PCWSTR *PartName,
111                  OUT PRTL_RELATIVE_NAME_U RelativeName);
112
113 extern NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder)
114                         (PCUNICODE_STRING VolumeRootPath);
115
116 /* Other utility functions */
117
118 extern int
119 win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path);
120
121 extern int
122 win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]);
123
124 extern bool
125 win32_try_to_attach_wof(const wchar_t *drive);
126
127 extern void
128 win32_warning(DWORD err, const wchar_t *format, ...) _cold_attribute;
129
130 extern void
131 win32_error(DWORD err, const wchar_t *format, ...) _cold_attribute;
132
133 extern void
134 winnt_warning(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
135
136 extern void
137 winnt_error(NTSTATUS status, const wchar_t *format, ...) _cold_attribute;
138
139 extern NTSTATUS
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);
142
143 #endif /* _WIMLIB_WIN32_COMMON_H */