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

[misc] simplify the declaration of extensions for FileDialog()

* Also update the Changelog
This commit is contained in:
Pete Batard 2014-05-22 22:46:36 +01:00
parent abae44f198
commit 1e121d2025
5 changed files with 46 additions and 31 deletions

View file

@ -1,3 +1,14 @@
o Version 1.4.8 (2014.06.??)
Add KolibriOS ISO support
Add VHD support (as *uncompressed* image source)
Add Arabic translation, courtesy of عمر الصمد
Add Croatian translation, courtesy of Dario Komar
Add Danish translation, courtesy of Jens Hansen
Add Latvian translation, courtesy of Aldis Tutins
Report the detected USB speed in the log
Fix support for pure UEFI bootable disk images
Various other fixes and improvements
o Version 1.4.7 (2014.04.22) o Version 1.4.7 (2014.04.22)
Add VHD support as a target, courtesy of Scott Add VHD support as a target, courtesy of Scott
Add ReFS support (only for Windows 8.1 or later and only for fixed drives) Add ReFS support (only for Windows 8.1 or later and only for fixed drives)

View file

@ -766,10 +766,7 @@ BOOL CALLBACK LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long lfHeight; long lfHeight;
DWORD log_size; DWORD log_size;
char *log_buffer = NULL, *filepath; char *log_buffer = NULL, *filepath;
const char* log_x[] = { "*.log" }; EXT_DECL(log_ext, "rufus.log", __VA_GROUP__("*.log"), __VA_GROUP__("Rufus log"));
const char* log_d[] = { lmprintf(MSG_108) };
ext_t log_ext = {ARRAYSIZE(log_x), "rufus.log", log_x, log_d };
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
apply_localization(IDD_LOG, hDlg); apply_localization(IDD_LOG, hDlg);
@ -1509,12 +1506,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
static MY_SHChangeNotifyEntry NotifyEntry; static MY_SHChangeNotifyEntry NotifyEntry;
loc_cmd* lcmd = NULL; loc_cmd* lcmd = NULL;
// TODO: Add "*.img;*.vhd" / "All Supported Images" to the list below and use a generic "%s Image" in the .loc // TODO: Add "*.img;*.vhd" / "All Supported Images" to the list below and use a generic "%s Image" in the .loc
const char* img_x[] = { "*.img", "*.vhd" }; EXT_DECL(img_ext, NULL, __VA_GROUP__("*.img", "*.vhd"), __VA_GROUP__(lmprintf(MSG_095), "VHD Image"));
const char* img_d[] = { lmprintf(MSG_095), "VHD Image" }; EXT_DECL(iso_ext, NULL, __VA_GROUP__("*.iso"), __VA_GROUP__(lmprintf(MSG_036)));
ext_t img_ext = {ARRAYSIZE(img_x), NULL, img_x, img_d};
const char* iso_x[] = { "*.iso" };
const char* iso_d[] = { lmprintf(MSG_036) };
ext_t iso_ext = {ARRAYSIZE(iso_x), NULL, iso_x, iso_d };
switch (message) { switch (message) {

View file

@ -263,6 +263,29 @@ typedef struct {
char* release_notes; char* release_notes;
} RUFUS_UPDATE; } RUFUS_UPDATE;
/*
* Structure and macros used for the extensions specification of FileDialog()
* You can use:
* EXT_DECL(my_extensions, "default.std", __VA_GROUP__("*.std", "*.other"), __VA_GROUP__("Standard type", "Other Type"));
* to define an 'ext_t my_extensions' variable initialized with the relevant attributes.
*/
typedef struct ext_t {
const size_t count;
const char* filename;
const char** extension;
const char** description;
} ext_t;
#ifndef __VA_GROUP__
#define __VA_GROUP__(...) __VA_ARGS__
#endif
#define EXT_X(prefix, ...) const char* _##prefix##_x[] = { __VA_ARGS__ }
#define EXT_D(prefix, ...) const char* _##prefix##_d[] = { __VA_ARGS__ }
#define EXT_DECL(var, filename, extensions, descriptions) \
EXT_X(var, extensions); \
EXT_D(var, descriptions); \
ext_t var = { ARRAYSIZE(_##var##_x), filename, _##var##_x, _##var##_d }
/* Duplication of the TBPFLAG enum for Windows 7 taskbar progress */ /* Duplication of the TBPFLAG enum for Windows 7 taskbar progress */
typedef enum TASKBAR_PROGRESS_FLAGS typedef enum TASKBAR_PROGRESS_FLAGS
{ {
@ -286,14 +309,6 @@ enum WindowsVersion {
WINDOWS_MAX WINDOWS_MAX
}; };
/* Extensions structure used by FileDialog() */
typedef struct ext_t {
const size_t count;
const char* filename;
const char** extension;
const char** description;
} ext_t;
/* /*
* Globals * Globals
@ -375,14 +390,12 @@ extern BOOL WimExtractFile(const char* wim_image, int index, const char* src, co
extern BOOL IsHDImage(const char* path); extern BOOL IsHDImage(const char* path);
extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid);
static __inline BOOL UnlockDrive(HANDLE hDrive) static __inline BOOL UnlockDrive(HANDLE hDrive) {
{
DWORD size; DWORD size;
return DeviceIoControl(hDrive, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL); return DeviceIoControl(hDrive, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL);
} }
static __inline void *_reallocf(void *ptr, size_t size) static __inline void *_reallocf(void *ptr, size_t size) {
{
void *ret = realloc(ptr, size); void *ret = realloc(ptr, size);
if (!ret) if (!ret)
free(ptr); free(ptr);

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329 IDD_DIALOG DIALOGEX 12, 12, 206, 329
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
CAPTION "Rufus 1.4.8.482" CAPTION "Rufus 1.4.8.483"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329
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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.8.482" CAPTION "Rufus 1.4.8.483"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -427,8 +427,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,8,482 FILEVERSION 1,4,8,483
PRODUCTVERSION 1,4,8,482 PRODUCTVERSION 1,4,8,483
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -445,13 +445,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.4.8.482" VALUE "FileVersion", "1.4.8.483"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2014 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.4.8.482" VALUE "ProductVersion", "1.4.8.483"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1187,9 +1187,7 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
STARTUPINFOA si; STARTUPINFOA si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
HFONT hyperlink_font = NULL; HFONT hyperlink_font = NULL;
const char* dl_x[] = { "*.exe" }; EXT_DECL(dl_ext, NULL, __VA_GROUP__("*.exe"), __VA_GROUP__(lmprintf(MSG_037)));
const char* dl_d[] = { lmprintf(MSG_037) };
ext_t dl_ext = { ARRAYSIZE(dl_x), "rufus.log", dl_x, dl_d };
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG: