[WIN32SS][NTUSER] Implement NtUserDestroyInputContext (#4063)

CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2021-11-01 15:20:42 +09:00 committed by GitHub
parent e3402aca65
commit 3d78601f39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 10 deletions

View file

@ -3,7 +3,8 @@
* PROJECT: ReactOS Win32k subsystem
* PURPOSE: Input Method Editor and Input Method Manager support
* FILE: win32ss/user/ntuser/ime.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* PROGRAMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include <win32k.h>
@ -134,5 +135,82 @@ NtUserSetImeOwnerWindow(PIMEINFOEX pImeInfoEx, BOOL fFlag)
return 0;
}
PVOID
AllocInputContextObject(PDESKTOP pDesk,
PTHREADINFO pti,
SIZE_T Size,
PVOID* HandleOwner)
{
PTHRDESKHEAD ObjHead;
ASSERT(Size > sizeof(*ObjHead));
ASSERT(pti != NULL);
ObjHead = UserHeapAlloc(Size);
if (!ObjHead)
return NULL;
RtlZeroMemory(ObjHead, Size);
ObjHead->pSelf = ObjHead;
ObjHead->rpdesk = pDesk;
ObjHead->pti = pti;
IntReferenceThreadInfo(pti);
*HandleOwner = pti;
pti->ppi->UserHandleCount++;
return ObjHead;
}
VOID UserFreeInputContext(PVOID Object)
{
PIMC pIMC = Object, pImc0;
PTHREADINFO pti = pIMC->head.pti;
UserMarkObjectDestroy(Object);
for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext)
{
if (pImc0->pImcNext == pIMC)
{
pImc0->pImcNext = pIMC->pImcNext;
break;
}
}
UserHeapFree(Object);
pti->ppi->UserHandleCount--;
IntDereferenceThreadInfo(pti);
}
BOOLEAN UserDestroyInputContext(PVOID Object)
{
PIMC pIMC = Object;
UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
return TRUE;
}
BOOL APIENTRY NtUserDestroyInputContext(HIMC hIMC)
{
PIMC pIMC;
BOOL ret = FALSE;
UserEnterExclusive();
if (!(gpsi->dwSRVIFlags & SRVINFO_IMM32))
{
EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
UserLeave();
return FALSE;
}
pIMC = UserGetObject(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
if (pIMC)
ret = UserDereferenceObject(pIMC);
UserLeave();
return ret;
}
/* EOF */

View file

@ -424,14 +424,6 @@ NtUserCreateInputContext(PCLIENTIMC pClientImc)
return NULL;
}
BOOL
APIENTRY
NtUserDestroyInputContext(HIMC hIMC)
{
STUB;
return FALSE;
}
DWORD
APIENTRY
NtUserGetRawInputBuffer(

View file

@ -237,7 +237,7 @@ static const struct
{ AllocSysObject, /*UserKbdFileCleanup*/NULL, FreeSysObject }, /* TYPE_KBDFILE */
{ AllocThreadObject, IntRemoveEvent, FreeThreadObject }, /* TYPE_WINEVENTHOOK */
{ AllocSysObject, /*UserTimerCleanup*/NULL, FreeSysObject }, /* TYPE_TIMER */
{ NULL, NULL, NULL }, /* TYPE_INPUTCONTEXT */
{ AllocInputContextObject, UserDestroyInputContext, UserFreeInputContext }, /* TYPE_INPUTCONTEXT */
{ NULL, NULL, NULL }, /* TYPE_HIDDATA */
{ NULL, NULL, NULL }, /* TYPE_DEVICEINFO */
{ NULL, NULL, NULL }, /* TYPE_TOUCHINPUTINFO */

View file

@ -163,4 +163,10 @@ BOOL UserPaintCaption(PWND pWnd, INT Flags);
BOOL FASTCALL SetLayeredStatus(PWND pWnd, BYTE set);
BOOL FASTCALL GetLayeredStatus(PWND pWnd);
/************** INPUT CONTEXT **************/
VOID UserFreeInputContext(PVOID Object);
BOOLEAN UserDestroyInputContext(PVOID Object);
PVOID AllocInputContextObject(PDESKTOP pDesk, PTHREADINFO pti, SIZE_T Size, PVOID* HandleOwner);
/* EOF */