mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 16:31:07 +08:00
[NTOS:CM] CmpSetSystemValues(): Export the Vista+ "FirmwareBootDevice" registry value
In the `HKLM\SYSTEM\CurrentControlSet\Control` registry key, the `FirmwareBootDevice` value specifies the firmware boot (i.e. system partition) device in ARC format, obtained from `LoaderBlock->ArcHalDeviceName`. For some reason it is exposed only on Windows Vista and later. This value is similar to the `SystemBootDevice` one, which specifies instead the OS boot device in ARC format, obtained from `LoaderBlock->ArcBootDeviceName`. In addition: check the value returned by `RtlCreateUnicodeStringFromAsciiz()` and fail if so.
This commit is contained in:
@@ -409,8 +409,7 @@ CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
|
||||
/* Setup attributes for loader options */
|
||||
RtlInitUnicodeString(&KeyName,
|
||||
L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\"
|
||||
L"Control");
|
||||
L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
@@ -431,19 +430,41 @@ CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto Quit;
|
||||
|
||||
/* Setup the value for the system boot device in ARC format */
|
||||
/* Setup the value for the OS boot device in ARC format */
|
||||
RtlInitUnicodeString(&KeyName, L"SystemBootDevice");
|
||||
RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->ArcBootDeviceName);
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->ArcBootDeviceName))
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
goto Quit;
|
||||
}
|
||||
Status = NtSetValueKey(KeyHandle,
|
||||
&KeyName,
|
||||
0,
|
||||
REG_SZ,
|
||||
ValueName.Buffer,
|
||||
ValueName.Length);
|
||||
|
||||
/* Free the temporary string */
|
||||
RtlFreeUnicodeString(&ValueName);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto Quit;
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA) || defined(__REACTOS__)
|
||||
/* Setup the value for the firmware boot (i.e. system partition) device in ARC format */
|
||||
RtlInitUnicodeString(&KeyName, L"FirmwareBootDevice");
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->ArcHalDeviceName))
|
||||
{
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
goto Quit;
|
||||
}
|
||||
Status = NtSetValueKey(KeyHandle,
|
||||
&KeyName,
|
||||
0,
|
||||
REG_SZ,
|
||||
ValueName.Buffer,
|
||||
ValueName.Length);
|
||||
RtlFreeUnicodeString(&ValueName);
|
||||
#endif
|
||||
|
||||
Quit:
|
||||
/* Close the key and return */
|
||||
NtClose(KeyHandle);
|
||||
|
||||
Reference in New Issue
Block a user