Author: pschweitzer
Date: Mon May 16 17:52:03 2011
New Revision: 51796
URL:
http://svn.reactos.org/svn/reactos?rev=51796&view=rev
Log:
[NTOSKRNL]
- Implemented IoSetSystemPartition(). This is required by MountMgr.
- Fixed buffer size in IopStoreSystemPartitionInformation(). No need to have a buffer
twice bigger than maximum use.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c
trunk/reactos/ntoskrnl/io/iomgr/volume.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iorsrce.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] Mon May 16 17:52:03 2011
@@ -701,7 +701,7 @@
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));
Modified: trunk/reactos/ntoskrnl/io/iomgr/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] Mon May 16 17:52:03 2011
@@ -937,14 +937,56 @@
}
/*
- * @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;
}
/*