Skip to content

Commit

Permalink
chore(windows): add comments for _WIN64 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdurdin committed Jul 4, 2024
1 parent b15dcef commit 12fdb2b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 42 deletions.
20 changes: 11 additions & 9 deletions windows/src/engine/keyman32/hotkeys.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Name: hotkeys
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Documentation:
Description:
Create Date: 1 Aug 2006
Modified Date: 25 Oct 2016
Authors: mcdurdin
Related Files:
Dependencies:
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
Bugs:
Todo:
Notes:
History: 01 Aug 2006 - mcdurdin - Initial version
11 Dec 2009 - mcdurdin - I934 - x64 - Initial version
12 Mar 2010 - mcdurdin - I934 - x64 - Complete
Expand All @@ -26,6 +26,8 @@
// I5136
#include "pch.h"

// This file is used only in keyman32.dll; it tracks hotkeys for Keyman keyboard
// switching and events
#ifndef _WIN64

Hotkeys *g_Hotkeys = NULL; // I4326
Expand Down Expand Up @@ -79,7 +81,7 @@ void Hotkeys::Load() { // I4390
m_hotkeys[m_nHotkeys].HotkeyValue = reg.ReadInteger(name);
m_hotkeys[m_nHotkeys].Target = atoi(name);

SendDebugMessageFormat(0, sdmGlobal, 0, "InterfaceHotkey[%d] = {HotkeyValue: %x, Target: %d}",
SendDebugMessageFormat(0, sdmGlobal, 0, "InterfaceHotkey[%d] = {HotkeyValue: %x, Target: %d}",
m_nHotkeys,
m_hotkeys[m_nHotkeys].HotkeyValue,
m_hotkeys[m_nHotkeys].Target);
Expand Down Expand Up @@ -115,7 +117,7 @@ void Hotkeys::Load() { // I4390
WCHAR hkval[64];
reg.ReadString(valuename, hkval, 64);
m_hotkeys[m_nHotkeys].HotkeyValue = _wtoi(hkval);

SendDebugMessageFormat(0, sdmGlobal, 0, "LanguageHotkey[%d] = {HotkeyValue: %x, hkl: %x, profileGUID: %ws}", m_nHotkeys,
m_hotkeys[m_nHotkeys].HotkeyValue,
m_hotkeys[m_nHotkeys].hkl,
Expand Down
2 changes: 2 additions & 0 deletions windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "serialkeyeventserver.h"
#include "kbd.h" /* DDK kbdlayout */

// This file is used only in keyman32.dll; it implements our low level keyboard hook
// in the main keyman.exe process for hotkeys, serial key event server
#ifndef _WIN64

BOOL ProcessHotkey(UINT vkCode, BOOL isUp, DWORD ShiftState);
Expand Down
4 changes: 4 additions & 0 deletions windows/src/engine/keyman32/kmhook_keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
#include "pch.h"
#include <Psapi.h>

// This file is used only in keyman32.dll; it has support functions for hotkeys
// which used to be in a keyboard hook but are now in the low-level keyboard
// hook
// TODO: rename this file
#ifndef _WIN64

// I3617
Expand Down
1 change: 1 addition & 0 deletions windows/src/engine/keyman32/serialkeyeventserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "security.h"
#include "kbd.h"

// This file is used only in keyman32.dll; implements the serial key event server
#ifndef _WIN64

/*
Expand Down
33 changes: 17 additions & 16 deletions windows/src/engine/keyman32/syskbdnt.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Name: syskbdnt
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Documentation:
Description:
Create Date: 22 Jan 2007
Modified Date: 6 Feb 2015
Authors: mcdurdin
Related Files:
Dependencies:
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
Bugs:
Todo:
Notes:
History: 22 Jan 2007 - mcdurdin - Don't translate any number pad keys
13 Jul 2007 - mcdurdin - I911 - Fix for Ctrl+BKSP
10 Sep 2008 - mcdurdin - I1635 - mnemonic layouts on x64 fail
Expand All @@ -35,8 +35,9 @@
////////////////////////////////////////////////////////////////////////////

#include "pch.h"
#include "kbd.h" /* DDK kbdlayout */
#include "kbd.h" /* DDK kbdlayout */

// This file is used only in keyman32.dll; it maps syskbd for x86 builds of Windows
#ifndef _WIN64

extern BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64();
Expand Down Expand Up @@ -73,19 +74,19 @@ BOOL LoadNewLibrary()
if(r->ReadString("Layout File", buf, 32))
{
hKbdLibrary = LoadLibrary(buf);
if(!hKbdLibrary)
{
if(!hKbdLibrary)
{
SendDebugMessageFormat(GetFocus(), sdmKeyboard, 0, "LoadNewLibrary: Exit -- could not load library");
return FALSE;
return FALSE;
}
PKBDLAYERDESCRIPTORFUNC KbdLayerDescriptorFunc = (PKBDLAYERDESCRIPTORFUNC) GetProcAddress(hKbdLibrary, "KbdLayerDescriptor");
if(KbdLayerDescriptorFunc)
{
KbdTables = (*KbdLayerDescriptorFunc)();
if(KbdTables)
if(KbdTables)
return TRUE;
}

FreeLibrary(hKbdLibrary);
}
}
Expand All @@ -109,15 +110,15 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT()

HKL hkl = GetKeyboardLayout(0);

/* Find the appropriate keyboard tables */
/* Find the appropriate keyboard tables */

if(hkl != ActiveHKL_NT)
{
ActiveHKL_NT = hkl;
ActiveHKL_NT = hkl;
LoadNewLibrary();
}

if(!KbdTables) /* Could not load keyboard DLL */
if(!KbdTables) /* Could not load keyboard DLL */
return FALSE;

return (KbdTables->fLocaleFlags & 0x1) ? TRUE : FALSE;
Expand Down
35 changes: 18 additions & 17 deletions windows/src/engine/keyman32/syskbdnt64.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
Name: syskbdnt64
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Documentation:
Description:
Create Date: 10 Sep 2008
Modified Date: 6 Feb 2015
Authors: mcdurdin
Related Files:
Dependencies:
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
Bugs:
Todo:
Notes:
History: 10 Sep 2008 - mcdurdin - I1635 - Initial version
11 Mar 2009 - mcdurdin - I1894 - Fix threading bugs introduced in I1888
30 Nov 2009 - mcdurdin - I934 - Prep for x64 - change UINT to WORD for vkeys
Expand All @@ -32,9 +32,10 @@

#include "pch.h"

// This file is used only in keyman32.dll; it maps syskbd for x64 builds of Windows
#ifndef _WIN64

#include "kbd.h" /* DDK kbdlayout */
#include "kbd.h" /* DDK kbdlayout */

//#pragma warning ( disable : 4200 )

Expand Down Expand Up @@ -154,19 +155,19 @@ BOOL LoadNewLibrary_x64()
if(r->ReadString("Layout File", buf, 32))
{
hKbdLibrary_x64 = LoadLibrary(buf);
if(!hKbdLibrary_x64)
{
if(!hKbdLibrary_x64)
{
SendDebugMessageFormat(GetFocus(), sdmKeyboard, 0, "LoadNewLibrary_x64: Exit -- could not load library");
return FALSE;
return FALSE;
}
PKBDLAYERDESCRIPTORFUNC KbdLayerDescriptorFunc = (PKBDLAYERDESCRIPTORFUNC) GetProcAddress(hKbdLibrary_x64, "KbdLayerDescriptor");
if(KbdLayerDescriptorFunc)
{
KbdTables_x64 = (*KbdLayerDescriptorFunc)();
if(KbdTables_x64)
if(KbdTables_x64)
return TRUE;
}

FreeLibrary(hKbdLibrary_x64);
}
}
Expand All @@ -186,15 +187,15 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64()
{
HKL hkl = GetKeyboardLayout(0);

/* Find the appropriate keyboard tables */
/* Find the appropriate keyboard tables */

if(hkl != ActiveHKL_NT_x64)
{
ActiveHKL_NT_x64 = hkl;
ActiveHKL_NT_x64 = hkl;
LoadNewLibrary_x64();
}

if(!KbdTables_x64) /* Could not load keyboard DLL */
if(!KbdTables_x64) /* Could not load keyboard DLL */
return FALSE;

return (KbdTables_x64->fLocaleFlags & 0x1) ? TRUE : FALSE;
Expand All @@ -203,7 +204,7 @@ BOOL KeyboardGivesCtrlRAltForRAlt_NT_x64()

typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);

LPFN_ISWOW64PROCESS
LPFN_ISWOW64PROCESS
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(
GetModuleHandle("kernel32"),"IsWow64Process");
BOOL fStored = FALSE;
Expand Down

0 comments on commit 12fdb2b

Please sign in to comment.