1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-06-09 22:36:59 -05:00

Windows: Add setting/CLI switch to enable IME during Secure Desktop. Fix Preferences tabs handling.

Now it is possible to enable IME during Secure Desktop using a setting in Preferences or using /enableIME switch.
This helps solve issues with some IME that causes VeraCrypt to freeze when selecting keyfile while VeraCrypt secure desktop is active.
See: https://sourceforge.net/p/veracrypt/discussion/general/thread/1e8b9aeacd
This commit is contained in:
Mounir IDRASSI
2025-09-20 22:31:13 +09:00
parent a7ebddc5f3
commit b952201412
50 changed files with 342 additions and 137 deletions
+18 -9
View File
@@ -168,9 +168,12 @@ BOOL bHideWaitingDialog = FALSE;
BOOL bCmdHideWaitingDialog = FALSE;
BOOL bCmdHideWaitingDialogValid = FALSE;
BOOL bUseSecureDesktop = FALSE;
BOOL bEnableIMEInSecureDesktop = FALSE;
BOOL bUseLegacyMaxPasswordLength = FALSE;
BOOL bCmdUseSecureDesktop = FALSE;
BOOL bCmdUseSecureDesktopValid = FALSE;
BOOL bCmdEnableIMEInSecureDesktop = FALSE;
BOOL bCmdEnableIMEInSecureDesktopValid = FALSE;
BOOL bStartOnLogon = FALSE;
BOOL bMountDevicesOnLogon = FALSE;
BOOL bMountFavoritesOnLogon = FALSE;
@@ -14123,6 +14126,7 @@ typedef struct
LPARAM dwInitParam;
INT_PTR retValue;
BOOL bDlgDisplayed; // set to TRUE if the dialog was displayed on secure desktop
BOOL bEnableIMEInSecureDesktop;
} SecureDesktopThreadParam;
typedef struct
@@ -14206,17 +14210,20 @@ static unsigned int __stdcall SecureDesktopThread( LPVOID lpThreadParameter )
if (bNewDesktopSet)
{
ScreenCaptureBlocker blocker;
// call ImmDisableIME from imm32.dll to disable IME since it can create issue with secure desktop
// cf: https://keepass.info/help/kb/sec_desk.html#ime
HMODULE hImmDll = LoadLibraryEx (L"imm32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hImmDll)
HMODULE hImmDll = NULL;
if (!pParam->bEnableIMEInSecureDesktop)
{
typedef BOOL (WINAPI *ImmDisableIME_t)(DWORD);
ImmDisableIME_t ImmDisableIME = (ImmDisableIME_t) GetProcAddress (hImmDll, "ImmDisableIME");
if (ImmDisableIME)
// call ImmDisableIME from imm32.dll to disable IME since it can create issue with secure desktop
// cf: https://keepass.info/help/kb/sec_desk.html#ime
hImmDll = LoadLibraryEx (L"imm32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hImmDll)
{
ImmDisableIME (0);
typedef BOOL (WINAPI *ImmDisableIME_t)(DWORD);
ImmDisableIME_t ImmDisableIME = (ImmDisableIME_t) GetProcAddress (hImmDll, "ImmDisableIME");
if (ImmDisableIME)
{
ImmDisableIME (0);
}
}
}
@@ -14316,6 +14323,7 @@ INT_PTR SecureDesktopDialogBoxParam(
BOOL bSuccess = FALSE;
INT_PTR retValue = 0;
BOOL bEffectiveUseSecureDesktop = bCmdUseSecureDesktopValid? bCmdUseSecureDesktop : bUseSecureDesktop;
BOOL bEffectiveEnableIMEInSecureDesktop = bCmdEnableIMEInSecureDesktopValid? bCmdEnableIMEInSecureDesktop : bEnableIMEInSecureDesktop;
if (bEffectiveUseSecureDesktop && !IsThreadInSecureDesktop(GetCurrentThreadId()))
{
@@ -14372,6 +14380,7 @@ INT_PTR SecureDesktopDialogBoxParam(
param.dwInitParam = dwInitParam;
param.retValue = 0;
param.bDlgDisplayed = FALSE;
param.bEnableIMEInSecureDesktop = bEffectiveEnableIMEInSecureDesktop;
// use _beginthreadex instead of CreateThread because lpDialogFunc may be using the C runtime library
HANDLE hThread = (HANDLE) _beginthreadex (NULL, 0, SecureDesktopThread, (LPVOID) &param, 0, NULL);
+3
View File
@@ -128,11 +128,14 @@ extern BOOL bHideWaitingDialog;
extern BOOL bCmdHideWaitingDialog;
extern BOOL bCmdHideWaitingDialogValid;
extern BOOL bUseSecureDesktop;
extern BOOL bEnableIMEInSecureDesktop;
extern volatile BOOL bSecureDesktopOngoing;
extern TCHAR SecureDesktopName[65];
extern BOOL bUseLegacyMaxPasswordLength;
extern BOOL bCmdUseSecureDesktop;
extern BOOL bCmdUseSecureDesktopValid;
extern BOOL bCmdEnableIMEInSecureDesktop;
extern BOOL bCmdEnableIMEInSecureDesktopValid;
extern BOOL bStartOnLogon;
extern BOOL bMountDevicesOnLogon;
extern BOOL bMountFavoritesOnLogon;
+2
View File
@@ -1651,6 +1651,8 @@
<entry lang="en" key="IDD_PREFERENCES_TAB_GENERAL">General</entry>
<entry lang="en" key="IDD_PREFERENCES_TAB_ACTIONS">Actions</entry>
<entry lang="en" key="IDD_PREFERENCES_TAB_PASSWORD">Password</entry>
<entry lang="en" key="IDC_SECURE_DESKTOP_ENABLE_IME">Enable Input Method Editor (IME) in Secure Desktop</entry>
<entry lang="en" key="ENABLE_IME_IN_SECURE_DESKTOP_WARNING">WARNING: Enable this option only if you are encountering issues when selecting Keyfiles/Tokens under Secure Desktop.</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">