Previously, ImmGenerateMessage could return early when ImmLockIMCC(ctx->hMsgBuf) failed, without unlocking the HIMC obtained via ImmLockIMC. This could leave the HIMC locked and lead to resource leaks.
This patch adds calls to ImmUnlockIMC(himc) at all early return points, and also unlocks the HIMC before returning TRUE at the end, ensuring that every ImmLockIMC call is properly balanced with a corresponding ImmUnlockIMC.
Tested on: Ubuntu 25.10 & deepin Linux V25, Wine compiled from master branch. No functional behavior of message dispatch is changed.
Signed-off-by: chenzhengyong chenzhengyong@uniontech.com