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

[ms-sys] fix for detecting windows MBRs with localised messages

* Windows MBRs contain localised strings which mean the bytes between the
  executable code and the disk signature / partition table can change depending
  on locale. This patch adds lengths to reflect the offsets which are the same
  for every locale, and only compares these lengths when detecting existing
  Windows MBRs.
This commit is contained in:
Robert McQueen 2016-09-21 09:56:51 +01:00 committed by Pete Batard
parent c4b9ec4a62
commit 234b0a3fde
5 changed files with 19 additions and 13 deletions

View file

@ -117,7 +117,7 @@ int is_2000_mbr(FILE *fp)
#include "mbr_2000.h"
return
contains_data(fp, 0x0, mbr_2000_0x0, sizeof(mbr_2000_0x0)) &&
contains_data(fp, 0x0, mbr_2000_0x0, MBR_2000_LANG_INDEP_LEN) &&
is_br(fp);
} /* is_2000_mbr */
@ -126,7 +126,7 @@ int is_vista_mbr(FILE *fp)
#include "mbr_vista.h"
return
contains_data(fp, 0x0, mbr_vista_0x0, sizeof(mbr_vista_0x0)) &&
contains_data(fp, 0x0, mbr_vista_0x0, MBR_VISTA_LANG_INDEP_LEN) &&
is_br(fp);
} /* is_vista_mbr */
@ -135,7 +135,7 @@ int is_win7_mbr(FILE *fp)
#include "mbr_win7.h"
return
contains_data(fp, 0x0, mbr_win7_0x0, sizeof(mbr_win7_0x0)) &&
contains_data(fp, 0x0, mbr_win7_0x0, MBR_WIN7_LANG_INDEP_LEN) &&
is_br(fp);
} /* is_win7_mbr */

View file

@ -1,7 +1,9 @@
/* First 446 bytes of MBR from Windows 2000, XP and 2003 */
/* This is English version. Bytes 0x12c onwards vary with language. */
/* Last two bytes 1b6 and 1b7 point to language-specific messages. */
/* Last three bytes 1b5-1b7 point to language-specific messages. */
/* Support of other languages is an exercise for the reader! */
/* see: http://thestarman.pcministry.com/asm/mbr/Win2kmbr.htm */
#define MBR_2000_LANG_INDEP_LEN 0x12c
unsigned char mbr_2000_0x0[] = {
0x33, 0xc0, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0xfb, 0x50, 0x07, 0x50, 0x1f,
0xfc, 0xbe, 0x1b, 0x7c, 0xbf, 0x1b, 0x06, 0x50, 0x57, 0xb9, 0xe5, 0x01,

View file

@ -1,7 +1,9 @@
/* First 446 bytes of MBR from Windows Vista */
/* This is English version. Bytes 0x12c onwards vary with language. */
/* Last two bytes 1b6 and 1b7 point to language-specific messages. */
/* This is English version. Bytes 0x162 onwards vary with language. */
/* Last three bytes 1b5-1b7 point to language-specific messages. */
/* Support of other languages is an exercise for the reader! */
/* see: http://thestarman.pcministry.com/asm/mbr/VistaMBR.htm */
#define MBR_VISTA_LANG_INDEP_LEN 0x162
unsigned char mbr_vista_0x0[] = {
0x33, 0xc0, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0x8e, 0xc0, 0x8e, 0xd8, 0xbe,
0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x02, 0xfc, 0xf3, 0xa4, 0x50,

View file

@ -1,7 +1,9 @@
/* First 446 bytes of MBR from Windows 7 */
/* This is English version. Bytes 0x12c onwards vary with language. */
/* Last two bytes 1b6 and 1b7 point to language-specific messages. */
/* This is English version. Bytes 0x163 onwards vary with language. */
/* Last three bytes 1b5-1b7 point to language-specific messages. */
/* Support of other languages is an exercise for the reader! */
/* see: http://thestarman.pcministry.com/asm/mbr/W7MBR.htm */
#define MBR_WIN7_LANG_INDEP_LEN 0x163
unsigned char mbr_win7_0x0[] = {
0x33, 0xc0, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0x8e, 0xc0, 0x8e, 0xd8, 0xbe,
0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x02, 0xfc, 0xf3, 0xa4, 0x50,

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.11.996"
CAPTION "Rufus 2.11.997"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,11,996,0
PRODUCTVERSION 2,11,996,0
FILEVERSION 2,11,997,0
PRODUCTVERSION 2,11,997,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.11.996"
VALUE "FileVersion", "2.11.997"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.11.996"
VALUE "ProductVersion", "2.11.997"
END
END
BLOCK "VarFileInfo"