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

[vhd] fix broken save to VHD cheat mode

* vhd_save wasn't static, which of course created all kind of issues
  when the VHD save thread tried to use it while it was being freed...
* Closes #591
This commit is contained in:
Pete Batard 2015-09-04 14:15:22 +01:00
parent 4788ee25d2
commit ff9eae4e6d
3 changed files with 12 additions and 9 deletions

View file

@ -1975,7 +1975,7 @@ DWORD WINAPI SaveImageThread(void* param)
{ {
BOOL s; BOOL s;
DWORD rSize, wSize; DWORD rSize, wSize;
VHD_SAVE *vhd_save = param; VHD_SAVE *vhd_save = (VHD_SAVE*)param;
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE; HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
HANDLE hDestImage = INVALID_HANDLE_VALUE; HANDLE hDestImage = INVALID_HANDLE_VALUE;
LARGE_INTEGER li; LARGE_INTEGER li;

View file

@ -1989,15 +1989,18 @@ void SetBoot(int fs, int tt)
void SaveVHD(void) void SaveVHD(void)
{ {
static VHD_SAVE vhd_save;
char filename[128]; char filename[128];
char path[MAX_PATH]; char path[MAX_PATH];
int DriveIndex = ComboBox_GetCurSel(hDeviceList); int DriveIndex = ComboBox_GetCurSel(hDeviceList);
EXT_DECL(vhd_ext, filename, __VA_GROUP__("*.vhd"), __VA_GROUP__("VHD File"));
ULARGE_INTEGER free_space;
if (DriveIndex >= 0) if (DriveIndex >= 0)
safe_sprintf(filename, sizeof(filename), "%s.vhd", DriveLabel.String[DriveIndex]); safe_sprintf(filename, sizeof(filename), "%s.vhd", DriveLabel.String[DriveIndex]);
if ((DriveIndex != CB_ERR) && (!format_op_in_progress) && (format_thid == NULL)) { if ((DriveIndex != CB_ERR) && (!format_op_in_progress) && (format_thid == NULL)) {
EXT_DECL(vhd_ext, filename, __VA_GROUP__("*.vhd"), __VA_GROUP__("VHD File")); vhd_save.DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, DriveIndex);
ULARGE_INTEGER free_space; vhd_save.path = FileDialog(TRUE, NULL, &vhd_ext, 0);
VHD_SAVE vhd_save = { (DWORD)ComboBox_GetItemData(hDeviceList, DriveIndex), FileDialog(TRUE, NULL, &vhd_ext, 0) };
if (vhd_save.path != NULL) { if (vhd_save.path != NULL) {
// Reset all progress bars // Reset all progress bars
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0); SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
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
CAPTION "Rufus 2.4.723" CAPTION "Rufus 2.4.724"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -317,8 +317,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,4,723,0 FILEVERSION 2,4,724,0
PRODUCTVERSION 2,4,723,0 PRODUCTVERSION 2,4,724,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -335,13 +335,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", "2.4.723" VALUE "FileVersion", "2.4.724"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 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", "2.4.723" VALUE "ProductVersion", "2.4.724"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"