https://git.reactos.org/?p=reactos.git;a=commitdiff;h=51cb3cc6b240ed623bf56274a77ff78d14668480

commit 51cb3cc6b240ed623bf56274a77ff78d14668480
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Thu Dec 26 17:16:04 2019 +0100
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Thu Dec 26 17:16:14 2019 +0100

    [SETUPLIB] Register the \DosDevices\?: drive letter from installation time 
in the correct SYSTEM\MountedDevices registry key, i.e. the one of the ReactOS 
being currently installed.
    CORE-15575
    
    However I now hit a separate bug (see the report) that still prevent the
    drive letter to be correctly assigned at reboot.
---
 base/setup/lib/utils/partlist.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/base/setup/lib/utils/partlist.c b/base/setup/lib/utils/partlist.c
index 5c094e31123..2e635954134 100644
--- a/base/setup/lib/utils/partlist.c
+++ b/base/setup/lib/utils/partlist.c
@@ -11,6 +11,7 @@
 
 #include "partlist.h"
 #include "fsutil.h"
+#include "registry.h"
 
 #define NDEBUG
 #include <debug.h>
@@ -3972,13 +3973,13 @@ SetMountedDeviceValue(
     IN ULONG Signature,
     IN LARGE_INTEGER StartingOffset)
 {
+    NTSTATUS Status;
     OBJECT_ATTRIBUTES ObjectAttributes;
-    WCHAR ValueNameBuffer[16];
-    UNICODE_STRING KeyName = 
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\MountedDevices");
+    UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\MountedDevices");
     UNICODE_STRING ValueName;
-    REG_DISK_MOUNT_INFO MountInfo;
-    NTSTATUS Status;
+    WCHAR ValueNameBuffer[16];
     HANDLE KeyHandle;
+    REG_DISK_MOUNT_INFO MountInfo;
 
     RtlStringCchPrintfW(ValueNameBuffer, ARRAYSIZE(ValueNameBuffer),
                         L"\\DosDevices\\%c:", Letter);
@@ -3987,12 +3988,12 @@ SetMountedDeviceValue(
     InitializeObjectAttributes(&ObjectAttributes,
                                &KeyName,
                                OBJ_CASE_INSENSITIVE,
-                               NULL,
+                               GetRootKeyByPredefKey(HKEY_LOCAL_MACHINE, NULL),
                                NULL);
 
-    Status =  NtOpenKey(&KeyHandle,
-                        KEY_ALL_ACCESS,
-                        &ObjectAttributes);
+    Status = NtOpenKey(&KeyHandle,
+                       KEY_ALL_ACCESS,
+                       &ObjectAttributes);
     if (!NT_SUCCESS(Status))
     {
         Status = NtCreateKey(&KeyHandle,
@@ -4003,7 +4004,6 @@ SetMountedDeviceValue(
                              REG_OPTION_NON_VOLATILE,
                              NULL);
     }
-
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);

Reply via email to