From 75e94c1087cd334a9395cd7f690df38f67675f71 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sun, 25 Dec 2011 22:24:38 +0000 Subject: [PATCH] [locale] finalized DOS keyboard locale setup * added FreeDOS support * closes #3 --- TODO.txt | 1 - src/dos.c | 73 +-- src/dos.h | 2 +- src/dos_locale.c | 1274 ++++++++++++++++++++++++++++++++++------------ src/rufus.c | 4 +- src/rufus.rc | 12 +- 6 files changed, 990 insertions(+), 376 deletions(-) diff --git a/TODO.txt b/TODO.txt index 04ef5d17..b795e251 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,5 @@ o Create a report file with failed block details on bad blocks o Allow the provision of external DOS files -o Set DOS keyboard according to locale o Allow selection of one of the existing compatible partitions (keep existing MBR) vs. full repartitioning (overwrite MBR) o Bootable NTFS/exFAT (http://sourceforge.net/projects/grub4dos)? o GPT support? diff --git a/src/dos.c b/src/dos.c index 9bbd55ba..2ab4d289 100644 --- a/src/dos.c +++ b/src/dos.c @@ -174,6 +174,9 @@ static BOOL Patch_COMMAND_COM(size_t filestart, size_t filesize) uprintf(" unexpected file size\n"); return FALSE; } +// See #24: https://github.com/pbatard/rufus/issues/24 +// uprintf("&DiskImage[filestart(=%x)+0x650c] = %p\n", filestart, &DiskImage[filestart+0x650c]); +// uprintf("&DiskImage[0] = %p\n", &DiskImage[0]); if (memcmp(&DiskImage[filestart+0x650c], expected, sizeof(expected)) != 0) { uprintf(" unexpected binary data\n"); return FALSE; @@ -336,14 +339,14 @@ static BOOL ExtractMSDOS(const char* path) for (j=0; r && j 1) { - uprintf("Could not match a DOS keyboard ID for locale 0x%04X\n", locale); - return KB_US; + unsigned int i, j; + for (i=0; i NUL\n", oem_cp, dos_cpi_str[egacpi_id]); - fprintf(fd, "mode con codepage select=%d > NUL\n", oem_cp); - // TODO: specify /ID: for Turkish and Hebrew - fprintf(fd, "keyb %s,,\\locale\\%s\n", dos_kb_str[kb_id], dos_kb_drv_str[drv_id]); - fprintf(fd, ":US\n"); + fprintf(fd, ":1\n"); + fprintf(fd, "mode con codepage prepare=((%d) C:\\locale\\%s) > NUL\n", (int)cp, egadrv); + fprintf(fd, "mode con codepage select=%d > NUL\n", (int)cp); + fprintf(fd, "keyb %s,,C:\\locale\\%s\n", kb, kbdrv); + fprintf(fd, ":2\n"); fclose(fd); uprintf("Succesfully wrote 'AUTOEXEC.BAT'\n"); diff --git a/src/rufus.c b/src/rufus.c index b554933e..edf011cb 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -618,8 +618,8 @@ static void InitProgress(void) nb_slots[OP_BADBLOCKS] = -1; } if (IsChecked(IDC_DOS)) { - // 3 slots + 1 for PBR writing - nb_slots[OP_DOS] = 3+1; + // 1 extra slot for PBR writing + nb_slots[OP_DOS] = ((ComboBox_GetCurSel(hDOSType) == DT_FREEDOS)?5:3)+1; } nb_slots[OP_PARTITION] = 1; nb_slots[OP_FIX_MBR] = 1; diff --git a/src/rufus.rc b/src/rufus.rc index bc6d353a..fda292db 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 278 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.0.5.103" +CAPTION "Rufus v1.0.5.104" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,236,50,14 @@ -65,7 +65,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP CONTROL "http://rufus.akeo.ie",IDC_ABOUT_RUFUS_URL, "SysLink",WS_TABSTOP,46,47,114,9 - LTEXT "Version 1.0.5 (Build 103)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.0.5 (Build 104)",IDC_STATIC,46,19,78,8 PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 @@ -170,8 +170,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,5,103 - PRODUCTVERSION 1,0,5,103 + FILEVERSION 1,0,5,104 + PRODUCTVERSION 1,0,5,104 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -188,13 +188,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.0.5.103" + VALUE "FileVersion", "1.0.5.104" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "ยฉ 2011 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.0.5.103" + VALUE "ProductVersion", "1.0.5.104" END END BLOCK "VarFileInfo"