From 98c630d81a6f124c29482e0bc936ea7993ff9fd1 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 19 Feb 2020 18:48:24 +0000 Subject: [PATCH] [mbr] finalize protective message MBR * Note that msg.txt uses codepage 850 --- res/mbr/msg.S | 48 ++++++++++++++++++++++++++++++++++++++++-------- res/mbr/msg.bin | Bin 512 -> 512 bytes res/mbr/msg.txt | 28 +++++++++++++++++++--------- src/rufus.rc | 10 +++++----- 4 files changed, 64 insertions(+), 22 deletions(-) diff --git a/res/mbr/msg.S b/res/mbr/msg.S index 1b23051d..dd94c487 100644 --- a/res/mbr/msg.S +++ b/res/mbr/msg.S @@ -1,6 +1,6 @@ -/********************************************************************************/ +ο»Ώ/********************************************************************************/ /* MSG - A protective MBR that displays an ASCII message located in the */ -/* following sectors. */ +/* subsequent sectors. */ /* */ /* Copyright (c) 2019-2020 Pete Batard */ /* */ @@ -139,20 +139,50 @@ display_msg: # Display the message mov ax, es mov ds, ax call print_msg - jmp halt_system + jmp prompt_user display_err: # Read error -> display shorter message from this MBR mov si, offset err_msg call print_msg - -halt_system: # Halt the system - hlt - jmp halt_system # Just in case... + +prompt_user: + xor ax, ax + mov ds, ax + mov si, offset prompt_string + call print_msg # Prompt the user + call flush_keyboard + +wait_for_keyboard: + mov ah, 0x01 + int 0x16 # KEYBOARD - CHECK BUFFER, DO NOT CLEAR + jnz reboot # Z is clear when characters are present in the buffer + mov ah, 0x02 + int 0x16 # KEYBOARD - GET SHIFT STATUS + and al, 0x04 # AL = shift status bits + jz wait_for_keyboard + +reboot: # Trigger a reboot + xor ax, ax + mov ds, ax + mov ax, 0x1234 + mov [0x473], ax + jmp 0xffff:0000 /********************************************************************************/ /* Subroutines */ /********************************************************************************/ +flush_keyboard: # Flush the keyboard buffer + mov ah, 0x01 + int 0x16 # KEYBOARD - CHECK BUFFER, DO NOT CLEAR + jz 0f # Z is set if no character in buffer + mov ah, 0x00 + int 0x16 # KEYBOARD - READ CHAR FROM BUFFER + loop flush_keyboard +0: ret + +# --------------------------------------------------------------------------- + print_msg: # Print NUL terminated string in DS:SI to console lodsb cmp al, 0x00 # NUL? @@ -204,7 +234,9 @@ print_msg: # Print NUL terminated string in DS:SI to console /* Data section */ /********************************************************************************/ err_msg: - .string "*** ERROR: THIS MEDIA CANNOT BOOT IN LEGACY MODE ***" + .string "\r\n \\04*** ERROR: THIS MEDIA CANNOT BOOT IN LEGACY MODE ***\\07\r\n" +prompt_string: + .string "\r\n\r\n \\70Please remove this media and press any key to reboot\\07" /********************************************************************************/ /* From offset 0x1b8, the MBR contains the partition table and signature data */ diff --git a/res/mbr/msg.bin b/res/mbr/msg.bin index a6080668dbd4b2c09a7279fab70f75c6d4a68848..b350c71f0fa165bad91643333d8a79cfafb61f0c 100644 GIT binary patch delta 186 zcmZo*X<(Vq>}b#Mnr)wC?F(}T!vlRc_NCUo&}Dcb%dmy7N)aeDl8?RKvFwQ zgccXGykcPZ{~sh-!nTFstk|P3hbK-572@SmKn5`eCKI2U1jZPc^Kvopa-qwb8wBK} zCKjhE6s6|om!&F{WMmdAr4| MBR -* Target system -> BIOS... + This drive was created by Rufus [\09https://rufus.ie\07]. + + It can boot in \04UEFI mode only\07 but you are trying to + boot it in BIOS/Legacy mode. THIS WILL NOT WORK! + + To remove this message you need to do \02ONE\07 of the following: + o If this computer supports UEFI, go to the UEFI settings + and disable or lower the priority of \09CSM/Legacy mode\07. + o \02OR\07 Recreate the drive in Rufus and use: + * \09Partition scheme\07 -> \09MBR\07. + * \09Target system\07 -> \09BIOS (...)\07 + o \02OR\07 Erase the whole drive in Rufus by selecting: + * \09Boot Type\07 -> \09Non bootable\07 diff --git a/src/rufus.rc b/src/rufus.rc index b4dd5358..99c6763b 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.9.1618" +CAPTION "Rufus 3.9.1619" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -394,8 +394,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,9,1618,0 - PRODUCTVERSION 3,9,1618,0 + FILEVERSION 3,9,1619,0 + PRODUCTVERSION 3,9,1619,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -413,13 +413,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.9.1618" + VALUE "FileVersion", "3.9.1619" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "Β© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.9.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.9.1618" + VALUE "ProductVersion", "3.9.1619" END END BLOCK "VarFileInfo"