https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5a9c77b3be66780ba09a1…
commit 5a9c77b3be66780ba09a16cdf273f46f3d59a399
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jul 14 01:19:35 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jul 14 01:19:35 2021 +0900
[IMM32_APITEST] Add clientimc testcase (#3815)
- Add clientimc testcase to imm32_apitest.
- Add "precomp.h".
CORE-11700
---
modules/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(-)
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(a)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(a)gmail.com)
*/
-#include <ntstatus.h>
-#define WIN32_NO_STATUS
-#include <windows.h>
-#include <imm.h>
-#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 <ntstatus.h>
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <imm.h>
+#include <ddk/imm.h>
+#include <pseh/pseh2.h>
+#include <ndk/umtypes.h>
+#include <ndk/pstypes.h>
+#include "../../../win32ss/include/ntuser.h"
+#include <imm32_undoc.h>
+#include <ndk/rtlfuncs.h>
+#include <wine/test.h>
+#include <stdio.h>
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 <wine/test.h>
+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