ReactOS 0.4.15-dev-7958-gcd0bb1a
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
11static 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
22START_TEST(clientimc)
23{
24 DWORD dwCode;
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;
39 {
40 ImmUnlockClientImc(pClientImc);
41 }
43 {
44 dwCode = _SEH2_GetExceptionCode();
45 }
48
49 ok_long(pClientImc->cLockObj, 0);
50 ok_long(ImmGetIMCCSize((HIMCC)pClientImc->hInputContext), 0);
51
52 HeapFree(GetProcessHeap(), 0, pClientImc);
53}
#define ok_long(expression, result)
Definition: atltest.h:133
#define START_TEST(x)
Definition: atltest.h:75
DWORD HIMCC
Definition: dimm.idl:76
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:983
HIMCC WINAPI ImmCreateIMCC(DWORD size)
Definition: utils.c:1178
DWORD WINAPI ImmGetIMCCSize(HIMCC imcc)
Definition: utils.c:1236
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
RTL_CRITICAL_SECTION cs
Definition: imm32_undoc.h:120
HANDLE hInputContext
Definition: imm32_undoc.h:116
PVOID HANDLE
Definition: typedefs.h:73
CONST void * LPCVOID
Definition: windef.h:191
unsigned char BYTE
Definition: xxhash.c:193