MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2QueryRegistrySettings

Function Ext2QueryRegistrySettings

Ext4Fsd/init.c:293–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292
293BOOLEAN
294Ext2QueryRegistrySettings(IN PUNICODE_STRING RegistryPath)
295{
296 UNICODE_STRING ParameterPath;
297 UNICODE_STRING UniName;
298 ANSI_STRING AnsiName;
299
300 ULONG WritingSupport = 0;
301 ULONG CheckingBitmap = 0;
302 ULONG Ext3ForceWriting = 0;
303 ULONG AutoMount = 0;
304
305 WCHAR UniBuffer[CODEPAGE_MAXLEN];
306 USHORT Buffer[HIDINGPAT_LEN];
307
308 NTSTATUS Status;
309
310 ParameterPath.Length = 0;
311 ParameterPath.MaximumLength =
312 RegistryPath->Length + sizeof(PARAMETERS_KEY) + sizeof(WCHAR);
313 ParameterPath.Buffer =
314 (PWSTR) Ext2AllocatePool(
315 PagedPool,
316 ParameterPath.MaximumLength,
317 'LG2E'
318 );
319 if (!ParameterPath.Buffer) {
320 DbgBreak();
321 DEBUG(DL_ERR, ( "Ex2QueryParameters: failed to allocate Parameters...\n"));
322 return FALSE;
323 }
324
325 RtlCopyUnicodeString(&ParameterPath, RegistryPath);
326 RtlAppendUnicodeToString(&ParameterPath, PARAMETERS_KEY);
327
328 /* enable automount of ext2/3/4 volumes */
329 SetLongFlag(Ext2Global->Flags, EXT2_AUTO_MOUNT);
330
331 /* query parameter settings from registry */
332 Ext2QueryGlobalParameters(&ParameterPath);
333
334 /* set global codepage settings */
335 if (wcslen(&Ext2Global->Codepage.PageName[0])) {
336 UniName.Length = sizeof(WCHAR) * wcslen(&Ext2Global->Codepage.PageName[0]);
337 UniName.MaximumLength = CODEPAGE_MAXLEN * sizeof(WCHAR);
338 UniName.Buffer = &Ext2Global->Codepage.PageName[0];
339 AnsiName.MaximumLength = CODEPAGE_MAXLEN;
340 AnsiName.Length = 0;
341 AnsiName.Buffer = &Ext2Global->Codepage.AnsiName[0];
342 Status = RtlUnicodeStringToAnsiString(
343 &AnsiName,
344 &UniName,
345 FALSE);
346 if (!NT_SUCCESS(Status)) {
347 DEBUG(DL_ERR, ( "Ext2QueryParameters: Wrong CodePage %wZ ...\n", &UniName));
348 RtlCopyMemory(&(Ext2Global->Codepage.AnsiName[0]),"default\0", 8);
349 }
350 } else {

Callers 1

DriverEntryFunction · 0.85

Calls 2

Ext2AllocatePoolFunction · 0.85

Tested by

no test coverage detected