https://git.reactos.org/?p=reactos.git;a=commitdiff;h=10c9aa067f3f64f4828f7…
commit 10c9aa067f3f64f4828f77dbd385ca70ce15b4b5
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Aug 21 07:31:10 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Aug 21 07:31:10 2021 +0900
[NTUSER] Improve NtUserQueryWindow (#3915)
- Improve NtUserQueryWindow function.
- Add IMC structure.
- Modify THREADINFO structure.
CORE-11700
---
win32ss/include/ntuser.h | 8 ++++++++
win32ss/user/ntuser/win32.h | 6 ++++++
win32ss/user/ntuser/window.c | 31 +++++++++++++++++++++++--------
3 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h
index 71c9f3a6f43..f3777680be9 100644
--- a/win32ss/include/ntuser.h
+++ b/win32ss/include/ntuser.h
@@ -187,6 +187,14 @@ typedef struct _THRDESKHEAD
PVOID pSelf;
} THRDESKHEAD, *PTHRDESKHEAD;
+typedef struct tagIMC
+{
+ THRDESKHEAD head;
+ struct tagIMC *pImcNext;
+ ULONG_PTR dwClientImcData;
+ HWND hImeWnd;
+} IMC, *PIMC;
+
typedef struct _PROCDESKHEAD
{
HEAD;
diff --git a/win32ss/user/ntuser/win32.h b/win32ss/user/ntuser/win32.h
index f8ef4ef20ad..e7d3ac0e52a 100644
--- a/win32ss/user/ntuser/win32.h
+++ b/win32ss/user/ntuser/win32.h
@@ -75,6 +75,8 @@ typedef struct _W32THREAD
PVOID pUMPDObj;
} W32THREAD, *PW32THREAD;
+struct tagIMC;
+
#ifdef __cplusplus
typedef struct _THREADINFO : _W32THREAD
{
@@ -126,6 +128,10 @@ typedef struct _THREADINFO
INT iCursorLevel;
/* Last message cursor position */
POINT ptLast;
+ /* Input context-related */
+ struct _WND* spwndDefaultIme;
+ struct tagIMC* spDefaultImc;
+ HKL hklPrev;
INT cEnterCount;
/* Queue of messages posted to the queue. */
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index 319cef9063a..016eb89d955 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -3932,8 +3932,9 @@ NtUserQueryWindow(HWND hWnd, DWORD Index)
#define GWLP_CONSOLE_LEADER_PID 0
#define GWLP_CONSOLE_LEADER_TID 4
- PWND pWnd;
DWORD_PTR Result;
+ PWND pWnd, pwndActive;
+ PTHREADINFO pti, ptiActive;
DECLARE_RETURN(UINT);
TRACE("Enter NtUserQueryWindow\n");
@@ -3996,19 +3997,33 @@ NtUserQueryWindow(HWND hWnd, DWORD Index)
Result = (pWnd->head.pti->MessageQueue == gpqForeground);
break;
- case QUERY_WINDOW_DEFAULT_IME:
- ERR("QUERY_WINDOW_DEFAULT_IME: FIXME\n");
- Result = 0;
+ case QUERY_WINDOW_DEFAULT_IME: /* default IME window */
+ if (pWnd->head.pti->spwndDefaultIme)
+ Result = (DWORD_PTR)UserHMGetHandle(pWnd->head.pti->spwndDefaultIme);
+ else
+ Result = 0;
break;
- case QUERY_WINDOW_DEFAULT_ICONTEXT:
- ERR("QUERY_WINDOW_DEFAULT_ICONTEXT: FIXME\n");
- Result = 0;
+ case QUERY_WINDOW_DEFAULT_ICONTEXT: /* default input context handle */
+ if (pWnd->head.pti->spDefaultImc)
+ Result = (DWORD_PTR)UserHMGetHandle(pWnd->head.pti->spDefaultImc);
+ else
+ Result = 0;
break;
case QUERY_WINDOW_ACTIVE_IME:
- ERR("QUERY_WINDOW_ACTIVE_IME: FIXME\n");
Result = 0;
+ if (gpqForeground && gpqForeground->spwndActive)
+ {
+ pwndActive = gpqForeground->spwndActive;
+ pti = PsGetCurrentThreadWin32Thread();
+ if (pti->rpdesk == pwndActive->head.rpdesk)
+ {
+ ptiActive = pwndActive->head.pti;
+ if (ptiActive->spwndDefaultIme)
+ Result = (DWORD_PTR)UserHMGetHandle(ptiActive->spwndDefaultIme);
+ }
+ }
break;
default: