https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d93100afce502da09c23…
commit 9d93100afce502da09c23b583b0e40154c5c181c
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Sep 3 16:19:59 2017 +0000
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Oct 28 00:25:51 2018 +0200
[SETUPLIB][USETUP] Move the floppy-disk accessibility check into
InstallFatBootcodeToFloppy().
svn path=/branches/setup_improvements/; revision=75751
---
base/setup/lib/bootsup.c | 6 +++++-
base/setup/usetup/usetup.c | 17 +++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c
index 7ea6240b9a..0ef4e8241e 100644
--- a/base/setup/lib/bootsup.c
+++ b/base/setup/lib/bootsup.c
@@ -2303,7 +2303,11 @@ InstallFatBootcodeToFloppy(
WCHAR SrcPath[MAX_PATH];
WCHAR DstPath[MAX_PATH];
- /* Format the floppy first */
+ /* Verify that the floppy disk is accessible */
+ if (DoesDirExist(NULL, FloppyDevice.Buffer) == FALSE)
+ return STATUS_DEVICE_NOT_READY;
+
+ /* Format the floppy disk */
FatFS = GetFileSystemByName(L"FAT");
if (!FatFS)
{
diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c
index f29935b41b..a5764589ef 100644
--- a/base/setup/usetup/usetup.c
+++ b/base/setup/usetup/usetup.c
@@ -4532,16 +4532,14 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir)
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
- if (DoesDirExist(NULL, L"\\Device\\Floppy0\\") == FALSE)
- {
- MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
- return BOOT_LOADER_FLOPPY_PAGE;
- }
-
- Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
&USetupData.DestinationArcPath);
+ Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
+ &USetupData.DestinationArcPath);
if (!NT_SUCCESS(Status))
{
- /* Print error message */
+ if (Status == STATUS_DEVICE_NOT_READY)
+ MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
+
+ /* TODO: Print error message */
return BOOT_LOADER_FLOPPY_PAGE;
}
@@ -4625,8 +4623,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
DestinationDevicePathBuffer);
if (!NT_SUCCESS(Status))
{
- DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
- Status);
+ DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
MUIDisplayError(ERROR_INSTALL_BOOTCODE, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}