mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[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
This commit is contained in:
parent
cb69c4c691
commit
83d5c711b3
1 changed files with 12 additions and 60 deletions
|
@ -1166,76 +1166,28 @@ CmpCreateRegistryRoot(VOID)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
static NTSTATUS
|
||||||
NTAPI
|
|
||||||
CmpGetRegistryPath(OUT PWCHAR ConfigPath)
|
CmpGetRegistryPath(OUT PWCHAR ConfigPath)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
/* Just use default path */
|
||||||
NTSTATUS Status;
|
wcscpy(ConfigPath, L"\\SystemRoot");
|
||||||
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;
|
|
||||||
|
|
||||||
/* Check if we are booted in setup */
|
/* Check if we are booted in setup */
|
||||||
if (ExpInTextModeSetup)
|
if (!ExpInTextModeSetup)
|
||||||
{
|
{
|
||||||
DPRINT1("CmpGetRegistryPath TextMode setup HACK!!\n");
|
/* Add registry path */
|
||||||
|
#if 0
|
||||||
/* Setup the object attributes */
|
ResultSize = wcslen(ConfigPath);
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
if (ResultSize && ConfigPath[ResultSize - 1] == L'\\')
|
||||||
&KeyName,
|
ConfigPath[ResultSize - 1] = UNICODE_NULL;
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
|
#endif
|
||||||
NULL,
|
wcscat(ConfigPath, L"\\System32\\Config\\");
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Just use default path */
|
wcscat(ConfigPath, L"\\");
|
||||||
wcscpy(ConfigPath, L"\\SystemRoot");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add registry path */
|
|
||||||
wcscat(ConfigPath, L"\\System32\\Config\\");
|
|
||||||
|
|
||||||
DPRINT1("CmpGetRegistryPath: ConfigPath = '%S'\n", ConfigPath);
|
DPRINT1("CmpGetRegistryPath: ConfigPath = '%S'\n", ConfigPath);
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
|
|
Loading…
Reference in a new issue