https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce6da820a4bdba5ef108d…
commit ce6da820a4bdba5ef108d4b9c3de7e7161839d26
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Jan 16 09:56:18 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Jan 16 09:56:18 2022 +0900
[NTUSER] Implement NtUserBuildHimcList (#4286)
- Add UserBuildHimcList helper function.
- Implement NtUserBuildHimcList function.
CORE-11700
---
win32ss/user/ntuser/ime.c | 85 +++++++++++++++++++++++++++++++++++++++++++
win32ss/user/ntuser/ntstubs.c | 8 ----
2 files changed, 85 insertions(+), 8 deletions(-)
diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c
index 48faba31700..3a8af9d46a9 100644
--- a/win32ss/user/ntuser/ime.c
+++ b/win32ss/user/ntuser/ime.c
@@ -12,6 +12,38 @@ DBG_DEFAULT_CHANNEL(UserMisc);
#define INVALID_THREAD_ID ((ULONG)-1)
+DWORD FASTCALL UserBuildHimcList(PTHREADINFO pti, DWORD dwCount, HIMC *phList)
+{
+ PIMC pIMC;
+ DWORD dwRealCount = 0;
+
+ if (pti)
+ {
+ for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext)
+ {
+ if (dwRealCount < dwCount)
+ phList[dwRealCount] = UserHMGetHandle(pIMC);
+
+ ++dwRealCount;
+ }
+ }
+ else
+ {
+ for (pti = GetW32ThreadInfo()->ppi->ptiList; pti; pti =
pti->ptiSibling)
+ {
+ for (pIMC = pti->spDefaultImc; pIMC; pIMC = pIMC->pImcNext)
+ {
+ if (dwRealCount < dwCount)
+ phList[dwRealCount] = UserHMGetHandle(pIMC);
+
+ ++dwRealCount;
+ }
+ }
+ }
+
+ return dwRealCount;
+}
+
UINT FASTCALL
IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg, WPARAM wParam,
LPARAM lParam)
{
@@ -38,6 +70,59 @@ IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg,
WPARAM w
return 0;
}
+NTSTATUS
+APIENTRY
+NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
+{
+ NTSTATUS ret = STATUS_UNSUCCESSFUL;
+ DWORD dwRealCount;
+ PTHREADINFO pti;
+
+ UserEnterExclusive();
+
+ if (!IS_IMM_MODE())
+ {
+ EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ goto Quit;
+ }
+
+ if (dwThreadId == 0)
+ {
+ pti = GetW32ThreadInfo();
+ }
+ else if (dwThreadId == INVALID_THREAD_ID)
+ {
+ pti = NULL;
+ }
+ else
+ {
+ pti = IntTID2PTI(UlongToHandle(dwThreadId));
+ if (!pti || !pti->rpdesk)
+ goto Quit;
+ }
+
+ _SEH2_TRY
+ {
+ ProbeForWrite(phList, dwCount * sizeof(HIMC), 1);
+ ProbeForWrite(pdwCount, sizeof(DWORD), 1);
+ *pdwCount = dwRealCount = UserBuildHimcList(pti, dwCount, phList);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ goto Quit;
+ }
+ _SEH2_END;
+
+ if (dwCount < dwRealCount)
+ ret = STATUS_BUFFER_TOO_SMALL;
+ else
+ ret = STATUS_SUCCESS;
+
+Quit:
+ UserLeave();
+ return ret;
+}
+
BOOL WINAPI
NtUserGetImeHotKey(IN DWORD dwHotKey,
OUT LPUINT lpuModifiers,
diff --git a/win32ss/user/ntuser/ntstubs.c b/win32ss/user/ntuser/ntstubs.c
index 226ad3980c5..cdb801dc765 100644
--- a/win32ss/user/ntuser/ntstubs.c
+++ b/win32ss/user/ntuser/ntstubs.c
@@ -51,14 +51,6 @@ NtUserBitBltSysBmp(
return Ret;
}
-NTSTATUS
-APIENTRY
-NtUserBuildHimcList(DWORD dwThreadId, DWORD dwCount, HIMC *phList, LPDWORD pdwCount)
-{
- STUB;
- return STATUS_NOT_IMPLEMENTED;
-}
-
DWORD
APIENTRY
NtUserDragObject(