[NTOS:IOMGR] When booting from a ramdisk, always assign drive letter X: to it
authorHervé Poussineau <hpoussin@reactos.org>
Sun, 28 Dec 2014 22:33:17 +0000 (22:33 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Sun, 28 Dec 2014 22:33:17 +0000 (22:33 +0000)
The only incomplete part to boot the LiveCD from PXE is some support in ramdisk.sys

svn path=/trunk/; revision=65868

reactos/ntoskrnl/io/iomgr/ramdisk.c

index 658b997..810b106 100644 (file)
@@ -249,6 +249,25 @@ IopStartRamdisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
                      0);
     }
 
+    //
+    // ReactOS hack (drive letter should not be hardcoded, and maybe set by mountmgr.sys)
+    //
+    {
+        ANSI_STRING AnsiPath;
+        CHAR Buffer[256];
+        UNICODE_STRING NtSystemRoot;
+        UNICODE_STRING DriveLetter = RTL_CONSTANT_STRING(L"\\??\\X:");
+
+        AnsiPath.Length = sprintf(Buffer, "X:%s", LoaderBlock->NtBootPathName);
+        AnsiPath.MaximumLength = AnsiPath.Length + 1;
+        AnsiPath.Buffer = Buffer;
+        RtlInitEmptyUnicodeString(&NtSystemRoot,
+                                  SharedUserData->NtSystemRoot,
+                                  sizeof(SharedUserData->NtSystemRoot));
+        RtlAnsiStringToUnicodeString(&NtSystemRoot, &AnsiPath, FALSE);
+        IoCreateSymbolicLink(&DriveLetter, &DeviceString);
+    }
+
     //
     // We made it
     //