https://git.reactos.org/?p=reactos.git;a=commitdiff;h=83d5c711b366434d4fd33f...
commit 83d5c711b366434d4fd33fe183db7f3eb2c0eca8 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Thu Jun 22 00:46:30 2017 +0000 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Thu Oct 25 00:40:03 2018 +0200
[NTOS] Drastically reduce the hackish function CmpGetRegistryPath() for the text-mode setup case (it should ultimately completely disappear).
svn path=/branches/setup_improvements/; revision=75163 --- ntoskrnl/config/cmsysini.c | 72 ++++++++-------------------------------------- 1 file changed, 12 insertions(+), 60 deletions(-)
diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c index f49c07acd1..295e4b4376 100644 --- a/ntoskrnl/config/cmsysini.c +++ b/ntoskrnl/config/cmsysini.c @@ -1166,76 +1166,28 @@ CmpCreateRegistryRoot(VOID) return TRUE; }
-NTSTATUS -NTAPI +static NTSTATUS CmpGetRegistryPath(OUT PWCHAR ConfigPath) { - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - HANDLE KeyHandle; - PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; - UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\Registry\Machine\HARDWARE"); - UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"InstallPath"); - ULONG BufferSize, ResultSize; + /* Just use default path */ + wcscpy(ConfigPath, L"\SystemRoot");
/* Check if we are booted in setup */ - if (ExpInTextModeSetup) + if (!ExpInTextModeSetup) { - DPRINT1("CmpGetRegistryPath TextMode setup HACK!!\n"); - - /* Setup the object attributes */ - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, - NULL, - NULL); - /* Open the key */ - Status = ZwOpenKey(&KeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) return Status; - - /* Allocate the buffer */ - BufferSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 4096; - ValueInfo = ExAllocatePoolWithTag(PagedPool, BufferSize, TAG_CM); - if (!ValueInfo) - { - /* Fail */ - ZwClose(KeyHandle); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Query the value */ - Status = ZwQueryValueKey(KeyHandle, - &ValueName, - KeyValuePartialInformation, - ValueInfo, - BufferSize, - &ResultSize); - ZwClose(KeyHandle); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - ExFreePoolWithTag(ValueInfo, TAG_CM); - return Status; - } - - /* Copy the config path and null-terminate it */ - RtlCopyMemory(ConfigPath, - ValueInfo->Data, - ValueInfo->DataLength); - ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = UNICODE_NULL; - ExFreePoolWithTag(ValueInfo, TAG_CM); + /* Add registry path */ +#if 0 + ResultSize = wcslen(ConfigPath); + if (ResultSize && ConfigPath[ResultSize - 1] == L'\') + ConfigPath[ResultSize - 1] = UNICODE_NULL; +#endif + wcscat(ConfigPath, L"\System32\Config\"); } else { - /* Just use default path */ - wcscpy(ConfigPath, L"\SystemRoot"); + wcscat(ConfigPath, L"\"); }
- /* Add registry path */ - wcscat(ConfigPath, L"\System32\Config\"); - DPRINT1("CmpGetRegistryPath: ConfigPath = '%S'\n", ConfigPath);
/* Done */