Skip to content

Commit

Permalink
fix keyboard hook mode toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Moreau authored and awakecoding committed Feb 26, 2025
1 parent 103bab0 commit 549f153
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dll/ApiHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ LRESULT CALLBACK Hook_IHWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
{
IUnknown* pUnknown = NULL;
IMsRdpClient9* pMsRdpClient9 = NULL;
IMsRdpClientSecuredSettings* pMsRdpClientSecuredSettings = NULL;
IMsRdpClientSecuredSettings2* pMsRdpClientSecuredSettings = NULL;

if (instance)
instance->GetRdpClient((LPVOID*)&pUnknown);
Expand All @@ -918,7 +918,7 @@ LRESULT CALLBACK Hook_IHWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
pUnknown->QueryInterface(IID_IMsRdpClient9, (LPVOID*)&pMsRdpClient9);

if (pMsRdpClient9)
pMsRdpClient9->get_SecuredSettings2(&pMsRdpClientSecuredSettings);
pMsRdpClient9->get_SecuredSettings3(&pMsRdpClientSecuredSettings);

LONG keyboardHookMode = 0;
pMsRdpClientSecuredSettings->get_KeyboardHookMode(&keyboardHookMode);
Expand All @@ -941,6 +941,13 @@ LRESULT CALLBACK Hook_IHWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
MsRdpEx_LogPrint(DEBUG, "New KeyboardHookMode: %d", keyboardHookMode);
pMsRdpClientSecuredSettings->put_KeyboardHookMode(keyboardHookMode);

VARIANT propValue;
VariantInit(&propValue);
propValue.vt = VT_I4;
propValue.intVal = keyboardHookMode;
bstr_t propName = _com_util::ConvertStringToBSTR("KeyboardHookMode");
pExtendedSettings->put_BaseProperty(propName, &propValue);

if (pMsRdpClient9)
pMsRdpClient9->Release();

Expand Down

0 comments on commit 549f153

Please sign in to comment.