mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[IMM32] Rewrite IMCC handling functions (#3788)
Rewrite ImmCreateIMCC, ImmDestroyIMCC, ImmReSizeIMCC, ImmGetIMCCLockCount, ImmUnlockIMCC, ImmLockIMCC, and ImmGetIMCCSize functions. CORE-11700
This commit is contained in:
parent
7962db4cc1
commit
6eeea92530
1 changed files with 40 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in a new issue