[syslinux] work on duplicated copies of ldlinux.sys and ldlinux.bss

* If not, a VS2012 compiled Rufus will crash, as it doesn't allow
  working directly on embedded resources
* Closes #118
* Also update ChangeLog for previous patch
This commit is contained in:
Pete Batard 2013-01-13 22:16:10 +00:00
parent 97576d79cb
commit 6b8833bcfb
3 changed files with 22 additions and 10 deletions

View file

@ -1,6 +1,6 @@
o Version 1.3.1 (2013.01.09) o Version 1.3.1 (2013.01.09)
Fix Windows XP ISO support, that was broken in 1.3.0 Fix Windows XP ISO support, that was broken in 1.3.0
Drops support for ArchLinux, until they fix their ISO9660 compliance Drop support for newer ArchLinux ISOs - this will be fixed in 1.3.2
Indicate which of FAT32 or Large FAT32 will be used as well as Partition Scheme Indicate which of FAT32 or Large FAT32 will be used as well as Partition Scheme
Various internal fixes Various internal fixes
o Version 1.3.0 (2012.12.16) o Version 1.3.0 (2012.12.16)

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 316 IDD_DIALOG DIALOGEX 12, 12, 206, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.3.1.221" CAPTION "Rufus v1.3.1.222"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,278,50,14 DEFPUSHBUTTON "Start",IDC_START,94,278,50,14
@ -274,8 +274,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,1,221 FILEVERSION 1,3,1,222
PRODUCTVERSION 1,3,1,221 PRODUCTVERSION 1,3,1,222
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -292,13 +292,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.3.1.221" VALUE "FileVersion", "1.3.1.222"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "(c) 2011-2012 Pete Batard (GPL v3)" VALUE "LegalCopyright", "(c) 2011-2012 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.3.1.221" VALUE "ProductVersion", "1.3.1.222"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -34,9 +34,9 @@
#include "libfat.h" #include "libfat.h"
#include "setadv.h" #include "setadv.h"
unsigned char* syslinux_ldlinux; unsigned char* syslinux_ldlinux = NULL;
unsigned int syslinux_ldlinux_len; unsigned int syslinux_ldlinux_len;
unsigned char* syslinux_bootsect; unsigned char* syslinux_bootsect = NULL;
unsigned int syslinux_bootsect_len; unsigned int syslinux_bootsect_len;
/* /*
@ -102,8 +102,13 @@ BOOL InstallSyslinux(DWORD num, const char* drive_name)
uprintf("Unable to load ldlinux.sys resource: %s\n", WindowsErrorString()); uprintf("Unable to load ldlinux.sys resource: %s\n", WindowsErrorString());
goto out; goto out;
} }
syslinux_ldlinux = (unsigned char*)LockResource(res_handle);
syslinux_ldlinux_len = SizeofResource(NULL, res); syslinux_ldlinux_len = SizeofResource(NULL, res);
syslinux_ldlinux = (unsigned char*)malloc(syslinux_ldlinux_len);
if (syslinux_ldlinux == NULL) {
uprintf("Unable to allocate ldlinux.sys resource\n");
goto out;
}
memcpy(syslinux_ldlinux, LockResource(res_handle), syslinux_ldlinux_len);
/* Access ldlinux.bss resource */ /* Access ldlinux.bss resource */
res = FindResource(hMainInstance, MAKEINTRESOURCE(IDR_SL_LDLINUX_BSS), RT_RCDATA); res = FindResource(hMainInstance, MAKEINTRESOURCE(IDR_SL_LDLINUX_BSS), RT_RCDATA);
@ -116,8 +121,13 @@ BOOL InstallSyslinux(DWORD num, const char* drive_name)
uprintf("Unable to load ldlinux.bss resource: %s\n", WindowsErrorString()); uprintf("Unable to load ldlinux.bss resource: %s\n", WindowsErrorString());
goto out; goto out;
} }
syslinux_bootsect = (unsigned char*)LockResource(res_handle);
syslinux_bootsect_len = SizeofResource(NULL, res); syslinux_bootsect_len = SizeofResource(NULL, res);
syslinux_bootsect = (unsigned char*)malloc(syslinux_bootsect_len);
if (syslinux_bootsect == NULL) {
uprintf("Unable to allocate ldlinux.bss resource\n");
goto out;
}
memcpy(syslinux_bootsect, LockResource(res_handle), syslinux_bootsect_len);
/* Create ldlinux.sys file */ /* Create ldlinux.sys file */
f_handle = CreateFileA(ldlinux_name, GENERIC_READ | GENERIC_WRITE, f_handle = CreateFileA(ldlinux_name, GENERIC_READ | GENERIC_WRITE,
@ -220,6 +230,8 @@ BOOL InstallSyslinux(DWORD num, const char* drive_name)
r = TRUE; r = TRUE;
out: out:
safe_free(syslinux_ldlinux);
safe_free(syslinux_bootsect);
safe_free(sectors); safe_free(sectors);
safe_closehandle(d_handle); safe_closehandle(d_handle);
safe_closehandle(f_handle); safe_closehandle(f_handle);