https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ea1353e4beb2e820bf1c7…
commit ea1353e4beb2e820bf1c76de2a12d64739376df9
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 12 14:48:20 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 12 14:48:20 2022 +0900
[NTUSER] Implement NtUserSetThreadLayoutHandles (#4277)
- Modify NtUserSetThreadLayoutHandles prototype.
- Implement NtUserSetThreadLayoutHandles function.
CORE-11700
---
win32ss/include/ntuser.h | 2 +-
win32ss/user/ntuser/ntstubs.c | 25 ++++++++++++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h
index e6db897fa4b..3770d2761b9 100644
--- a/win32ss/include/ntuser.h
+++ b/win32ss/include/ntuser.h
@@ -3313,7 +3313,7 @@ NtUserSetSystemTimer(
UINT uElapse,
TIMERPROC lpTimerFunc);
-DWORD
+VOID
NTAPI
NtUserSetThreadLayoutHandles(HKL hNewKL, HKL hOldKL);
diff --git a/win32ss/user/ntuser/ntstubs.c b/win32ss/user/ntuser/ntstubs.c
index 09b9473756a..000fd2bdf5d 100644
--- a/win32ss/user/ntuser/ntstubs.c
+++ b/win32ss/user/ntuser/ntstubs.c
@@ -1023,12 +1023,31 @@ Quit:
return Status;
}
-DWORD
+VOID
APIENTRY
NtUserSetThreadLayoutHandles(HKL hNewKL, HKL hOldKL)
{
- STUB;
- return 0;
+ PTHREADINFO pti;
+ PKL pOldKL, pNewKL;
+
+ UserEnterExclusive();
+
+ pti = GetW32ThreadInfo();
+ pOldKL = pti->KeyboardLayout;
+ if (pOldKL && pOldKL->hkl != hOldKL)
+ goto Quit;
+
+ pNewKL = UserHklToKbl(hNewKL);
+ if (!pNewKL)
+ goto Quit;
+
+ if (IS_IME_HKL(hNewKL) != IS_IME_HKL(hOldKL))
+ pti->hklPrev = hOldKL;
+
+ pti->KeyboardLayout = pNewKL;
+
+Quit:
+ UserLeave();
}
BOOL