https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6eeea92530e15df5c6c7d…
commit 6eeea92530e15df5c6c7d5f3caa3daa7263f8d6e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jul 7 10:04:30 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jul 7 10:04:30 2021 +0900
[IMM32] Rewrite IMCC handling functions (#3788)
Rewrite ImmCreateIMCC, ImmDestroyIMCC, ImmReSizeIMCC, ImmGetIMCCLockCount,
ImmUnlockIMCC, ImmLockIMCC, and ImmGetIMCCSize functions. CORE-11700
---
dll/win32/imm32/imm.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index 5bdd37a031a..31bd2ac339f 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -3013,7 +3013,13 @@ DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC)
*/
HIMCC WINAPI ImmCreateIMCC(DWORD size)
{
+#ifdef __REACTOS__
+ if (size < 4)
+ size = 4;
+ return LocalAlloc(LHND, size);
+#else
return GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, size);
+#endif
}
/***********************************************************************
@@ -3021,7 +3027,13 @@ HIMCC WINAPI ImmCreateIMCC(DWORD size)
*/
HIMCC WINAPI ImmDestroyIMCC(HIMCC block)
{
+#ifdef __REACTOS__
+ if (block)
+ return LocalFree(block);
+ return NULL;
+#else
return GlobalFree(block);
+#endif
}
/***********************************************************************
@@ -3029,7 +3041,13 @@ HIMCC WINAPI ImmDestroyIMCC(HIMCC block)
*/
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
{
+#ifdef __REACTOS__
+ if (imcc)
+ return LocalLock(imcc);
+ return NULL;
+#else
return GlobalLock(imcc);
+#endif
}
/***********************************************************************
@@ -3037,7 +3055,13 @@ LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
*/
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
{
+#ifdef __REACTOS__
+ if (imcc)
+ return LocalUnlock(imcc);
+ return FALSE;
+#else
return GlobalUnlock(imcc);
+#endif
}
/***********************************************************************
@@ -3045,7 +3069,11 @@ BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
*/
DWORD WINAPI ImmGetIMCCLockCount(HIMCC imcc)
{
+#ifdef __REACTOS__
+ return LocalFlags(imcc) & LMEM_LOCKCOUNT;
+#else
return GlobalFlags(imcc) & GMEM_LOCKCOUNT;
+#endif
}
/***********************************************************************
@@ -3053,7 +3081,13 @@ DWORD WINAPI ImmGetIMCCLockCount(HIMCC imcc)
*/
HIMCC WINAPI ImmReSizeIMCC(HIMCC imcc, DWORD size)
{
+#ifdef __REACTOS__
+ if (!imcc)
+ return NULL;
+ return LocalReAlloc(imcc, size, LHND);
+#else
return GlobalReAlloc(imcc, size, GMEM_ZEROINIT | GMEM_MOVEABLE);
+#endif
}
/***********************************************************************
@@ -3061,7 +3095,13 @@ HIMCC WINAPI ImmReSizeIMCC(HIMCC imcc, DWORD size)
*/
DWORD WINAPI ImmGetIMCCSize(HIMCC imcc)
{
+#ifdef __REACTOS__
+ if (imcc)
+ return LocalSize(imcc);
+ return 0;
+#else
return GlobalSize(imcc);
+#endif
}
/***********************************************************************