mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
parent
de38e3be61
commit
eb902e5bee
1 changed files with 45 additions and 36 deletions
|
@ -1231,19 +1231,19 @@ VOID UserFreeInputContext(PVOID Object)
|
|||
{
|
||||
PTHRDESKHEAD ObjHead = Object;
|
||||
PDESKTOP pDesk = ObjHead->rpdesk;
|
||||
PIMC pIMC = Object, *ppIMC;
|
||||
PIMC pNode, pIMC = Object;
|
||||
PTHREADINFO pti;
|
||||
|
||||
if (!pIMC)
|
||||
return;
|
||||
|
||||
/* Find the IMC in the list and remove it */
|
||||
// Remove pIMC from the list except spDefaultImc
|
||||
pti = pIMC->head.pti;
|
||||
for (ppIMC = &pti->spDefaultImc; *ppIMC; ppIMC = &(*ppIMC)->pImcNext)
|
||||
for (pNode = pti->spDefaultImc; pNode; pNode = pNode->pImcNext)
|
||||
{
|
||||
if (*ppIMC == pIMC)
|
||||
if (pNode->pImcNext == pIMC)
|
||||
{
|
||||
*ppIMC = pIMC->pImcNext;
|
||||
pNode->pImcNext = pIMC->pImcNext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1258,60 +1258,69 @@ BOOLEAN UserDestroyInputContext(PVOID Object)
|
|||
{
|
||||
PIMC pIMC = Object;
|
||||
|
||||
if (!pIMC)
|
||||
if (!pIMC || !UserMarkObjectDestroy(pIMC))
|
||||
return TRUE;
|
||||
|
||||
UserMarkObjectDestroy(pIMC);
|
||||
|
||||
return UserDeleteObject(UserHMGetHandle(pIMC), TYPE_INPUTCONTEXT);
|
||||
}
|
||||
|
||||
BOOL NTAPI NtUserDestroyInputContext(HIMC hIMC)
|
||||
// Win: DestroyInputContext
|
||||
BOOLEAN IntDestroyInputContext(PVOID Object)
|
||||
{
|
||||
PIMC pIMC;
|
||||
BOOL ret = FALSE;
|
||||
PIMC pIMC = Object;
|
||||
HIMC hIMC = pIMC->head.h;
|
||||
PTHREADINFO pti = pIMC->head.pti;
|
||||
PWND pwndChild;
|
||||
PWINDOWLIST pwl;
|
||||
HWND *phwnd;
|
||||
PWND pWnd;
|
||||
PWINDOWLIST pwl;
|
||||
PTHREADINFO pti;
|
||||
|
||||
UserEnterExclusive();
|
||||
|
||||
if (!IS_IMM_MODE())
|
||||
if (pIMC->head.pti != gptiCurrent)
|
||||
{
|
||||
ERR("!IS_IMM_MODE()\n");
|
||||
EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
goto Quit;
|
||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pIMC = UserGetObjectNoErr(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
|
||||
if (!pIMC)
|
||||
goto Quit;
|
||||
if (pIMC == pti->spDefaultImc)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pti = pIMC->head.pti;
|
||||
if (pti != GetW32ThreadInfo() || pIMC == pti->spDefaultImc)
|
||||
goto Quit;
|
||||
|
||||
UserMarkObjectDestroy(pIMC);
|
||||
|
||||
pwl = IntBuildHwndList(pti->rpdesk->pDeskInfo->spwnd->spwndChild,
|
||||
IACE_CHILDREN | IACE_LIST, pti);
|
||||
pwndChild = pti->rpdesk->pDeskInfo->spwnd->spwndChild;
|
||||
pwl = IntBuildHwndList(pwndChild, IACE_LIST | IACE_CHILDREN, pti);
|
||||
if (pwl)
|
||||
{
|
||||
for (phwnd = pwl->ahwnd; *phwnd != HWND_TERMINATOR; ++phwnd)
|
||||
{
|
||||
pWnd = ValidateHwndNoErr(*phwnd);
|
||||
if (!pWnd)
|
||||
continue;
|
||||
|
||||
if (pWnd->hImc == hIMC)
|
||||
pWnd = UserGetObjectNoErr(gHandleTable, *phwnd, TYPE_WINDOW);
|
||||
if (pWnd && pWnd->hImc == hIMC)
|
||||
IntAssociateInputContext(pWnd, pti->spDefaultImc);
|
||||
}
|
||||
|
||||
IntFreeHwndList(pwl);
|
||||
}
|
||||
|
||||
ret = UserDeleteObject(hIMC, TYPE_INPUTCONTEXT);
|
||||
UserDeleteObject(hIMC, TYPE_INPUTCONTEXT);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL NTAPI NtUserDestroyInputContext(HIMC hIMC)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
PIMC pIMC;
|
||||
|
||||
UserEnterExclusive();
|
||||
|
||||
if (!IS_IMM_MODE())
|
||||
{
|
||||
EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
pIMC = UserGetObjectNoErr(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
|
||||
if (pIMC)
|
||||
ret = IntDestroyInputContext(pIMC);
|
||||
|
||||
Quit:
|
||||
UserLeave();
|
||||
|
|
Loading…
Reference in a new issue