mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[NTOSKRNL]
- Implemented IoSetSystemPartition(). This is required by MountMgr. - Fixed buffer size in IopStoreSystemPartitionInformation(). No need to have a buffer twice bigger than maximum use. svn path=/trunk/; revision=51796
This commit is contained in:
parent
52539ea5a9
commit
8f5d08dbdd
2 changed files with 46 additions and 4 deletions
|
@ -701,7 +701,7 @@ IopStoreSystemPartitionInformation(IN PUNICODE_STRING NtSystemPartitionDeviceNam
|
|||
UNICODE_STRING LinkTarget, KeyName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE LinkHandle, RegistryHandle, KeyHandle;
|
||||
WCHAR LinkTargetBuffer[256], KeyNameBuffer[sizeof("SystemPartition")];
|
||||
WCHAR LinkTargetBuffer[256], KeyNameBuffer[sizeof("SystemPartition") / sizeof(WCHAR)];
|
||||
UNICODE_STRING CmRegistryMachineSystemName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM");
|
||||
|
||||
ASSERT(NtSystemPartitionDeviceName->MaximumLength >= NtSystemPartitionDeviceName->Length + sizeof(WCHAR));
|
||||
|
|
|
@ -937,14 +937,56 @@ IoReleaseVpbSpinLock(IN KIRQL Irql)
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IoSetSystemPartition(IN PUNICODE_STRING VolumeNameString)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
NTSTATUS Status;
|
||||
HANDLE RootHandle, KeyHandle;
|
||||
UNICODE_STRING HKLMSystem, KeyString;
|
||||
WCHAR Buffer[sizeof(L"SystemPartition") / sizeof(WCHAR)];
|
||||
|
||||
RtlInitUnicodeString(&HKLMSystem, L"\\REGISTRY\\MACHINE\\SYSTEM");
|
||||
|
||||
/* Open registry to save data (HKLM\SYSTEM) */
|
||||
Status = IopOpenRegistryKeyEx(&RootHandle, 0, &HKLMSystem, KEY_ALL_ACCESS);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Create or open Setup subkey */
|
||||
KeyString.Buffer = Buffer;
|
||||
KeyString.Length = sizeof(L"Setup") - sizeof(UNICODE_NULL);
|
||||
KeyString.MaximumLength = sizeof(L"Setup");
|
||||
RtlCopyMemory(Buffer, L"Setup", sizeof(L"Setup"));
|
||||
Status = IopCreateRegistryKeyEx(&KeyHandle,
|
||||
RootHandle,
|
||||
&KeyString,
|
||||
KEY_ALL_ACCESS,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
NULL);
|
||||
ZwClose(RootHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Store caller value */
|
||||
KeyString.Length = sizeof(L"SystemPartition") - sizeof(UNICODE_NULL);
|
||||
KeyString.MaximumLength = sizeof(L"SystemPartition");
|
||||
RtlCopyMemory(Buffer, L"SystemPartition", sizeof(L"SystemPartition"));
|
||||
Status = ZwSetValueKey(KeyHandle,
|
||||
&KeyString,
|
||||
0,
|
||||
REG_SZ,
|
||||
VolumeNameString->Buffer,
|
||||
VolumeNameString->Length + sizeof(UNICODE_NULL));
|
||||
ZwClose(KeyHandle);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue