[iso] UI ISO support improvements

* add ISO scan and extract progress dialog
* compute sizes and set properties
* allow cancellation
* minor other updates
This commit is contained in:
Pete Batard 2012-02-01 14:26:36 +00:00
parent 013db6a6d8
commit fd0e6d4b3b
10 changed files with 238 additions and 78 deletions

View file

@ -17,6 +17,7 @@
*/
#include <windows.h>
#include <winioctl.h> // for DISK_GEOMETRY
#include <stdint.h>
#pragma once
@ -24,6 +25,15 @@
#define RUFUS_DEBUG // print debug info to Debug facility (use debugview to consult)
#define DISABLE_AUTORUN // disable new USB drive notification from explorer when application is running
/* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS! */
//#define RUFUS_TEST
#define ISO_DEST "D:/tmp/iso"
#define ISO_IMAGE "D:\\Incoming\\Windows 8 Preview\\WindowsDeveloperPreview-64bit-English-Developer.iso"
//#define ISO_IMAGE "D:\\fd11src.iso", "D:/tmp/iso"
//#define ISO_IMAGE "D:\\Incoming\\GRMSDKX_EN_DVD.iso"
//#define ISO_IMAGE "D:\\Incoming\\en_windows_driver_kit_3790.iso"
//#define ISO_IMAGE "D:\\Incoming\\en_windows_7_ultimate_with_sp1_x64_dvd_618240.iso"
#define STR_NO_LABEL "NO_LABEL"
#define RUFUS_CANCELBOX_TITLE "Rufus - Cancellation"
#define DRIVE_INDEX_MIN 0x80
@ -74,7 +84,8 @@ extern void _uprintf(const char *format, ...);
/* Custom Windows messages */
enum user_message_type {
UM_FORMAT_COMPLETED = WM_APP
UM_FORMAT_COMPLETED = WM_APP,
UM_ISO_EXIT
};
/* Custom notifications */
@ -136,18 +147,26 @@ typedef struct {
} ClusterSize[FS_MAX];
} RUFUS_DRIVE_INFO;
/* ISO details that the application may want */
typedef struct {
uint64_t projected_size;
BOOL has_4GB_file;
} RUFUS_ISO_REPORT;
/*
* Globals
*/
extern HINSTANCE hMainInstance;
extern HWND hMainDialog, hStatus, hDeviceList, hCapacity;
extern HWND hFileSystem, hClusterSize, hLabel, hDOSType, hNBPasses;
extern HWND hISOProgressDlg, hISOProgressBar, hISOFileName;
extern float fScale;
extern char szFolderPath[MAX_PATH];
extern DWORD FormatStatus;
extern RUFUS_DRIVE_INFO SelectedDrive;
extern const int nb_steps[FS_MAX];
extern BOOL bWithFreeDOS;
extern RUFUS_ISO_REPORT iso_report;
/*
* Shared prototypes
@ -165,13 +184,14 @@ extern void DestroyTooltip(HWND hWnd);
extern void DestroyAllTooltips(void);
extern BOOL Notification(int type, char* title, char* format, ...);
extern BOOL ExtractDOS(const char* path);
extern BOOL ExtractISO(const char* src_iso, const char* dest_dir);
extern BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan);
extern BOOL InstallSyslinux(DWORD num, const char* drive_name);
extern void __cdecl FormatThread(void* param);
extern BOOL CreatePartition(HANDLE hDrive);
extern HANDLE GetDriveHandle(DWORD DriveIndex, char* DriveLetter, BOOL bWriteAccess, BOOL bLockDrive);
extern BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label);
extern BOOL UnmountDrive(HANDLE hDrive);
extern BOOL CreateProgress(void);
__inline static BOOL UnlockDrive(HANDLE hDrive)
{
@ -191,6 +211,8 @@ extern void StrArrayAdd(StrArray* arr, const char* str);
extern void StrArrayClear(StrArray* arr);
extern void StrArrayDestroy(StrArray* arr);
/* Clang/MinGW32 has an issue with intptr_t */
#ifndef _UINTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED
@ -218,3 +240,5 @@ typedef struct {
#define ERROR_INVALID_VOLUME_SIZE 0x1204
#define ERROR_CANT_START_THREAD 0x1205
#define ERROR_BADBLOCKS_FAILURE 0x1206
#define ERROR_ISO_SCAN 0x1207
#define ERROR_ISO_EXTRACT 0x1208