Skip to content

Commit

Permalink
[NTUSER][USER32] Implement IntImmProcessKey (#4353)
Browse files Browse the repository at this point in the history
- Establish the trampoline callback USER32_CALLBACK_IMMPROCESSKEY for imm32!ImmProcessKey function, between NTUSER and IMM32.
- Add IntGetImeCompatFlags helper function.
- Implement co_IntImmProcessKey and IntImmProcessKey functions.
CORE-11700
  • Loading branch information
katahiromz committed Feb 11, 2022
1 parent 27d73cd commit b5c9d53
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 28 deletions.
14 changes: 13 additions & 1 deletion win32ss/include/callback.h
Expand Up @@ -19,7 +19,8 @@
#define USER32_CALLBACK_SETOBM (15)
#define USER32_CALLBACK_LPK (16)
#define USER32_CALLBACK_UMPD (17)
#define USER32_CALLBACK_MAXIMUM (17)
#define USER32_CALLBACK_IMMPROCESSKEY (18)
#define USER32_CALLBACK_MAXIMUM (18)

typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
{
Expand Down Expand Up @@ -168,6 +169,15 @@ typedef struct _LPK_CALLBACK_ARGUMENTS
BOOL bRect;
} LPK_CALLBACK_ARGUMENTS, *PLPK_CALLBACK_ARGUMENTS;

typedef struct _IMMPROCESSKEY_CALLBACK_ARGUMENTS
{
HWND hWnd;
HKL hKL;
UINT vKey;
LPARAM lParam;
DWORD dwHotKeyID;
} IMMPROCESSKEY_CALLBACK_ARGUMENTS, *PIMMPROCESSKEY_CALLBACK_ARGUMENTS;

NTSTATUS WINAPI
User32CallCopyImageFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS WINAPI
Expand Down Expand Up @@ -204,4 +214,6 @@ NTSTATUS WINAPI
User32CallLPKFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS WINAPI
User32CallUMPDFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS WINAPI
User32CallImmProcessKeyFromKernel(PVOID Arguments, ULONG ArgumentLength);
#endif /* __INCLUDE_USER32_CALLBACK_H */
24 changes: 24 additions & 0 deletions win32ss/user/ntuser/callback.c
Expand Up @@ -1247,4 +1247,28 @@ co_UserCBClientPrinterThunk( PVOID pkt, INT InSize, PVOID pvOutData, INT OutSize
return 0;
}

DWORD
APIENTRY
co_IntImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
{
DWORD ret = 0;
NTSTATUS Status;
ULONG ResultLength = sizeof(DWORD);
PVOID ResultPointer = NULL;
IMMPROCESSKEY_CALLBACK_ARGUMENTS Common = { hWnd, hKL, vKey, lParam, dwHotKeyID };

UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_IMMPROCESSKEY,
&Common,
sizeof(Common),
&ResultPointer,
&ResultLength);
UserEnterCo();

if (NT_SUCCESS(Status))
ret = *(LPDWORD)ResultPointer;

return ret;
}

/* EOF */
4 changes: 4 additions & 0 deletions win32ss/user/ntuser/callback.h
Expand Up @@ -76,3 +76,7 @@ BOOL FASTCALL co_IntSetWndIcons(VOID);
VOID FASTCALL co_IntDeliverUserAPC(VOID);
VOID FASTCALL co_IntSetupOBM(VOID);
BOOL FASTCALL IntMsgCreateStructW(PWND,CREATESTRUCTW*,CREATESTRUCTW*,PVOID*,PVOID*);

DWORD
APIENTRY
co_IntImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID);

0 comments on commit b5c9d53

Please sign in to comment.