[SETUPLIB][USETUP] Diverse additions.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 31 May 2017 01:43:12 +0000 (03:43 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 3 Jun 2018 20:12:45 +0000 (22:12 +0200)
- Use NT string safe functions.
- Add support for other bootloaders;
- Update a couple of comments;
- Remove deprecated __REACTOS__ #ifdefs.

svn path=/branches/setup_improvements/; revision=74713

base/setup/lib/fsutil.c
base/setup/lib/partlist.c
base/setup/lib/setuplib.h
base/setup/usetup/bootsup.c
base/setup/usetup/usetup.rc

index b1f498a..bec91c4 100644 (file)
@@ -127,11 +127,11 @@ _MyGetFileSystem(
     FileFsAttribute = (PFILE_FS_ATTRIBUTE_INFORMATION)Buffer;
 
     /* Set PartitionRootPath */
-    swprintf(PathBuffer,
-             // L"\\Device\\Harddisk%lu\\Partition%lu", // Should work! But because ReactOS sucks atm. it actually doesn't work!!
-             L"\\Device\\Harddisk%lu\\Partition%lu\\",  // HACK: Use this as a temporary hack!
-             PartEntry->DiskEntry->DiskNumber,
-             PartEntry->PartitionNumber);
+    RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+                        // L"\\Device\\Harddisk%lu\\Partition%lu", // Should work! But because ReactOS sucks atm. it actually doesn't work!!
+                        L"\\Device\\Harddisk%lu\\Partition%lu\\",  // HACK: Use this as a temporary hack!
+                        PartEntry->DiskEntry->DiskNumber,
+                        PartEntry->PartitionNumber);
     RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
     DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
 
index f29b285..71fd77a 100644 (file)
@@ -110,9 +110,9 @@ GetDriverName(
     RtlInitUnicodeString(&DiskEntry->DriverName,
                          NULL);
 
-    swprintf(KeyName,
-             L"\\Scsi\\Scsi Port %hu",
-             DiskEntry->Port);
+    RtlStringCchPrintfW(KeyName, ARRAYSIZE(KeyName),
+                        L"\\Scsi\\Scsi Port %hu",
+                        DiskEntry->Port);
 
     RtlZeroMemory(&QueryTable,
                   sizeof(QueryTable));
@@ -366,7 +366,9 @@ EnumerateBiosDiskEntries(
     AdapterCount = 0;
     while (1)
     {
-        swprintf(Name, L"%s\\%lu", ROOT_NAME, AdapterCount);
+        RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
+                            L"%s\\%lu",
+                            ROOT_NAME, AdapterCount);
         Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
                                         Name,
                                         &QueryTable[2],
@@ -377,7 +379,9 @@ EnumerateBiosDiskEntries(
             break;
         }
 
-        swprintf(Name, L"%s\\%lu\\DiskController", ROOT_NAME, AdapterCount);
+        RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
+                            L"%s\\%lu\\DiskController",
+                            ROOT_NAME, AdapterCount);
         Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
                                         Name,
                                         &QueryTable[2],
@@ -387,7 +391,9 @@ EnumerateBiosDiskEntries(
         {
             while (1)
             {
-                swprintf(Name, L"%s\\%lu\\DiskController\\0", ROOT_NAME, AdapterCount);
+                RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
+                                    L"%s\\%lu\\DiskController\\0",
+                                    ROOT_NAME, AdapterCount);
                 Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
                                                 Name,
                                                 &QueryTable[2],
@@ -399,7 +405,9 @@ EnumerateBiosDiskEntries(
                     return;
                 }
 
-                swprintf(Name, L"%s\\%lu\\DiskController\\0\\DiskPeripheral", ROOT_NAME, AdapterCount);
+                RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
+                                    L"%s\\%lu\\DiskController\\0\\DiskPeripheral",
+                                    ROOT_NAME, AdapterCount);
                 Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
                                                 Name,
                                                 &QueryTable[2],
@@ -421,7 +429,9 @@ EnumerateBiosDiskEntries(
                             break;
                         }
 
-                        swprintf(Name, L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu", ROOT_NAME, AdapterCount, DiskCount);
+                        RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
+                                            L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu",
+                                            ROOT_NAME, AdapterCount, DiskCount);
                         Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
                                                         Name,
                                                         QueryTable,
@@ -974,7 +984,8 @@ AddDiskToList(
     }
     Checksum = ~Checksum + 1;
 
-    swprintf(Identifier, L"%08x-%08x-A", Checksum, Signature);
+    RtlStringCchPrintfW(Identifier, ARRAYSIZE(Identifier),
+                        L"%08x-%08x-A", Checksum, Signature);
     DPRINT("Identifier: %S\n", Identifier);
 
     DiskEntry = RtlAllocateHeap(ProcessHeap,
@@ -1205,7 +1216,7 @@ CreatePartitionList(VOID)
 
     List = (PPARTLIST)RtlAllocateHeap(ProcessHeap,
                                       0,
-                                      sizeof (PARTLIST));
+                                      sizeof(PARTLIST));
     if (List == NULL)
         return NULL;
 
@@ -1233,11 +1244,10 @@ CreatePartitionList(VOID)
 
     for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
     {
-        swprintf(Buffer,
-                 L"\\Device\\Harddisk%d\\Partition0",
-                 DiskNumber);
-        RtlInitUnicodeString(&Name,
-                             Buffer);
+        RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer),
+                            L"\\Device\\Harddisk%lu\\Partition0",
+                            DiskNumber);
+        RtlInitUnicodeString(&Name, Buffer);
 
         InitializeObjectAttributes(&ObjectAttributes,
                                    &Name,
@@ -2460,7 +2470,7 @@ DeleteCurrentPartition(
         RtlFreeHeap(ProcessHeap, 0, PartEntry);
 
         /* Remove the next entry */
-        RemoveEntryList (&NextPartEntry->ListEntry);
+        RemoveEntryList(&NextPartEntry->ListEntry);
         RtlFreeHeap(ProcessHeap, 0, NextPartEntry);
 
         /* Update current partition */
@@ -2764,11 +2774,10 @@ WritePartitions(
 
     DPRINT("WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
 
-    swprintf(DstPath,
-             L"\\Device\\Harddisk%d\\Partition0",
-             DiskEntry->DiskNumber);
-    RtlInitUnicodeString(&Name,
-                         DstPath);
+    RtlStringCchPrintfW(DstPath, ARRAYSIZE(DstPath),
+                        L"\\Device\\Harddisk%lu\\Partition0",
+                        DiskEntry->DiskNumber);
+    RtlInitUnicodeString(&Name, DstPath);
     InitializeObjectAttributes(&ObjectAttributes,
                                &Name,
                                0,
@@ -2865,7 +2874,8 @@ SetMountedDeviceValue(
     NTSTATUS Status;
     HANDLE KeyHandle;
 
-    swprintf(ValueNameBuffer, L"\\DosDevices\\%C:", Letter);
+    RtlStringCchPrintfW(ValueNameBuffer, ARRAYSIZE(ValueNameBuffer),
+                        L"\\DosDevices\\%C:", Letter);
     RtlInitUnicodeString(&ValueName, ValueNameBuffer);
 
     InitializeObjectAttributes(&ObjectAttributes,
index a53fc3c..bee6e9f 100644 (file)
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
 
-#include <wingdi.h> // For LF_FACESIZE and TranslateCharsetInfo()
-#include <wincon.h>
-#include <winnls.h> // For code page support
-#include <winreg.h>
+#include <winxxx.h>
 
 #endif
 
@@ -29,6 +26,7 @@ extern HANDLE ProcessHeap;
 #include "linklist.h"
 #include "ntverrsrc.h"
 // #include "arcname.h"
+#include "bldrsup.h"
 #include "filesup.h"
 #include "fsutil.h"
 #include "genlist.h"
index b48d5c0..b597671 100644 (file)
@@ -435,13 +435,13 @@ CreateFreeLoaderIniForReactOS(
 static
 NTSTATUS
 CreateFreeLoaderIniForReactOSAndBootSector(
-    PWCHAR IniPath,
-    PWCHAR ArcPath,
-    PWCHAR Section,
-    PWCHAR Description,
-    PWCHAR BootDrive,
-    PWCHAR BootPartition,
-    PWCHAR BootSector)
+    IN PCWSTR IniPath,
+    IN PCWSTR ArcPath,
+    IN PCWSTR Section,
+    IN PCWSTR Description,
+    IN PCWSTR BootDrive,
+    IN PCWSTR BootPartition,
+    IN PCWSTR BootSector)
 {
     PINICACHE IniCache;
     PINICACHESECTION IniSection;
@@ -453,7 +453,7 @@ CreateFreeLoaderIniForReactOSAndBootSector(
     CreateCommonFreeLoaderSections(IniCache);
 
     /* Add the ReactOS entries */
-    CreateFreeLoaderReactOSEntries(IniCache, ArcPath);
+    CreateFreeLoaderReactOSEntries(IniCache, (PWCHAR)ArcPath);
 
     /* Get "Operating Systems" section */
     IniSection = IniCacheGetSection(IniCache, L"Operating Systems");
@@ -462,11 +462,11 @@ CreateFreeLoaderIniForReactOSAndBootSector(
     IniCacheInsertKey(IniSection,
                       NULL,
                       INSERT_LAST,
-                      Section,
-                      Description);
+                      (PWCHAR)Section,
+                      (PWCHAR)Description);
 
     /* Create new section */
-    IniSection = IniCacheAppendSection(IniCache, Section);
+    IniSection = IniCacheAppendSection(IniCache, (PWCHAR)Section);
 
     /* BootType=BootSector */
     IniCacheInsertKey(IniSection,
@@ -480,24 +480,24 @@ CreateFreeLoaderIniForReactOSAndBootSector(
                       NULL,
                       INSERT_LAST,
                       L"BootDrive",
-                      BootDrive);
+                      (PWCHAR)BootDrive);
 
     /* BootPartition= */
     IniCacheInsertKey(IniSection,
                       NULL,
                       INSERT_LAST,
                       L"BootPartition",
-                      BootPartition);
+                      (PWCHAR)BootPartition);
 
     /* BootSector= */
     IniCacheInsertKey(IniSection,
                       NULL,
                       INSERT_LAST,
                       L"BootSectorFile",
-                      BootSector);
+                      (PWCHAR)BootSector);
 
     /* Save the INI file */
-    IniCacheSave(IniCache, IniPath);
+    IniCacheSave(IniCache, (PWCHAR)IniPath);
     IniCacheDestroy(IniCache);
 
     return STATUS_SUCCESS;
@@ -2260,9 +2260,9 @@ InstallFatBootcodeToPartition(
     /* FAT or FAT32 partition */
     DPRINT("System path: '%wZ'\n", SystemRootPath);
 
-    /* Copy FreeLoader to the system partition */
+    /* Copy FreeLoader to the system partition, always overwriting the older version */
     CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\freeldr.sys");
-    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.sys");
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.sys");
 
     DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
     Status = SetupCopyFile(SrcPath, DstPath);
@@ -2272,8 +2272,8 @@ InstallFatBootcodeToPartition(
         return Status;
     }
 
-    /* Prepare for possibly copying 'freeldr.ini' */
-    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.ini");
+    /* Prepare for possibly updating 'freeldr.ini' */
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.ini");
 
     DoesFreeLdrExist = DoesFileExist(NULL, DstPath);
     if (DoesFreeLdrExist)
@@ -2292,10 +2292,12 @@ InstallFatBootcodeToPartition(
     /* Check for NT and other bootloaders */
 
     // FIXME: Check for Vista+ bootloader!
-    if (DoesFileExist_2(SystemRootPath->Buffer, L"ntldr") == TRUE ||
-        DoesFileExist_2(SystemRootPath->Buffer, L"boot.ini") == TRUE)
+    /*** Status = FindNTOSBootLoader(PartitionHandle, NtLdr, &Version); ***/
+    /*** Status = FindNTOSBootLoader(PartitionHandle, BootMgr, &Version); ***/
+    if (DoesFileExist_2(SystemRootPath->Buffer, L"NTLDR") == TRUE ||
+        DoesFileExist_2(SystemRootPath->Buffer, L"BOOT.INI") == TRUE)
     {
-        /* Search root directory for 'ntldr' and 'boot.ini' */
+        /* Search root directory for 'NTLDR' and 'BOOT.INI' */
         DPRINT1("Found Microsoft Windows NT/2000/XP boot loader\n");
 
         /* Create or update 'freeldr.ini' */
@@ -2303,7 +2305,7 @@ InstallFatBootcodeToPartition(
         {
             /* Create new 'freeldr.ini' */
             DPRINT1("Create new 'freeldr.ini'\n");
-            // CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.ini");
+            // CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.ini");
 
             Status = CreateFreeLoaderIniForReactOS(DstPath, DestinationArcPath->Buffer);
             if (!NT_SUCCESS(Status))
@@ -2313,7 +2315,7 @@ InstallFatBootcodeToPartition(
             }
 
             /* Install new bootcode into a file */
-            CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\bootsect.ros");
+            CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"bootsect.ros");
 
             if (PartitionType == PARTITION_FAT32 ||
                 PartitionType == PARTITION_FAT32_XINT13)
@@ -2347,7 +2349,7 @@ InstallFatBootcodeToPartition(
         }
 
         /* Update 'boot.ini' */
-        CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\boot.ini");
+        CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"boot.ini");
 
         DPRINT1("Update 'boot.ini': %S\n", DstPath);
         Status = UpdateBootIni(DstPath,
@@ -2363,31 +2365,97 @@ InstallFatBootcodeToPartition(
     {
         /* Non-NT bootloaders: install our own bootloader */
 
-        PWCHAR Section;
-        PWCHAR Description;
-        PWCHAR BootDrive;
-        PWCHAR BootPartition;
-        PWCHAR BootSector;
-        PWCHAR BootSectorFileName;
+        PCWSTR Section;
+        PCWSTR Description;
+        PCWSTR BootDrive;
+        PCWSTR BootPartition;
+        PCWSTR BootSector;
 
-        if (DoesFileExist_2(SystemRootPath->Buffer, L"io.sys") == TRUE ||
-            DoesFileExist_2(SystemRootPath->Buffer, L"msdos.sys") == TRUE)
+        /* Search for COMPAQ MS-DOS 1.x (1.11, 1.12, based on MS-DOS 1.25) boot loader */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"IOSYS.COM") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"MSDOS.COM") == TRUE)
+        {
+            DPRINT1("Found COMPAQ MS-DOS 1.x (1.11, 1.12) / MS-DOS 1.25 boot loader\n");
+
+            Section       = L"DOS";
+            Description   = L"\"COMPAQ MS-DOS 1.x / MS-DOS 1.25\"";
+            BootDrive     = L"hd0";
+            BootPartition = L"1";
+            BootSector    = L"BOOTSECT.DOS";
+        }
+        else
+        /* Search for Microsoft DOS or Windows 9x boot loader */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"IO.SYS") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"MSDOS.SYS") == TRUE)
+            // WINBOOT.SYS
         {
-            /* Search for root directory for 'io.sys' and 'msdos.sys' */
             DPRINT1("Found Microsoft DOS or Windows 9x boot loader\n");
 
             Section       = L"DOS";
-            Description   = L"\"DOS/Windows\"";
+            Description   = L"\"MS-DOS/Windows\"";
+            BootDrive     = L"hd0";
+            BootPartition = L"1";
+            BootSector    = L"BOOTSECT.DOS";
+        }
+        else
+        /* Search for IBM PC-DOS or DR-DOS 5.x boot loader */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"IBMIO.COM" ) == TRUE || // Some people refer to this file instead of IBMBIO.COM...
+            DoesFileExist_2(SystemRootPath->Buffer, L"IBMBIO.COM") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"IBMDOS.COM") == TRUE)
+        {
+            DPRINT1("Found IBM PC-DOS or DR-DOS 5.x or IBM OS/2 1.0\n");
+
+            Section       = L"DOS";
+            Description   = L"\"IBM PC-DOS or DR-DOS 5.x or IBM OS/2 1.0\"";
             BootDrive     = L"hd0";
             BootPartition = L"1";
             BootSector    = L"BOOTSECT.DOS";
+        }
+        else
+        /* Search for DR-DOS 3.x boot loader */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"DRBIOS.SYS") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"DRBDOS.SYS") == TRUE)
+        {
+            DPRINT1("Found DR-DOS 3.x\n");
+
+            Section       = L"DOS";
+            Description   = L"\"DR-DOS 3.x\"";
+            BootDrive     = L"hd0";
+            BootPartition = L"1";
+            BootSector    = L"BOOTSECT.DOS";
+        }
+        else
+        /* Search for MS OS/2 1.x */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"OS2BOOT.COM") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"OS2BIO.COM" ) == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"OS2DOS.COM" ) == TRUE)
+        {
+            DPRINT1("Found MS OS/2 1.x\n");
+
+            Section       = L"DOS";
+            Description   = L"\"MS OS/2 1.x\"";
+            BootDrive     = L"hd0";
+            BootPartition = L"1";
+            BootSector    = L"BOOTSECT.OS2";
+        }
+        else
+        /* Search for MS or IBM OS/2 */
+        if (DoesFileExist_2(SystemRootPath->Buffer, L"OS2BOOT") == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"OS2LDR" ) == TRUE ||
+            DoesFileExist_2(SystemRootPath->Buffer, L"OS2KRNL") == TRUE)
+        {
+            DPRINT1("Found MS/IBM OS/2\n");
 
-            BootSectorFileName = L"\\bootsect.dos";
+            Section       = L"DOS";
+            Description   = L"\"MS/IBM OS/2\"";
+            BootDrive     = L"hd0";
+            BootPartition = L"1";
+            BootSector    = L"BOOTSECT.OS2";
         }
         else
+        /* Search for FreeDOS boot loader */
         if (DoesFileExist_2(SystemRootPath->Buffer, L"kernel.sys") == TRUE)
         {
-            /* Search for root directory for 'kernel.sys' */
             DPRINT1("Found FreeDOS boot loader\n");
 
             Section       = L"DOS";
@@ -2395,8 +2463,6 @@ InstallFatBootcodeToPartition(
             BootDrive     = L"hd0";
             BootPartition = L"1";
             BootSector    = L"BOOTSECT.DOS";
-
-            BootSectorFileName = L"\\bootsect.dos";
         }
         else
         {
@@ -2408,8 +2474,6 @@ InstallFatBootcodeToPartition(
             BootDrive     = L"hd0";
             BootPartition = L"1";
             BootSector    = L"BOOTSECT.OLD";
-
-            BootSectorFileName = L"\\bootsect.old";
         }
 
         /* Create or update 'freeldr.ini' */
@@ -2417,7 +2481,7 @@ InstallFatBootcodeToPartition(
         {
             /* Create new 'freeldr.ini' */
             DPRINT1("Create new 'freeldr.ini'\n");
-            // CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.ini");
+            // CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.ini");
 
             if (IsThereAValidBootSector(SystemRootPath->Buffer))
             {
@@ -2432,7 +2496,7 @@ InstallFatBootcodeToPartition(
                 }
 
                 /* Save current bootsector */
-                CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, BootSectorFileName);
+                CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, BootSector);
 
                 DPRINT1("Save bootsector: %S ==> %S\n", SystemRootPath->Buffer, DstPath);
                 Status = SaveBootSector(SystemRootPath->Buffer, DstPath, SECTORSIZE);
@@ -2502,9 +2566,9 @@ InstallExt2BootcodeToPartition(
     /* EXT2 partition */
     DPRINT("System path: '%wZ'\n", SystemRootPath);
 
-    /* Copy FreeLoader to the system partition */
+    /* Copy FreeLoader to the system partition, always overwriting the older version */
     CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\freeldr.sys");
-    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.sys");
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.sys");
 
     DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
     Status = SetupCopyFile(SrcPath, DstPath);
@@ -2515,7 +2579,7 @@ InstallExt2BootcodeToPartition(
     }
 
     /* Prepare for possibly copying 'freeldr.ini' */
-    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\freeldr.ini");
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.ini");
 
     DoesFreeLdrExist = DoesFileExist(NULL, DstPath);
     if (DoesFreeLdrExist)
@@ -2545,10 +2609,12 @@ InstallExt2BootcodeToPartition(
 
         if (IsThereAValidBootSector(SystemRootPath->Buffer))
         {
+            PCWSTR BootSector = L"BOOTSECT.OLD";
+
             Status = CreateFreeLoaderIniForReactOSAndBootSector(
                          DstPath, DestinationArcPath->Buffer,
                          L"Linux", L"\"Linux\"",
-                         L"hd0", L"1", L"BOOTSECT.OLD");
+                         L"hd0", L"1", BootSector);
             if (!NT_SUCCESS(Status))
             {
                 DPRINT1("CreateFreeLoaderIniForReactOSAndBootSector() failed (Status %lx)\n", Status);
@@ -2556,7 +2622,7 @@ InstallExt2BootcodeToPartition(
             }
 
             /* Save current bootsector */
-            CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"\\bootsect.old");
+            CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, BootSector);
 
             DPRINT1("Save bootsector: %S ==> %S\n", SystemRootPath->Buffer, DstPath);
             Status = SaveBootSector(SystemRootPath->Buffer, DstPath, sizeof(EXT2_BOOTSECTOR));
@@ -2627,6 +2693,7 @@ InstallVBRToPartition(
         }
 
         case PARTITION_IFS:
+            DPRINT1("Partitions of type NTFS or HPFS are not supported yet!\n");
             break;
 
         default:
@@ -2645,7 +2712,7 @@ InstallFatBootcodeToFloppy(
 {
     NTSTATUS Status;
     PFILE_SYSTEM FatFS;
-    UNICODE_STRING FloppyDevice = RTL_CONSTANT_STRING(L"\\Device\\Floppy0");
+    UNICODE_STRING FloppyDevice = RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\");
     WCHAR SrcPath[MAX_PATH];
     WCHAR DstPath[MAX_PATH];
 
@@ -2670,8 +2737,7 @@ InstallFatBootcodeToFloppy(
 
     /* Copy FreeLoader to the boot partition */
     CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\freeldr.sys");
-
-    RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), L"\\Device\\Floppy0\\freeldr.sys");
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, FloppyDevice.Buffer, L"freeldr.sys");
 
     DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
     Status = SetupCopyFile(SrcPath, DstPath);
@@ -2682,7 +2748,7 @@ InstallFatBootcodeToFloppy(
     }
 
     /* Create new 'freeldr.ini' */
-    RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), L"\\Device\\Floppy0\\freeldr.ini");
+    CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, FloppyDevice.Buffer, L"freeldr.ini");
 
     DPRINT("Create new 'freeldr.ini'\n");
     Status = CreateFreeLoaderIniForReactOS(DstPath, DestinationArcPath->Buffer);
@@ -2692,16 +2758,15 @@ InstallFatBootcodeToFloppy(
         return Status;
     }
 
-    /* Install FAT12/16 boosector */
+    /* Install FAT12 boosector */
     CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\fat.bin");
-
-    RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), L"\\Device\\Floppy0");
+    RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), FloppyDevice.Buffer);
 
     DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath);
     Status = InstallFat12BootCodeToFloppy(SrcPath, DstPath);
     if (!NT_SUCCESS(Status))
     {
-        DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status);
+        DPRINT1("InstallFat12BootCodeToFloppy() failed (Status %lx)\n", Status);
         return Status;
     }
 
index d7347f3..0d9d304 100644 (file)
@@ -1,4 +1,5 @@
-#define REACTOS_STR_FILE_DESCRIPTION  "ReactOS Setup"
-#define REACTOS_STR_INTERNAL_NAME     "usetup"
-#define REACTOS_STR_ORIGINAL_FILENAME "usetup.exe"
+
+#define REACTOS_STR_FILE_DESCRIPTION    "ReactOS Text-Mode Setup"
+#define REACTOS_STR_INTERNAL_NAME       "usetup"
+#define REACTOS_STR_ORIGINAL_FILENAME   "usetup.exe"
 #include <reactos/version.rc>