Byeongsik Jeon (@bsjeon) commented about dlls/imm32/imm.c:
HeapFree(GetProcessHeap(),0,lpszwReading);
HeapFree(GetProcessHeap(),0,lpszwRegister);
return rc;
}
- }
- if (!ime->hIME || !ime->pImeEnumRegisterWord) return 0;
- if (!is_kbd_ime_unicode( ime ))
ret = ime->pImeEnumRegisterWord( (REGISTERWORDENUMPROCW)procA, (const WCHAR *)readingA,
elsestyle, (const WCHAR *)stringA, user );
return 0;
- {
WCHAR *readingW = strdupAtoW( readingA ), *stringW = strdupAtoW( stringA );
ret = ime->pImeEnumRegisterWord( (REGISTERWORDENUMPROCW)procA, readingW, style, stringW, user );
In my opinion, some more little code is needed here.
In the Unicode IME, ImeEnumRegisterWord() passes a Unicode string as a parameter to the callback function. For this reason, instead of passing procA directly to ImeEnumRegisterWord(), you need to pass a wrapping callback function that changes the string encoding(W to A).
The wrapping callback function must know the address of procA. My suggestion is to pass the address of the structure that stores procA and 'user' instead of 'user' as a parameter to ImeEnumRegisterWord(). The wrapping callback function can get them back as the last parameter.