mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
v1.1.4 (#150)
* closes #49 * closes #60 * closes #64 * should address #59 * set default doe ISOs with bot bootmgr and isolinux to syslinux * other improvements
This commit is contained in:
parent
a9c47a4922
commit
7ee5b35551
11 changed files with 233 additions and 149 deletions
27
src/format.c
27
src/format.c
|
@ -314,6 +314,7 @@ static BOOL ClearMBR(HANDLE hPhysicalDrive)
|
|||
static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
||||
{
|
||||
BOOL r = FALSE;
|
||||
int dt, fs;
|
||||
unsigned char* buf = NULL;
|
||||
size_t SecSize = SelectedDrive.Geometry.BytesPerSector;
|
||||
size_t nSecs = (0x200 + SecSize -1) / SecSize;
|
||||
|
@ -367,7 +368,9 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
|
||||
fake_fd._ptr = (char*)hPhysicalDrive;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
if (ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType)) == DT_ISO_FAT) {
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
if ((dt == DT_ISO) && ((fs == FS_FAT16) || (fs == FS_FAT32))) {
|
||||
r = write_syslinux_mbr(&fake_fd);
|
||||
} else {
|
||||
r = write_95b_mbr(&fake_fd);
|
||||
|
@ -484,7 +487,7 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
char bb_msg[512];
|
||||
char logfile[MAX_PATH], *userdir;
|
||||
FILE* log_fd;
|
||||
int r;
|
||||
int r, fs, dt;
|
||||
|
||||
hPhysicalDrive = GetDriveHandle(num, NULL, TRUE, TRUE);
|
||||
if (hPhysicalDrive == INVALID_HANDLE_VALUE) {
|
||||
|
@ -601,11 +604,10 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
}
|
||||
UpdateProgress(OP_FIX_MBR, -1.0f);
|
||||
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
switch(ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType))) {
|
||||
case DT_WINME:
|
||||
case DT_FREEDOS:
|
||||
case DT_ISO_NTFS:
|
||||
if ((dt == DT_WINME) || (dt == DT_FREEDOS) || ((dt == DT_ISO) && (fs == FS_NTFS))) {
|
||||
// We still have a lock, which we need to modify the volume boot record
|
||||
// => no need to reacquire the lock...
|
||||
hLogicalVolume = GetDriveHandle(num, drive_name, TRUE, FALSE);
|
||||
|
@ -624,13 +626,11 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
}
|
||||
// We must close and unlock the volume to write files to it
|
||||
safe_unlockclose(hLogicalVolume);
|
||||
break;
|
||||
case DT_ISO_FAT:
|
||||
} else if ((dt == DT_ISO) && ((fs == FS_FAT16) || (fs == FS_FAT32))) {
|
||||
PrintStatus(0, TRUE, "Installing Syslinux...");
|
||||
if (!InstallSyslinux(num, drive_name)) {
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (IsChecked(IDC_SET_ICON))
|
||||
|
@ -645,18 +645,14 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
UpdateProgress(OP_DOS, -1.0f);
|
||||
switch(ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType))) {
|
||||
case DT_WINME:
|
||||
case DT_FREEDOS:
|
||||
if ((dt == DT_WINME) || (dt == DT_FREEDOS)) {
|
||||
PrintStatus(0, TRUE, "Copying DOS files...");
|
||||
if (!ExtractDOS(drive_name)) {
|
||||
if (!FormatStatus)
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
case DT_ISO_NTFS:
|
||||
case DT_ISO_FAT:
|
||||
} else if (dt == DT_ISO) {
|
||||
if (iso_path != NULL) {
|
||||
PrintStatus(0, TRUE, "Copying ISO files...");
|
||||
drive_name[2] = 0;
|
||||
|
@ -666,7 +662,6 @@ DWORD WINAPI FormatThread(LPVOID param)
|
|||
goto out;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (IsChecked(IDC_SET_ICON))
|
||||
SetAutorun(drive_name);
|
||||
|
|
|
@ -177,7 +177,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
|
|||
goto out;
|
||||
}
|
||||
if (udf_is_dir(p_udf_dirent)) {
|
||||
if (!scan_only) _mkdir(psz_fullpath);
|
||||
if (!scan_only) _mkdirU(psz_fullpath);
|
||||
p_udf_dirent2 = udf_opendir(p_udf_dirent);
|
||||
if (p_udf_dirent2 != NULL) {
|
||||
if (udf_extract_files(p_udf, p_udf_dirent2, &psz_fullpath[strlen(psz_extract_dir)]))
|
||||
|
@ -287,7 +287,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
|
|||
continue;
|
||||
iso9660_name_translate_ext(p_statbuf->filename, psz_basename, i_joliet_level);
|
||||
if (p_statbuf->type == _STAT_DIR) {
|
||||
if (!scan_only) _mkdir(psz_fullpath);
|
||||
if (!scan_only) _mkdirU(psz_fullpath);
|
||||
if (iso_extract_files(p_iso, psz_iso_name))
|
||||
goto out;
|
||||
} else {
|
||||
|
|
|
@ -98,6 +98,12 @@ _cdio_memdup (const void *mem, size_t count);
|
|||
char *
|
||||
_cdio_strdup_upper (const char str[]);
|
||||
|
||||
/* Duplicate path and make it platform compliant. Typically needed for
|
||||
MinGW/MSYS where a "/c/..." path must be translated to "c:/..." for
|
||||
use with fopen(), etc. Returned string must be freed by the caller. */
|
||||
char *
|
||||
_cdio_strdup_fixpath (const char path[]);
|
||||
|
||||
void
|
||||
_cdio_strfreev(char **strv);
|
||||
|
||||
|
|
|
@ -56,11 +56,43 @@
|
|||
#define CDIO_FSEEK fseek
|
||||
#endif
|
||||
|
||||
/* Windows'd fopen is not UTF-8 compliant - make it so */
|
||||
#if !defined(_WIN32)
|
||||
#define CDIO_FOPEN fopen
|
||||
#else
|
||||
#define CDIO_FOPEN fopenU
|
||||
extern wchar_t* cdio_utf8_to_wchar(const char* str);
|
||||
static inline FILE* fopenU(const char* filename, const char* mode)
|
||||
{
|
||||
FILE* ret = NULL;
|
||||
wchar_t* wfilename = cdio_utf8_to_wchar(filename);
|
||||
wchar_t* wmode = cdio_utf8_to_wchar(mode);
|
||||
ret = _wfopen(wfilename, wmode);
|
||||
free(wfilename);
|
||||
free(wmode);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Use _stati64 if needed, on platforms that don't have transparent LFS support */
|
||||
#if defined(HAVE__STATI64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||
#define CDIO_STAT _stati64
|
||||
#define CDIO_STAT_STRUCT _stati64
|
||||
#if !defined(_WIN32)
|
||||
#define CDIO_STAT_CALL _stati64
|
||||
#else
|
||||
#define CDIO_STAT stat
|
||||
#define CDIO_STAT_CALL _stati64U
|
||||
/* Once more, we have to provide an UTF-8 compliant version on Windows */
|
||||
static inline int _stati64U(const char *path, struct _stati64 *buffer) {
|
||||
int ret;
|
||||
wchar_t* wpath = cdio_utf8_to_wchar(path);
|
||||
ret = _wstati64(wpath, buffer);
|
||||
free(wpath);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define CDIO_STAT_STRUCT stat
|
||||
#define CDIO_STAT_CALL stat
|
||||
#endif
|
||||
|
||||
#define _STRINGIFY(a) #a
|
||||
|
@ -82,7 +114,7 @@ _stdio_open (void *user_data)
|
|||
{
|
||||
_UserData *const ud = user_data;
|
||||
|
||||
if ((ud->fd = fopen (ud->pathname, "rb")))
|
||||
if ((ud->fd = CDIO_FOPEN (ud->pathname, "rb")))
|
||||
{
|
||||
ud->fd_buf = calloc (1, CDIO_STDIO_BUFSIZE);
|
||||
setvbuf (ud->fd, ud->fd_buf, _IOFBF, CDIO_STDIO_BUFSIZE);
|
||||
|
@ -225,25 +257,18 @@ cdio_stdio_new(const char pathname[])
|
|||
CdioDataSource_t *new_obj = NULL;
|
||||
cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
_UserData *ud = NULL;
|
||||
struct CDIO_STAT statbuf;
|
||||
struct CDIO_STAT_STRUCT statbuf;
|
||||
char* pathdup;
|
||||
|
||||
if (pathname == NULL)
|
||||
return NULL;
|
||||
|
||||
pathdup = strdup(pathname);
|
||||
/* MinGW may require a translated path */
|
||||
pathdup = _cdio_strdup_fixpath(pathname);
|
||||
if (pathdup == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* _stati64 requires using native Windows paths => convert "/c/..." to "c:/..." */
|
||||
if ((strlen(pathdup) > 3) && (pathdup[0] == '/') && (pathdup[2] == '/') && (isalpha(pathdup[1])))
|
||||
{
|
||||
pathdup[0] = pathdup[1];
|
||||
pathdup[1] = ':';
|
||||
}
|
||||
#endif
|
||||
if (CDIO_STAT (pathdup, &statbuf) == -1)
|
||||
if (CDIO_STAT_CALL (pathdup, &statbuf) == -1)
|
||||
{
|
||||
cdio_warn ("could not retrieve file info for `%s': %s",
|
||||
pathdup, strerror (errno));
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_JOLIET
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
@ -43,7 +42,66 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
// TODO: also remove the need for iconv on MinGW
|
||||
/* Windows requires some basic UTF-8 support outside of Joliet */
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
#define wchar_to_utf8_no_alloc(wsrc, dest, dest_size) \
|
||||
WideCharToMultiByte(CP_UTF8, 0, wsrc, -1, dest, dest_size, NULL, NULL)
|
||||
#define utf8_to_wchar_no_alloc(src, wdest, wdest_size) \
|
||||
MultiByteToWideChar(CP_UTF8, 0, src, -1, wdest, wdest_size)
|
||||
|
||||
/*
|
||||
* Converts an UTF-16 string to UTF8 (allocate returned string)
|
||||
* Returns NULL on error
|
||||
*/
|
||||
char* cdio_wchar_to_utf8(const wchar_t* wstr)
|
||||
{
|
||||
int size = 0;
|
||||
char* str = NULL;
|
||||
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
if (size <= 1) /* An empty string would be size 1 */
|
||||
return NULL;
|
||||
|
||||
if ((str = (char*)calloc(size, 1)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (wchar_to_utf8_no_alloc(wstr, str, size) != size) {
|
||||
free(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts an UTF8 string to UTF-16 (allocate returned string)
|
||||
* Returns NULL on error
|
||||
*/
|
||||
wchar_t* cdio_utf8_to_wchar(const char* str)
|
||||
{
|
||||
int size = 0;
|
||||
wchar_t* wstr = NULL;
|
||||
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
|
||||
if (size <= 1) /* An empty string would be size 1 */
|
||||
return NULL;
|
||||
|
||||
if ((wstr = (wchar_t*)calloc(size, sizeof(wchar_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (utf8_to_wchar_no_alloc(str, wstr, size) != size) {
|
||||
free(wstr);
|
||||
return NULL;
|
||||
}
|
||||
return wstr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_JOLIET
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
struct cdio_charset_coverter_s
|
||||
|
@ -210,61 +268,6 @@ bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
|
|||
return result;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
#define wchar_to_utf8_no_alloc(wsrc, dest, dest_size) \
|
||||
WideCharToMultiByte(CP_UTF8, 0, wsrc, -1, dest, dest_size, NULL, NULL)
|
||||
#define utf8_to_wchar_no_alloc(src, wdest, wdest_size) \
|
||||
MultiByteToWideChar(CP_UTF8, 0, src, -1, wdest, wdest_size)
|
||||
|
||||
/*
|
||||
* Converts an UTF-16 string to UTF8 (allocate returned string)
|
||||
* Returns NULL on error
|
||||
*/
|
||||
static inline char* wchar_to_utf8(const wchar_t* wstr)
|
||||
{
|
||||
int size = 0;
|
||||
char* str = NULL;
|
||||
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
if (size <= 1) /* An empty string would be size 1 */
|
||||
return NULL;
|
||||
|
||||
if ((str = (char*)calloc(size, 1)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (wchar_to_utf8_no_alloc(wstr, str, size) != size) {
|
||||
free(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts an UTF8 string to UTF-16 (allocate returned string)
|
||||
* Returns NULL on error
|
||||
*/
|
||||
static inline wchar_t* utf8_to_wchar(const char* str)
|
||||
{
|
||||
int size = 0;
|
||||
wchar_t* wstr = NULL;
|
||||
|
||||
/* Find out the size we need to allocate for our converted string */
|
||||
size = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
|
||||
if (size <= 1) /* An empty string would be size 1 */
|
||||
return NULL;
|
||||
|
||||
if ((wstr = (wchar_t*)calloc(size, sizeof(wchar_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (utf8_to_wchar_no_alloc(str, wstr, size) != size) {
|
||||
free(wstr);
|
||||
return NULL;
|
||||
}
|
||||
return wstr;
|
||||
}
|
||||
|
||||
bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst,
|
||||
int * dst_len, const char * dst_charset)
|
||||
|
@ -276,7 +279,7 @@ bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst,
|
|||
return false;
|
||||
|
||||
/* Eliminate empty strings */
|
||||
le_dst = utf8_to_wchar(src);
|
||||
le_dst = cdio_utf8_to_wchar(src);
|
||||
if ((le_dst == NULL) || (le_dst[0] == 0)) {
|
||||
free(le_dst);
|
||||
return false;
|
||||
|
@ -323,7 +326,7 @@ bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
|
|||
((char*)le_src)[2*i+1] = src[2*i];
|
||||
}
|
||||
le_src[src_len] = 0;
|
||||
*dst = wchar_to_utf8(le_src);
|
||||
*dst = cdio_wchar_to_utf8(le_src);
|
||||
free(le_src);
|
||||
|
||||
return (*dst != NULL);
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "inttypes.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cdio_assert.h"
|
||||
#include <cdio/types.h>
|
||||
#include <cdio/util.h>
|
||||
|
@ -136,6 +138,29 @@ _cdio_strdup_upper (const char str[])
|
|||
return new_str;
|
||||
}
|
||||
|
||||
/* Convert MinGW/MSYS paths that start in "/c/..." to "c:/..."
|
||||
so that they can be used with fopen(), stat(), etc. */
|
||||
char *
|
||||
_cdio_strdup_fixpath (const char path[])
|
||||
{
|
||||
char *new_path = NULL;
|
||||
|
||||
if (path)
|
||||
{
|
||||
new_path = strdup (path);
|
||||
#if defined(_WIN32)
|
||||
if (new_path && (strlen (new_path) >= 3) && (new_path[0] == '/') &&
|
||||
(new_path[2] == '/') && (isalpha (new_path[1])))
|
||||
{
|
||||
new_path[0] = new_path[1];
|
||||
new_path[1] = ':';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return new_path;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cdio_to_bcd8 (uint8_t n)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <commdlg.h>
|
||||
#include <shellapi.h>
|
||||
#include <setupapi.h>
|
||||
#include <direct.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -618,6 +619,15 @@ static __inline char* getenvU(const char* varname)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static __inline int _mkdirU(const char* dirname)
|
||||
{
|
||||
wconvert(dirname);
|
||||
int ret;
|
||||
ret = _wmkdir(wdirname);
|
||||
wfree(dirname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -63,10 +63,7 @@ char* get_token_data(const char* filename, const char* token)
|
|||
goto out;
|
||||
}
|
||||
fd = _wfopen(wfilename, L"r, ccs=UNICODE");
|
||||
if (fd == NULL) {
|
||||
uprintf("Could not open file '%s'\n", filename);
|
||||
goto out;
|
||||
}
|
||||
if (fd == NULL) goto out;
|
||||
|
||||
// Process individual lines. NUL is always appended.
|
||||
// Ideally, we'd check that our buffer fits the line
|
||||
|
|
114
src/rufus.c
114
src/rufus.c
|
@ -46,6 +46,7 @@ static const char* ClusterSizeLabel[] = { "512 bytes", "1024 bytes","2048 bytes"
|
|||
"1024 kilobytes","2048 kilobytes","4096 kilobytes","8192 kilobytes","16 megabytes","32 megabytes" };
|
||||
static BOOL existing_key = FALSE; // For LGP set/restore
|
||||
static BOOL iso_size_check = TRUE;
|
||||
static int selection_default;
|
||||
BOOL enable_fixed_disks = FALSE;
|
||||
|
||||
/*
|
||||
|
@ -387,19 +388,38 @@ static BOOL GetDriveInfo(void)
|
|||
|
||||
static void SetFSFromISO(void)
|
||||
{
|
||||
int i, fs;
|
||||
int i, fs, selected_fs = FS_UNKNOWN;
|
||||
uint32_t fs_mask = 0;
|
||||
|
||||
if (iso_path == NULL)
|
||||
return;
|
||||
|
||||
for (i=ComboBox_GetCount(hFileSystem)-1; i>=0; i--) {
|
||||
// Create a mask of all the FS's available
|
||||
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, i);
|
||||
if ( ((iso_report.has_bootmgr) && (fs == FS_NTFS))
|
||||
|| ((iso_report.has_isolinux) && ((fs == FS_FAT32) || (fs == FS_FAT16))) ) {
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
|
||||
break;
|
||||
fs_mask |= 1<<fs;
|
||||
}
|
||||
|
||||
// Syslinux has precedence over bootmgr
|
||||
if (iso_report.has_isolinux) {
|
||||
if (fs_mask & (1<<FS_FAT32)) {
|
||||
selected_fs = FS_FAT32;
|
||||
} else if (fs_mask & (1<<FS_FAT16)) {
|
||||
selected_fs = FS_FAT16;
|
||||
}
|
||||
} else if (iso_report.has_bootmgr) {
|
||||
if (fs_mask & (1<<FS_NTFS)) {
|
||||
selected_fs = FS_NTFS;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to select the FS
|
||||
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, i);
|
||||
if (fs == selected_fs)
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
|
||||
}
|
||||
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
|
||||
ComboBox_GetCurSel(hFileSystem));
|
||||
}
|
||||
|
@ -1113,6 +1133,9 @@ void InitDialog(HWND hDlg)
|
|||
safe_sprintf(tmp, sizeof(tmp), "Rufus (with FreeDOS)");
|
||||
tmp[20] = ' ';
|
||||
SetWindowTextA(hDlg, tmp);
|
||||
selection_default = DT_FREEDOS;
|
||||
} else {
|
||||
selection_default = DT_WINME;
|
||||
}
|
||||
|
||||
// Create the status line
|
||||
|
@ -1162,7 +1185,7 @@ void InitDialog(HWND hDlg)
|
|||
static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
DRAWITEMSTRUCT* pDI;
|
||||
int nDeviceIndex, fs, dt;
|
||||
int nDeviceIndex, fs, i;
|
||||
static DWORD DeviceNum = 0;
|
||||
wchar_t wtmp[128], wstr[MAX_PATH];
|
||||
static UINT uDOSChecked = BST_CHECKED;
|
||||
|
@ -1243,32 +1266,29 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
break;
|
||||
#endif
|
||||
case IDC_DEVICE:
|
||||
switch (HIWORD(wParam)) {
|
||||
case CBN_SELCHANGE:
|
||||
PrintStatus(0, TRUE, "%d device%s found.", ComboBox_GetCount(hDeviceList),
|
||||
(ComboBox_GetCount(hDeviceList)!=1)?"s":"");
|
||||
PopulateProperties(ComboBox_GetCurSel(hDeviceList));
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
}
|
||||
PrintStatus(0, TRUE, "%d device%s found.", ComboBox_GetCount(hDeviceList),
|
||||
(ComboBox_GetCount(hDeviceList)!=1)?"s":"");
|
||||
PopulateProperties(ComboBox_GetCurSel(hDeviceList));
|
||||
break;
|
||||
case IDC_NBPASSES:
|
||||
switch (HIWORD(wParam)) {
|
||||
case CBN_SELCHANGE:
|
||||
DestroyTooltip(hPassesToolTip);
|
||||
switch(ComboBox_GetCurSel(hNBPasses)) {
|
||||
case 0:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55", -1);
|
||||
break;
|
||||
case 1:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA", -1);
|
||||
break;
|
||||
case 2:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA, 0xFF", -1);
|
||||
break;
|
||||
case 3:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA, 0xFF, 0x00", -1);
|
||||
break;
|
||||
}
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
DestroyTooltip(hPassesToolTip);
|
||||
switch(ComboBox_GetCurSel(hNBPasses)) {
|
||||
case 0:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55", -1);
|
||||
break;
|
||||
case 1:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA", -1);
|
||||
break;
|
||||
case 2:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA, 0xFF", -1);
|
||||
break;
|
||||
case 3:
|
||||
hPassesToolTip = CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA, 0xFF, 0x00", -1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IDC_FILESYSTEM:
|
||||
|
@ -1293,15 +1313,18 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "MS-DOS"), DT_WINME));
|
||||
if (bWithFreeDOS)
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "FreeDOS"), DT_FREEDOS));
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO_FAT));
|
||||
}
|
||||
if (fs == FS_NTFS) {
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO_NTFS));
|
||||
IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO));
|
||||
if ((selection_default == DT_ISO) && (iso_path == NULL))
|
||||
selection_default = (bWithFreeDOS)?DT_FREEDOS:DT_WINME;
|
||||
for (i=0; i<ComboBox_GetCount(hDOSType); i++) {
|
||||
if (ComboBox_GetItemData(hDOSType, i) == selection_default) {
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iso_path != NULL)
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, ComboBox_GetCount(hDOSType) - 1));
|
||||
else
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, (bWithFreeDOS && (fs != FS_NTFS))?1:0));
|
||||
if (i == ComboBox_GetCount(hDOSType))
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, 0));
|
||||
if (!IsWindowEnabled(hDOS)) {
|
||||
EnableWindow(hDOS, TRUE);
|
||||
EnableWindow(hDOSType, TRUE);
|
||||
|
@ -1312,8 +1335,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case IDC_DOSTYPE:
|
||||
if (HIWORD(wParam) != CBN_SELCHANGE)
|
||||
break;
|
||||
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
if ((dt == DT_ISO_NTFS) || (dt == DT_ISO_FAT)) {
|
||||
if (ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType)) == DT_ISO) {
|
||||
if ((iso_path == NULL) || (iso_report.label[0] == 0)) {
|
||||
// Set focus to the Select ISO button
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
|
@ -1336,6 +1358,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
hISOToolTip = CreateTooltip(hSelectISO, "Click to select...", -1);
|
||||
break;
|
||||
}
|
||||
selection_default = DT_ISO;
|
||||
hISOToolTip = CreateTooltip(hSelectISO, iso_path, -1);
|
||||
FormatStatus = 0;
|
||||
// You'd think that Windows would let you instantiate a modeless dialog wherever
|
||||
|
@ -1356,11 +1379,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
return (INT_PTR)TRUE;
|
||||
}
|
||||
FormatStatus = 0;
|
||||
selection_default = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
nDeviceIndex = ComboBox_GetCurSel(hDeviceList);
|
||||
if (nDeviceIndex != CB_ERR) {
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType));
|
||||
if ((dt == DT_ISO_NTFS) || (dt == DT_ISO_FAT)) {
|
||||
if (ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType)) == DT_ISO) {
|
||||
if (iso_path == NULL) {
|
||||
MessageBoxA(hMainDialog, "Please click on the disc button to select a bootable ISO,\n"
|
||||
"or uncheck the \"Create a bootable disk...\" checkbox.",
|
||||
|
@ -1372,13 +1395,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
"for the selected target.", "ISO image too big...", MB_OK|MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
if ((dt == DT_ISO_NTFS) && (!iso_report.has_bootmgr)) {
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
if ((fs == FS_NTFS) && (!iso_report.has_bootmgr)) {
|
||||
MessageBoxA(hMainDialog, "Only 'bootmgr' based ISO "
|
||||
"images can be used with NTFS.", "Unsupported ISO...", MB_OK|MB_ICONERROR);
|
||||
"images can currently be used with NTFS.", "Unsupported ISO...", MB_OK|MB_ICONERROR);
|
||||
break;
|
||||
} else if ((dt == DT_ISO_FAT) && (!iso_report.has_isolinux)) {
|
||||
} else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (!iso_report.has_isolinux)) {
|
||||
MessageBoxA(hMainDialog, "Only 'isolinux' based ISO "
|
||||
"images can be used with FAT.", "Unsupported ISO...", MB_OK|MB_ICONERROR);
|
||||
"images can currently be used with FAT.", "Unsupported ISO...", MB_OK|MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,7 @@ enum {
|
|||
enum dos_type {
|
||||
DT_WINME = 0,
|
||||
DT_FREEDOS,
|
||||
DT_ISO_FAT,
|
||||
DT_ISO_NTFS,
|
||||
DT_ISO,
|
||||
DT_MAX
|
||||
};
|
||||
|
||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 206, 289
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Rufus v1.1.4.149"
|
||||
CAPTION "Rufus v1.1.4.150"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,248,50,14
|
||||
|
@ -73,7 +73,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
|
||||
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
|
||||
"SysLink",WS_TABSTOP,46,47,114,9
|
||||
LTEXT "Version 1.1.4 (Build 149)",IDC_STATIC,46,19,78,8
|
||||
LTEXT "Version 1.1.4 (Build 150)",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
|
||||
|
@ -223,8 +223,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,1,4,149
|
||||
PRODUCTVERSION 1,1,4,149
|
||||
FILEVERSION 1,1,4,150
|
||||
PRODUCTVERSION 1,1,4,150
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -241,13 +241,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "akeo.ie"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.1.4.149"
|
||||
VALUE "FileVersion", "1.1.4.150"
|
||||
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.1.4.149"
|
||||
VALUE "ProductVersion", "1.1.4.150"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue