Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

misc.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define D(x)
#define LOCALE_CPDATA   7

Functions

HWND WINAPI ImmGetDefaultIMEWnd (HWND hWnd)
BOOL WINAPI ImmDisableIME (DWORD dwThreadId)
BOOL WINAPI ImmIsUIMessageA (HWND hIMEWnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL WINAPI ImmIsUIMessageW (HWND hIMEWnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL ImmIsUIMessageWorker (HWND hIMEWnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL fAnsi)
BOOL WINAPI ImmGenerateMessage (HIMC hImc)
UINT WINAPI ImmGetVirtualKey (HWND hWnd)
PINPUTCONTEXT WINAPI InternalImmLockIMC (HIMC hImc, BOOL fCanCallImeSelect)
PINPUTCONTEXT WINAPI ImmLockIMC (HIMC hImc)
BOOL WINAPI ImmUnlockIMC (HIMC hImc)
DWORD WINAPI ImmGetIMCLockCount (HIMC hImc)
HIMCC WINAPI ImmCreateIMCC (DWORD dwSize)
HIMCC WINAPI ImmDestroyIMCC (HIMCC hIMCC)
LPVOID WINAPI ImmLockIMCC (HIMCC hIMCC)
BOOL WINAPI ImmUnlockIMCC (HIMCC hIMCC)
DWORD WINAPI ImmGetIMCCLockCount (HIMCC hIMCC)
HIMCC WINAPI ImmReSizeIMCC (HIMCC hIMCC, DWORD dwSize)
DWORD WINAPI ImmGetIMCCSize (HIMCC hIMCC)
LPVOID ImmLocalAlloc (DWORD uFlag, DWORD uBytes)
PTHREADINFO PtiCurrent (VOID)
BOOL TestInputContextProcess (PIMC pImc)
BOOL TestWindowProcess (PWND pwnd)
UINT GetKeyboardLayoutCP (HKL hKL)
UINT GetThreadKeyboardLayoutCP (DWORD dwThreadId)
PCLIENTIMC WINAPI ImmLockClientImc (HIMC hImc)
VOID WINAPI ImmUnlockClientImc (PCLIENTIMC pClientImc)
PIMEDPI WINAPI ImmGetImeDpi (HKL hKL)
PIMEDPI WINAPI ImmLockImeDpi (HKL hKL)
VOID WINAPI ImmUnlockImeDpi (PIMEDPI pImeDpi)
BOOL WINAPI ImmGetImeInfoEx (PIMEINFOEX piiex, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
DWORD ImmGetAppCompatFlags (HIMC hImc)
BOOL ImmPtInRect (int left, int top, int width, int height, LPPOINT lppt)
LRESULT ImmSystemHandler (HIMC hImc, WPARAM wParam, LPARAM lParam)

Variables

LCID CachedLCID = 0
UINT CachedCP = CP_ACP


Define Documentation

#define D  ) 
 

Definition at line 17 of file w32/ntuser/imm/misc.c.

#define LOCALE_CPDATA   7
 

Referenced by GetKeyboardLayoutCP().


Function Documentation

UINT GetKeyboardLayoutCP HKL  hKL  ) 
 

Definition at line 643 of file w32/ntuser/imm/misc.c.

References CachedCP, CachedLCID, LOCALE_CPDATA, NULL, and UINT.

Referenced by GetThreadKeyboardLayoutCP(), and ImmPenAuxInput().

00645 { 00646 #define LOCALE_CPDATA 7 00647 WCHAR wszCodePage[LOCALE_CPDATA]; 00648 LCID lcid; 00649 00650 lcid = MAKELCID(LOWORD(HandleToUlong(hKL)), SORT_DEFAULT); 00651 00652 if (lcid == CachedLCID) 00653 return CachedCP; 00654 00655 if (!GetLocaleInfoW(lcid, LOCALE_IDEFAULTANSICODEPAGE, 00656 wszCodePage, LOCALE_CPDATA)) 00657 return CP_ACP; 00658 00659 CachedLCID = lcid; 00660 CachedCP = (UINT)wcstol(wszCodePage, NULL, 10); 00661 00662 return CachedCP; 00663 }

UINT GetThreadKeyboardLayoutCP DWORD  dwThreadId  ) 
 

Definition at line 672 of file w32/ntuser/imm/misc.c.

References GetKeyboardLayout(), GetKeyboardLayoutCP(), and UINT.

00674 { 00675 HKL hKL; 00676 00677 hKL = GetKeyboardLayout(dwThreadId); 00678 00679 return GetKeyboardLayoutCP(hKL); 00680 }

HIMCC WINAPI ImmCreateIMCC DWORD  dwSize  ) 
 

Definition at line 436 of file w32/ntuser/imm/misc.c.

References DWORD, and LHND.

Referenced by CreateInputContext(), and SelectInputContext().

00438 { 00439 // At least size should be DWORD. 00440 if (dwSize < sizeof(DWORD)) { 00441 dwSize = sizeof(DWORD); 00442 } 00443 00444 return (HIMCC)LocalAlloc(LHND, dwSize); 00445 }

HIMCC WINAPI ImmDestroyIMCC HIMCC  hIMCC  ) 
 

Definition at line 454 of file w32/ntuser/imm/misc.c.

References NULL.

Referenced by CreateInputContext(), DestroyInputContext(), and SelectInputContext().

00456 { 00457 if (hIMCC == NULL) { 00458 return NULL; 00459 } 00460 00461 return (HIMCC)LocalFree(hIMCC); 00462 }

BOOL WINAPI ImmDisableIME DWORD  dwThreadId  ) 
 

Definition at line 50 of file w32/ntuser/imm/misc.c.

References BOOL, gcsImeDpi, gpImeDpi, ImmLocalFree, NtUserDisableThreadIme(), tagIMEDPI::pNext, TRUE, and UnloadIME().

00051 { 00052 #ifdef LATER // hiro 00053 if (dwThreadId == -1) { 00054 // Unload all IMEs 00055 RtlEnterCriticalSection(&gcsImeDpi); 00056 while (gpImeDpi) { 00057 PIMEDPI pImeDpi = gpImeDpi; 00058 gpImeDpi = gpImeDpi->pNext; 00059 UnloadIME(pImeDpi, TRUE); 00060 ImmLocalFree(pImeDpi); 00061 } 00062 RtlLeaveCriticalSection(&gcsImeDpi); 00063 } 00064 #endif 00065 return (BOOL)NtUserDisableThreadIme(dwThreadId); 00066 }

BOOL WINAPI ImmGenerateMessage HIMC  hImc  ) 
 

Definition at line 171 of file w32/ntuser/imm/misc.c.

References BOOL, DWORD, FALSE, GetClientInfo, GetInputContextThread, IMCF_UNICODE, ImmLocalAlloc(), ImmLocalFree, ImmLockClientImc(), ImmLockIMC(), ImmLockIMCC(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), INT, L, NULL, TestICF, TransGetLevel(), TRUE, VER40, and WINNLSTranslateMessage().

00173 { 00174 PCLIENTIMC pClientImc; 00175 PINPUTCONTEXT pInputContext; 00176 PTRANSMSG pTransMsg; 00177 INT iNum; 00178 INT i; 00179 BOOL fUnicodeImc; 00180 00181 if (GetInputContextThread(hImc) != GetCurrentThreadId()) { 00182 RIPMSG1(RIP_WARNING, 00183 "ImmGenerateMessage: Invalid input context access %lx.", hImc); 00184 return FALSE; 00185 } 00186 00187 pClientImc = ImmLockClientImc(hImc); 00188 if (pClientImc == NULL) 00189 return FALSE; 00190 00191 fUnicodeImc = TestICF(pClientImc, IMCF_UNICODE); 00192 00193 ImmUnlockClientImc(pClientImc); 00194 00195 pInputContext = ImmLockIMC(hImc); 00196 if (!pInputContext) { 00197 RIPMSG1(RIP_WARNING, "ImmGenerateMessage: Lock hImc %lx failed.", hImc); 00198 return FALSE; 00199 } 00200 00201 iNum = (int)pInputContext->dwNumMsgBuf; 00202 00203 if (iNum && (pTransMsg = (PTRANSMSG)ImmLockIMCC(pInputContext->hMsgBuf))) { 00204 PTRANSMSG pTransMsgBuf, pTransMsgTemp; 00205 00206 pTransMsgBuf = (PTRANSMSG)ImmLocalAlloc(0, iNum * sizeof(TRANSMSG)); 00207 00208 if (pTransMsgBuf != NULL) { 00209 00210 RtlCopyMemory(pTransMsgBuf, pTransMsg, iNum * sizeof(TRANSMSG)); 00211 00212 if (GetClientInfo()->dwExpWinVer < VER40) { 00213 /* 00214 * translate messages for those applications that expect 00215 * old style IME messages. 00216 */ 00217 DWORD dwLangId; 00218 dwLangId = PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())); 00219 if ( (dwLangId == LANG_KOREAN && TransGetLevel(pInputContext->hWnd) == 3) || 00220 (dwLangId == LANG_JAPANESE) ) { 00221 iNum = WINNLSTranslateMessage(iNum, 00222 pTransMsgBuf, 00223 hImc, 00224 !fUnicodeImc, 00225 dwLangId ); 00226 } 00227 } 00228 00229 pTransMsgTemp = pTransMsgBuf; 00230 00231 for (i = 0; i < iNum; i++) { 00232 if (fUnicodeImc) { 00233 SendMessageW( pInputContext->hWnd, 00234 pTransMsgTemp->message, 00235 pTransMsgTemp->wParam, 00236 pTransMsgTemp->lParam ); 00237 } else { 00238 SendMessageW( pInputContext->hWnd, 00239 pTransMsgTemp->message, 00240 pTransMsgTemp->wParam, 00241 pTransMsgTemp->lParam ); 00242 } 00243 pTransMsgTemp++; 00244 } 00245 00246 ImmLocalFree(pTransMsgBuf); 00247 } 00248 00249 ImmUnlockIMCC(pInputContext->hMsgBuf); 00250 } 00251 00252 /* 00253 * We should not reallocate the message buffer 00254 */ 00255 pInputContext->dwNumMsgBuf = 0L; 00256 00257 ImmUnlockIMC(hImc); 00258 00259 return TRUE; 00260 }

DWORD ImmGetAppCompatFlags HIMC  hImc  ) 
 

Definition at line 912 of file w32/ntuser/imm/misc.c.

References tagCLIENTIMC::dwImeCompatFlags, DWORD, ImmLockClientImc(), ImmUnlockClientImc(), and NULL.

Referenced by ImmProcessKey(), MySetCandidateWindow(), MySetCompFont(), and MySetCompWindow().

00913 { 00914 PCLIENTIMC pClientImc; 00915 DWORD dwImeCompat = 0; 00916 00917 pClientImc = ImmLockClientImc( hImc ); 00918 if ( pClientImc != NULL ) { 00919 dwImeCompat = pClientImc->dwImeCompatFlags; 00920 ImmUnlockClientImc( pClientImc ); 00921 } 00922 return dwImeCompat; 00923 }

HWND WINAPI ImmGetDefaultIMEWnd HWND  hWnd  ) 
 

Definition at line 27 of file w32/ntuser/imm/misc.c.

References hWnd, IS_IME_ENABLED, NtUserGetThreadState(), NtUserQueryWindow(), and NULL.

Referenced by _InitializeImmEntryTable(), ImmActivateLayout(), ImmEnableIME(), ImmSetActiveContext(), MyPostImsMessage(), SendIMEMessageAll(), WINNLSTranslateMessageJ(), and WINNLSTranslateMessageK().

00029 { 00030 if (!IS_IME_ENABLED()) { 00031 return NULL; 00032 } 00033 if (hWnd == NULL) { 00034 /* 00035 * Query default IME window of current thread. 00036 */ 00037 return (HWND)NtUserGetThreadState(UserThreadStateDefaultImeWindow); 00038 } 00039 00040 return (HWND)NtUserQueryWindow(hWnd, WindowDefaultImeWindow); 00041 }

DWORD WINAPI ImmGetIMCCLockCount HIMCC  hIMCC  ) 
 

Definition at line 505 of file w32/ntuser/imm/misc.c.

References DWORD, and NULL.

Referenced by SelectInputContext().

00507 { 00508 if (hIMCC == NULL) { 00509 return 0; 00510 } 00511 00512 return (DWORD)(LocalFlags(hIMCC) & LMEM_LOCKCOUNT); 00513 }

DWORD WINAPI ImmGetIMCCSize HIMCC  hIMCC  ) 
 

Definition at line 540 of file w32/ntuser/imm/misc.c.

References DWORD, and NULL.

Referenced by SelectInputContext().

00542 { 00543 if (hIMCC == NULL) { 00544 return 0; 00545 } 00546 00547 return (DWORD)LocalSize(hIMCC); 00548 }

DWORD WINAPI ImmGetIMCLockCount HIMC  hImc  ) 
 

Definition at line 412 of file w32/ntuser/imm/misc.c.

References DWORD, tagCLIENTIMC::hInputContext, ImmLockClientImc(), ImmUnlockClientImc(), and NULL.

00414 { 00415 PCLIENTIMC pClientImc; 00416 DWORD dwRet = 0; 00417 00418 if ((pClientImc = ImmLockClientImc(hImc)) == NULL) 00419 return dwRet; 00420 00421 if (pClientImc->hInputContext != NULL) 00422 dwRet = (DWORD)(LocalFlags(pClientImc->hInputContext) & LMEM_LOCKCOUNT); 00423 00424 ImmUnlockClientImc(pClientImc); 00425 00426 return dwRet; 00427 }

PIMEDPI WINAPI ImmGetImeDpi HKL  hKL  ) 
 

Definition at line 769 of file w32/ntuser/imm/misc.c.

References gcsImeDpi, gpImeDpi, tagIMEDPI::hKL, NULL, and tagIMEDPI::pNext.

Referenced by ImmLoadIME(), and LoadImeDpi().

00771 { 00772 PIMEDPI pImeDpi; 00773 00774 RtlEnterCriticalSection(&gcsImeDpi); 00775 00776 pImeDpi = gpImeDpi; 00777 00778 while (pImeDpi != NULL && pImeDpi->hKL != hKL) 00779 pImeDpi = pImeDpi->pNext; 00780 00781 RtlLeaveCriticalSection(&gcsImeDpi); 00782 00783 return (PIMEDPI)pImeDpi; 00784 }

BOOL WINAPI ImmGetImeInfoEx PIMEINFOEX  piiex,
IMEINFOEXCLASS  SearchType,
PVOID  pvSearchKey
 

Definition at line 876 of file w32/ntuser/imm/misc.c.

References BOOL, FALSE, tagIMEINFOEX::hkl, ImeInfoExImeFileName, ImeInfoExKeyboardLayout, ImmAssert, IS_IME_KBDLAYOUT, NtUserGetImeInfoEx(), NULL, and tagIMEINFOEX::wszImeFile.

Referenced by _InitializeImmEntryTable(), ImmGetDescriptionA(), ImmGetDescriptionW(), ImmGetIMEFileNameA(), ImmGetIMEFileNameW(), ImmGetProperty(), ImmIMPQueryIMEW(), ImmIMPSetIMEW(), ImmInstallIMEW(), ImmIsIME(), IMPGetIMEWorker(), and LoadImeDpi().

00880 { 00881 ImmAssert(piiex != NULL && pvSearchKey != NULL); 00882 00883 switch (SearchType) { 00884 case ImeInfoExKeyboardLayout: 00885 piiex->hkl = *((HKL *)pvSearchKey); 00886 /* 00887 * Quick return for non-IME based keyboard layout 00888 */ 00889 if (!IS_IME_KBDLAYOUT(piiex->hkl)) 00890 return FALSE; 00891 break; 00892 00893 case ImeInfoExImeFileName: 00894 wcscpy(piiex->wszImeFile, (PWSTR)pvSearchKey); 00895 break; 00896 00897 default: 00898 return FALSE; 00899 } 00900 00901 return NtUserGetImeInfoEx(piiex, SearchType); 00902 }

UINT WINAPI ImmGetVirtualKey HWND  hWnd  ) 
 

Definition at line 271 of file w32/ntuser/imm/misc.c.

References hWnd, ImmGetContext(), ImmLockIMC(), ImmUnlockIMC(), and UINT.

00273 { 00274 HIMC hImc; 00275 PINPUTCONTEXT pInputContext; 00276 UINT uVirtKey; 00277 00278 hImc = ImmGetContext(hWnd); 00279 00280 pInputContext = ImmLockIMC(hImc); 00281 if (!pInputContext) { 00282 RIPMSG1(RIP_WARNING, "ImmGetVirtualKey: lock IMC %x failure", hImc); 00283 return (VK_PROCESSKEY); 00284 } 00285 00286 if (pInputContext->fChgMsg) { 00287 uVirtKey = pInputContext->uSavedVKey; 00288 } else { 00289 uVirtKey = VK_PROCESSKEY; 00290 } 00291 00292 ImmUnlockIMC(hImc); 00293 return (uVirtKey); 00294 }

BOOL WINAPI ImmIsUIMessageA HWND  hIMEWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 76 of file w32/ntuser/imm/misc.c.

References BOOL, ImmIsUIMessageWorker(), and TRUE.

00081 { 00082 return ImmIsUIMessageWorker(hIMEWnd, message, wParam, lParam, TRUE); 00083 }

BOOL WINAPI ImmIsUIMessageW HWND  hIMEWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 94 of file w32/ntuser/imm/misc.c.

References BOOL, FALSE, and ImmIsUIMessageWorker().

00099 { 00100 return ImmIsUIMessageWorker(hIMEWnd, message, wParam, lParam, FALSE); 00101 }

BOOL ImmIsUIMessageWorker HWND  hIMEWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
BOOL  fAnsi
 

Definition at line 115 of file w32/ntuser/imm/misc.c.

References BOOL, D, DbgPrint, FALSE, IsWindow(), and TRUE.

Referenced by ImmIsUIMessageA(), and ImmIsUIMessageW().

00121 { 00122 D(DbgPrint("ImmIsUIMessageWorker(wnd[%08X], msg[%04X], wp[%08X], lp[%08X], Ansi[%d]\n", 00123 hIMEWnd, message, wParam, lParam, fAnsi)); 00124 00125 switch (message) { 00126 case WM_IME_STARTCOMPOSITION: 00127 case WM_IME_ENDCOMPOSITION: 00128 case WM_IME_COMPOSITION: 00129 case WM_IME_SETCONTEXT: 00130 case WM_IME_COMPOSITIONFULL: 00131 case WM_IME_SELECT: 00132 case WM_IME_NOTIFY: 00133 case WM_IME_SYSTEM: 00134 00135 if (!hIMEWnd) 00136 return TRUE; 00137 00138 #if DBG 00139 if (!IsWindow(hIMEWnd)) { 00140 RIPMSG1(RIP_WARNING, 00141 "ImmIsUIMessage: Invalid window handle %x", hIMEWnd); 00142 return FALSE; 00143 } 00144 #endif 00145 00146 if (fAnsi) { 00147 SendMessageA(hIMEWnd, message, wParam, lParam); 00148 } 00149 else { 00150 SendMessageW(hIMEWnd, message, wParam, lParam); 00151 } 00152 00153 return TRUE; 00154 00155 default: 00156 break; 00157 } 00158 00159 return FALSE; 00160 }

LPVOID ImmLocalAlloc DWORD  uFlag,
DWORD  uBytes
 

Definition at line 557 of file w32/ntuser/imm/misc.c.

References LPVOID, NULL, and pImmHeap.

Referenced by BuildHimcList(), CopyImeFile(), EnumRegisterWordProcA(), EnumRegisterWordProcW(), GetImeModeSaver(), GetImePrivateModeSaver(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmCreateContext(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmFreeLayout(), ImmGenerateMessage(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetImeMenuItemsWorker(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmIMPQueryIMEW(), ImmIMPSetIMEW(), ImmInstallIMEA(), ImmInstallIMEW(), ImmLockClientImc(), ImmPenAuxInput(), ImmPostMessages(), ImmProcessKey(), ImmPutImeMenuItemsIntoMappedFile(), ImmRegisterWordA(), ImmRegisterWordW(), ImmRequestMessageWorker(), ImmTranslateMessage(), ImmUnregisterWordA(), ImmUnregisterWordW(), InternalGetCompositionStringA(), InternalGetCompositionStringW(), InternalSCS_CHANGEATTR(), InternalSCS_CHANGECLAUSE(), InternalSCS_RECONVERTSTRING(), InternalSCS_SETSTR(), LoadImeDpi(), LoadVersionInfo(), and WINNLSTranslateMessageJ().

00560 { 00561 if (pImmHeap == NULL) { 00562 pImmHeap = RtlProcessHeap(); 00563 if (pImmHeap == NULL) { 00564 RIPMSG0(RIP_WARNING, "ImmLocalAlloc: NULL pImmHeap!"); 00565 return NULL; 00566 } 00567 } 00568 00569 return HeapAlloc(pImmHeap, uFlag, uBytes); 00570 }

PCLIENTIMC WINAPI ImmLockClientImc HIMC  hImc  ) 
 

Definition at line 689 of file w32/ntuser/imm/misc.c.

References tagCLIENTIMC::cLockObj, tagIMC::dwClientImcData, tagCLIENTIMC::dwImeCompatFlags, DWORD, HMValidateHandle(), IMCF_DEFAULTIMC, IMCF_INDESTROY, ImmLocalAlloc(), ImmLocalFree, InitImcCrit, NtUserGetThreadState(), NtUserUpdateInputContext(), NULL, NULL_HIMC, SetICF, TestICF, TestInputContextProcess(), TYPE_INPUTCONTEXT, and UpdateClientInputContext.

Referenced by CreateInputContext(), ImmEnableIME(), ImmGenerateMessage(), ImmGetAppCompatFlags(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionFontA(), ImmGetCompositionFontW(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), ImmGetIMCLockCount(), ImmGetSaveContext(), ImmPostMessages(), ImmRequestMessageWorker(), ImmSetActiveContext(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmUnlockIMC(), InternalImmLockIMC(), IsAnsiIMC(), MySetCompFont(), SelectInputContext(), and SetFontForMCWVERTICAL().

00691 { 00692 PIMC pImc; 00693 PCLIENTIMC pClientImc; 00694 00695 if (hImc == NULL_HIMC) 00696 return NULL; 00697 00698 pImc = HMValidateHandle((HANDLE)hImc, TYPE_INPUTCONTEXT); 00699 00700 /* 00701 * Cannot access input context from other process. 00702 */ 00703 if (pImc == NULL || !TestInputContextProcess(pImc)) 00704 return NULL; 00705 00706 pClientImc = (PCLIENTIMC)pImc->dwClientImcData; 00707 00708 if (pClientImc == NULL) { 00709 /* 00710 * We delay the creation of client side per-thread default Imc. 00711 * Now, this is the time to create it. 00712 */ 00713 pClientImc = ImmLocalAlloc(HEAP_ZERO_MEMORY, sizeof(CLIENTIMC)); 00714 if (pClientImc == NULL) 00715 return NULL; 00716 00717 InitImcCrit(pClientImc); 00718 pClientImc->dwImeCompatFlags = (DWORD)NtUserGetThreadState(UserThreadStateImeCompatFlags); 00719 00720 /* 00721 * Update the kernel side input context. 00722 */ 00723 if (!NtUserUpdateInputContext(hImc, 00724 UpdateClientInputContext, (ULONG_PTR)pClientImc)) { 00725 ImmLocalFree(pClientImc); 00726 return NULL; 00727 } 00728 00729 /* 00730 * Marks with default input context signature. 00731 */ 00732 SetICF(pClientImc, IMCF_DEFAULTIMC); 00733 } 00734 else if (TestICF(pClientImc, IMCF_INDESTROY)) { 00735 /* 00736 * Cannot access destroyed input context. 00737 */ 00738 return NULL; 00739 } 00740 00741 InterlockedIncrement(&pClientImc->cLockObj); 00742 00743 return pClientImc; 00744 }

PINPUTCONTEXT WINAPI ImmLockIMC HIMC  hImc  ) 
 

Definition at line 371 of file w32/ntuser/imm/misc.c.

References InternalImmLockIMC(), and TRUE.

Referenced by _InitializeImmEntryTable(), CIMENonIMEToggle(), CompositionString(), CreateInputContext(), CSymbolToggle(), DestroyInputContext(), ImmGenerateMessage(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCandidateWindow(), ImmGetCompositionFontA(), ImmGetCompositionFontW(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetCompositionWindow(), ImmGetConversionStatus(), ImmGetGuideLineWorker(), ImmGetImeMenuItemsWorker(), ImmGetOpenStatus(), ImmGetStatusWindowPos(), ImmGetVirtualKey(), ImmProcessKey(), ImmRequestMessageAorW(), ImmSetActiveContext(), ImmSetCandidateWindow(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmSetCompositionWindow(), ImmSetConversionStatus(), ImmSetOpenStatus(), ImmSetStatusWindowPos(), ImmTranslateMessage(), JCloseOpen(), KEnglishHangul(), KHanjaConvert(), KShapeToggle(), MySetCandidateWindow(), MySetCompFont(), MySetCompWindow(), SendNotificationProc(), SKC1ButtonUp(), SKT1ButtonUp(), SKWndProcT1(), TransSetConversionFontEx(), TransSetConversionWindow(), TransSetOpenJ(), TShapeToggle(), and WINNLSTranslateMessage().

00373 { 00374 return InternalImmLockIMC(hImc, TRUE); 00375 }

LPVOID WINAPI ImmLockIMCC HIMCC  hIMCC  ) 
 

Definition at line 471 of file w32/ntuser/imm/misc.c.

References LPVOID, and NULL.

Referenced by CompositionString(), CreateInputContext(), ImmGenerateMessage(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), ImmTranslateMessage(), SelectInputContext(), and WINNLSTranslateMessage().

00473 { 00474 if (hIMCC == NULL) { 00475 return NULL; 00476 } 00477 00478 return LocalLock(hIMCC); 00479 }

PIMEDPI WINAPI ImmLockImeDpi HKL  hKL  ) 
 

Definition at line 793 of file w32/ntuser/imm/misc.c.

References tagIMEDPI::cLock, tagIMEDPI::dwFlag, gcsImeDpi, gpImeDpi, tagIMEDPI::hKL, IMEDPI_UNLOADED, NULL, and tagIMEDPI::pNext.

Referenced by _InitializeImmEntryTable(), CreateInputContext(), DestroyInputContext(), FindOrLoadImeDpi(), HotKeyIDDispatcher(), ImmActivateLayout(), ImmCallImeConsoleIME(), ImmCreateSoftKeyboard(), ImmGetImeMenuItemsWorker(), ImmNotifyIME(), ImmProcessKey(), ImmSetActiveContext(), ImmSetCompositionStringWorker(), ImmTranslateMessage(), JCloseOpen(), MakeIMENotify(), SelectInputContext(), and TransHanjaMode().

00795 { 00796 PIMEDPI pImeDpi; 00797 00798 RtlEnterCriticalSection(&gcsImeDpi); 00799 00800 pImeDpi = gpImeDpi; 00801 00802 while (pImeDpi != NULL && pImeDpi->hKL != hKL) 00803 pImeDpi = pImeDpi->pNext; 00804 00805 if (pImeDpi != NULL) { 00806 if (pImeDpi->dwFlag & IMEDPI_UNLOADED) 00807 pImeDpi = NULL; 00808 else 00809 pImeDpi->cLock++; 00810 } 00811 00812 RtlLeaveCriticalSection(&gcsImeDpi); 00813 00814 return (PIMEDPI)pImeDpi; 00815 }

BOOL ImmPtInRect int  left,
int  top,
int  width,
int  height,
LPPOINT  lppt
 

Definition at line 933 of file w32/ntuser/imm/misc.c.

References BOOL.

Referenced by SKC1MousePosition(), and SKT1MousePosition().

00939 { 00940 return (lppt->x >= left && lppt->x < (left + width) && 00941 lppt->y >= top && lppt->y < (top + height)); 00942 }

HIMCC WINAPI ImmReSizeIMCC HIMCC  hIMCC,
DWORD  dwSize
 

Definition at line 522 of file w32/ntuser/imm/misc.c.

References LHND, and NULL.

Referenced by SelectInputContext().

00525 { 00526 if (hIMCC == NULL) { 00527 return NULL; 00528 } 00529 00530 return (HIMCC)LocalReAlloc(hIMCC, dwSize, LHND); 00531 }

LRESULT ImmSystemHandler HIMC  hImc,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 955 of file w32/ntuser/imm/misc.c.

References BOOL, ImmNotifyIME(), and ImmSendNotification().

Referenced by _InitializeImmEntryTable().

00959 { 00960 LRESULT lRet = 0; 00961 00962 switch (wParam) { 00963 case IMS_SENDNOTIFICATION: 00964 ImmSendNotification((BOOL)lParam); 00965 break; 00966 case IMS_FINALIZE_COMPSTR: 00967 ImmNotifyIME(hImc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); 00968 break; 00969 } 00970 00971 return lRet; 00972 }

VOID WINAPI ImmUnlockClientImc PCLIENTIMC  pClientImc  ) 
 

Definition at line 747 of file w32/ntuser/imm/misc.c.

References tagCLIENTIMC::cLockObj, DeleteImcCrit, tagCLIENTIMC::hInputContext, IMCF_INDESTROY, ImmLocalFree, NULL, TestICF, and VOID().

Referenced by CreateInputContext(), DestroyInputContext(), ImmEnableIME(), ImmGenerateMessage(), ImmGetAppCompatFlags(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionFontA(), ImmGetCompositionFontW(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), ImmGetIMCLockCount(), ImmGetSaveContext(), ImmPostMessages(), ImmRequestMessageWorker(), ImmSetActiveContext(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmUnlockIMC(), InternalImmLockIMC(), IsAnsiIMC(), MySetCompFont(), SelectInputContext(), and SetFontForMCWVERTICAL().

00749 { 00750 if (InterlockedDecrement(&pClientImc->cLockObj) == 0) { 00751 if (TestICF(pClientImc, IMCF_INDESTROY)) { 00752 if (pClientImc->hInputContext != NULL) 00753 LocalFree(pClientImc->hInputContext); 00754 00755 DeleteImcCrit(pClientImc); 00756 ImmLocalFree(pClientImc); 00757 } 00758 } 00759 00760 return; 00761 }

BOOL WINAPI ImmUnlockIMC HIMC  hImc  ) 
 

Definition at line 383 of file w32/ntuser/imm/misc.c.

References BOOL, tagCLIENTIMC::cLockObj, FALSE, tagCLIENTIMC::hInputContext, ImmLockClientImc(), ImmUnlockClientImc(), NULL, and TRUE.

Referenced by _InitializeImmEntryTable(), CIMENonIMEToggle(), CompositionString(), CreateInputContext(), CSymbolToggle(), DestroyInputContext(), ImmGenerateMessage(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCandidateWindow(), ImmGetCompositionFontA(), ImmGetCompositionFontW(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetCompositionWindow(), ImmGetConversionStatus(), ImmGetGuideLineWorker(), ImmGetImeMenuItemsWorker(), ImmGetOpenStatus(), ImmGetStatusWindowPos(), ImmGetVirtualKey(), ImmProcessKey(), ImmRequestMessageAorW(), ImmSetActiveContext(), ImmSetCandidateWindow(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmSetCompositionStringWorker(), ImmSetCompositionWindow(), ImmSetConversionStatus(), ImmSetOpenStatus(), ImmSetStatusWindowPos(), ImmTranslateMessage(), JCloseOpen(), KEnglishHangul(), KHanjaConvert(), KShapeToggle(), MySetCandidateWindow(), MySetCompFont(), MySetCompWindow(), SelectInputContext(), SKC1ButtonUp(), SKT1ButtonUp(), SKWndProcT1(), TransSetConversionFontEx(), TransSetConversionWindow(), TransSetOpenJ(), TShapeToggle(), and WINNLSTranslateMessage().

00385 { 00386 PCLIENTIMC pClientImc; 00387 00388 if ((pClientImc = ImmLockClientImc(hImc)) == NULL) 00389 return FALSE; 00390 00391 if (pClientImc->hInputContext != NULL) 00392 LocalUnlock(pClientImc->hInputContext); 00393 00394 /* 00395 * Decrement lock count so that the ImmUnlockClientImc() can 00396 * free up the pClientImc->hInputContext if required. 00397 */ 00398 InterlockedDecrement(&pClientImc->cLockObj); 00399 00400 ImmUnlockClientImc(pClientImc); 00401 00402 return TRUE; 00403 }

BOOL WINAPI ImmUnlockIMCC HIMCC  hIMCC  ) 
 

Definition at line 488 of file w32/ntuser/imm/misc.c.

References BOOL, FALSE, and NULL.

Referenced by CompositionString(), CreateInputContext(), ImmGenerateMessage(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), ImmSetCompositionStringWorker(), ImmTranslateMessage(), SelectInputContext(), and WINNLSTranslateMessage().

00490 { 00491 if (hIMCC == NULL) { 00492 return FALSE; 00493 } 00494 00495 return LocalUnlock(hIMCC); 00496 }

VOID WINAPI ImmUnlockImeDpi PIMEDPI  pImeDpi  ) 
 

Definition at line 824 of file w32/ntuser/imm/misc.c.

References tagIMEDPI::cLock, tagIMEDPI::dwFlag, gcsImeDpi, gpImeDpi, IMEDPI_UNLOADED, IMEDPI_UNLOCKUNLOAD, tagIMEDPI::ImeInfo, ImmLocalFree, NULL, tagIMEDPI::pNext, TRUE, UnloadIME(), and VOID().

Referenced by _InitializeImmEntryTable(), CreateInputContext(), DestroyInputContext(), HotKeyIDDispatcher(), ImmActivateLayout(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmCreateSoftKeyboard(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetImeMenuItemsWorker(), ImmGetProperty(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmNotifyIME(), ImmPenAuxInput(), ImmProcessKey(), ImmRegisterWordA(), ImmRegisterWordW(), ImmSetActiveContext(), ImmSetCompositionStringWorker(), ImmTranslateMessage(), ImmUnregisterWordA(), ImmUnregisterWordW(), JCloseOpen(), MakeIMENotify(), SelectInputContext(), and TransHanjaMode().

00826 { 00827 PIMEDPI pImeDpiT; 00828 00829 if (pImeDpi == NULL) 00830 return; 00831 00832 RtlEnterCriticalSection(&gcsImeDpi); 00833 00834 if (--pImeDpi->cLock == 0) { 00835 00836 if ((pImeDpi->dwFlag & IMEDPI_UNLOADED) || 00837 ((pImeDpi->dwFlag & IMEDPI_UNLOCKUNLOAD) && 00838 (pImeDpi->ImeInfo.fdwProperty & IME_PROP_END_UNLOAD))) 00839 { 00840 /* 00841 * Unlink it. 00842 */ 00843 if (gpImeDpi == pImeDpi) { 00844 gpImeDpi = pImeDpi->pNext; 00845 } 00846 else { 00847 pImeDpiT = gpImeDpi; 00848 00849 while (pImeDpiT != NULL && pImeDpiT->pNext != pImeDpi) 00850 pImeDpiT = pImeDpiT->pNext; 00851 00852 if (pImeDpiT != NULL) 00853 pImeDpiT->pNext = pImeDpi->pNext; 00854 } 00855 00856 /* 00857 * Unload the IME DLL. 00858 */ 00859 UnloadIME(pImeDpi, TRUE); 00860 ImmLocalFree(pImeDpi); 00861 } 00862 } 00863 00864 RtlLeaveCriticalSection(&gcsImeDpi); 00865 00866 return; 00867 }

PINPUTCONTEXT WINAPI InternalImmLockIMC HIMC  hImc,
BOOL  fCanCallImeSelect
 

Definition at line 303 of file w32/ntuser/imm/misc.c.

References tagCLIENTIMC::cLockObj, CreateInputContext(), DWORD, EnterImcCrit, GetKeyboardLayout(), tagCLIENTIMC::hInputContext, ImmLockClientImc(), ImmUnlockClientImc(), InputContextDefaultImeWindow, InputContextThread, LeaveImcCrit, LHND, NtUserQueryInputContext(), and NULL.

Referenced by ImmLockIMC(), and SelectInputContext().

00306 { 00307 PCLIENTIMC pClientImc; 00308 PINPUTCONTEXT pInputContext; 00309 DWORD dwImcThreadId; 00310 00311 if ((pClientImc = ImmLockClientImc(hImc)) == NULL) 00312 return NULL; 00313 00314 EnterImcCrit(pClientImc); 00315 00316 if (pClientImc->hInputContext == NULL) { 00317 /* 00318 * If the owner thread of this hImc does not have 00319 * default IME window, don't bother to create the 00320 * INPUTCONTEXT. It could happen when some other 00321 * thread which call ImmGetContext() to retrieve 00322 * the associate hImc before the default IME window 00323 * is created. 00324 */ 00325 if ((HWND)NtUserQueryInputContext(hImc, 00326 InputContextDefaultImeWindow) == NULL) { 00327 LeaveImcCrit(pClientImc); 00328 ImmUnlockClientImc(pClientImc); 00329 return NULL; 00330 } 00331 00332 /* 00333 * This is a delay creation of INPUTCONTEXT structure. Create 00334 * it now for this hImc. 00335 */ 00336 pClientImc->hInputContext = LocalAlloc(LHND, sizeof(INPUTCONTEXT)); 00337 00338 if (pClientImc->hInputContext == NULL) { 00339 LeaveImcCrit(pClientImc); 00340 ImmUnlockClientImc(pClientImc); 00341 return NULL; 00342 } 00343 00344 dwImcThreadId = (DWORD)NtUserQueryInputContext(hImc, InputContextThread); 00345 00346 if (!CreateInputContext(hImc, GetKeyboardLayout(dwImcThreadId), fCanCallImeSelect)) { 00347 RIPMSG0(RIP_WARNING, "ImmLockIMC: CreateInputContext failed"); 00348 LocalFree(pClientImc->hInputContext); 00349 pClientImc->hInputContext = NULL; 00350 LeaveImcCrit(pClientImc); 00351 ImmUnlockClientImc(pClientImc); 00352 return NULL; 00353 } 00354 } 00355 00356 LeaveImcCrit(pClientImc); 00357 00358 pInputContext = (PINPUTCONTEXT)LocalLock(pClientImc->hInputContext); 00359 00360 /* 00361 * Increment lock count so that the ImmUnlockClientImc() won't 00362 * free up the pClientImc->hInputContext. 00363 */ 00364 InterlockedIncrement(&pClientImc->cLockObj); 00365 00366 ImmUnlockClientImc(pClientImc); 00367 00368 return pInputContext; 00369 }

PTHREADINFO PtiCurrent VOID   ) 
 

Definition at line 585 of file w32/ntuser/imm/misc.c.

References ConnectIfNecessary.

00586 { 00587 ConnectIfNecessary(); 00588 return (PTHREADINFO)NtCurrentTebShared()->Win32ThreadInfo; 00589 }

BOOL TestInputContextProcess PIMC  pImc  ) 
 

Definition at line 598 of file w32/ntuser/imm/misc.c.

References BOOL, GetInputContextProcess, GETPROCESSID, GETPTI, PtiCurrent, PtoH, and TRUE.

Referenced by ImmLockClientImc().

00600 { 00601 /* 00602 * If the threads are the same, don't bother going to the kernel 00603 * to get the input context's process id. 00604 */ 00605 if (GETPTI(pImc) == PtiCurrent()) { 00606 return TRUE; 00607 } 00608 00609 return (GetInputContextProcess(PtoH(pImc)) == GETPROCESSID()); 00610 }

BOOL TestWindowProcess PWND  pwnd  ) 
 

Definition at line 619 of file w32/ntuser/imm/misc.c.

References BOOL, GETPROCESSID, GETPTI, GetWindowProcess, HW, PtiCurrent, and TRUE.

00621 { 00622 /* 00623 * If the threads are the same, don't bother going to the kernel 00624 * to get the window's process id. 00625 */ 00626 if (GETPTI(pwnd) == PtiCurrent()) { 00627 return TRUE; 00628 } 00629 00630 return (GetWindowProcess(HW(pwnd)) == GETPROCESSID()); 00631 }


Variable Documentation

UINT CachedCP = CP_ACP [static]
 

Definition at line 641 of file w32/ntuser/imm/misc.c.

Referenced by GetKeyboardLayoutCP().

LCID CachedLCID = 0 [static]
 

Definition at line 640 of file w32/ntuser/imm/misc.c.

Referenced by GetKeyboardLayoutCP().


Generated on Sat May 15 19:44:43 2004 for test by doxygen 1.3.7