Author: hbelusca Date: Thu Jun 22 00:46:30 2017 New Revision: 75163
URL: http://svn.reactos.org/svn/reactos?rev=75163&view=rev Log: [NTOS]: Drastically reduce the hackish function CmpGetRegistryPath() for the text-mode setup case (it should ultimately completely disappear).
Modified: branches/setup_improvements/ntoskrnl/config/cmsysini.c
Modified: branches/setup_improvements/ntoskrnl/config/cmsysini.c URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/ntoskrnl/conf... ============================================================================== --- branches/setup_improvements/ntoskrnl/config/cmsysini.c [iso-8859-1] (original) +++ branches/setup_improvements/ntoskrnl/config/cmsysini.c [iso-8859-1] Thu Jun 22 00:46:30 2017 @@ -1159,75 +1159,27 @@ 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) - { - 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); + if (!ExpInTextModeSetup) + { + /* 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"); - } - - /* Add registry path */ - wcscat(ConfigPath, L"\System32\Config\"); + wcscat(ConfigPath, L"\"); + }
DPRINT1("CmpGetRegistryPath: ConfigPath = '%S'\n", ConfigPath);