1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[mbr] finalize protective message MBR

* Note that msg.txt uses codepage 850
This commit is contained in:
Pete Batard 2020-02-19 18:48:24 +00:00
parent bfbb9d2ed5
commit 98c630d81a
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 64 additions and 22 deletions

View file

@ -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 <pete@akeo.ie> */
/* */
@ -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 */

Binary file not shown.

View file

@ -1,11 +1,21 @@
****************************************
*** ERROR: LEGACY BOOT OF UEFI MEDIA ***
****************************************
\07
\70 ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \07
\70 º º \07
\70 º \74ERROR: BIOS/LEGACY BOOT OF UEFI-ONLY MEDIA\70 º \07
\70 º º \07
\70 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \07
This drive can only boot in UEFI mode.
It can not boot in BIOS/Legacy mode.
If you want to boot this drive in BIOS/Legacy mode, you
should recreate it in Rufus using the following settings:
* Partition scheme -> 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

View file

@ -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"