https://git.reactos.org/?p=reactos.git;a=commitdiff;h=424278db3ff4ecc261e0c73160d23c3c75cc537e

commit 424278db3ff4ecc261e0c73160d23c3c75cc537e
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Sun Jul 21 21:48:55 2024 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Sun Oct 20 16:51:26 2024 +0200

    [SETUP:REACTOS] Add bootloader installation support (#7310)
    
    CORE-13525
---
 base/setup/reactos/lang/bg-BG.rc |   7 ++
 base/setup/reactos/lang/cs-CZ.rc |   7 ++
 base/setup/reactos/lang/de-DE.rc |   7 ++
 base/setup/reactos/lang/el-GR.rc |   7 ++
 base/setup/reactos/lang/en-US.rc |   7 ++
 base/setup/reactos/lang/es-ES.rc |   7 ++
 base/setup/reactos/lang/et-EE.rc |   7 ++
 base/setup/reactos/lang/eu-ES.rc |   7 ++
 base/setup/reactos/lang/fi-FI.rc |   7 ++
 base/setup/reactos/lang/fr-FR.rc |   7 ++
 base/setup/reactos/lang/he-IL.rc |   7 ++
 base/setup/reactos/lang/hi-IN.rc |   7 ++
 base/setup/reactos/lang/hu-HU.rc |   7 ++
 base/setup/reactos/lang/id-ID.rc |   7 ++
 base/setup/reactos/lang/it-IT.rc |   7 ++
 base/setup/reactos/lang/ja-JP.rc |   7 ++
 base/setup/reactos/lang/ms-MY.rc |   7 ++
 base/setup/reactos/lang/no-NO.rc |   7 ++
 base/setup/reactos/lang/pl-PL.rc |   7 ++
 base/setup/reactos/lang/pt-BR.rc |   7 ++
 base/setup/reactos/lang/pt-PT.rc |   7 ++
 base/setup/reactos/lang/ro-RO.rc |   7 ++
 base/setup/reactos/lang/ru-RU.rc |   7 ++
 base/setup/reactos/lang/sk-SK.rc |   7 ++
 base/setup/reactos/lang/sq-AL.rc |   7 ++
 base/setup/reactos/lang/tr-TR.rc |   7 ++
 base/setup/reactos/lang/uk-UA.rc |   7 ++
 base/setup/reactos/lang/vi-VN.rc |   7 ++
 base/setup/reactos/lang/zh-CN.rc |   7 ++
 base/setup/reactos/lang/zh-HK.rc |   7 ++
 base/setup/reactos/lang/zh-TW.rc |   7 ++
 base/setup/reactos/reactos.c     | 135 ++++++++++++++++++++++++++++++++++++++-
 base/setup/reactos/resource.h    |  10 +++
 33 files changed, 361 insertions(+), 1 deletion(-)

diff --git a/base/setup/reactos/lang/bg-BG.rc b/base/setup/reactos/lang/bg-BG.rc
index 2f43f74839a..06995ecf1cb 100644
--- a/base/setup/reactos/lang/bg-BG.rc
+++ b/base/setup/reactos/lang/bg-BG.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/cs-CZ.rc b/base/setup/reactos/lang/cs-CZ.rc
index 9645e7cbc00..a77b7f2689e 100644
--- a/base/setup/reactos/lang/cs-CZ.rc
+++ b/base/setup/reactos/lang/cs-CZ.rc
@@ -286,4 +286,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/de-DE.rc b/base/setup/reactos/lang/de-DE.rc
index 00b0347afe4..e36c9a2adea 100644
--- a/base/setup/reactos/lang/de-DE.rc
+++ b/base/setup/reactos/lang/de-DE.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/el-GR.rc b/base/setup/reactos/lang/el-GR.rc
index 4ef7d7f2485..fd39462b009 100644
--- a/base/setup/reactos/lang/el-GR.rc
+++ b/base/setup/reactos/lang/el-GR.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/en-US.rc b/base/setup/reactos/lang/en-US.rc
index f408db08e42..4bea2f92b56 100644
--- a/base/setup/reactos/lang/en-US.rc
+++ b/base/setup/reactos/lang/en-US.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/es-ES.rc b/base/setup/reactos/lang/es-ES.rc
index e2f2443cda4..3dc8d747fa2 100644
--- a/base/setup/reactos/lang/es-ES.rc
+++ b/base/setup/reactos/lang/es-ES.rc
@@ -289,4 +289,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/et-EE.rc b/base/setup/reactos/lang/et-EE.rc
index 2173ed3fe83..59147fca93b 100644
--- a/base/setup/reactos/lang/et-EE.rc
+++ b/base/setup/reactos/lang/et-EE.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/eu-ES.rc b/base/setup/reactos/lang/eu-ES.rc
index 174b6c36c1f..515008778f7 100644
--- a/base/setup/reactos/lang/eu-ES.rc
+++ b/base/setup/reactos/lang/eu-ES.rc
@@ -287,4 +287,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/fi-FI.rc b/base/setup/reactos/lang/fi-FI.rc
index 2cdadc38d2b..2060840e4ca 100644
--- a/base/setup/reactos/lang/fi-FI.rc
+++ b/base/setup/reactos/lang/fi-FI.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/fr-FR.rc b/base/setup/reactos/lang/fr-FR.rc
index c1655ba3a56..8377367c049 100644
--- a/base/setup/reactos/lang/fr-FR.rc
+++ b/base/setup/reactos/lang/fr-FR.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Échec de l'installation du code de démarrage %s sur 
la partition système."
+    IDS_ERROR_INSTALL_BOOTCODE "Échec de l'installation du code de démarrage 
%s sur le disque système."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Échec de l'installation du code de 
démarrage sur le média amovible."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Le programme d'installation ne 
supporte pas actuellement l'installation du chargeur de démarrage sur 
l'ordinateur que vous utilisez.\
+\nCliquez sur OK pour continuer quand même."
+    IDS_ERROR_BOOTLDR_FAILED "Le programme d'installation n'a pas pu installer 
le chargeur de démarrage (Status 0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/he-IL.rc b/base/setup/reactos/lang/he-IL.rc
index bca834654ca..4e36e313204 100644
--- a/base/setup/reactos/lang/he-IL.rc
+++ b/base/setup/reactos/lang/he-IL.rc
@@ -282,4 +282,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/hi-IN.rc b/base/setup/reactos/lang/hi-IN.rc
index 649fbc1c0bc..787f9dfaca4 100644
--- a/base/setup/reactos/lang/hi-IN.rc
+++ b/base/setup/reactos/lang/hi-IN.rc
@@ -250,4 +250,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/hu-HU.rc b/base/setup/reactos/lang/hu-HU.rc
index 21498adb4c4..3624c26ccd6 100644
--- a/base/setup/reactos/lang/hu-HU.rc
+++ b/base/setup/reactos/lang/hu-HU.rc
@@ -282,4 +282,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/id-ID.rc b/base/setup/reactos/lang/id-ID.rc
index 8a02a29a0bb..8181054b616 100644
--- a/base/setup/reactos/lang/id-ID.rc
+++ b/base/setup/reactos/lang/id-ID.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/it-IT.rc b/base/setup/reactos/lang/it-IT.rc
index c1415f9b2f2..f071c217f10 100644
--- a/base/setup/reactos/lang/it-IT.rc
+++ b/base/setup/reactos/lang/it-IT.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/ja-JP.rc b/base/setup/reactos/lang/ja-JP.rc
index e432ae65f22..9301269e54f 100644
--- a/base/setup/reactos/lang/ja-JP.rc
+++ b/base/setup/reactos/lang/ja-JP.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/ms-MY.rc b/base/setup/reactos/lang/ms-MY.rc
index da8c49cc800..733abf5613f 100644
--- a/base/setup/reactos/lang/ms-MY.rc
+++ b/base/setup/reactos/lang/ms-MY.rc
@@ -282,4 +282,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/no-NO.rc b/base/setup/reactos/lang/no-NO.rc
index 8ffecfa7a0e..1d9447cfc1b 100644
--- a/base/setup/reactos/lang/no-NO.rc
+++ b/base/setup/reactos/lang/no-NO.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/pl-PL.rc b/base/setup/reactos/lang/pl-PL.rc
index fadc7d1ac62..5afae2e1781 100644
--- a/base/setup/reactos/lang/pl-PL.rc
+++ b/base/setup/reactos/lang/pl-PL.rc
@@ -291,4 +291,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/pt-BR.rc b/base/setup/reactos/lang/pt-BR.rc
index 38fab3d8b8f..fa6f3c4b1e6 100644
--- a/base/setup/reactos/lang/pt-BR.rc
+++ b/base/setup/reactos/lang/pt-BR.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/pt-PT.rc b/base/setup/reactos/lang/pt-PT.rc
index 26c8547d453..26162b708c0 100644
--- a/base/setup/reactos/lang/pt-PT.rc
+++ b/base/setup/reactos/lang/pt-PT.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/ro-RO.rc b/base/setup/reactos/lang/ro-RO.rc
index efebc60631a..209973a0e68 100644
--- a/base/setup/reactos/lang/ro-RO.rc
+++ b/base/setup/reactos/lang/ro-RO.rc
@@ -289,4 +289,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/ru-RU.rc b/base/setup/reactos/lang/ru-RU.rc
index 1c6ea120e51..db2a6c843e6 100644
--- a/base/setup/reactos/lang/ru-RU.rc
+++ b/base/setup/reactos/lang/ru-RU.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/sk-SK.rc b/base/setup/reactos/lang/sk-SK.rc
index 0314a8adb61..1bed0d0a631 100644
--- a/base/setup/reactos/lang/sk-SK.rc
+++ b/base/setup/reactos/lang/sk-SK.rc
@@ -285,4 +285,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/sq-AL.rc b/base/setup/reactos/lang/sq-AL.rc
index 67df75a0690..0d4641bf045 100644
--- a/base/setup/reactos/lang/sq-AL.rc
+++ b/base/setup/reactos/lang/sq-AL.rc
@@ -282,4 +282,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/tr-TR.rc b/base/setup/reactos/lang/tr-TR.rc
index 984d7469379..7c5196fcdfc 100644
--- a/base/setup/reactos/lang/tr-TR.rc
+++ b/base/setup/reactos/lang/tr-TR.rc
@@ -287,4 +287,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/uk-UA.rc b/base/setup/reactos/lang/uk-UA.rc
index 7b3cc3f6368..80a8f388094 100644
--- a/base/setup/reactos/lang/uk-UA.rc
+++ b/base/setup/reactos/lang/uk-UA.rc
@@ -288,4 +288,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/vi-VN.rc b/base/setup/reactos/lang/vi-VN.rc
index 412fbc53fac..75aa2a299c3 100644
--- a/base/setup/reactos/lang/vi-VN.rc
+++ b/base/setup/reactos/lang/vi-VN.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/zh-CN.rc b/base/setup/reactos/lang/zh-CN.rc
index ceaab5efa48..41e7cd8f4f8 100644
--- a/base/setup/reactos/lang/zh-CN.rc
+++ b/base/setup/reactos/lang/zh-CN.rc
@@ -280,4 +280,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/zh-HK.rc b/base/setup/reactos/lang/zh-HK.rc
index 0c31f4db676..6e658a9976b 100644
--- a/base/setup/reactos/lang/zh-HK.rc
+++ b/base/setup/reactos/lang/zh-HK.rc
@@ -288,4 +288,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/lang/zh-TW.rc b/base/setup/reactos/lang/zh-TW.rc
index f7860c17214..2fb700bf3d7 100644
--- a/base/setup/reactos/lang/zh-TW.rc
+++ b/base/setup/reactos/lang/zh-TW.rc
@@ -289,4 +289,11 @@ the Setup program cannot install ReactOS.\
 \nClick on CANCEL to quit Setup."
 
     IDS_ERROR_CHECKING_PARTITION "ChkDsk detected some disk errors.\n(Status 
0x%08lx)."
+
+    IDS_ERROR_WRITE_BOOT "Setup failed to install the %s bootcode on the 
system partition."
+    IDS_ERROR_INSTALL_BOOTCODE "Setup failed to install the %s bootcode on the 
boot disk."
+    IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE "Setup failed to install the bootcode 
on the removable media."
+    IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED "Setup does not currently support 
installing the bootloader on the computer you are using.\
+\nClick on OK to continue anyway."
+    IDS_ERROR_BOOTLDR_FAILED "Setup could not install the bootloader (Status 
0x%08lx)."
 END
diff --git a/base/setup/reactos/reactos.c b/base/setup/reactos/reactos.c
index aab095cc61d..5d5ee21cb0f 100644
--- a/base/setup/reactos/reactos.c
+++ b/base/setup/reactos/reactos.c
@@ -1769,7 +1769,7 @@ PrepareAndDoCopyThread(
     NTSTATUS Status;
     FSVOL_CONTEXT FsVolContext;
     COPYCONTEXT CopyContext;
-    // WCHAR PathBuffer[MAX_PATH];
+    WCHAR PathBuffer[RTL_NUMBER_OF_FIELD(PARTENTRY, DeviceName) + 1];
 
     /* Retrieve pointer to the global setup data */
     pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
@@ -1986,6 +1986,139 @@ PrepareAndDoCopyThread(
     DBG_UNREFERENCED_PARAMETER(ErrorNumber);
     SendMessageW(UiContext.hWndProgress, PBM_SETPOS, 100, 0);
 
+    /*
+     * And finally, install the bootloader
+     */
+
+    /* Set status text */
+    SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"Installing the bootloader...");
+    SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
+
+    RtlFreeUnicodeString(&pSetupData->USetupData.SystemRootPath);
+    StringCchPrintfW(PathBuffer, _countof(PathBuffer),
+                     L"%s\\", SystemPartition->DeviceName);
+    RtlCreateUnicodeString(&pSetupData->USetupData.SystemRootPath, PathBuffer);
+    DPRINT1("SystemRootPath: %wZ\n", &pSetupData->USetupData.SystemRootPath);
+
+    switch (pSetupData->USetupData.BootLoaderLocation)
+    {
+        /* Install on removable disk */
+        case 1:
+        {
+            // TODO: So far SETUP only supports the 1st floppy.
+            // Use a simple UI like comdlg32's DlgDirList* to show
+            // a list of drives that the user could select.
+            static const UNICODE_STRING FloppyDrive = 
RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\");
+            static const WCHAR DriveLetter = L'A';
+
+            INT nRet;
+        RetryCancel:
+            nRet = DisplayMessage(GetParent(hwndDlg),
+                                  MB_ICONINFORMATION | MB_OKCANCEL,
+                                  L"Bootloader installation",
+                                  L"Please insert a blank floppy disk in drive 
%c: .\n"
+                                  L"All data in the floppy disk will be 
erased!\n"
+                                  L"\nClick on OK to continue."
+                                  L"\nClick on CANCEL to skip bootloader 
installation.",
+                                  DriveLetter);
+            if (nRet != IDOK)
+                break; /* Skip installation */
+
+        Retry:
+            Status = 
InstallBootcodeToRemovable(pSetupData->USetupData.ArchType,
+                                                &FloppyDrive,
+                                                
&pSetupData->USetupData.SourceRootPath,
+                                                
&pSetupData->USetupData.DestinationArcPath);
+            if (Status == STATUS_SUCCESS)
+                break; /* Successful installation */
+
+            if (Status == STATUS_DEVICE_NOT_READY)
+            {
+                // ERROR_NO_FLOPPY
+                nRet = DisplayMessage(GetParent(hwndDlg),
+                                      MB_ICONWARNING | MB_RETRYCANCEL,
+                                      NULL, // Default to "Error"
+                                      L"No disk detected in drive %c: .",
+                                      DriveLetter);
+                if (nRet == IDRETRY)
+                    goto Retry;
+            }
+            else if ((Status == ERROR_WRITE_BOOT) ||
+                     (Status == ERROR_INSTALL_BOOTCODE))
+            {
+                /* Error when writing the boot code */
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE);
+            }
+            else if (!NT_SUCCESS(Status))
+            {
+                /* Any other NTSTATUS failure code */
+                DPRINT1("InstallBootcodeToRemovable() failed: Status 0x%lx\n", 
Status);
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_BOOTLDR_FAILED,
+                             Status);
+            }
+            goto RetryCancel;
+        }
+
+        /* Install on hard-disk */
+        case 2: // System partition / MBR and VBR (on BIOS-based PC)
+        case 3: // VBR only (on BIOS-based PC)
+        {
+            /* Copy FreeLoader to the disk and save the boot entries */
+            Status = InstallBootManagerAndBootEntries(
+                        pSetupData->USetupData.ArchType,
+                        &pSetupData->USetupData.SystemRootPath,
+                        &pSetupData->USetupData.SourceRootPath,
+                        &pSetupData->USetupData.DestinationArcPath,
+                        (pSetupData->USetupData.BootLoaderLocation == 2)
+                           ? 1 /* Install MBR and VBR */
+                           : 0 /* Install VBR only */);
+            if (Status == STATUS_SUCCESS)
+                break; /* Successful installation */
+
+            if (Status == ERROR_WRITE_BOOT)
+            {
+                /* Error when writing the VBR */
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_WRITE_BOOT,
+                             SystemVolume->Info.FileSystem);
+            }
+            else if (Status == ERROR_INSTALL_BOOTCODE)
+            {
+                /* Error when writing the MBR */
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_INSTALL_BOOTCODE,
+                             L"MBR");
+            }
+            else if (Status == STATUS_NOT_SUPPORTED)
+            {
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED);
+            }
+            else if (!NT_SUCCESS(Status))
+            {
+                /* Any other NTSTATUS failure code */
+                DPRINT1("InstallBootManagerAndBootEntries() failed: Status 
0x%lx\n", Status);
+                DisplayError(GetParent(hwndDlg),
+                             0, // Default to "Error"
+                             IDS_ERROR_BOOTLDR_FAILED,
+                             Status);
+            }
+            break;
+        }
+
+        /* Skip installation */
+        case 0:
+        default:
+            break;
+    }
+
 
     /* We are done! Switch to the Terminate page */
     PropSheet_SetCurSelByID(GetParent(hwndDlg), IDD_RESTARTPAGE);
diff --git a/base/setup/reactos/resource.h b/base/setup/reactos/resource.h
index fac1ad7b48d..a9e154049b2 100644
--- a/base/setup/reactos/resource.h
+++ b/base/setup/reactos/resource.h
@@ -178,3 +178,13 @@
 
 // ERROR_CHECKING_PARTITION // TODO
 #define IDS_ERROR_CHECKING_PARTITION    5315
+
+// ERROR_WRITE_BOOT
+#define IDS_ERROR_WRITE_BOOT        5316
+// ERROR_INSTALL_BOOTCODE
+#define IDS_ERROR_INSTALL_BOOTCODE  5317
+#define IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE    5318
+// STATUS_NOT_SUPPORTED for bootloader
+#define IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED      5319
+// ERROR_BOOTLDR_FAILED // TODO
+#define IDS_ERROR_BOOTLDR_FAILED    5320

Reply via email to