Go to the source code of this file.
◆ DOE_START_PENDING
#define DOE_START_PENDING 0x10 |
◆ boot_add_device()
Definition at line 318 of file boot.c.
318 {
320
322
323
325
326 if (pdo->DeviceObjectExtension) {
327 ((
DEVOBJ_EXTENSION2*)pdo->DeviceObjectExtension)->ExtensionFlags &= ~DOE_START_PENDING;
328
331 }
332
334}
static void mountmgr_notification(BTRFS_UUID *uuid)
DRIVER_ADD_DEVICE AddDevice
volume_device_extension * vde
Referenced by add_volume_device(), and check_system_root().
◆ check_boot_options()
static void check_boot_options |
( |
| ) |
|
|
static |
Definition at line 232 of file boot.c.
232 {
235
236 static const WCHAR pathw[] =
L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control";
237 static const WCHAR namew[] =
L"SystemStartOptions";
238 static const WCHAR subvol[] =
L"SUBVOL=";
239
248
250 path.Length =
path.MaximumLength =
sizeof(pathw) -
sizeof(
WCHAR);
251
253
256 ERR(
"ZwOpenKey returned %08lx\n",
Status);
257 return;
258 }
259
260
261
263 if (!kvfi) {
264 ERR(
"out of memory\n");
266 return;
267 }
268
270 name.Length =
name.MaximumLength =
sizeof(namew) -
sizeof(
WCHAR);
271
273 kvfilen, &kvfilen);
275 ERR(
"ZwQueryValueKey returned %08lx\n",
Status);
277 return;
278 }
279
281
284
286
288 return;
289
290 s += (
sizeof(subvol) /
sizeof(
WCHAR)) - 1;
291
293
294 while (true) {
295 if (*
s >=
'0' && *
s <=
'9') {
298 }
else if (*
s >=
'a' && *
s <=
'f') {
301 }
else if (*
s >=
'A' && *
s <=
'F') {
304 } else
305 break;
306
308 }
310 return;
312
315 }
316}
#define NT_SUCCESS(StatCode)
#define ExAllocatePoolWithTag(hernya, size, tag)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define EXCEPTION_EXECUTE_HANDLER
#define InitializeObjectAttributes(p, n, a, r, s)
struct _KEY_VALUE_FULL_INFORMATION KEY_VALUE_FULL_INFORMATION
@ KeyValueFullInformation
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define _SEH2_EXCEPT(...)
Referenced by check_system_root().
◆ check_system_root()
void check_system_root |
( |
| ) |
|
Definition at line 336 of file boot.c.
336 {
339
341
342
345
347 return;
348
350
354
357 pdo_to_add = pdode->
pdo;
360
363
366 ERR(
"IoSetDeviceInterfaceState returned %08lx\n",
Status);
367
370 ERR(
"IoSetDeviceInterfaceState returned %08lx\n",
Status);
371 }
372
373 break;
374 }
375
377 }
378
380
382
383
384
385
386
387 if (pdo_to_add)
389}
static bool get_system_root()
void boot_add_device(DEVICE_OBJECT *pdo)
static void check_boot_options()
#define RtlCompareMemory(s1, s2, l)
#define ExAcquireResourceExclusiveLite(res, wait)
#define DO_SYSTEM_BOOT_PARTITION
#define ExAcquireResourceSharedLite(res, wait)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
struct _LIST_ENTRY * Flink
#define CONTAINING_RECORD(address, type, field)
Referenced by _Function_class_().
◆ get_system_root()
static bool get_system_root |
( |
| ) |
|
|
static |
Definition at line 49 of file boot.c.
49 {
55 bool second_time = false;
56
57 static const WCHAR system_root[] =
L"\\SystemRoot";
58 static const WCHAR boot_device[] =
L"\\Device\\BootDevice";
59 static const WCHAR arc_btrfs_prefix[] =
L"\\ArcName\\btrfs(";
60
61 us.Buffer = (
WCHAR*)system_root;
62 us.Length =
us.MaximumLength =
sizeof(system_root) -
sizeof(
WCHAR);
63
65
66 while (true) {
69 ERR(
"ZwOpenSymbolicLinkObject returned %08lx\n",
Status);
70 return false;
71 }
72
74
77 ERR(
"ZwQuerySymbolicLinkObject returned %08lx\n",
Status);
79 return false;
80 }
81
82 if (retlen == 0) {
84 return false;
85 }
86
89 ERR(
"out of memory\n");
91 return false;
92 }
93
95
98 ERR(
"ZwQuerySymbolicLinkObject returned %08lx\n",
Status);
101 return false;
102 }
103
105
106 if (second_time) {
108 } else {
110 }
111
112 if (!second_time &&
target.Length >=
sizeof(boot_device) -
sizeof(
WCHAR) &&
115
116 us.Buffer = (
WCHAR*)boot_device;
117 us.Length =
us.MaximumLength =
sizeof(boot_device) -
sizeof(
WCHAR);
118
119 second_time = true;
120 } else
121 break;
122 }
123
124 if (
target.Length >=
sizeof(arc_btrfs_prefix) -
sizeof(
WCHAR) &&
127
128 for (
unsigned int i = 0;
i < 16;
i++) {
129 if (*
s >=
'0' && *
s <=
'9')
131 else if (*
s >=
'a' && *
s <=
'f')
133 else if (*
s >=
'A' && *
s <=
'F')
135 else {
137 return false;
138 }
139
141
142 if (*
s >=
'0' && *
s <=
'9')
144 else if (*
s >=
'a' && *
s <=
'f')
146 else if (*
s >=
'A' && *
s <=
'F')
148 else {
150 return false;
151 }
152
154
155 if (
i == 3 ||
i == 5 ||
i == 7 ||
i == 9) {
158 return false;
159 }
160
162 }
163 }
164
167 return false;
168 }
169
171
172 return true;
173 }
174
176
177 return false;
178}
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
NTSYSAPI NTSTATUS NTAPI ZwOpenSymbolicLinkObject(_Out_ PHANDLE SymbolicLinkHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
#define STATUS_BUFFER_TOO_SMALL
Referenced by check_system_root().
◆ mountmgr_notification()
Definition at line 180 of file boot.c.
180 {
188
192 ERR(
"IoGetDeviceObjectPointer returned %08lx\n",
Status);
193 return;
194 }
195
197
199 if (!mmtn) {
200 ERR(
"out of memory\n");
201 return;
202 }
203
205
207
209
210 for (
unsigned int i = 0;
i < 16;
i++) {
213
214 if (
i == 3 ||
i == 5 ||
i == 7 ||
i == 9) {
217 }
218 }
219
221
224 ERR(
"IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION returned %08lx\n",
Status);
226 return;
227 }
228
230}
#define BTRFS_VOLUME_PREFIX
NTSTATUS dev_ioctl(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG ControlCode, _In_reads_bytes_opt_(InputBufferSize) PVOID InputBuffer, _In_ ULONG InputBufferSize, _Out_writes_bytes_opt_(OutputBufferSize) PVOID OutputBuffer, _In_ ULONG OutputBufferSize, _In_ bool Override, _Out_opt_ IO_STATUS_BLOCK *iosb)
GLubyte GLubyte GLubyte GLubyte w
#define MOUNTMGR_DEVICE_NAME
#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION
#define FILE_READ_ATTRIBUTES
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
#define offsetof(TYPE, MEMBER)
#define RtlCopyMemory(Destination, Source, Length)
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Referenced by boot_add_device().
◆ boot_lock
◆ boot_subvol
◆ boot_uuid
◆ drvobj
◆ pdo_list
◆ pdo_list_lock