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

[ui] fix shutdown prevention issues

* Also minor UI improvements for High DPI
* Part of issue #676
This commit is contained in:
Pete Batard 2016-02-02 16:14:22 +00:00
parent 23aa486161
commit 4474642863
2 changed files with 23 additions and 10 deletions

View file

@ -75,6 +75,9 @@
#ifndef MSGFLT_ADD #ifndef MSGFLT_ADD
#define MSGFLT_ADD 1 #define MSGFLT_ADD 1
#endif #endif
#ifndef WM_CLIENTSHUTDOWN
#define WM_CLIENTSHUTDOWN 0x3B
#endif
#ifndef WM_COPYGLOBALDATA #ifndef WM_COPYGLOBALDATA
#define WM_COPYGLOBALDATA 0x49 #define WM_COPYGLOBALDATA 0x49
#endif #endif
@ -1862,9 +1865,8 @@ void InitDialog(HWND hDlg)
rcSelectImage.right - rcSelectImage.left, rcBootType.bottom - rcBootType.top + 2, SWP_NOZORDER); rcSelectImage.right - rcSelectImage.left, rcBootType.bottom - rcBootType.top + 2, SWP_NOZORDER);
// The things one needs to do to keep things looking good... // The things one needs to do to keep things looking good...
if (nWindowsVersion == WINDOWS_7) { if (fScale > 1.4f) {
ResizeMoveCtrl(hDlg, GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), 0, -1, 0, 2, fScale); ResizeMoveCtrl(hDlg, GetDlgItem(hMainDialog, IDS_ADVANCED_OPTIONS_GRP), 0, +1, 0, 0, fScale);
ResizeMoveCtrl(hDlg, hProgress, 0, 1, 0, 0, fScale);
} }
// Subclass the Info box so that we can align its text vertically // Subclass the Info box so that we can align its text vertically
@ -2641,12 +2643,23 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
} }
break; break;
// This is >>>SUPER WEIRD<<<. After a successful ISO or DD write (e.g. Arch 2016.01)
// we no longer receive WM_QUERYENDSESSION messages, only WM_ENDSESSION.
// But if we do a FreeDOS format, WM_QUERYENDSESSION is still sent to us alright.
// What the heck is going on here?!?
// Also, even as we try to work around this, WM_ENDSESSION comes too late in the game
// to prevent shutdown block. So we need to handle the _undocumented_ WM_CLIENTSHUTDOWN.
case WM_CLOSE: case WM_CLOSE:
case WM_CLIENTSHUTDOWN:
case WM_QUERYENDSESSION:
case WM_ENDSESSION: case WM_ENDSESSION:
if (format_thid != NULL) { // TODO: Do we want to use ShutdownBlockReasonCreate() in Vista and later to stop
// forced shutdown? See https://msdn.microsoft.com/en-us/library/ms700677.aspx
if (format_op_in_progress) {
// WM_QUERYENDSESSION uses this value to prevent shutdown
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
} }
PostQuitMessage(0); SendMessage(hDlg, WM_COMMAND, (WPARAM)IDCANCEL, (LPARAM)0);
break; break;
case UM_PROGRESS_INIT: case UM_PROGRESS_INIT:

View file

@ -33,7 +33,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
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.7.840" CAPTION "Rufus 2.7.841"
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
@ -320,8 +320,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,7,840,0 FILEVERSION 2,7,841,0
PRODUCTVERSION 2,7,840,0 PRODUCTVERSION 2,7,841,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -338,13 +338,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.7.840" VALUE "FileVersion", "2.7.841"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2016 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.7.840" VALUE "ProductVersion", "2.7.841"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"