From 5a9c77b3be66780ba09a16cdf273f46f3d59a399 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Wed, 14 Jul 2021 01:19:35 +0900 Subject: [PATCH] [IMM32_APITEST] Add clientimc testcase (#3815) - Add clientimc testcase to imm32_apitest. - Add "precomp.h". CORE-11700 --- .../rostests/apitests/imm32/CMakeLists.txt | 3 ++ modules/rostests/apitests/imm32/clientimc.c | 53 +++++++++++++++++++ modules/rostests/apitests/imm32/imcc.c | 6 +-- modules/rostests/apitests/imm32/precomp.h | 15 ++++++ modules/rostests/apitests/imm32/testlist.c | 2 + sdk/include/reactos/imm32_undoc.h | 3 ++ 6 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 modules/rostests/apitests/imm32/clientimc.c create mode 100644 modules/rostests/apitests/imm32/precomp.h diff --git a/modules/rostests/apitests/imm32/CMakeLists.txt b/modules/rostests/apitests/imm32/CMakeLists.txt index 7e5e1223d7b..2edcec8f68f 100644 --- a/modules/rostests/apitests/imm32/CMakeLists.txt +++ b/modules/rostests/apitests/imm32/CMakeLists.txt @@ -1,5 +1,8 @@ +include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) + list(APPEND SOURCE + clientimc.c imcc.c testlist.c) diff --git a/modules/rostests/apitests/imm32/clientimc.c b/modules/rostests/apitests/imm32/clientimc.c new file mode 100644 index 00000000000..99ed8423537 --- /dev/null +++ b/modules/rostests/apitests/imm32/clientimc.c @@ -0,0 +1,53 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Test for imm32 ImmLockClientImc/ImmUnlockClientImc + * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) + */ + +#include "precomp.h" + +#if 0 +static void DumpBinary(LPCVOID pv, size_t cb) +{ + const BYTE *pb = pv; + while (cb--) + { + printf("%02X ", (BYTE)*pb++); + } + printf("\n"); +} +#endif + +START_TEST(clientimc) +{ + DWORD dwCode; + CLIENTIMC *pClientImc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLIENTIMC)); + + pClientImc->hImc = (HIMC)ImmCreateIMCC(4); + pClientImc->cLockObj = 2; + pClientImc->dwFlags = 0x40; + RtlInitializeCriticalSection(&pClientImc->cs); + ok_long(ImmGetIMCCSize(pClientImc->hImc), 4); + + ImmUnlockClientImc(pClientImc); + ok_long(pClientImc->cLockObj, 1); + ok_long(ImmGetIMCCSize(pClientImc->hImc), 4); + + dwCode = 0; + _SEH2_TRY + { + ImmUnlockClientImc(pClientImc); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + dwCode = _SEH2_GetExceptionCode(); + } + _SEH2_END; + ok_long(dwCode, STATUS_ACCESS_VIOLATION); + + ok_long(pClientImc->cLockObj, 0); + ok_long(ImmGetIMCCSize(pClientImc->hImc), 0); + + HeapFree(GetProcessHeap(), 0, pClientImc); +} diff --git a/modules/rostests/apitests/imm32/imcc.c b/modules/rostests/apitests/imm32/imcc.c index 230222be263..59829a4e35b 100644 --- a/modules/rostests/apitests/imm32/imcc.c +++ b/modules/rostests/apitests/imm32/imcc.c @@ -5,11 +5,7 @@ * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) */ -#include -#define WIN32_NO_STATUS -#include -#include -#include "wine/test.h" +#include "precomp.h" START_TEST(imcc) { diff --git a/modules/rostests/apitests/imm32/precomp.h b/modules/rostests/apitests/imm32/precomp.h new file mode 100644 index 00000000000..aaa4172e358 --- /dev/null +++ b/modules/rostests/apitests/imm32/precomp.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#define WIN32_NO_STATUS +#include +#include +#include +#include +#include +#include +#include "../../../win32ss/include/ntuser.h" +#include +#include +#include +#include diff --git a/modules/rostests/apitests/imm32/testlist.c b/modules/rostests/apitests/imm32/testlist.c index 15f00bfca65..a9b8f92a791 100644 --- a/modules/rostests/apitests/imm32/testlist.c +++ b/modules/rostests/apitests/imm32/testlist.c @@ -2,10 +2,12 @@ #define STANDALONE #include +extern void func_clientimc(void); extern void func_imcc(void); const struct test winetest_testlist[] = { + { "clientimc", func_clientimc }, { "imcc", func_imcc }, { 0, 0 } }; diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h index 8332d6bfde9..e207d52bc0e 100644 --- a/sdk/include/reactos/imm32_undoc.h +++ b/sdk/include/reactos/imm32_undoc.h @@ -32,6 +32,9 @@ extern "C" { BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey); +PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc); +VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc); + #ifdef __cplusplus } // extern "C" #endif