Add a default pagefile entry to the registry.
svn path=/trunk/; revision=62697
static UNICODE_STRING DestinationArcPath;
static UNICODE_STRING DestinationRootPath;
+static WCHAR DestinationDriveLetter;
+
/* Path to the active partition (boot manager) */
static UNICODE_STRING SystemRootPath;
TRUE);
}
+ DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter[0];
+
return SELECT_FILE_SYSTEM_PAGE;
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
return QUIT_PAGE;
}
+ /* Set the default pagefile entry */
+ SetDefaultPagefile(DestinationDriveLetter);
+
/* Update the mounted devices list */
SetMountedDeviceValues(PartitionList);
return TRUE;
}
+
+VOID
+SetDefaultPagefile(WCHAR Drive)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
+ UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"PagingFiles");
+ WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
+ HANDLE KeyHandle;
+ NTSTATUS Status;
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = NtOpenKey(&KeyHandle,
+ KEY_ALL_ACCESS,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status))
+ return;
+
+ ValueBuffer[0] = Drive;
+
+ NtSetValueKey(KeyHandle,
+ &ValueName,
+ 0,
+ REG_MULTI_SZ,
+ (PVOID)&ValueBuffer,
+ sizeof(ValueBuffer));
+
+ NtClose(KeyHandle);
+}
+
/* EOF */
BOOLEAN
SetMountedDeviceValue(CHAR Letter, ULONG Signature, LARGE_INTEGER StartingOffset);
+VOID
+SetDefaultPagefile(WCHAR Drive);
+
/* EOF */