[core] display a notice about Legacy in the protective MBR for GPT

* This should help Windows users who create a GPT/UEFI drive and try to use it in BIOS/Legacy
* Also make sure that we take into account the split space for both "SELECT" and "DOWNLOAD"
This commit is contained in:
Pete Batard 2019-03-16 13:01:55 +00:00
parent 789373ed59
commit 28c1d6eb31
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
11 changed files with 200 additions and 10 deletions

View file

@ -148,6 +148,15 @@ int is_rufus_mbr(FILE *fp)
is_br(fp);
} /* is_rufus_mbr */
int is_rufus_gpt_mbr(FILE *fp)
{
#include "mbr_gpt_rufus.h"
return
contains_data(fp, 0x0, mbr_gpt_rufus_0x0, sizeof(mbr_gpt_rufus_0x0)) &&
is_br(fp);
} /* is_rufus_gpt_mbr */
int is_reactos_mbr(FILE *fp)
{
#include "mbr_reactos.h"
@ -289,6 +298,15 @@ int write_rufus_mbr(FILE *fp)
write_bootmark(fp);
} /* write_rufus_mbr */
int write_rufus_gpt_mbr(FILE *fp)
{
#include "mbr_gpt_rufus.h"
return
write_data(fp, 0x0, mbr_gpt_rufus_0x0, sizeof(mbr_gpt_rufus_0x0)) &&
write_bootmark(fp);
} /* write_rufus_gpt_mbr */
int write_reactos_mbr(FILE *fp)
{
#include "mbr_reactos.h"

View file

@ -54,6 +54,10 @@ int is_win7_mbr(FILE *fp);
FALSE.The file position will change when this function is called! */
int is_rufus_mbr(FILE *fp);
/* returns TRUE if the file has a Rufus GPT master boot record, otherwise
FALSE.The file position will change when this function is called! */
int is_rufus_gpt_mbr(FILE *fp);
/* returns TRUE if the file has a ReactOS master boot record, otherwise
FALSE.The file position will change when this function is called! */
int is_reactos_mbr(FILE *fp);
@ -107,6 +111,10 @@ int write_win7_mbr(FILE *fp);
FALSE */
int write_rufus_mbr(FILE *fp);
/* Writes a Rufus GPT master boot record to a file, returns TRUE on success, otherwise
FALSE */
int write_rufus_gpt_mbr(FILE *fp);
/* Writes a ReactOS master boot record to a file, returns TRUE on success, otherwise
FALSE */
int write_reactos_mbr(FILE *fp);

View file

@ -0,0 +1,41 @@
/*
* Rufus Protective MBR for GPT systems
* https://github.com/pbatard/rufus/tree/master/res/mbr
* Copyright © 2019 Pete Batard <pete@akeo.ie>
*/
unsigned char mbr_gpt_rufus_0x0[] = {
0x41, 0x4B, 0x45, 0x4F, 0xFC, 0x31, 0xC0, 0x8E, 0xD8, 0xBE, 0x31, 0x7C,
0xE8, 0x13, 0x00, 0xBE, 0x5C, 0x7C, 0xE8, 0x0D, 0x00, 0xBE, 0x31, 0x7C,
0xE8, 0x07, 0x00, 0xBE, 0x87, 0x7C, 0xE8, 0x01, 0x00, 0xF4, 0xAC, 0x3C,
0x00, 0x74, 0x09, 0xB4, 0x0E, 0xBB, 0x07, 0x00, 0xCD, 0x10, 0xEB, 0xF2,
0xC3, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x0D, 0x0A, 0x00, 0x2A, 0x2A, 0x2A, 0x20,
0x45, 0x52, 0x52, 0x4F, 0x52, 0x3A, 0x20, 0x4C, 0x45, 0x47, 0x41, 0x43,
0x59, 0x20, 0x42, 0x4F, 0x4F, 0x54, 0x20, 0x4F, 0x46, 0x20, 0x55, 0x45,
0x46, 0x49, 0x20, 0x4D, 0x45, 0x44, 0x49, 0x41, 0x20, 0x2A, 0x2A, 0x2A,
0x0D, 0x0A, 0x00, 0x0D, 0x0A, 0x54, 0x68, 0x69, 0x73, 0x20, 0x64, 0x72,
0x69, 0x76, 0x65, 0x20, 0x63, 0x61, 0x6E, 0x20, 0x6F, 0x6E, 0x6C, 0x79,
0x20, 0x62, 0x6F, 0x6F, 0x74, 0x20, 0x69, 0x6E, 0x20, 0x55, 0x45, 0x46,
0x49, 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0A, 0x49, 0x74, 0x20,
0x63, 0x61, 0x6E, 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x62, 0x6F, 0x6F, 0x74,
0x20, 0x69, 0x6E, 0x20, 0x42, 0x49, 0x4F, 0x53, 0x2F, 0x4C, 0x65, 0x67,
0x61, 0x63, 0x79, 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0A, 0x0D,
0x0A, 0x49, 0x66, 0x20, 0x79, 0x6F, 0x75, 0x20, 0x77, 0x61, 0x6E, 0x74,
0x20, 0x74, 0x6F, 0x20, 0x62, 0x6F, 0x6F, 0x74, 0x20, 0x74, 0x68, 0x69,
0x73, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x20, 0x69, 0x6E, 0x20, 0x42,
0x49, 0x4F, 0x53, 0x2F, 0x4C, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x6D,
0x6F, 0x64, 0x65, 0x2C, 0x20, 0x79, 0x6F, 0x75, 0x0D, 0x0A, 0x73, 0x68,
0x6F, 0x75, 0x6C, 0x64, 0x20, 0x72, 0x65, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x20, 0x69, 0x74, 0x20, 0x69, 0x6E, 0x20, 0x52, 0x75, 0x66, 0x75,
0x73, 0x20, 0x75, 0x73, 0x69, 0x6E, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20,
0x66, 0x6F, 0x6C, 0x6C, 0x6F, 0x77, 0x69, 0x6E, 0x67, 0x20, 0x73, 0x65,
0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x3A, 0x0D, 0x0A, 0x2A, 0x20, 0x50,
0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x73, 0x63, 0x68,
0x65, 0x6D, 0x65, 0x20, 0x2D, 0x3E, 0x20, 0x4D, 0x42, 0x52, 0x0D, 0x0A,
0x2A, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x73, 0x79, 0x73,
0x74, 0x65, 0x6D, 0x20, 0x2D, 0x3E, 0x20, 0x42, 0x49, 0x4F, 0x53, 0x2E,
0x2E, 0x2E, 0x0D, 0x0A, 0x00
};