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

[iso] fix crash when opening Windows ISOs

* Closes #1268
* Issue was introduced in 521034da99 and has
  to do with VS2017's handling of static strings in RELEASE mode.
  Fix is to use a static char array instead.
* Also fix MinGw build warnings and increase process search timeout
This commit is contained in:
Pete Batard 2019-01-31 13:50:03 +00:00
parent 326ae54f45
commit f98c243eb8
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 12 additions and 11 deletions

View file

@ -172,7 +172,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
bWriteShare = TRUE; bWriteShare = TRUE;
// Try to report the process that is locking the drive // Try to report the process that is locking the drive
// We also use bit 6 as a flag to indicate that SearchProcess was called. // We also use bit 6 as a flag to indicate that SearchProcess was called.
access_mask = SearchProcess(DevPath, 5000, TRUE, TRUE, FALSE) | 0x40; access_mask = SearchProcess(DevPath, SEARCH_PROCESS_TIMEOUT, TRUE, TRUE, FALSE) | 0x40;
} }
Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES); Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES);
} }
@ -202,7 +202,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
uprintf("Could not lock access to %s: %s", Path, WindowsErrorString()); uprintf("Could not lock access to %s: %s", Path, WindowsErrorString());
// See if we can report the processes are accessing the drive // See if we can report the processes are accessing the drive
if (!IS_ERROR(FormatStatus) && (access_mask == 0)) if (!IS_ERROR(FormatStatus) && (access_mask == 0))
access_mask = SearchProcess(DevPath, 5000, TRUE, TRUE, FALSE); access_mask = SearchProcess(DevPath, SEARCH_PROCESS_TIMEOUT, TRUE, TRUE, FALSE);
// Try to continue if the only access rights we saw were for read-only // Try to continue if the only access rights we saw were for read-only
if ((access_mask & 0x07) != 0x01) if ((access_mask & 0x07) != 0x01)
safe_closehandle(hDrive); safe_closehandle(hDrive);

View file

@ -959,7 +959,7 @@ static void CALLBACK BlockingTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD
#define PRINT_ISO_PROP(b, ...) do {if (b) uprintf(__VA_ARGS__);} while(0) #define PRINT_ISO_PROP(b, ...) do {if (b) uprintf(__VA_ARGS__);} while(0)
static void DisplayISOProps(void) static void DisplayISOProps(void)
{ {
static char* inst_str = "[1/#]"; static char inst_str[] = " [1/#]";
int i; int i;
uprintf("ISO label: '%s'", img_report.label); uprintf("ISO label: '%s'", img_report.label);
@ -995,7 +995,7 @@ static void DisplayISOProps(void)
HAS_BOOTMGR_BIOS(img_report) ? (HAS_BOOTMGR_EFI(img_report) ? "BIOS and UEFI" : "BIOS only") : "UEFI only"); HAS_BOOTMGR_BIOS(img_report) ? (HAS_BOOTMGR_EFI(img_report) ? "BIOS and UEFI" : "BIOS only") : "UEFI only");
PRINT_ISO_PROP(HAS_WINPE(img_report), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : ""); PRINT_ISO_PROP(HAS_WINPE(img_report), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : "");
if (HAS_WININST(img_report)) { if (HAS_WININST(img_report)) {
inst_str[3] = '0' + img_report.wininst_index; inst_str[4] = '0' + img_report.wininst_index;
uprintf(" Uses: Install.%s%s (version %d.%d.%d%s)", &img_report.wininst_path[0][strlen(img_report.wininst_path[0]) - 3], uprintf(" Uses: Install.%s%s (version %d.%d.%d%s)", &img_report.wininst_path[0][strlen(img_report.wininst_path[0]) - 3],
(img_report.wininst_index > 1) ? inst_str : "", (img_report.wininst_version >> 24) & 0xff, (img_report.wininst_index > 1) ? inst_str : "", (img_report.wininst_version >> 24) & 0xff,
(img_report.wininst_version >> 16) & 0xff, (img_report.wininst_version >> 8) & 0xff, (img_report.wininst_version >> 16) & 0xff, (img_report.wininst_version >> 8) & 0xff,

View file

@ -76,7 +76,8 @@
#define MORE_INFO_URL 0xFFFF #define MORE_INFO_URL 0xFFFF
#define STATUS_MSG_TIMEOUT 3500 // How long should cheat mode messages appear for on the status bar #define STATUS_MSG_TIMEOUT 3500 // How long should cheat mode messages appear for on the status bar
#define WRITE_RETRIES 4 #define WRITE_RETRIES 4
#define WRITE_TIMEOUT 5000 // How long we should wait between write retries #define WRITE_TIMEOUT 5000 // How long we should wait between write retries (in ms)
#define SEARCH_PROCESS_TIMEOUT 10000 // How long we should search for conflicting processes before giving up (in ms)
#define MARQUEE_TIMER_REFRESH 10 // Time between progress bar marquee refreshes, in ms #define MARQUEE_TIMER_REFRESH 10 // Time between progress bar marquee refreshes, in ms
#define FS_DEFAULT FS_FAT32 #define FS_DEFAULT FS_FAT32
#define SINGLE_CLUSTERSIZE_DEFAULT 0x00000100 #define SINGLE_CLUSTERSIZE_DEFAULT 0x00000100

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.5.1442" CAPTION "Rufus 3.5.1443"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -394,8 +394,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,1442,0 FILEVERSION 3,5,1443,0
PRODUCTVERSION 3,5,1442,0 PRODUCTVERSION 3,5,1443,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -413,13 +413,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie" VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.5.1442" VALUE "FileVersion", "3.5.1443"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.5.exe" VALUE "OriginalFilename", "rufus-3.5.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.5.1442" VALUE "ProductVersion", "3.5.1443"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -255,7 +255,7 @@ void GetWindowsVersion(void)
OSVERSIONINFOEXA vi, vi2; OSVERSIONINFOEXA vi, vi2;
const char* w = 0; const char* w = 0;
const char* w64 = "32 bit"; const char* w64 = "32 bit";
char *vptr, build_number[10] = ""; char *vptr;
size_t vlen; size_t vlen;
unsigned major, minor; unsigned major, minor;
ULONGLONG major_equal, minor_equal; ULONGLONG major_equal, minor_equal;