4 * Copyright 1998 Patrik Stridvall
5 * Copyright 2002, 2003, 2007 CodeWeavers, Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/debug.h"
35 #include "wine/list.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(imm
);
39 typedef struct tagIMCCInternal
45 #define MAKE_FUNCPTR(f) typeof(f) * p##f
46 typedef struct _tagImmHkl
{
51 WCHAR imeClassName
[17]; /* 16 character max */
54 /* Function Pointers */
55 MAKE_FUNCPTR(ImeInquire
);
56 MAKE_FUNCPTR(ImeConfigure
);
57 MAKE_FUNCPTR(ImeDestroy
);
58 MAKE_FUNCPTR(ImeEscape
);
59 MAKE_FUNCPTR(ImeSelect
);
60 MAKE_FUNCPTR(ImeSetActiveContext
);
61 MAKE_FUNCPTR(ImeToAsciiEx
);
62 MAKE_FUNCPTR(NotifyIME
);
63 MAKE_FUNCPTR(ImeRegisterWord
);
64 MAKE_FUNCPTR(ImeUnregisterWord
);
65 MAKE_FUNCPTR(ImeEnumRegisterWord
);
66 MAKE_FUNCPTR(ImeSetCompositionString
);
67 MAKE_FUNCPTR(ImeConversionList
);
68 MAKE_FUNCPTR(ImeProcessKey
);
69 MAKE_FUNCPTR(ImeGetRegisterWordStyle
);
70 MAKE_FUNCPTR(ImeGetImeMenuItems
);
74 typedef struct tagInputContextData
83 typedef struct _tagTRANSMSG
{
87 } TRANSMSG
, *LPTRANSMSG
;
89 typedef struct _tagIMMThreadData
{
94 static HANDLE hImeInst
;
95 static DWORD tlsIndex
= 0;
96 static struct list ImmHklList
= LIST_INIT(ImmHklList
);
99 static UINT WM_MSIME_SERVICE
;
100 static UINT WM_MSIME_RECONVERTOPTIONS
;
101 static UINT WM_MSIME_MOUSE
;
102 static UINT WM_MSIME_RECONVERTREQUEST
;
103 static UINT WM_MSIME_RECONVERT
;
104 static UINT WM_MSIME_QUERYPOSITION
;
105 static UINT WM_MSIME_DOCUMENTFEED
;
107 static const WCHAR szwWineIMCProperty
[] = {'W','i','n','e','I','m','m','H','I','M','C','P','r','o','p','e','r','t','y',0};
109 #define is_himc_ime_unicode(p) (p->immKbd->imeInfo.fdwProperty & IME_PROP_UNICODE)
110 #define is_kbd_ime_unicode(p) (p->imeInfo.fdwProperty & IME_PROP_UNICODE)
112 static BOOL
IMM_DestroyContext(HIMC hIMC
);
114 static inline WCHAR
*strdupAtoW( const char *str
)
119 DWORD len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
120 if ((ret
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) )))
121 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
126 static inline CHAR
*strdupWtoA( const WCHAR
*str
)
131 DWORD len
= WideCharToMultiByte( CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
132 if ((ret
= HeapAlloc( GetProcessHeap(), 0, len
)))
133 WideCharToMultiByte( CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
138 static IMMThreadData
* IMM_GetThreadData(void)
140 return (IMMThreadData
*)TlsGetValue(tlsIndex
);
143 static void IMM_InitThreadData(void)
145 IMMThreadData
* data
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
146 sizeof(IMMThreadData
));
147 TlsSetValue(tlsIndex
,data
);
149 TRACE("Thread Data Created\n");
152 static void IMM_FreeThreadData(void)
154 IMMThreadData
* data
= TlsGetValue(tlsIndex
);
155 IMM_DestroyContext(data
->defaultContext
);
156 DestroyWindow(data
->hwndDefault
);
157 HeapFree(GetProcessHeap(),0,data
);
158 TRACE("Thread Data Destroyed\n");
161 static HMODULE
LoadDefaultWineIME(void)
163 char buffer
[MAX_PATH
], libname
[32], *name
, *next
;
167 TRACE("Attempting to fall back to wine default IME\n");
169 strcpy( buffer
, "x11" ); /* default value */
170 /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
171 if (!RegOpenKeyA( HKEY_CURRENT_USER
, "Software\\Wine\\Drivers", &hkey
))
173 DWORD type
, count
= sizeof(buffer
);
174 RegQueryValueExA( hkey
, "Ime", 0, &type
, (LPBYTE
) buffer
, &count
);
181 next
= strchr( name
, ',' );
182 if (next
) *next
++ = 0;
184 snprintf( libname
, sizeof(libname
), "wine%s.drv", name
);
185 if ((module
= LoadLibraryA( libname
)) != 0) break;
192 /* ImmHkl loading and freeing */
193 #define LOAD_FUNCPTR(f) if((ptr->p##f = (LPVOID)GetProcAddress(ptr->hIME, #f)) == NULL){WARN("Can't find function %s in ime\n", #f);}
194 static ImmHkl
*IMM_GetImmHkl(HKL hkl
)
197 WCHAR filename
[MAX_PATH
];
199 TRACE("Seeking ime for keyboard 0x%x\n",(unsigned)hkl
);
201 LIST_FOR_EACH_ENTRY(ptr
, &ImmHklList
, ImmHkl
, entry
)
206 /* not found... create it */
208 ptr
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(ImmHkl
));
211 if (ImmGetIMEFileNameW(hkl
, filename
, MAX_PATH
)) ptr
->hIME
= LoadLibraryW(filename
);
213 ptr
->hIME
= LoadDefaultWineIME();
216 LOAD_FUNCPTR(ImeInquire
);
217 if (!ptr
->pImeInquire
|| !ptr
->pImeInquire(&ptr
->imeInfo
, ptr
->imeClassName
, NULL
))
219 FreeLibrary(ptr
->hIME
);
224 LOAD_FUNCPTR(ImeDestroy
);
225 LOAD_FUNCPTR(ImeSelect
);
226 if (!ptr
->pImeSelect
|| !ptr
->pImeDestroy
)
228 FreeLibrary(ptr
->hIME
);
233 LOAD_FUNCPTR(ImeConfigure
);
234 LOAD_FUNCPTR(ImeEscape
);
235 LOAD_FUNCPTR(ImeSetActiveContext
);
236 LOAD_FUNCPTR(ImeToAsciiEx
);
237 LOAD_FUNCPTR(NotifyIME
);
238 LOAD_FUNCPTR(ImeRegisterWord
);
239 LOAD_FUNCPTR(ImeUnregisterWord
);
240 LOAD_FUNCPTR(ImeEnumRegisterWord
);
241 LOAD_FUNCPTR(ImeSetCompositionString
);
242 LOAD_FUNCPTR(ImeConversionList
);
243 LOAD_FUNCPTR(ImeProcessKey
);
244 LOAD_FUNCPTR(ImeGetRegisterWordStyle
);
245 LOAD_FUNCPTR(ImeGetImeMenuItems
);
246 /* make sure our classname is WCHAR */
247 if (!is_kbd_ime_unicode(ptr
))
250 MultiByteToWideChar(CP_ACP
, 0, (LPSTR
)ptr
->imeClassName
,
252 lstrcpyW(ptr
->imeClassName
, bufW
);
257 list_add_head(&ImmHklList
,&ptr
->entry
);
263 static void IMM_FreeAllImmHkl(void)
265 ImmHkl
*ptr
,*cursor2
;
267 LIST_FOR_EACH_ENTRY_SAFE(ptr
, cursor2
, &ImmHklList
, ImmHkl
, entry
)
269 list_remove(&ptr
->entry
);
273 FreeLibrary(ptr
->hIME
);
275 HeapFree(GetProcessHeap(),0,ptr
);
279 static void IMM_RegisterMessages(void)
281 WM_MSIME_SERVICE
= RegisterWindowMessageA("MSIMEService");
282 WM_MSIME_RECONVERTOPTIONS
= RegisterWindowMessageA("MSIMEReconvertOptions");
283 WM_MSIME_MOUSE
= RegisterWindowMessageA("MSIMEMouseOperation");
284 WM_MSIME_RECONVERTREQUEST
= RegisterWindowMessageA("MSIMEReconvertRequest");
285 WM_MSIME_RECONVERT
= RegisterWindowMessageA("MSIMEReconvert");
286 WM_MSIME_QUERYPOSITION
= RegisterWindowMessageA("MSIMEQueryPosition");
287 WM_MSIME_DOCUMENTFEED
= RegisterWindowMessageA("MSIMEDocumentFeed");
290 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpReserved
)
292 TRACE("%p, %x, %p\n",hInstDLL
,fdwReason
,lpReserved
);
295 case DLL_PROCESS_ATTACH
:
297 IMM_RegisterMessages();
298 tlsIndex
= TlsAlloc();
299 IMM_InitThreadData();
301 case DLL_THREAD_ATTACH
:
302 IMM_InitThreadData();
304 case DLL_THREAD_DETACH
:
305 IMM_FreeThreadData();
307 case DLL_PROCESS_DETACH
:
308 IMM_FreeThreadData();
316 /* for posting messages as the IME */
317 static void ImmInternalPostIMEMessage(InputContextData
*data
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
319 HWND target
= GetFocus();
321 PostMessageW(data
->IMC
.hWnd
,msg
,wParam
,lParam
);
323 PostMessageW(target
, msg
, wParam
, lParam
);
326 static LRESULT
ImmInternalSendIMENotify(InputContextData
*data
, WPARAM notify
, LPARAM lParam
)
330 target
= data
->IMC
.hWnd
;
331 if (!target
) target
= GetFocus();
334 return SendMessageW(target
, WM_IME_NOTIFY
, notify
, lParam
);
339 static HIMCC
ImmCreateBlankCompStr(void)
342 LPCOMPOSITIONSTRING ptr
;
343 rc
= ImmCreateIMCC(sizeof(COMPOSITIONSTRING
));
344 ptr
= (LPCOMPOSITIONSTRING
)ImmLockIMCC(rc
);
345 memset(ptr
,0,sizeof(COMPOSITIONSTRING
));
346 ptr
->dwSize
= sizeof(COMPOSITIONSTRING
);
351 /***********************************************************************
352 * ImmAssociateContext (IMM32.@)
354 HIMC WINAPI
ImmAssociateContext(HWND hWnd
, HIMC hIMC
)
357 InputContextData
*data
= (InputContextData
*)hIMC
;
359 TRACE("(%p, %p):\n", hWnd
, hIMC
);
361 if (!IMM_GetThreadData()->defaultContext
)
362 IMM_GetThreadData()->defaultContext
= ImmCreateContext();
365 * If already associated just return
367 if (hIMC
&& data
->IMC
.hWnd
== hWnd
)
372 old
= (HIMC
)RemovePropW(hWnd
,szwWineIMCProperty
);
375 old
= IMM_GetThreadData()->defaultContext
;
376 else if (old
== (HIMC
)-1)
379 if (hIMC
!= IMM_GetThreadData()->defaultContext
)
381 if (hIMC
== NULL
) /* Meaning disable imm for that window*/
382 SetPropW(hWnd
,szwWineIMCProperty
,(HANDLE
)-1);
384 SetPropW(hWnd
,szwWineIMCProperty
,(HANDLE
)hIMC
);
391 if (IsWindow(data
->IMC
.hWnd
))
394 * Post a message that your context is switching
396 SendMessageW(data
->IMC
.hWnd
, WM_IME_SETCONTEXT
, FALSE
, ISC_SHOWUIALL
);
399 data
->IMC
.hWnd
= hWnd
;
401 if (IsWindow(data
->IMC
.hWnd
))
404 * Post a message that your context is switching
406 SendMessageW(data
->IMC
.hWnd
, WM_IME_SETCONTEXT
, TRUE
, ISC_SHOWUIALL
);
412 /***********************************************************************
413 * ImmAssociateContextEx (IMM32.@)
415 BOOL WINAPI
ImmAssociateContextEx(HWND hWnd
, HIMC hIMC
, DWORD dwFlags
)
417 FIXME("(%p, %p, %d): stub\n", hWnd
, hIMC
, dwFlags
);
418 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
422 /***********************************************************************
423 * ImmConfigureIMEA (IMM32.@)
425 BOOL WINAPI
ImmConfigureIMEA(
426 HKL hKL
, HWND hWnd
, DWORD dwMode
, LPVOID lpData
)
428 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
430 TRACE("(%p, %p, %d, %p):\n", hKL
, hWnd
, dwMode
, lpData
);
432 if (immHkl
->hIME
&& immHkl
->pImeConfigure
)
434 if (dwMode
!= IME_CONFIG_REGISTERWORD
|| !is_kbd_ime_unicode(immHkl
))
435 return immHkl
->pImeConfigure(hKL
,hWnd
,dwMode
,lpData
);
439 REGISTERWORDA
*rwa
= (REGISTERWORDA
*)lpData
;
442 rww
.lpReading
= strdupAtoW(rwa
->lpReading
);
443 rww
.lpWord
= strdupAtoW(rwa
->lpWord
);
444 rc
= immHkl
->pImeConfigure(hKL
,hWnd
,dwMode
,&rww
);
445 HeapFree(GetProcessHeap(),0,rww
.lpReading
);
446 HeapFree(GetProcessHeap(),0,rww
.lpWord
);
454 /***********************************************************************
455 * ImmConfigureIMEW (IMM32.@)
457 BOOL WINAPI
ImmConfigureIMEW(
458 HKL hKL
, HWND hWnd
, DWORD dwMode
, LPVOID lpData
)
460 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
462 TRACE("(%p, %p, %d, %p):\n", hKL
, hWnd
, dwMode
, lpData
);
464 if (immHkl
->hIME
&& immHkl
->pImeConfigure
)
466 if (dwMode
!= IME_CONFIG_REGISTERWORD
|| is_kbd_ime_unicode(immHkl
))
467 return immHkl
->pImeConfigure(hKL
,hWnd
,dwMode
,lpData
);
470 REGISTERWORDW
*rww
= (REGISTERWORDW
*)lpData
;
474 rwa
.lpReading
= strdupWtoA(rww
->lpReading
);
475 rwa
.lpWord
= strdupWtoA(rww
->lpWord
);
476 rc
= immHkl
->pImeConfigure(hKL
,hWnd
,dwMode
,&rwa
);
477 HeapFree(GetProcessHeap(),0,rwa
.lpReading
);
478 HeapFree(GetProcessHeap(),0,rwa
.lpWord
);
486 /***********************************************************************
487 * ImmCreateContext (IMM32.@)
489 HIMC WINAPI
ImmCreateContext(void)
491 InputContextData
*new_context
;
493 new_context
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(InputContextData
));
496 new_context
->immKbd
= IMM_GetImmHkl(GetKeyboardLayout(0));
498 if (!new_context
->immKbd
->hIME
)
500 TRACE("IME dll could not be loaded\n");
501 HeapFree(GetProcessHeap(),0,new_context
);
505 /* hCompStr is never NULL */
506 new_context
->IMC
.hCompStr
= ImmCreateBlankCompStr();
507 new_context
->IMC
.hMsgBuf
= ImmCreateIMCC(1);
509 /* Initialize the IME Private */
510 new_context
->IMC
.hPrivate
= ImmCreateIMCC(new_context
->immKbd
->imeInfo
.dwPrivateDataSize
);
512 if (!new_context
->immKbd
->pImeSelect(new_context
, TRUE
))
514 TRACE("Selection of IME failed\n");
515 IMM_DestroyContext(new_context
);
519 new_context
->immKbd
->uSelected
++;
520 TRACE("Created context 0x%x\n",(UINT
)new_context
);
522 return (HIMC
)new_context
;
525 static BOOL
IMM_DestroyContext(HIMC hIMC
)
527 InputContextData
*data
= (InputContextData
*)hIMC
;
529 TRACE("Destroying %p\n",hIMC
);
533 data
->immKbd
->uSelected
--;
534 data
->immKbd
->pImeSelect(hIMC
, FALSE
);
536 if (IMM_GetThreadData()->hwndDefault
== data
->imeWnd
)
537 IMM_GetThreadData()->hwndDefault
= NULL
;
538 DestroyWindow(data
->imeWnd
);
540 ImmDestroyIMCC(data
->IMC
.hCompStr
);
541 ImmDestroyIMCC(data
->IMC
.hCandInfo
);
542 ImmDestroyIMCC(data
->IMC
.hGuideLine
);
543 ImmDestroyIMCC(data
->IMC
.hPrivate
);
544 ImmDestroyIMCC(data
->IMC
.hMsgBuf
);
546 HeapFree(GetProcessHeap(),0,data
);
551 /***********************************************************************
552 * ImmDestroyContext (IMM32.@)
554 BOOL WINAPI
ImmDestroyContext(HIMC hIMC
)
556 if (hIMC
!= IMM_GetThreadData()->defaultContext
)
557 return IMM_DestroyContext(hIMC
);
562 /***********************************************************************
563 * ImmDisableIME (IMM32.@)
565 BOOL WINAPI
ImmDisableIME(DWORD idThread
)
567 FIXME("(%d): stub\n", idThread
);
571 /***********************************************************************
572 * ImmEnumRegisterWordA (IMM32.@)
574 UINT WINAPI
ImmEnumRegisterWordA(
575 HKL hKL
, REGISTERWORDENUMPROCA lpfnEnumProc
,
576 LPCSTR lpszReading
, DWORD dwStyle
,
577 LPCSTR lpszRegister
, LPVOID lpData
)
579 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
580 TRACE("(%p, %p, %s, %d, %s, %p):\n", hKL
, lpfnEnumProc
,
581 debugstr_a(lpszReading
), dwStyle
, debugstr_a(lpszRegister
), lpData
);
582 if (immHkl
->hIME
&& immHkl
->pImeEnumRegisterWord
)
584 if (!is_kbd_ime_unicode(immHkl
))
585 return immHkl
->pImeEnumRegisterWord((REGISTERWORDENUMPROCW
)lpfnEnumProc
,
586 (LPCWSTR
)lpszReading
, dwStyle
, (LPCWSTR
)lpszRegister
, lpData
);
589 FIXME("A procedure called with W ime back end\n");
590 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
598 /***********************************************************************
599 * ImmEnumRegisterWordW (IMM32.@)
601 UINT WINAPI
ImmEnumRegisterWordW(
602 HKL hKL
, REGISTERWORDENUMPROCW lpfnEnumProc
,
603 LPCWSTR lpszReading
, DWORD dwStyle
,
604 LPCWSTR lpszRegister
, LPVOID lpData
)
606 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
607 TRACE("(%p, %p, %s, %d, %s, %p):\n", hKL
, lpfnEnumProc
,
608 debugstr_w(lpszReading
), dwStyle
, debugstr_w(lpszRegister
), lpData
);
609 if (immHkl
->hIME
&& immHkl
->pImeEnumRegisterWord
)
611 if (is_kbd_ime_unicode(immHkl
))
612 return immHkl
->pImeEnumRegisterWord(lpfnEnumProc
, lpszReading
, dwStyle
,
613 lpszRegister
, lpData
);
616 FIXME("W procedure called with A ime back end\n");
617 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
625 /***********************************************************************
626 * ImmEscapeA (IMM32.@)
628 LRESULT WINAPI
ImmEscapeA(
630 UINT uEscape
, LPVOID lpData
)
632 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
633 TRACE("(%p, %p, %d, %p):\n", hKL
, hIMC
, uEscape
, lpData
);
635 if (immHkl
->hIME
&& immHkl
->pImeEscape
)
637 if (!is_kbd_ime_unicode(immHkl
))
638 return immHkl
->pImeEscape(hIMC
,uEscape
,lpData
);
641 FIXME("A procedure called with W ime back end\n");
642 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
650 /***********************************************************************
651 * ImmEscapeW (IMM32.@)
653 LRESULT WINAPI
ImmEscapeW(
655 UINT uEscape
, LPVOID lpData
)
657 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
658 TRACE("(%p, %p, %d, %p):\n", hKL
, hIMC
, uEscape
, lpData
);
660 if (immHkl
->hIME
&& immHkl
->pImeEscape
)
662 if (is_kbd_ime_unicode(immHkl
))
663 return immHkl
->pImeEscape(hIMC
,uEscape
,lpData
);
666 FIXME("W procedure called with A ime back end\n");
667 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
675 /***********************************************************************
676 * ImmGetCandidateListA (IMM32.@)
678 DWORD WINAPI
ImmGetCandidateListA(
679 HIMC hIMC
, DWORD deIndex
,
680 LPCANDIDATELIST lpCandList
, DWORD dwBufLen
)
682 FIXME("(%p, %d, %p, %d): stub\n",
686 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
690 /***********************************************************************
691 * ImmGetCandidateListCountA (IMM32.@)
693 DWORD WINAPI
ImmGetCandidateListCountA(
694 HIMC hIMC
, LPDWORD lpdwListCount
)
696 FIXME("(%p, %p): stub\n", hIMC
, lpdwListCount
);
697 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
701 /***********************************************************************
702 * ImmGetCandidateListCountW (IMM32.@)
704 DWORD WINAPI
ImmGetCandidateListCountW(
705 HIMC hIMC
, LPDWORD lpdwListCount
)
707 FIXME("(%p, %p): stub\n", hIMC
, lpdwListCount
);
708 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
712 /***********************************************************************
713 * ImmGetCandidateListW (IMM32.@)
715 DWORD WINAPI
ImmGetCandidateListW(
716 HIMC hIMC
, DWORD deIndex
,
717 LPCANDIDATELIST lpCandList
, DWORD dwBufLen
)
719 FIXME("(%p, %d, %p, %d): stub\n",
723 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
727 /***********************************************************************
728 * ImmGetCandidateWindow (IMM32.@)
730 BOOL WINAPI
ImmGetCandidateWindow(
731 HIMC hIMC
, DWORD dwBufLen
, LPCANDIDATEFORM lpCandidate
)
733 FIXME("(%p, %d, %p): stub\n", hIMC
, dwBufLen
, lpCandidate
);
734 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
738 /***********************************************************************
739 * ImmGetCompositionFontA (IMM32.@)
741 BOOL WINAPI
ImmGetCompositionFontA(HIMC hIMC
, LPLOGFONTA lplf
)
746 TRACE("(%p, %p):\n", hIMC
, lplf
);
748 rc
= ImmGetCompositionFontW(hIMC
,&lfW
);
751 memcpy(lplf
,&lfW
,sizeof(LOGFONTA
));
752 WideCharToMultiByte(CP_ACP
, 0, lfW
.lfFaceName
, -1, lplf
->lfFaceName
,
753 LF_FACESIZE
, NULL
, NULL
);
758 /***********************************************************************
759 * ImmGetCompositionFontW (IMM32.@)
761 BOOL WINAPI
ImmGetCompositionFontW(HIMC hIMC
, LPLOGFONTW lplf
)
763 InputContextData
*data
= (InputContextData
*)hIMC
;
765 TRACE("(%p, %p):\n", hIMC
, lplf
);
770 *lplf
= data
->IMC
.lfFont
.W
;
775 /***********************************************************************
776 * ImmGetCompositionStringA (IMM32.@)
778 LONG WINAPI
ImmGetCompositionStringA(
779 HIMC hIMC
, DWORD dwIndex
, LPVOID lpBuf
, DWORD dwBufLen
)
783 InputContextData
*data
= (InputContextData
*)hIMC
;
784 LPCOMPOSITIONSTRING compstr
;
787 TRACE("(%p, 0x%x, %p, %d)\n", hIMC
, dwIndex
, lpBuf
, dwBufLen
);
792 if (!data
->IMC
.hCompStr
)
795 compdata
= ImmLockIMCC(data
->IMC
.hCompStr
);
796 compstr
= (LPCOMPOSITIONSTRING
)compdata
;
798 if (dwIndex
== GCS_RESULTSTR
&& compstr
->dwResultStrLen
> 0 &&
799 compstr
->dwResultStrOffset
> 0)
801 LPWSTR ResultStr
= (LPWSTR
)(compdata
+ compstr
->dwResultStrOffset
);
803 TRACE("GSC_RESULTSTR %p %i\n",ResultStr
,
804 compstr
->dwResultStrLen
);
806 buf
= HeapAlloc( GetProcessHeap(), 0, compstr
->dwResultStrLen
* 3 );
807 rc
= WideCharToMultiByte(CP_ACP
, 0, ResultStr
,
808 compstr
->dwResultStrLen
, buf
,
809 compstr
->dwResultStrLen
* 3, NULL
, NULL
);
811 memcpy(lpBuf
,buf
,rc
);
813 HeapFree( GetProcessHeap(), 0, buf
);
815 else if (dwIndex
== GCS_COMPSTR
&& compstr
->dwCompStrLen
> 0 &&
816 compstr
->dwCompStrOffset
> 0)
818 LPWSTR CompString
= (LPWSTR
)(compdata
+ compstr
->dwCompStrOffset
);
820 TRACE("GSC_COMPSTR %p %i\n", CompString
, compstr
->dwCompStrLen
);
822 buf
= HeapAlloc( GetProcessHeap(), 0, compstr
->dwCompStrLen
* 3 );
823 rc
= WideCharToMultiByte(CP_ACP
, 0, CompString
,
824 compstr
->dwCompStrLen
, buf
,
825 compstr
->dwCompStrLen
* 3, NULL
, NULL
);
827 memcpy(lpBuf
,buf
,rc
);
828 HeapFree( GetProcessHeap(), 0, buf
);
830 else if (dwIndex
== GCS_COMPATTR
&& compstr
->dwCompAttrLen
> 0 &&
831 compstr
->dwCompAttrOffset
> 0)
833 LPWSTR Compattr
= (LPWSTR
)(compdata
+ compstr
->dwCompAttrOffset
);
834 TRACE("GSC_COMPATTR %p %i\n", Compattr
, compstr
->dwCompAttrLen
);
836 rc
= compstr
->dwCompAttrLen
;
838 memcpy(lpBuf
,Compattr
,rc
);
840 else if (dwIndex
== GCS_COMPCLAUSE
&& compstr
->dwCompClauseLen
> 0 &&
841 compstr
->dwCompClauseOffset
> 0)
843 LPWSTR Compclause
= (LPWSTR
)(compdata
+ compstr
->dwCompClauseOffset
);
844 TRACE("GSC_COMPCLAUSE %p %i\n", Compclause
, compstr
->dwCompClauseLen
);
846 rc
= compstr
->dwCompClauseLen
;
847 if (dwBufLen
>= compstr
->dwCompClauseLen
)
848 memcpy(lpBuf
,Compclause
,rc
);
850 else if (dwIndex
== GCS_RESULTCLAUSE
&& compstr
->dwResultClauseLen
> 0 &&
851 compstr
->dwResultClauseOffset
> 0)
853 LPWSTR Resultclause
= (LPWSTR
)(compdata
+ compstr
->dwResultClauseOffset
);
854 TRACE("GSC_RESULTCLAUSE %p %i\n", Resultclause
, compstr
->dwResultClauseLen
);
856 rc
= compstr
->dwResultClauseLen
;
857 if (dwBufLen
>= compstr
->dwResultClauseLen
)
858 memcpy(lpBuf
,Resultclause
,rc
);
860 else if (dwIndex
== GCS_CURSORPOS
)
862 TRACE("GSC_CURSORPOS\n");
863 rc
= compstr
->dwCursorPos
;
865 else if (dwIndex
== GCS_DELTASTART
)
867 TRACE("GCS_DELTASTART\n");
868 rc
= compstr
->dwDeltaStart
;
872 FIXME("Unhandled index 0x%x\n",dwIndex
);
875 ImmUnlockIMCC(data
->IMC
.hCompStr
);
880 /***********************************************************************
881 * ImmGetCompositionStringW (IMM32.@)
883 LONG WINAPI
ImmGetCompositionStringW(
884 HIMC hIMC
, DWORD dwIndex
,
885 LPVOID lpBuf
, DWORD dwBufLen
)
888 InputContextData
*data
= (InputContextData
*)hIMC
;
889 LPCOMPOSITIONSTRING compstr
;
892 TRACE("(%p, 0x%x, %p, %d)\n", hIMC
, dwIndex
, lpBuf
, dwBufLen
);
897 if (!data
->IMC
.hCompStr
)
900 compdata
= ImmLockIMCC(data
->IMC
.hCompStr
);
901 compstr
= (LPCOMPOSITIONSTRING
)compdata
;
903 if (dwIndex
== GCS_RESULTSTR
&& compstr
->dwResultStrLen
> 0 &&
904 compstr
->dwResultStrOffset
> 0)
906 LPWSTR ResultStr
= (LPWSTR
)(compdata
+ compstr
->dwResultStrOffset
);
907 rc
= compstr
->dwResultStrLen
* sizeof(WCHAR
);
910 memcpy(lpBuf
,ResultStr
,rc
);
912 else if (dwIndex
== GCS_RESULTREADSTR
&& compstr
->dwResultReadStrLen
> 0 &&
913 compstr
->dwResultReadStrOffset
> 0)
915 LPWSTR ResultReadString
= (LPWSTR
)(compdata
+ compstr
->dwResultReadStrOffset
);
917 rc
= compstr
->dwResultReadStrLen
* sizeof(WCHAR
);
919 memcpy(lpBuf
,ResultReadString
,rc
);
921 else if (dwIndex
== GCS_COMPSTR
&& compstr
->dwCompStrLen
> 0 &&
922 compstr
->dwCompStrOffset
> 0)
924 LPWSTR CompString
= (LPWSTR
)(compdata
+ compstr
->dwCompStrOffset
);
925 rc
= compstr
->dwCompStrLen
* sizeof(WCHAR
);
927 memcpy(lpBuf
,CompString
,rc
);
929 else if (dwIndex
== GCS_COMPATTR
&& compstr
->dwCompAttrLen
> 0 &&
930 compstr
->dwCompAttrOffset
> 0)
933 LPWSTR Compattr
= (LPWSTR
)(compdata
+ compstr
->dwCompAttrOffset
);
935 rc
= compstr
->dwCompAttrLen
;
937 memcpy(lpBuf
,Compattr
,rc
);
939 else if (dwIndex
== GCS_COMPCLAUSE
&& compstr
->dwCompClauseLen
> 0 &&
940 compstr
->dwCompClauseOffset
> 0)
942 LPWSTR Compclause
= (LPWSTR
)(compdata
+ compstr
->dwCompClauseOffset
);
944 rc
= compstr
->dwCompClauseLen
;
945 if (dwBufLen
>= compstr
->dwCompClauseLen
)
946 memcpy(lpBuf
,Compclause
,rc
);
948 else if (dwIndex
== GCS_COMPREADSTR
&& compstr
->dwCompReadStrLen
> 0 &&
949 compstr
->dwCompReadStrOffset
> 0)
951 LPWSTR CompReadString
= (LPWSTR
)(compdata
+ compstr
->dwCompReadStrOffset
);
953 rc
= compstr
->dwCompReadStrLen
* sizeof(WCHAR
);
956 memcpy(lpBuf
,CompReadString
,rc
);
958 else if (dwIndex
== GCS_CURSORPOS
)
960 TRACE("GSC_CURSORPOS\n");
961 rc
= compstr
->dwCursorPos
;
963 else if (dwIndex
== GCS_DELTASTART
)
965 TRACE("GCS_DELTASTART\n");
966 rc
= compstr
->dwDeltaStart
;
970 FIXME("Unhandled index 0x%x\n",dwIndex
);
973 ImmUnlockIMCC(data
->IMC
.hCompStr
);
978 /***********************************************************************
979 * ImmGetCompositionWindow (IMM32.@)
981 BOOL WINAPI
ImmGetCompositionWindow(HIMC hIMC
, LPCOMPOSITIONFORM lpCompForm
)
983 InputContextData
*data
= (InputContextData
*)hIMC
;
985 TRACE("(%p, %p)\n", hIMC
, lpCompForm
);
990 *lpCompForm
= data
->IMC
.cfCompForm
;
994 /***********************************************************************
995 * ImmGetContext (IMM32.@)
998 HIMC WINAPI
ImmGetContext(HWND hWnd
)
1002 TRACE("%p\n", hWnd
);
1003 if (!IMM_GetThreadData()->defaultContext
)
1004 IMM_GetThreadData()->defaultContext
= ImmCreateContext();
1006 rc
= (HIMC
)GetPropW(hWnd
,szwWineIMCProperty
);
1009 else if (rc
== NULL
)
1010 rc
= IMM_GetThreadData()->defaultContext
;
1014 InputContextData
*data
= (InputContextData
*)rc
;
1015 data
->IMC
.hWnd
= hWnd
;
1017 TRACE("returning %p\n", rc
);
1022 /***********************************************************************
1023 * ImmGetConversionListA (IMM32.@)
1025 DWORD WINAPI
ImmGetConversionListA(
1027 LPCSTR pSrc
, LPCANDIDATELIST lpDst
,
1028 DWORD dwBufLen
, UINT uFlag
)
1030 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
1031 TRACE("(%p, %p, %s, %p, %d, %d):\n", hKL
, hIMC
, debugstr_a(pSrc
), lpDst
,
1033 if (immHkl
->hIME
&& immHkl
->pImeConversionList
)
1035 if (!is_kbd_ime_unicode(immHkl
))
1036 return immHkl
->pImeConversionList(hIMC
,(LPCWSTR
)pSrc
,lpDst
,dwBufLen
,uFlag
);
1039 FIXME("A procedure called with W ime back end\n");
1040 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1048 /***********************************************************************
1049 * ImmGetConversionListW (IMM32.@)
1051 DWORD WINAPI
ImmGetConversionListW(
1053 LPCWSTR pSrc
, LPCANDIDATELIST lpDst
,
1054 DWORD dwBufLen
, UINT uFlag
)
1056 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
1057 TRACE("(%p, %p, %s, %p, %d, %d):\n", hKL
, hIMC
, debugstr_w(pSrc
), lpDst
,
1059 if (immHkl
->hIME
&& immHkl
->pImeConversionList
)
1061 if (is_kbd_ime_unicode(immHkl
))
1062 return immHkl
->pImeConversionList(hIMC
,pSrc
,lpDst
,dwBufLen
,uFlag
);
1065 FIXME("W procedure called with A ime back end\n");
1066 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1074 /***********************************************************************
1075 * ImmGetConversionStatus (IMM32.@)
1077 BOOL WINAPI
ImmGetConversionStatus(
1078 HIMC hIMC
, LPDWORD lpfdwConversion
, LPDWORD lpfdwSentence
)
1080 TRACE("(%p, %p, %p): best guess\n", hIMC
, lpfdwConversion
, lpfdwSentence
);
1081 if (lpfdwConversion
)
1082 *lpfdwConversion
= IME_CMODE_NATIVE
;
1084 *lpfdwSentence
= IME_SMODE_NONE
;
1088 /***********************************************************************
1089 * ImmGetDefaultIMEWnd (IMM32.@)
1091 HWND WINAPI
ImmGetDefaultIMEWnd(HWND hWnd
)
1093 TRACE("Default is %x\n",(unsigned)IMM_GetThreadData()->hwndDefault
);
1094 return IMM_GetThreadData()->hwndDefault
;
1097 /***********************************************************************
1098 * ImmGetDescriptionA (IMM32.@)
1100 UINT WINAPI
ImmGetDescriptionA(
1101 HKL hKL
, LPSTR lpszDescription
, UINT uBufLen
)
1106 TRACE("%p %p %d\n", hKL
, lpszDescription
, uBufLen
);
1108 /* find out how many characters in the unicode buffer */
1109 len
= ImmGetDescriptionW( hKL
, NULL
, 0 );
1111 /* allocate a buffer of that size */
1112 buf
= HeapAlloc( GetProcessHeap(), 0, (len
+ 1) * sizeof (WCHAR
) );
1116 /* fetch the unicode buffer */
1117 len
= ImmGetDescriptionW( hKL
, buf
, len
+ 1 );
1119 /* convert it back to ASCII */
1120 len
= WideCharToMultiByte( CP_ACP
, 0, buf
, len
+ 1,
1121 lpszDescription
, uBufLen
, NULL
, NULL
);
1123 HeapFree( GetProcessHeap(), 0, buf
);
1128 /***********************************************************************
1129 * ImmGetDescriptionW (IMM32.@)
1131 UINT WINAPI
ImmGetDescriptionW(HKL hKL
, LPWSTR lpszDescription
, UINT uBufLen
)
1133 static const WCHAR name
[] = { 'W','i','n','e',' ','X','I','M',0 };
1135 FIXME("(%p, %p, %d): semi stub\n", hKL
, lpszDescription
, uBufLen
);
1137 if (!uBufLen
) return lstrlenW( name
);
1138 lstrcpynW( lpszDescription
, name
, uBufLen
);
1139 return lstrlenW( lpszDescription
);
1142 /***********************************************************************
1143 * ImmGetGuideLineA (IMM32.@)
1145 DWORD WINAPI
ImmGetGuideLineA(
1146 HIMC hIMC
, DWORD dwIndex
, LPSTR lpBuf
, DWORD dwBufLen
)
1148 FIXME("(%p, %d, %s, %d): stub\n",
1149 hIMC
, dwIndex
, debugstr_a(lpBuf
), dwBufLen
1151 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1155 /***********************************************************************
1156 * ImmGetGuideLineW (IMM32.@)
1158 DWORD WINAPI
ImmGetGuideLineW(HIMC hIMC
, DWORD dwIndex
, LPWSTR lpBuf
, DWORD dwBufLen
)
1160 FIXME("(%p, %d, %s, %d): stub\n",
1161 hIMC
, dwIndex
, debugstr_w(lpBuf
), dwBufLen
1163 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1167 /***********************************************************************
1168 * ImmGetIMEFileNameA (IMM32.@)
1170 UINT WINAPI
ImmGetIMEFileNameA( HKL hKL
, LPSTR lpszFileName
, UINT uBufLen
)
1173 UINT wBufLen
= uBufLen
;
1176 if (uBufLen
&& lpszFileName
)
1177 bufW
= HeapAlloc(GetProcessHeap(),0,uBufLen
* sizeof(WCHAR
));
1178 else /* We need this to get the number of byte required */
1180 bufW
= HeapAlloc(GetProcessHeap(),0,MAX_PATH
* sizeof(WCHAR
));
1184 rc
= ImmGetIMEFileNameW(hKL
,bufW
,wBufLen
);
1188 if (uBufLen
&& lpszFileName
)
1189 rc
= WideCharToMultiByte(CP_ACP
, 0, bufW
, -1, lpszFileName
,
1190 uBufLen
, NULL
, NULL
);
1191 else /* get the length */
1192 rc
= WideCharToMultiByte(CP_ACP
, 0, bufW
, -1, NULL
, 0, NULL
,
1196 HeapFree(GetProcessHeap(),0,bufW
);
1200 /***********************************************************************
1201 * ImmGetIMEFileNameW (IMM32.@)
1203 UINT WINAPI
ImmGetIMEFileNameW(HKL hKL
, LPWSTR lpszFileName
, UINT uBufLen
)
1205 static const WCHAR szImeFileW
[] = {'I','m','e',' ','F','i','l','e',0};
1206 static const WCHAR fmt
[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s','\\','%','0','8','x',0};
1211 WCHAR regKey
[sizeof(fmt
)/sizeof(WCHAR
)+8];
1213 wsprintfW( regKey
, fmt
, (unsigned)hKL
);
1214 rc
= RegOpenKeyW( HKEY_LOCAL_MACHINE
, regKey
, &hkey
);
1215 if (rc
!= ERROR_SUCCESS
)
1222 rc
= RegGetValueW(hkey
, NULL
, szImeFileW
, RRF_RT_REG_SZ
, NULL
, NULL
, &length
);
1224 if (rc
!= ERROR_SUCCESS
)
1230 if (length
> uBufLen
* sizeof(WCHAR
) || !lpszFileName
)
1235 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
1239 return length
/ sizeof(WCHAR
);
1242 RegGetValueW(hkey
, NULL
, szImeFileW
, RRF_RT_REG_SZ
, NULL
, lpszFileName
, &length
);
1246 return length
/ sizeof(WCHAR
);
1249 /***********************************************************************
1250 * ImmGetOpenStatus (IMM32.@)
1252 BOOL WINAPI
ImmGetOpenStatus(HIMC hIMC
)
1254 InputContextData
*data
= (InputContextData
*)hIMC
;
1258 FIXME("(%p): semi-stub\n", hIMC
);
1260 return data
->IMC
.fOpen
;
1263 /***********************************************************************
1264 * ImmGetProperty (IMM32.@)
1266 DWORD WINAPI
ImmGetProperty(HKL hKL
, DWORD fdwIndex
)
1271 TRACE("(%p, %d)\n", hKL
, fdwIndex
);
1272 kbd
= IMM_GetImmHkl(hKL
);
1274 if (kbd
&& kbd
->hIME
)
1278 case IGP_PROPERTY
: rc
= kbd
->imeInfo
.fdwProperty
; break;
1279 case IGP_CONVERSION
: rc
= kbd
->imeInfo
.fdwConversionCaps
; break;
1280 case IGP_SENTENCE
: rc
= kbd
->imeInfo
.fdwSentenceCaps
; break;
1281 case IGP_SETCOMPSTR
: rc
= kbd
->imeInfo
.fdwSCSCaps
; break;
1282 case IGP_SELECT
: rc
= kbd
->imeInfo
.fdwSelectCaps
; break;
1283 case IGP_GETIMEVERSION
: rc
= IMEVER_0400
; break;
1284 case IGP_UI
: rc
= 0; break;
1291 /***********************************************************************
1292 * ImmGetRegisterWordStyleA (IMM32.@)
1294 UINT WINAPI
ImmGetRegisterWordStyleA(
1295 HKL hKL
, UINT nItem
, LPSTYLEBUFA lpStyleBuf
)
1297 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
1298 TRACE("(%p, %d, %p):\n", hKL
, nItem
, lpStyleBuf
);
1299 if (immHkl
->hIME
&& immHkl
->pImeGetRegisterWordStyle
)
1301 if (!is_kbd_ime_unicode(immHkl
))
1302 return immHkl
->pImeGetRegisterWordStyle(nItem
,(LPSTYLEBUFW
)lpStyleBuf
);
1308 rc
= immHkl
->pImeGetRegisterWordStyle(nItem
,&sbw
);
1309 WideCharToMultiByte(CP_ACP
, 0, sbw
.szDescription
, -1,
1310 lpStyleBuf
->szDescription
, 32, NULL
, NULL
);
1311 lpStyleBuf
->dwStyle
= sbw
.dwStyle
;
1319 /***********************************************************************
1320 * ImmGetRegisterWordStyleW (IMM32.@)
1322 UINT WINAPI
ImmGetRegisterWordStyleW(
1323 HKL hKL
, UINT nItem
, LPSTYLEBUFW lpStyleBuf
)
1325 ImmHkl
*immHkl
= IMM_GetImmHkl(hKL
);
1326 TRACE("(%p, %d, %p):\n", hKL
, nItem
, lpStyleBuf
);
1327 if (immHkl
->hIME
&& immHkl
->pImeGetRegisterWordStyle
)
1329 if (is_kbd_ime_unicode(immHkl
))
1330 return immHkl
->pImeGetRegisterWordStyle(nItem
,lpStyleBuf
);
1336 rc
= immHkl
->pImeGetRegisterWordStyle(nItem
,(LPSTYLEBUFW
)&sba
);
1337 MultiByteToWideChar(CP_ACP
, 0, sba
.szDescription
, -1,
1338 lpStyleBuf
->szDescription
, 32);
1339 lpStyleBuf
->dwStyle
= sba
.dwStyle
;
1347 /***********************************************************************
1348 * ImmGetStatusWindowPos (IMM32.@)
1350 BOOL WINAPI
ImmGetStatusWindowPos(HIMC hIMC
, LPPOINT lpptPos
)
1352 FIXME("(%p, %p): stub\n", hIMC
, lpptPos
);
1353 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1357 /***********************************************************************
1358 * ImmGetVirtualKey (IMM32.@)
1360 UINT WINAPI
ImmGetVirtualKey(HWND hWnd
)
1362 OSVERSIONINFOA version
;
1363 FIXME("(%p): stub\n", hWnd
);
1364 GetVersionExA( &version
);
1365 switch(version
.dwPlatformId
)
1367 case VER_PLATFORM_WIN32_WINDOWS
:
1368 return VK_PROCESSKEY
;
1369 case VER_PLATFORM_WIN32_NT
:
1372 FIXME("%d not supported\n",version
.dwPlatformId
);
1373 return VK_PROCESSKEY
;
1377 /***********************************************************************
1378 * ImmInstallIMEA (IMM32.@)
1380 HKL WINAPI
ImmInstallIMEA(
1381 LPCSTR lpszIMEFileName
, LPCSTR lpszLayoutText
)
1383 FIXME("(%s, %s): stub\n",
1384 debugstr_a(lpszIMEFileName
), debugstr_a(lpszLayoutText
)
1386 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1390 /***********************************************************************
1391 * ImmInstallIMEW (IMM32.@)
1393 HKL WINAPI
ImmInstallIMEW(
1394 LPCWSTR lpszIMEFileName
, LPCWSTR lpszLayoutText
)
1396 FIXME("(%s, %s): stub\n",
1397 debugstr_w(lpszIMEFileName
), debugstr_w(lpszLayoutText
)
1399 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1403 /***********************************************************************
1404 * ImmIsIME (IMM32.@)
1406 BOOL WINAPI
ImmIsIME(HKL hKL
)
1409 TRACE("(%p):\n", hKL
);
1410 ptr
= IMM_GetImmHkl(hKL
);
1411 return (ptr
&& ptr
->hIME
);
1414 /***********************************************************************
1415 * ImmIsUIMessageA (IMM32.@)
1417 BOOL WINAPI
ImmIsUIMessageA(
1418 HWND hWndIME
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1422 TRACE("(%p, %x, %ld, %ld)\n", hWndIME
, msg
, wParam
, lParam
);
1423 if ((msg
>= WM_IME_STARTCOMPOSITION
&& msg
<= WM_IME_KEYLAST
) ||
1424 (msg
>= WM_IME_SETCONTEXT
&& msg
<= WM_IME_KEYUP
) ||
1425 (msg
== WM_MSIME_SERVICE
) ||
1426 (msg
== WM_MSIME_RECONVERTOPTIONS
) ||
1427 (msg
== WM_MSIME_MOUSE
) ||
1428 (msg
== WM_MSIME_RECONVERTREQUEST
) ||
1429 (msg
== WM_MSIME_RECONVERT
) ||
1430 (msg
== WM_MSIME_QUERYPOSITION
) ||
1431 (msg
== WM_MSIME_DOCUMENTFEED
))
1434 if (!IMM_GetThreadData()->hwndDefault
)
1435 ImmGetDefaultIMEWnd(NULL
);
1437 if (hWndIME
== NULL
)
1438 PostMessageA(IMM_GetThreadData()->hwndDefault
, msg
, wParam
, lParam
);
1445 /***********************************************************************
1446 * ImmIsUIMessageW (IMM32.@)
1448 BOOL WINAPI
ImmIsUIMessageW(
1449 HWND hWndIME
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1452 TRACE("(%p, %d, %ld, %ld):\n", hWndIME
, msg
, wParam
, lParam
);
1453 if ((msg
>= WM_IME_STARTCOMPOSITION
&& msg
<= WM_IME_KEYLAST
) ||
1454 (msg
>= WM_IME_SETCONTEXT
&& msg
<= WM_IME_KEYUP
) ||
1455 (msg
== WM_MSIME_SERVICE
) ||
1456 (msg
== WM_MSIME_RECONVERTOPTIONS
) ||
1457 (msg
== WM_MSIME_MOUSE
) ||
1458 (msg
== WM_MSIME_RECONVERTREQUEST
) ||
1459 (msg
== WM_MSIME_RECONVERT
) ||
1460 (msg
== WM_MSIME_QUERYPOSITION
) ||
1461 (msg
== WM_MSIME_DOCUMENTFEED
))
1466 /***********************************************************************
1467 * ImmNotifyIME (IMM32.@)
1469 BOOL WINAPI
ImmNotifyIME(
1470 HIMC hIMC
, DWORD dwAction
, DWORD dwIndex
, DWORD dwValue
)
1472 InputContextData
*data
= (InputContextData
*)hIMC
;
1474 TRACE("(%p, %d, %d, %d)\n",
1475 hIMC
, dwAction
, dwIndex
, dwValue
);
1477 if (!data
|| ! data
->immKbd
->pNotifyIME
)
1480 return data
->immKbd
->pNotifyIME(hIMC
,dwAction
,dwIndex
,dwValue
);
1483 /***********************************************************************
1484 * ImmRegisterWordA (IMM32.@)
1486 BOOL WINAPI
ImmRegisterWordA(
1487 HKL hKL
, LPCSTR lpszReading
, DWORD dwStyle
, LPCSTR lpszRegister
)
1489 FIXME("(%p, %s, %d, %s): stub\n",
1490 hKL
, debugstr_a(lpszReading
), dwStyle
, debugstr_a(lpszRegister
)
1492 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1496 /***********************************************************************
1497 * ImmRegisterWordW (IMM32.@)
1499 BOOL WINAPI
ImmRegisterWordW(
1500 HKL hKL
, LPCWSTR lpszReading
, DWORD dwStyle
, LPCWSTR lpszRegister
)
1502 FIXME("(%p, %s, %d, %s): stub\n",
1503 hKL
, debugstr_w(lpszReading
), dwStyle
, debugstr_w(lpszRegister
)
1505 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1509 /***********************************************************************
1510 * ImmReleaseContext (IMM32.@)
1512 BOOL WINAPI
ImmReleaseContext(HWND hWnd
, HIMC hIMC
)
1514 static int shown
= 0;
1517 FIXME("(%p, %p): stub\n", hWnd
, hIMC
);
1523 /***********************************************************************
1524 * ImmSetCandidateWindow (IMM32.@)
1526 BOOL WINAPI
ImmSetCandidateWindow(
1527 HIMC hIMC
, LPCANDIDATEFORM lpCandidate
)
1529 FIXME("(%p, %p): stub\n", hIMC
, lpCandidate
);
1530 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1534 /***********************************************************************
1535 * ImmSetCompositionFontA (IMM32.@)
1537 BOOL WINAPI
ImmSetCompositionFontA(HIMC hIMC
, LPLOGFONTA lplf
)
1539 InputContextData
*data
= (InputContextData
*)hIMC
;
1540 TRACE("(%p, %p)\n", hIMC
, lplf
);
1545 memcpy(&data
->IMC
.lfFont
.W
,lplf
,sizeof(LOGFONTA
));
1546 MultiByteToWideChar(CP_ACP
, 0, lplf
->lfFaceName
, -1, data
->IMC
.lfFont
.W
.lfFaceName
,
1548 ImmInternalSendIMENotify(data
, IMN_SETCOMPOSITIONFONT
, 0);
1553 /***********************************************************************
1554 * ImmSetCompositionFontW (IMM32.@)
1556 BOOL WINAPI
ImmSetCompositionFontW(HIMC hIMC
, LPLOGFONTW lplf
)
1558 InputContextData
*data
= (InputContextData
*)hIMC
;
1559 TRACE("(%p, %p)\n", hIMC
, lplf
);
1564 data
->IMC
.lfFont
.W
= *lplf
;
1565 ImmInternalSendIMENotify(data
, IMN_SETCOMPOSITIONFONT
, 0);
1570 /***********************************************************************
1571 * ImmSetCompositionStringA (IMM32.@)
1573 BOOL WINAPI
ImmSetCompositionStringA(
1574 HIMC hIMC
, DWORD dwIndex
,
1575 LPCVOID lpComp
, DWORD dwCompLen
,
1576 LPCVOID lpRead
, DWORD dwReadLen
)
1580 WCHAR
*CompBuffer
= NULL
;
1581 WCHAR
*ReadBuffer
= NULL
;
1583 InputContextData
*data
= (InputContextData
*)hIMC
;
1585 TRACE("(%p, %d, %p, %d, %p, %d):\n",
1586 hIMC
, dwIndex
, lpComp
, dwCompLen
, lpRead
, dwReadLen
);
1591 if (!is_himc_ime_unicode(data
))
1592 return data
->immKbd
->pImeSetCompositionString(hIMC
, dwIndex
, lpComp
,
1593 dwCompLen
, lpRead
, dwReadLen
);
1595 comp_len
= MultiByteToWideChar(CP_ACP
, 0, lpComp
, dwCompLen
, NULL
, 0);
1598 CompBuffer
= HeapAlloc(GetProcessHeap(),0,comp_len
* sizeof(WCHAR
));
1599 MultiByteToWideChar(CP_ACP
, 0, lpComp
, dwCompLen
, CompBuffer
, comp_len
);
1602 read_len
= MultiByteToWideChar(CP_ACP
, 0, lpRead
, dwReadLen
, NULL
, 0);
1605 ReadBuffer
= HeapAlloc(GetProcessHeap(),0,read_len
* sizeof(WCHAR
));
1606 MultiByteToWideChar(CP_ACP
, 0, lpRead
, dwReadLen
, ReadBuffer
, read_len
);
1609 rc
= ImmSetCompositionStringW(hIMC
, dwIndex
, CompBuffer
, comp_len
,
1610 ReadBuffer
, read_len
);
1612 HeapFree(GetProcessHeap(), 0, CompBuffer
);
1613 HeapFree(GetProcessHeap(), 0, ReadBuffer
);
1618 /***********************************************************************
1619 * ImmSetCompositionStringW (IMM32.@)
1621 BOOL WINAPI
ImmSetCompositionStringW(
1622 HIMC hIMC
, DWORD dwIndex
,
1623 LPCVOID lpComp
, DWORD dwCompLen
,
1624 LPCVOID lpRead
, DWORD dwReadLen
)
1628 CHAR
*CompBuffer
= NULL
;
1629 CHAR
*ReadBuffer
= NULL
;
1631 InputContextData
*data
= (InputContextData
*)hIMC
;
1633 TRACE("(%p, %d, %p, %d, %p, %d):\n",
1634 hIMC
, dwIndex
, lpComp
, dwCompLen
, lpRead
, dwReadLen
);
1639 if (is_himc_ime_unicode(data
))
1640 return data
->immKbd
->pImeSetCompositionString(hIMC
, dwIndex
, lpComp
,
1641 dwCompLen
, lpRead
, dwReadLen
);
1643 comp_len
= WideCharToMultiByte(CP_ACP
, 0, lpComp
, dwCompLen
, NULL
, 0, NULL
,
1647 CompBuffer
= HeapAlloc(GetProcessHeap(),0,comp_len
);
1648 WideCharToMultiByte(CP_ACP
, 0, lpComp
, dwCompLen
, CompBuffer
, comp_len
,
1652 read_len
= WideCharToMultiByte(CP_ACP
, 0, lpRead
, dwReadLen
, NULL
, 0, NULL
,
1656 ReadBuffer
= HeapAlloc(GetProcessHeap(),0,read_len
);
1657 WideCharToMultiByte(CP_ACP
, 0, lpRead
, dwReadLen
, ReadBuffer
, read_len
,
1661 rc
= ImmSetCompositionStringA(hIMC
, dwIndex
, CompBuffer
, comp_len
,
1662 ReadBuffer
, read_len
);
1664 HeapFree(GetProcessHeap(), 0, CompBuffer
);
1665 HeapFree(GetProcessHeap(), 0, ReadBuffer
);
1670 /***********************************************************************
1671 * ImmSetCompositionWindow (IMM32.@)
1673 BOOL WINAPI
ImmSetCompositionWindow(
1674 HIMC hIMC
, LPCOMPOSITIONFORM lpCompForm
)
1676 BOOL reshow
= FALSE
;
1677 InputContextData
*data
= (InputContextData
*)hIMC
;
1679 TRACE("(%p, %p)\n", hIMC
, lpCompForm
);
1680 TRACE("\t%x, (%i,%i), (%i,%i - %i,%i)\n",lpCompForm
->dwStyle
,
1681 lpCompForm
->ptCurrentPos
.x
, lpCompForm
->ptCurrentPos
.y
, lpCompForm
->rcArea
.top
,
1682 lpCompForm
->rcArea
.left
, lpCompForm
->rcArea
.bottom
, lpCompForm
->rcArea
.right
);
1687 data
->IMC
.cfCompForm
= *lpCompForm
;
1689 if (IsWindowVisible(IMM_GetThreadData()->hwndDefault
))
1692 ShowWindow(IMM_GetThreadData()->hwndDefault
,SW_HIDE
);
1695 /* FIXME: this is a partial stub */
1698 ShowWindow(IMM_GetThreadData()->hwndDefault
,SW_SHOWNOACTIVATE
);
1700 ImmInternalSendIMENotify(data
, IMN_SETCOMPOSITIONWINDOW
, 0);
1704 /***********************************************************************
1705 * ImmSetConversionStatus (IMM32.@)
1707 BOOL WINAPI
ImmSetConversionStatus(
1708 HIMC hIMC
, DWORD fdwConversion
, DWORD fdwSentence
)
1710 static int shown
= 0;
1713 FIXME("(%p, %d, %d): stub\n",
1714 hIMC
, fdwConversion
, fdwSentence
1718 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1722 /***********************************************************************
1723 * ImmSetOpenStatus (IMM32.@)
1725 BOOL WINAPI
ImmSetOpenStatus(HIMC hIMC
, BOOL fOpen
)
1727 InputContextData
*data
= (InputContextData
*)hIMC
;
1729 TRACE("%p %d\n", hIMC
, fOpen
);
1734 if (data
->imeWnd
== NULL
)
1736 /* create the ime window */
1737 data
->imeWnd
= CreateWindowExW( WS_EX_TOOLWINDOW
,
1738 data
->immKbd
->imeClassName
,
1739 NULL
, WS_POPUP
, 0, 0, 1, 1, 0, 0, hImeInst
, 0);
1740 SetWindowLongW(data
->imeWnd
, IMMGWL_IMC
, (LONG
)data
);
1741 IMM_GetThreadData()->hwndDefault
= data
->imeWnd
;
1744 data
->IMC
.fOpen
= fOpen
;
1745 return ImmNotifyIME(hIMC
,NI_CONTEXTUPDATED
,0,IMC_SETOPENSTATUS
);
1748 /***********************************************************************
1749 * ImmSetStatusWindowPos (IMM32.@)
1751 BOOL WINAPI
ImmSetStatusWindowPos(HIMC hIMC
, LPPOINT lpptPos
)
1753 FIXME("(%p, %p): stub\n", hIMC
, lpptPos
);
1754 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1758 /***********************************************************************
1759 * ImmSimulateHotKey (IMM32.@)
1761 BOOL WINAPI
ImmSimulateHotKey(HWND hWnd
, DWORD dwHotKeyID
)
1763 FIXME("(%p, %d): stub\n", hWnd
, dwHotKeyID
);
1764 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1768 /***********************************************************************
1769 * ImmUnregisterWordA (IMM32.@)
1771 BOOL WINAPI
ImmUnregisterWordA(
1772 HKL hKL
, LPCSTR lpszReading
, DWORD dwStyle
, LPCSTR lpszUnregister
)
1774 FIXME("(%p, %s, %d, %s): stub\n",
1775 hKL
, debugstr_a(lpszReading
), dwStyle
, debugstr_a(lpszUnregister
)
1777 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1781 /***********************************************************************
1782 * ImmUnregisterWordW (IMM32.@)
1784 BOOL WINAPI
ImmUnregisterWordW(
1785 HKL hKL
, LPCWSTR lpszReading
, DWORD dwStyle
, LPCWSTR lpszUnregister
)
1787 FIXME("(%p, %s, %d, %s): stub\n",
1788 hKL
, debugstr_w(lpszReading
), dwStyle
, debugstr_w(lpszUnregister
)
1790 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1794 /***********************************************************************
1795 * ImmGetImeMenuItemsA (IMM32.@)
1797 DWORD WINAPI
ImmGetImeMenuItemsA( HIMC hIMC
, DWORD dwFlags
, DWORD dwType
,
1798 LPIMEMENUITEMINFOA lpImeParentMenu
, LPIMEMENUITEMINFOA lpImeMenu
,
1801 InputContextData
*data
= (InputContextData
*)hIMC
;
1802 TRACE("(%p, %i, %i, %p, %p, %i):\n", hIMC
, dwFlags
, dwType
,
1803 lpImeParentMenu
, lpImeMenu
, dwSize
);
1804 if (data
->immKbd
->hIME
&& data
->immKbd
->pImeGetImeMenuItems
)
1806 if (!is_himc_ime_unicode(data
) || (!lpImeParentMenu
&& !lpImeMenu
))
1807 return data
->immKbd
->pImeGetImeMenuItems(hIMC
, dwFlags
, dwType
,
1808 (IMEMENUITEMINFOW
*)lpImeParentMenu
,
1809 (IMEMENUITEMINFOW
*)lpImeMenu
, dwSize
);
1812 IMEMENUITEMINFOW lpImeParentMenuW
;
1813 IMEMENUITEMINFOW
*lpImeMenuW
, *parent
= NULL
;
1816 if (lpImeParentMenu
)
1817 parent
= &lpImeParentMenuW
;
1820 int count
= dwSize
/ sizeof(LPIMEMENUITEMINFOA
);
1821 dwSize
= count
* sizeof(IMEMENUITEMINFOW
);
1822 lpImeMenuW
= HeapAlloc(GetProcessHeap(), 0, dwSize
);
1827 rc
= data
->immKbd
->pImeGetImeMenuItems(hIMC
, dwFlags
, dwType
,
1828 parent
, lpImeMenuW
, dwSize
);
1830 if (lpImeParentMenu
)
1832 memcpy(lpImeParentMenu
,&lpImeParentMenuW
,sizeof(IMEMENUITEMINFOA
));
1833 lpImeParentMenu
->hbmpItem
= lpImeParentMenuW
.hbmpItem
;
1834 WideCharToMultiByte(CP_ACP
, 0, lpImeParentMenuW
.szString
,
1835 -1, lpImeParentMenu
->szString
, IMEMENUITEM_STRING_SIZE
,
1838 if (lpImeMenu
&& rc
)
1841 for (i
= 0; i
< rc
; i
++)
1843 memcpy(&lpImeMenu
[i
],&lpImeMenuW
[1],sizeof(IMEMENUITEMINFOA
));
1844 lpImeMenu
[i
].hbmpItem
= lpImeMenuW
[i
].hbmpItem
;
1845 WideCharToMultiByte(CP_ACP
, 0, lpImeMenuW
[i
].szString
,
1846 -1, lpImeMenu
[i
].szString
, IMEMENUITEM_STRING_SIZE
,
1850 HeapFree(GetProcessHeap(),0,lpImeMenuW
);
1858 /***********************************************************************
1859 * ImmGetImeMenuItemsW (IMM32.@)
1861 DWORD WINAPI
ImmGetImeMenuItemsW( HIMC hIMC
, DWORD dwFlags
, DWORD dwType
,
1862 LPIMEMENUITEMINFOW lpImeParentMenu
, LPIMEMENUITEMINFOW lpImeMenu
,
1865 InputContextData
*data
= (InputContextData
*)hIMC
;
1866 TRACE("(%p, %i, %i, %p, %p, %i):\n", hIMC
, dwFlags
, dwType
,
1867 lpImeParentMenu
, lpImeMenu
, dwSize
);
1868 if (data
->immKbd
->hIME
&& data
->immKbd
->pImeGetImeMenuItems
)
1870 if (is_himc_ime_unicode(data
) || (!lpImeParentMenu
&& !lpImeMenu
))
1871 return data
->immKbd
->pImeGetImeMenuItems(hIMC
, dwFlags
, dwType
,
1872 lpImeParentMenu
, lpImeMenu
, dwSize
);
1875 IMEMENUITEMINFOA lpImeParentMenuA
;
1876 IMEMENUITEMINFOA
*lpImeMenuA
, *parent
= NULL
;
1879 if (lpImeParentMenu
)
1880 parent
= &lpImeParentMenuA
;
1883 int count
= dwSize
/ sizeof(LPIMEMENUITEMINFOW
);
1884 dwSize
= count
* sizeof(IMEMENUITEMINFOA
);
1885 lpImeMenuA
= HeapAlloc(GetProcessHeap(), 0, dwSize
);
1890 rc
= data
->immKbd
->pImeGetImeMenuItems(hIMC
, dwFlags
, dwType
,
1891 (IMEMENUITEMINFOW
*)parent
,
1892 (IMEMENUITEMINFOW
*)lpImeMenuA
, dwSize
);
1894 if (lpImeParentMenu
)
1896 memcpy(lpImeParentMenu
,&lpImeParentMenuA
,sizeof(IMEMENUITEMINFOA
));
1897 lpImeParentMenu
->hbmpItem
= lpImeParentMenuA
.hbmpItem
;
1898 MultiByteToWideChar(CP_ACP
, 0, lpImeParentMenuA
.szString
,
1899 -1, lpImeParentMenu
->szString
, IMEMENUITEM_STRING_SIZE
);
1901 if (lpImeMenu
&& rc
)
1904 for (i
= 0; i
< rc
; i
++)
1906 memcpy(&lpImeMenu
[i
],&lpImeMenuA
[1],sizeof(IMEMENUITEMINFOA
));
1907 lpImeMenu
[i
].hbmpItem
= lpImeMenuA
[i
].hbmpItem
;
1908 MultiByteToWideChar(CP_ACP
, 0, lpImeMenuA
[i
].szString
,
1909 -1, lpImeMenu
[i
].szString
, IMEMENUITEM_STRING_SIZE
);
1912 HeapFree(GetProcessHeap(),0,lpImeMenuA
);
1920 /***********************************************************************
1921 * ImmLockIMC(IMM32.@)
1923 LPINPUTCONTEXT WINAPI
ImmLockIMC(HIMC hIMC
)
1925 InputContextData
*data
= (InputContextData
*)hIMC
;
1933 /***********************************************************************
1934 * ImmUnlockIMC(IMM32.@)
1936 BOOL WINAPI
ImmUnlockIMC(HIMC hIMC
)
1938 InputContextData
*data
= (InputContextData
*)hIMC
;
1940 return (data
->dwLock
!=0);
1943 /***********************************************************************
1944 * ImmGetIMCLockCount(IMM32.@)
1946 DWORD WINAPI
ImmGetIMCLockCount(HIMC hIMC
)
1948 InputContextData
*data
= (InputContextData
*)hIMC
;
1949 return data
->dwLock
;
1952 /***********************************************************************
1953 * ImmCreateIMCC(IMM32.@)
1955 HIMCC WINAPI
ImmCreateIMCC(DWORD size
)
1957 IMCCInternal
*internal
;
1958 int real_size
= size
+ sizeof(IMCCInternal
);
1960 internal
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, real_size
);
1961 if (internal
== NULL
)
1964 internal
->dwSize
= size
;
1965 return (HIMCC
)internal
;
1968 /***********************************************************************
1969 * ImmDestroyIMCC(IMM32.@)
1971 HIMCC WINAPI
ImmDestroyIMCC(HIMCC block
)
1973 HeapFree(GetProcessHeap(),0,block
);
1977 /***********************************************************************
1978 * ImmLockIMCC(IMM32.@)
1980 LPVOID WINAPI
ImmLockIMCC(HIMCC imcc
)
1982 IMCCInternal
*internal
;
1983 internal
= (IMCCInternal
*) imcc
;
1985 internal
->dwLock
++;
1986 return internal
+ 1;
1989 /***********************************************************************
1990 * ImmUnlockIMCC(IMM32.@)
1992 BOOL WINAPI
ImmUnlockIMCC(HIMCC imcc
)
1994 IMCCInternal
*internal
;
1995 internal
= (IMCCInternal
*) imcc
;
1997 internal
->dwLock
--;
1998 return (internal
->dwLock
!=0);
2001 /***********************************************************************
2002 * ImmGetIMCCLockCount(IMM32.@)
2004 DWORD WINAPI
ImmGetIMCCLockCount(HIMCC imcc
)
2006 IMCCInternal
*internal
;
2007 internal
= (IMCCInternal
*) imcc
;
2009 return internal
->dwLock
;
2012 /***********************************************************************
2013 * ImmReSizeIMCC(IMM32.@)
2015 HIMCC WINAPI
ImmReSizeIMCC(HIMCC imcc
, DWORD size
)
2017 IMCCInternal
*internal
,*newone
;
2018 int real_size
= size
+ sizeof(IMCCInternal
);
2020 internal
= (IMCCInternal
*) imcc
;
2022 newone
= HeapReAlloc(GetProcessHeap(), 0, internal
, real_size
);
2023 newone
->dwSize
= size
;
2028 /***********************************************************************
2029 * ImmGetIMCCSize(IMM32.@)
2031 DWORD WINAPI
ImmGetIMCCSize(HIMCC imcc
)
2033 IMCCInternal
*internal
;
2034 internal
= (IMCCInternal
*) imcc
;
2036 return internal
->dwSize
;
2039 /***********************************************************************
2040 * ImmGenerateMessage(IMM32.@)
2042 BOOL WINAPI
ImmGenerateMessage(HIMC hIMC
)
2044 InputContextData
*data
= (InputContextData
*)hIMC
;
2046 TRACE("%i messages queued\n",data
->IMC
.dwNumMsgBuf
);
2047 if (data
->IMC
.dwNumMsgBuf
> 0)
2049 LPTRANSMSG lpTransMsg
;
2052 lpTransMsg
= (LPTRANSMSG
)ImmLockIMCC(data
->IMC
.hMsgBuf
);
2053 for (i
= 0; i
< data
->IMC
.dwNumMsgBuf
; i
++)
2054 ImmInternalPostIMEMessage(data
, lpTransMsg
[i
].message
, lpTransMsg
[i
].wParam
, lpTransMsg
[i
].lParam
);
2056 ImmUnlockIMCC(data
->IMC
.hMsgBuf
);
2058 data
->IMC
.dwNumMsgBuf
= 0;