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

[loc] fix alert hook handling when switching language

* Because the localized title/button text lookup was only executed once
  on startup, it wouldn't apply to the new language on relaunch. Fix that.
This commit is contained in:
Pete Batard 2019-03-13 17:01:26 +00:00
parent 7e21f8a60c
commit 924c6b1a79
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 14 additions and 10 deletions

View file

@ -3155,8 +3155,9 @@ relaunch:
ChangeWindowMessageFilter(WM_COPYGLOBALDATA, MSGFLT_ADD); ChangeWindowMessageFilter(WM_COPYGLOBALDATA, MSGFLT_ADD);
// Set the hook to automatically close Windows' "You need to format the disk in drive..." prompt // Set the hook to automatically close Windows' "You need to format the disk in drive..." prompt
SetAlertPromptMessages();
if (!SetAlertPromptHook()) if (!SetAlertPromptHook())
uprintf("Warning: Could not set alert prompts hook"); uprintf("Warning: Could not set alert prompt hook");
ShowWindow(hDlg, SW_SHOWNORMAL); ShowWindow(hDlg, SW_SHOWNORMAL);
UpdateWindow(hDlg); UpdateWindow(hDlg);

View file

@ -567,6 +567,7 @@ extern BOOL IsBufferInDB(const unsigned char* buf, const size_t len);
extern char* _printbits(size_t const size, void const * const ptr, int leading_zeroes); extern char* _printbits(size_t const size, void const * const ptr, int leading_zeroes);
extern BOOL IsCurrentProcessElevated(void); extern BOOL IsCurrentProcessElevated(void);
extern char* GetCurrentMUI(void); extern char* GetCurrentMUI(void);
extern void SetAlertPromptMessages(void);
extern BOOL SetAlertPromptHook(void); extern BOOL SetAlertPromptHook(void);
extern void ClrAlertPromptHook(void); extern void ClrAlertPromptHook(void);
extern BYTE SearchProcess(char* HandleName, DWORD dwTimeout, BOOL bPartialMatch, BOOL bIgnoreSelf, BOOL bQuiet); extern BYTE SearchProcess(char* HandleName, DWORD dwTimeout, BOOL bPartialMatch, BOOL bIgnoreSelf, BOOL bQuiet);

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
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 3.5.1457" CAPTION "Rufus 3.5.1458"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -394,8 +394,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,1457,0 FILEVERSION 3,5,1458,0
PRODUCTVERSION 3,5,1457,0 PRODUCTVERSION 3,5,1458,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -413,13 +413,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie" VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.5.1457" VALUE "FileVersion", "3.5.1458"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.5.exe" VALUE "OriginalFilename", "rufus-3.5.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.5.1457" VALUE "ProductVersion", "3.5.1458"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1977,14 +1977,11 @@ static void CALLBACK AlertPromptHook(HWINEVENTHOOK hWinEventHook, DWORD Event, H
} }
} }
BOOL SetAlertPromptHook(void) void SetAlertPromptMessages(void)
{ {
HMODULE mui_lib; HMODULE mui_lib;
char mui_path[MAX_PATH]; char mui_path[MAX_PATH];
if (ap_weh != NULL)
return TRUE; // No need to set again if active
// Fetch the localized strings in the relevant MUI // Fetch the localized strings in the relevant MUI
static_sprintf(mui_path, "%s\\%s\\shell32.dll.mui", system_dir, GetCurrentMUI()); static_sprintf(mui_path, "%s\\%s\\shell32.dll.mui", system_dir, GetCurrentMUI());
mui_lib = LoadLibraryU(mui_path); mui_lib = LoadLibraryU(mui_path);
@ -2013,7 +2010,12 @@ BOOL SetAlertPromptHook(void)
FreeLibrary(mui_lib); FreeLibrary(mui_lib);
} }
static_strcpy(title_str[2], lmprintf(MSG_149)); static_strcpy(title_str[2], lmprintf(MSG_149));
}
BOOL SetAlertPromptHook(void)
{
if (ap_weh != NULL)
return TRUE; // No need to set again if active
ap_weh = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL, ap_weh = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL,
AlertPromptHook, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); AlertPromptHook, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
return (ap_weh != NULL); return (ap_weh != NULL);