[NTUSER] Fix UserSetDefaultInputLang by using reordering

- Move IntReorderKeyboardLayouts function.
- Fix UserSetDefaultInputLang function.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-09-13 14:32:39 +09:00
parent f308c6a2bc
commit b76602ff22

View file

@ -556,6 +556,26 @@ UserHklToKbl(HKL hKl)
return NULL;
}
// Win: ReorderKeyboardLayouts
VOID FASTCALL
IntReorderKeyboardLayouts(
_Inout_ PWINSTATION_OBJECT pWinSta,
_Inout_ PKL pNewKL)
{
PKL pOldKL = gspklBaseLayout;
if ((pWinSta->Flags & WSS_NOIO) || pNewKL == pOldKL)
return;
pNewKL->pklPrev->pklNext = pNewKL->pklNext;
pNewKL->pklNext->pklPrev = pNewKL->pklPrev;
pNewKL->pklNext = pOldKL;
pNewKL->pklPrev = pOldKL->pklPrev;
pOldKL->pklPrev->pklNext = pNewKL;
pOldKL->pklPrev = pNewKL;
gspklBaseLayout = pNewKL; /* Should we use UserAssignmentLock? */
}
/*
* UserSetDefaultInputLang
*
@ -571,7 +591,7 @@ UserSetDefaultInputLang(HKL hKl)
if (!pKl)
return FALSE;
gspklBaseLayout = pKl;
IntReorderKeyboardLayouts(IntGetProcessWindowStation(NULL), pKl);
return TRUE;
}
@ -741,26 +761,6 @@ co_UserActivateKeyboardLayout(
return hOldKL;
}
// Win: ReorderKeyboardLayouts
VOID FASTCALL
IntReorderKeyboardLayouts(
_Inout_ PWINSTATION_OBJECT pWinSta,
_Inout_ PKL pNewKL)
{
PKL pOldKL = gspklBaseLayout;
if ((pWinSta->Flags & WSS_NOIO) || pNewKL == pOldKL)
return;
pNewKL->pklPrev->pklNext = pNewKL->pklNext;
pNewKL->pklNext->pklPrev = pNewKL->pklPrev;
pNewKL->pklNext = pOldKL;
pNewKL->pklPrev = pOldKL->pklPrev;
pOldKL->pklPrev->pklNext = pNewKL;
pOldKL->pklPrev = pNewKL;
gspklBaseLayout = pNewKL; /* Should we use UserAssignmentLock? */
}
/* Win: xxxActivateKeyboardLayout */
HKL APIENTRY
co_IntActivateKeyboardLayout(