Use a 'secret' registry value to tell ntoskrnl where to create the registry hives.

svn path=/trunk/; revision=3795
This commit is contained in:
Eric Kohl 2002-11-26 15:33:06 +00:00
parent a76689e99c
commit 5f973ce0cf

View file

@ -1259,6 +1259,15 @@ FileCopyPage(PINPUT_RECORD Ir)
static ULONG
InitSystemPage(PINPUT_RECORD Ir)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName;
HANDLE KeyHandle;
NTSTATUS Status;
WCHAR TargetPath[MAX_PATH];
UNICODE_STRING ValueName;
SetTextXY(6, 8, "Initializing system settings");
@ -1271,14 +1280,55 @@ InitSystemPage(PINPUT_RECORD Ir)
SetStatusText(" Please wait...");
/*
* Create registry hives
*/
/* Create the 'secret' InstallPath key */
RtlInitUnicodeStringFromLiteral(&KeyName,
L"\\Registry\\Machine\\HARDWARE");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtOpenKey(&KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
}
RtlInitUnicodeStringFromLiteral(&ValueName,
L"InstallPath");
swprintf(TargetPath,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartData.DiskNumber,
PartData.PartNumber);
if (InstallDir[0] != L'\\')
wcscat(TargetPath, L"\\");
wcscat(TargetPath, InstallDir);
Status = NtSetValueKey(KeyHandle,
&ValueName,
0,
REG_SZ,
(PVOID)TargetPath,
wcslen(TargetPath) * sizeof(WCHAR));
NtClose(KeyHandle);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
}
/* Create the standard hives */
Status = NtInitializeRegistry(TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status);
}
/*
* Update registry
*/
/* Update registry */
/* FIXME: Create key '\Registry\Machine\System\Setup' */