VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/ExpandVolume/WinMain.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-15 00:41:07 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-15 00:41:07 +0100
commit43ad4f93eb2c64bb2c278cdbefdfe0250293868e (patch)
tree838b3dd1d2ff69c3e7d162d0347d08435c745cb5 /src/ExpandVolume/WinMain.cpp
parent117d8dd046fcfc8e85c8aadf96556eb9f445695c (diff)
downloadVeraCrypt-43ad4f93eb2c64bb2c278cdbefdfe0250293868e.tar.gz
VeraCrypt-43ad4f93eb2c64bb2c278cdbefdfe0250293868e.zip
Windows: Fix various compiler warnings
Diffstat (limited to 'src/ExpandVolume/WinMain.cpp')
-rw-r--r--src/ExpandVolume/WinMain.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp
index 9a822153..37cd11c8 100644
--- a/src/ExpandVolume/WinMain.cpp
+++ b/src/ExpandVolume/WinMain.cpp
@@ -131,7 +131,7 @@ MountOptions defaultMountOptions;
KeyFile *FirstCmdKeyFile;
HBITMAP hbmLogoBitmapRescaled = NULL;
-wchar_t OrigKeyboardLayout [8+1] = L"00000409";
+wchar_t OrigKeyboardLayout [KL_NAMELENGTH] = L"00000409";
BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */
BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */
@@ -552,9 +552,12 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L"");
- StringCbPrintfW (OrigKeyboardLayout, sizeof(OrigKeyboardLayout),L"%08X", (DWORD) GetKeyboardLayout (NULL) & 0xFFFF);
+ if (!GetKeyboardLayoutNameW(OrigKeyboardLayout))
+ {
+ StringCbPrintfW(OrigKeyboardLayout, sizeof(OrigKeyboardLayout), L"%08X", (DWORD) (DWORD_PTR) GetKeyboardLayout(NULL) & 0xFFFF);
+ }
- DWORD keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ DWORD keybLayout = (DWORD) (DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
@@ -594,7 +597,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case TIMER_ID_KEYB_LAYOUT_GUARD:
if (bPrebootPasswordDlgMode)
{
- DWORD keybLayout = (DWORD) GetKeyboardLayout (NULL);
+ DWORD keybLayout = (DWORD) (DWORD_PTR) GetKeyboardLayout (NULL);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{
@@ -607,7 +610,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp);
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), L"");
- keybLayout = (DWORD) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
+ keybLayout = (DWORD) (DWORD_PTR) LoadKeyboardLayout (L"00000409", KLF_ACTIVATE);
if (keybLayout != 0x00000409 && keybLayout != 0x04090409)
{