ReactOS  0.4.15-dev-5122-g72bdbdd
clientimc.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Test for imm32 ImmLockClientImc/ImmUnlockClientImc
5  * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6  */
7 
8 #include "precomp.h"
9 
10 #if 0
11 static void DumpBinary(LPCVOID pv, size_t cb)
12 {
13  const BYTE *pb = pv;
14  while (cb--)
15  {
16  printf("%02X ", (BYTE)*pb++);
17  }
18  printf("\n");
19 }
20 #endif
21 
22 START_TEST(clientimc)
23 {
24  DWORD dwCode;
25  CLIENTIMC *pClientImc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLIENTIMC));
26 
27  pClientImc->hInputContext = (HANDLE)ImmCreateIMCC(4);
28  pClientImc->cLockObj = 2;
29  pClientImc->dwFlags = 0x40;
30  RtlInitializeCriticalSection(&pClientImc->cs);
31  ok_long(ImmGetIMCCSize((HIMCC)pClientImc->hInputContext), 4);
32 
33  ImmUnlockClientImc(pClientImc);
34  ok_long(pClientImc->cLockObj, 1);
35  ok_long(ImmGetIMCCSize((HIMCC)pClientImc->hInputContext), 4);
36 
37  dwCode = 0;
38  _SEH2_TRY
39  {
40  ImmUnlockClientImc(pClientImc);
41  }
43  {
44  dwCode = _SEH2_GetExceptionCode();
45  }
46  _SEH2_END;
48 
49  ok_long(pClientImc->cLockObj, 0);
50  ok_long(ImmGetIMCCSize((HIMCC)pClientImc->hInputContext), 0);
51 
52  HeapFree(GetProcessHeap(), 0, pClientImc);
53 }
DWORD WINAPI ImmGetIMCCSize(HIMCC imcc)
Definition: utils.c:1147
DWORD HIMCC
Definition: dimm.idl:76
LONG cLockObj
Definition: ntuser.h:1307
START_TEST(clientimc)
Definition: clientimc.c:22
#define ok_long(expression, result)
Definition: atltest.h:133
_SEH2_TRY
Definition: create.c:4226
HIMCC WINAPI ImmCreateIMCC(DWORD size)
Definition: utils.c:1089
#define printf
Definition: freeldr.h:94
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
HANDLE hInputContext
Definition: ntuser.h:1306
PVOID HANDLE
Definition: typedefs.h:73
unsigned long DWORD
Definition: ntddk_ex.h:95
RTL_CRITICAL_SECTION cs
Definition: ntuser.h:1310
unsigned char BYTE
Definition: xxhash.c:193
_SEH2_END
Definition: create.c:4400
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
DWORD dwFlags
Definition: ntuser.h:1308
CONST void * LPCVOID
Definition: windef.h:191
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define HeapFree(x, y, z)
Definition: compat.h:594
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:946