test: immcli.h File Reference

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

# immcli.h File Reference

`#include <windows.h>`
`#include <stddef.h>`
`#include <w32err.h>`
`#include <w32gdip.h>`
`#include "winuserp.h"`
`#include "winuserk.h"`
`#include "kbd.h"`
`#include <wowuserp.h>`
`#include <memory.h>`
`#include <string.h>`
`#include <imm.h>`
`#include <immp.h>`
`#include <ime.h>`
`#include <imep.h>`
`#include <winnls32.h>`
`#include "immstruc.h"`
`#include "immuser.h"`
`#include "user.h"`

Go to the source code of this file.

## Classes

struct | _ENUMREGWORDDATA
struct | tagIMELAYOUT
struct | tagFE_KEYBOARDS
struct | ADVAPI_FN

## Defines

#define | OEMRESOURCE 1
#define | HEX_ASCII_SIZE 20
#define | ImmAssert UserAssert
#define | bUser32Initialized (gpsi != NULL)
#define | ValidateHwnd(hwnd)
#define | ValidateHimc(himc)
#define | RevalidateHimc(himc)
#define | ImmLocalReAlloc(p, uBytes, uFlags) HeapReAlloc(pImmHeap, uFlags, (LPSTR)(p), (uBytes))
#define | ImmLocalFree(p) HeapFree(pImmHeap, 0, (LPSTR)(p))
#define | ImmLocalSize(p) HeapSize(pImmHeap, 0, (LPSTR)(p))
#define | ImmLocalLock(p) (LPSTR)(p)
#define | ImmLocalUnlock(p)
#define | ImmLocalFlags(p) 0
#define | ImmLocalHandle(p) (HLOCAL)(p)
#define | GetInputContextProcess(himc) (DWORD)NtUserQueryInputContext(himc, InputContextProcess)
#define | GetInputContextThread(himc) (DWORD)NtUserQueryInputContext(himc, InputContextThread)
#define | GetWindowProcess(hwnd) (ULONG_PTR)NtUserQueryWindow(hwnd, WindowProcess)
#define | GETPROCESSID() (ULONG_PTR)(NtCurrentTeb()->ClientId.UniqueProcess)
#define | DWORD_ALIGN(x) ((x+3)&~3)
#define | SetICF(pClientImc, flag) ((pClientImc)->dwFlags |= flag)
#define | ClrICF(pClientImc, flag) ((pClientImc)->dwFlags &= ~flag)
#define | TestICF(pClientImc, flag) ((pClientImc)->dwFlags & flag)
#define | IsWndEqual(hWnd1, hWnd2)
#define | HKL_TO_LANGID(hkl) (LOWORD(HandleToUlong(hkl)))
#define | LANGIDFROMHKL(hkl) (LOBYTE(LOWORD((ULONG_PTR)hkl)))
#define | IMECodePage(pImeDpi) (CP_ACP)
#define | CImcCodePage(pClientImc) (CP_ACP)
#define | TRACE(x)
#define | BACK_T1 100
#define | TAB_T1 101
#define | CAPS_T1 102
#define | ENTER_T1 103
#define | SHIFT_T1 104
#define | CTRL_T1 105
#define | ESC_T1 106
#define | ALT_T1 107
#define | LABEL_T1 108
#define | BACKSP_C1 201
#define | TAB_C1 202
#define | CAPS_C1 203
#define | ENTER_C1 204
#define | SHIFT_C1 205
#define | INS_C1 206
#define | DEL_C1 207
#define | ESC_C1 208
#define | LABEL_C1 209

## Typedefs

typedef _ENUMREGWORDDATA | ENUMREGWORDDATA
typedef _ENUMREGWORDDATA * | PENUMREGWORDDATA
typedef tagIMELAYOUT | IMELAYOUT
typedef tagIMELAYOUT * | PIMELAYOUT
typedef tagFE_KEYBOARDS | FE_KEYBOARDS

## Functions

LPVOID | ImmLocalAlloc (DWORD uFlag, DWORD uBytes)
BOOL | CreateInputContext (HIMC hImc, HKL hKL, BOOL fCanCallImeSelect)
BOOL | DestroyInputContext (HIMC hImc, HKL hKL, BOOL bTerminate)
VOID | SelectInputContext (HKL hSelKL, HKL hUnSelKL, HIMC hImc)
DWORD | BuildHimcList (DWORD idThread, HIMC **pphimcFirst)
HIMC | ImmGetSaveContext (HWND hWnd, DWORD dwFlag)
BOOL | ImmSetCompositionStringWorker (HIMC hImc, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen, BOOL fAnsi)
DWORD | ImmGetCandidateListCountWorker (HIMC hImc, LPDWORD lpdwListCount, BOOL fAnsi)
DWORD | ImmGetCandidateListWorker (HIMC hImc, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen, BOOL fAnsi)
DWORD | ImmGetGuideLineWorker (HIMC hImc, DWORD dwIndex, LPBYTE lpBuf, DWORD dwBufLen, BOOL fAnsi)
LONG | InternalGetCompositionStringA (LPCOMPOSITIONSTRING lpCompStr, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL fAnsiImc, DWORD dwCodePage)
LONG | InternalGetCompositionStringW (LPCOMPOSITIONSTRING lpCompStr, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL fAnsiImc, DWORD dwCodePage)
DWORD | InternalGetCandidateListAtoW (LPCANDIDATELIST lpCandListA, LPCANDIDATELIST lpCandListW, DWORD dwBufLen, DWORD dwCodePage)
DWORD | InternalGetCandidateListWtoA (LPCANDIDATELIST lpCandListW, LPCANDIDATELIST lpCandListA, DWORD dwBufLen, DWORD dwCodePage)
DWORD | CalcCharacterPositionAtoW (DWORD dwCharPosA, LPSTR lpszCharStr, DWORD dwCodePage)
DWORD | CalcCharacterPositionWtoA (DWORD dwCharPosW, LPWSTR lpwszCharStr, DWORD dwCodePage)
VOID | LFontAtoLFontW (LPLOGFONTA lfFontA, LPLOGFONTW lfFontW)
VOID | LFontWtoLFontA (LPLOGFONTW lfFontW, LPLOGFONTA lfFontA)
BOOL | MakeIMENotify (HIMC hImc, HWND hWnd, DWORD dwAction, DWORD dwIndex, DWORD dwValue, WPARAM wParam, LPARAM lParam)
VOID | ImmSendNotification (BOOL fForProcess)
BOOL | InquireIme (PIMEDPI pImeDpi)
BOOL | LoadIME (PIMEINFOEX piiex, PIMEDPI pImeDpi)
VOID | UnloadIME (PIMEDPI pImeDpi, BOOL fTerminateIme)
PIMEDPI | LoadImeDpi (HKL hKL, BOOL fLock)
PIMEDPI | FindOrLoadImeDpi (HKL hKL)
VOID | GetSystemPathName (PWSTRpwszPath, PWSTR pwszFileName, UINT maxChar)
BOOL | LoadVersionInfo (PIMEINFOEX piiex)
LPWSTR | MakeStringFromRegFullInfo (PKEY_VALUE_FULL_INFORMATION pKey, size_t limit)
PINPUTCONTEXT | InternalImmLockIMC (HIMC hImc, BOOL fCanCallImeSelect)
BOOL | ImmIsUIMessageWorker (HWND hIMEWnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL fAnsi)
BOOL | TestInputContextProcess (PIMC pImc)
PIMEDPI | ImmGetImeDpi (HKL hKL)
DWORD | ImmGetAppCompatFlags (HIMC hImc)
BOOL | ImmPtInRect (int left, int top, int width, int height, LPPOINT lppt)
UINT | GetKeyboardLayoutCP (HKL hKL)
UINT CALLBACK | EnumRegisterWordProcA (LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszString, PENUMREGWORDDATA pEnumRegWordData)
UINT CALLBACK | EnumRegisterWordProcW (LPCWSTR lpwszReading, DWORD dwStyle, LPCWSTR lpwszString, PENUMREGWORDDATA pEnumRegWordData)
VOID | ImmPostMessages (HWND hwnd, HIMC hImc, INT iNum, PTRANSMSG pTransMsg)
BOOL | HotKeyIDDispatcher (HWND hWnd, HIMC hImc, HKL hKL, DWORD dwHotKeyID)
BOOL | OpenRegApi (ADVAPI_FN *pfn)
void | CloseRegApi (ADVAPI_FN *pfn)
LRESULT | TranslateIMESubFunctions (HWND hWndApp, LPIMESTRUCT lpIme, BOOL fAnsi)
LRESULT | TransGetLevel (HWND hWndApp)
LRESULT | TransSetLevel (HWND hWndApp, LPIMESTRUCT lpIme)
LRESULT | TransCodeConvert (HIMC hImc, LPIMESTRUCT lpIme)
LRESULT | TransConvertList (HIMC hImc, LPIMESTRUCT lpIme)
LRESULT | TransGetMNTable (HIMC hImc, LPIMESTRUCT lpIme)
UINT | WINNLSTranslateMessageK (int iNumMsg, PTRANSMSG pTransMsg, LPINPUTCONTEXT lpIMC, LPCOMPOSITIONSTRING lpCompStr, BOOL bAnsiIMC)
UINT | WINNLSTranslateMessageJ (UINT uiNumMsg, PTRANSMSG pTransMsg, LPINPUTCONTEXT lpIMC, LPCOMPOSITIONSTRING lpCompStr, BOOL bAnsiIMC)
UINT | WINNLSTranslateMessage (INT iNum, PTRANSMSG pTransMsg, HIMC hImc, BOOL fAnsi, DWORD dwLangId)
__inline int | IsAnsiIMC (HIMC hIMC)

## Variables

BOOLEAN | gfInitialized
HINSTANCE | ghInst
PVOID | pImmHeap
PSERVERINFO | gpsi
SHAREDINFO | gSharedInfo
PIMEDPI | gpImeDpi
CRITICAL_SECTION | gcsImeDpi
POINT | gptWorkArea
POINT | gptRaiseEdge
UINT | guScanCode [0XFF]
CONST WCHAR | gszRegKbdLayout []
CONST WCHAR | gszRegKbdOrder []
CONST WCHAR | gszValLayoutText []
CONST WCHAR | gszValLayoutFile []
CONST WCHAR | gszValImeFile []
PTHREADINFO | PtiCurrent (VOID)

## Define Documentation

#define ALT_T1 107

| Definition at line 484 of file immcli.h. Referenced by InitSKT1Bitmap().

#define BACK_T1 100

| Definition at line 477 of file immcli.h. Referenced by InitSKT1Bitmap().

#define BACKSP_C1 201

| Definition at line 488 of file immcli.h. Referenced by InitSKC1Bitmap().

#define bUser32Initialized (gpsi != NULL)

| Definition at line 118 of file immcli.h.

#define CAPS_C1 203

| Definition at line 490 of file immcli.h. Referenced by InitSKC1Bitmap().

#define CAPS_T1 102

| Definition at line 479 of file immcli.h. Referenced by InitSKT1Bitmap().

#define CImcCodePage | ( | pClientImc |  | ) | (CP_ACP)

| Definition at line 183 of file immcli.h. Referenced by ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), and ImmRequestMessageWorker().

#define ClrICF | ( | pClientImc,
|  | flag |  | ) | ((pClientImc)->dwFlags &= ~flag)

| Definition at line 164 of file immcli.h. Referenced by ImmEnableIME(), ImmSetActiveContext(), and SelectInputContext().

#define CTRL_T1 105

| Definition at line 482 of file immcli.h. Referenced by InitSKT1Bitmap().

#define DEL_C1 207

| Definition at line 494 of file immcli.h. Referenced by InitSKC1Bitmap().

#define DWORD_ALIGN | ( | x |  | ) | ((x+3)&~3)

| Definition at line 160 of file immcli.h. Referenced by AddTaggedElement(), AddTagTableEntry(), ChangeTaggedElementSize(), CompStrAToStringExA(), CompStrAToStringExW(), CompStrAToUndetA(), CompStrAToUndetW(), CompStrWToStringExA(), CompStrWToStringExW(), CompStrWToUndetA(), CompStrWToUndetW(), DeleteTaggedElement(), ImmGetCandidateListCountWorker(), InternalGetCandidateListAtoW(), InternalGetCandidateListWtoA(), SetColorProfileElementReference(), and SetColorProfileElementSize().

#define ENTER_C1 204

| Definition at line 491 of file immcli.h. Referenced by InitSKC1Bitmap().

#define ENTER_T1 103

| Definition at line 480 of file immcli.h. Referenced by InitSKT1Bitmap().

#define ESC_C1 208

| Definition at line 495 of file immcli.h. Referenced by InitSKC1Bitmap().

#define ESC_T1 106

| Definition at line 483 of file immcli.h. Referenced by InitSKT1Bitmap().

#define GetInputContextProcess | ( | himc |  | ) | (DWORD)NtUserQueryInputContext(himc, InputContextProcess)

| Definition at line 149 of file immcli.h. Referenced by ImmGetImeMenuItemsWorker(), and TestInputContextProcess().

#define GetInputContextThread | ( | himc |  | ) | (DWORD)NtUserQueryInputContext(himc, InputContextThread)

| Definition at line 152 of file immcli.h. Referenced by HotKeyIDDispatcher(), ImmAssociateContext(), ImmAssociateContextEx(), ImmDestroyContext(), ImmGenerateMessage(), ImmGetImeMenuItemsWorker(), ImmNotifyIME(), ImmRequestMessageAorW(), ImmSetCandidateWindow(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmSetCompositionStringWorker(), ImmSetCompositionWindow(), ImmSetConversionStatus(), ImmSetOpenStatus(), ImmSetStatusWindowPos(), MakeIMENotify(), and TransHanjaMode().

#define GETPROCESSID | (

)

(ULONG_PTR)(NtCurrentTeb()->ClientId.UniqueProcess)

| Definition at line 158 of file immcli.h.

#define GetWindowProcess | ( | hwnd |  | ) | (ULONG_PTR)NtUserQueryWindow(hwnd, WindowProcess)

| Definition at line 155 of file immcli.h.

#define HEX_ASCII_SIZE 20

| Definition at line 51 of file immcli.h. Referenced by GetImeLayout(), ImmInstallIMEW(), and WriteImeLayout().

#define HKL_TO_LANGID | ( | hkl |  | ) | (LOWORD(HandleToUlong(hkl)))

| Definition at line 171 of file immcli.h.

#define IMECodePage | ( | pImeDpi |  | ) | (CP_ACP)

| Definition at line 182 of file immcli.h. Referenced by CreateInputContext(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmRegisterWordA(), ImmRegisterWordW(), ImmSetCompositionStringWorker(), ImmUnregisterWordA(), ImmUnregisterWordW(), InquireIme(), and SelectInputContext().

#define ImmAssert UserAssert

| Definition at line 59 of file immcli.h. Referenced by EnumRegisterWordProcA(), EnumRegisterWordProcW(), HotKeyIDDispatcher(), ImmGetImeInfoEx(), ImmPenAuxInput(), ImmProcessKey(), ImmTranslateMessage(), RestorePrivateMode(), and SelectInputContext().

#define ImmLocalFlags | ( | p |  | ) | 0

| Definition at line 141 of file immcli.h.

#define ImmLocalFree | ( | p |  | ) | HeapFree(pImmHeap, 0, (LPSTR)(p))

| Definition at line 137 of file immcli.h. Referenced by BuildHimcList(), CopyImeFile(), DestroyImeModeSaver(), EnumRegisterWordProcA(), EnumRegisterWordProcW(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmCreateContext(), ImmDisableIME(), ImmEnumInputContext(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmFreeLayout(), ImmGenerateMessage(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetImeMenuItemsWorker(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmIMPQueryIMEW(), ImmIMPSetIMEW(), ImmInstallIMEA(), ImmInstallIMEW(), ImmLockClientImc(), ImmPenAuxInput(), ImmPostMessages(), ImmProcessKey(), ImmPutImeMenuItemsIntoMappedFile(), ImmRegisterWordA(), ImmRegisterWordW(), ImmRequestMessageWorker(), ImmSetCompositionStringWorker(), ImmTranslateMessage(), ImmUnloadIME(), ImmUnlockClientImc(), ImmUnlockImeDpi(), ImmUnregisterWordA(), ImmUnregisterWordW(), InternalGetCompositionStringA(), InternalGetCompositionStringW(), InternalSCS_CHANGEATTR(), InternalSCS_CHANGECLAUSE(), InternalSCS_RECONVERTSTRING(), LoadImeDpi(), LoadVersionInfo(), and WINNLSTranslateMessageJ().

#define ImmLocalHandle | ( | p |  | ) | (HLOCAL)(p)

| Definition at line 142 of file immcli.h.

#define ImmLocalLock | ( | p |  | ) | (LPSTR)(p)

| Definition at line 139 of file immcli.h.

#define ImmLocalReAlloc | ( | p,
|  | uBytes,
|  | uFlags |  | ) | HeapReAlloc(pImmHeap, uFlags, (LPSTR)(p), (uBytes))

| Definition at line 136 of file immcli.h.

#define ImmLocalSize | ( | p |  | ) | HeapSize(pImmHeap, 0, (LPSTR)(p))

| Definition at line 138 of file immcli.h.

#define ImmLocalUnlock | ( | p |  | ) |

| Definition at line 140 of file immcli.h.

#define INS_C1 206

| Definition at line 493 of file immcli.h. Referenced by InitSKC1Bitmap().

#define IsWndEqual | ( | hWnd1,
|  | hWnd2 |  | ) |

Value:

    (LOWORD(HandleToUlong(hWnd1)) == LOWORD(HandleToUlong(hWnd2)) && \
                ValidateHwnd(hWnd1) == ValidateHwnd(hWnd2))

Definition at line 168 of file immcli.h.

Referenced by ImmAssociateContext(), SKT1ButtonUp(), and TransSetConversionWindow().

#define LABEL_C1 209

| Definition at line 496 of file immcli.h. Referenced by InitSKC1Bitmap().

#define LABEL_T1 108

| Definition at line 485 of file immcli.h. Referenced by InitSKT1Bitmap().

#define LANGIDFROMHKL | ( | hkl |  | ) | (LOBYTE(LOWORD((ULONG_PTR)hkl)))

| Definition at line 176 of file immcli.h. Referenced by WriteImeLayout().

#define OEMRESOURCE 1

| Definition at line 18 of file immcli.h.

#define RevalidateHimc | ( | himc |  | ) |

Value:

    (((himc) == (HIMC)NULL || !bUser32Initialized) \
            ? (PIMC)NULL : HMValidateHandleNoRip((HANDLE)himc, TYPE_INPUTCONTEXT))

Definition at line 126 of file immcli.h.

Referenced by ImmEnumInputContext().

#define SetICF | ( | pClientImc,
|  | flag |  | ) | ((pClientImc)->dwFlags |= flag)

| Definition at line 162 of file immcli.h. Referenced by CreateInputContext(), DestroyInputContext(), ImmEnableIME(), ImmLockClientImc(), ImmSetActiveContext(), and SelectInputContext().

#define SHIFT_C1 205

| Definition at line 492 of file immcli.h. Referenced by InitSKC1Bitmap().

#define SHIFT_T1 104

| Definition at line 481 of file immcli.h. Referenced by InitSKT1Bitmap().

#define TAB_C1 202

| Definition at line 489 of file immcli.h. Referenced by InitSKC1Bitmap().

#define TAB_T1 101

| Definition at line 478 of file immcli.h. Referenced by InitSKT1Bitmap().

#define TestICF | ( | pClientImc,
|  | flag |  | ) | ((pClientImc)->dwFlags & flag)

| Definition at line 166 of file immcli.h. Referenced by DestroyInputContext(), ImmEnableIME(), ImmGenerateMessage(), ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetCompositionFontA(), ImmGetCompositionFontW(), ImmGetCompositionStringA(), ImmGetCompositionStringW(), ImmGetGuideLineWorker(), ImmGetSaveContext(), ImmLockClientImc(), ImmPostMessages(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmUnlockClientImc(), IsAnsiIMC(), MySetCompFont(), SelectInputContext(), and SetFontForMCWVERTICAL().

#define TRACE | ( | x |  | ) |

| Definition at line 470 of file immcli.h.

#define ValidateHimc | ( | himc |  | ) |

Value:

    (((himc) == (HIMC)NULL || !bUser32Initialized) \
            ? (PIMC)NULL : HMValidateHandle((HANDLE)himc, TYPE_INPUTCONTEXT))

Definition at line 123 of file immcli.h.

#define ValidateHwnd | ( | hwnd |  | ) |

Value:

    (((hwnd) == (HWND)NULL || !bUser32Initialized) \
            ? (PWND)NULL : HMValidateHandle(hwnd, TYPE_WINDOW))

Definition at line 120 of file immcli.h.

Referenced by _CreateWindowEx(), _SetWindowLongPtr(), AnimateWindow(), ArrangeWindows(), ButtonWndProcA(), ButtonWndProcW(), CalcClientScrolling(), CheckRadioButton(), ChildWindowFromPoint(), ClientToScreen(), CloseWindow(), ComboBoxWndProcA(), ComboBoxWndProcW(), ComboBoxWndProcWorker(), ComboListBoxWndProcA(), ComboListBoxWndProcW(), DDEMLClientWndProc(), DefDlgProcA(), DefDlgProcW(), DefDlgProcWorker(), DefFrameProcWorker(), DefMDIChildProcWorker(), DefWindowProc(), DesktopWndProcWorker(), DialogBox2(), DispatchMessageWorker(), DlgDirListA(), DlgDirListComboBoxA(), DlgDirListComboBoxW(), DlgDirListW(), DlgDirSelectComboBoxExW(), ECGetControlBrush(), ECIsAncestorActive(), EditWndProcA(), EditWndProcW(), EndDialog(), EnterReaderModeHelper(), EnumHwndDlgChildProc(), FChildVisible(), GetClassLongPtr(), GetClassNameA(), GetClassWord(), GetClientRect(), GetDesktopWindow(), GetDialogMonitor(), GetDlgCtrlID(), GetDlgItem(), GetLastActivePopup(), GetMenu(), GetNextDlgGroupItem(), GetNextDlgTabItem(), GetParent(), GetProp(), GetScrollInfo(), GetScrollPos(), GetScrollRange(), GetTopWindow(), GetUpdateRect(), GetUpdateRgn(), GetWindow(), GetWindowInfo(), GetWindowLongPtr(), GetWindowModuleFileName(), GetWindowRect(), GetWindowRgn(), GetWindowText(), GetWindowTextLength(), GetWindowWord(), ImeWndProcA(), ImeWndProcW(), ImmAssociateContext(), ImmAssociateContextEx(), ImmCallImeConsoleIME(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmGetSaveContext(), ImmRequestMessageAorW(), ImmSetActiveContext(), InternalCreateDialog(), InternalDialogBox(), InternalEnumWindows(), IsChild(), IsDialogMessageA(), IsDialogMessageW(), IsIconic(), IsWindowEnabled(), IsWindowUnicode(), IsWindowVisible(), IsZoomed(), ListBoxWndProcA(), ListBoxWndProcW(), MapDialogRect(), MapWindowPoints(), MB_DlgProcWorker(), MDIActivateDlgSize(), MDIAddSysMenu(), MDIClientWndProcA(), MDIClientWndProcW(), MDIClientWndProcWorker(), MDICompleteChildCreation(), MDIRemoveSysMenu(), MenuWndProcWorker(), MESSAGECALL(), MLScroll(), MonitorFromWindow(), NtUserFlashWindowEx(), NtUserGetDC(), NtUserGetDCEx(), NtUserPostMessage(), NtUserTranslateMessage(), OpenIcon(), PaintRect(), ProcessDDEMLInitiate(), ReaderWndProc(), ScreenToClient(), ScrollBarWndProcWorker(), SendMessage(), SetScrollRange(), SetWindowText(), SLEditWndProc(), SmoothScrollWindowEx(), StaticWndProcA(), StaticWndProcW(), TrackMouseEvent(), UnmaximizeChildWindows(), UpdateWindow(), UserAssociateHwnd(), UserGetClientRgn(), UserGetDesktopDC(), ValidatePositionableWindow(), WinHelpA(), xxxbFullscreenSwitch(), xxxCBCreateHandler(), xxxCheckDefPushButton(), xxxCsEvent(), xxxDDETrackGetMessageHook(), xxxDDETrackPostHook(), xxxDDETrackSendHook(), xxxDefWindowProc(), xxxDispatchMessage(), xxxDragObject(), xxxHelpLoop(), xxxInternalGetMessage(), xxxLBoxCaretBlinker(), xxxMDIActivate(), xxxMDIDestroy(), xxxSaveDlgFocus(), xxxSetConsoleCaretInfo(), xxxSetFrameTitle(), xxxSetWindowData(), xxxSysCommand(), and xxxTranslateMessage().

## Typedef Documentation

typedef struct _ENUMREGWORDDATA ENUMREGWORDDATA

| Referenced by ImmEnumRegisterWordA().

typedef struct tagFE_KEYBOARDS FE_KEYBOARDS

typedef struct tagIMELAYOUT IMELAYOUT

typedef struct _ENUMREGWORDDATA * PENUMREGWORDDATA

| Referenced by EnumRegisterWordProcA().

typedef struct tagIMELAYOUT * PIMELAYOUT

## Function Documentation

DWORD BuildHimcList | ( | DWORD | idThread,
|  | HIMC ** | pphimcFirst
| ) |

Definition at line 1259 of file w32/ntuser/imm/context.c.

References DWORD, ImmLocalAlloc(), ImmLocalFree, NT_SUCCESS, NTSTATUS(), NtUserBuildHimcList(), NULL, Status, and UINT.

    01262 {
    01263     UINT cHimc;
    01264     HIMC *phimcFirst;
    01265     NTSTATUS Status;
    01266     int cTries;
    01267
    01268     /*
    01269      * Allocate a buffer to hold the names.
    01270      */
    01271     cHimc = 64;
    01272     phimcFirst = ImmLocalAlloc(0, cHimc * sizeof(HIMC));
    01273     if (phimcFirst == NULL)
    01274         return 0;
    01275
    01276     Status = NtUserBuildHimcList(idThread, cHimc, phimcFirst, &cHimc);
    01277
    01278     /*
    01279      * If the buffer wasn't big enough, reallocate
    01280      * the buffer and try again.
    01281      */
    01282     cTries = 0;
    01283     while (Status == STATUS_BUFFER_TOO_SMALL) {
    01284         ImmLocalFree(phimcFirst);
    01285
    01286         /*
    01287          * If we can't seem to get it right,
    01288          * call it quits
    01289          */
    01290         if (cTries++ == 10)
    01291             return 0;
    01292
    01293         phimcFirst = ImmLocalAlloc(0, cHimc * sizeof(HIMC));
    01294         if (phimcFirst == NULL)
    01295             return 0;
    01296
    01297         Status = NtUserBuildHimcList(idThread, cHimc, phimcFirst, &cHimc);
    01298     }
    01299
    01300     if (!NT_SUCCESS(Status) || cHimc == 0) {
    01301         ImmLocalFree(phimcFirst);
    01302         return 0;
    01303     }
    01304
    01305     *pphimcFirst = phimcFirst;
    01306
    01307     return cHimc;
    01308 }

DWORD CalcCharacterPositionAtoW | ( | DWORD | dwCharPosA,
|  | LPSTR | lpszCharStr,
|  | DWORD | dwCodePage
| ) |

Definition at line 3052 of file ctxtinfo.c.

References DWORD.

Referenced by CompStrAToStringExW(), CompStrAToUndetW(), ImmReconversionWorker(), ImmRequestMessageWorker(), InternalGetCompositionStringW(), and InternalSCS_CHANGECLAUSE().

    03056 {
    03057     DWORD dwCharPosW = 0;
    03058
    03059     while (dwCharPosA != 0) {
    03060         if (IsDBCSLeadByteEx(dwCodePage, *lpszCharStr)) {
    03061             if (dwCharPosA >= 2) {
    03062                 dwCharPosA -= 2;
    03063             }
    03064             else {
    03065                 dwCharPosA--;
    03066             }
    03067             lpszCharStr += 2;
    03068         }
    03069         else {
    03070             dwCharPosA--;
    03071             lpszCharStr++;
    03072         }
    03073         dwCharPosW++;
    03074     }
    03075
    03076     return dwCharPosW;
    03077 }

DWORD CalcCharacterPositionWtoA | ( | DWORD | dwCharPosW,
|  | LPWSTR | lpwszCharStr,
|  | DWORD | dwCodePage
| ) |

Definition at line 3089 of file ctxtinfo.c.

References DWORD, and UnicodeToMultiByteSize().

Referenced by CompStrWToStringExA(), CompStrWToUndetA(), ImmReconversionWorker(), ImmRequestMessageWorker(), InternalGetCompositionStringA(), and InternalSCS_CHANGECLAUSE().

    03093 {
    03094     DWORD dwCharPosA = 0;
    03095     ULONG MultiByteSize;
    03096
    03097     while (dwCharPosW != 0) {
    03098         MultiByteSize = UnicodeToMultiByteSize(dwCodePage, lpwszCharStr);
    03099         if (MultiByteSize == 2) {
    03100             dwCharPosA += 2;
    03101         }
    03102         else {
    03103             dwCharPosA++;
    03104         }
    03105         dwCharPosW--;
    03106         lpwszCharStr++;
    03107     }
    03108
    03109     return dwCharPosA;
    03110 }

void CloseRegApi | ( | ADVAPI_FN * | pfn | ) |

Definition at line 486 of file immhotky.c.

References ADVAPI_FN::hModule.

Referenced by CliSaveImeHotKey().

    00487 {
    00488     UserAssert(pfn->hModule);
    00489     if (pfn->hModule) {
    00490         FreeLibrary(pfn->hModule);
    00491         pfn->hModule;
    00492     }
    00493 }

BOOL CreateInputContext | ( | HIMC | hImc,
|  | HKL | hKL,
|  | BOOL | fCanCallImeSelect
| ) |

Definition at line 563 of file w32/ntuser/imm/context.c.

References BOOL, tagCLIENTIMC::dwCodePage, DWORD, FALSE, IMCF_UNICODE, IMECodePage, tagIMEDPI::ImeInfo, tagIMEDPI::_tagImeFunctions::ImeSelect, ImmCreateIMCC(), ImmDestroyIMCC(), ImmLockClientImc(), ImmLockIMC(), ImmLockIMCC(), ImmLockImeDpi(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), ImmUnlockImeDpi(), NULL, tagIMEDPI::pfn, SetICF, TRUE, and UINT.

    00567 {
    00568     PIMEDPI            pImeDpi;
    00569     PCLIENTIMC         pClientImc;
    00570     DWORD              dwPrivateDataSize;
    00571     DWORD              fdwInitConvMode = 0;    // do it later
    00572     BOOL               fInitOpen = FALSE;      // do it later
    00573     PINPUTCONTEXT      pInputContext;
    00574     PCOMPOSITIONSTRING pCompStr;
    00575     PCANDIDATEINFO     pCandInfo;
    00576     PGUIDELINE         pGuideLine;
    00577     int                i;
    00578
    00579     pInputContext = ImmLockIMC(hImc);
    00580     if (!pInputContext) {
    00581         RIPMSG1(RIP_WARNING, "CreateContext: Lock hIMC %x failure", hImc);
    00582         goto CrIMCLockErrOut;
    00583     }
    00584
    00585     /*
    00586      * Initialize the member of INPUTCONTEXT
    00587      */
    00588     pInputContext->hCompStr = ImmCreateIMCC(sizeof(COMPOSITIONSTRING));
    00589     if (!pInputContext->hCompStr) {
    00590         RIPMSG0(RIP_WARNING, "CreateContext: Create hCompStr failure");
    00591         goto CrIMCUnlockIMC;
    00592     }
    00593
    00594     pCompStr = (PCOMPOSITIONSTRING)ImmLockIMCC(pInputContext->hCompStr);
    00595     if (!pCompStr) {
    00596         RIPMSG1(RIP_WARNING,
    00597               "CreateContext: Lock hCompStr %x failure", pInputContext->hCompStr);
    00598         goto CrIMCFreeCompStr;
    00599     }
    00600
    00601     pCompStr->dwSize = sizeof(COMPOSITIONSTRING);
    00602     ImmUnlockIMCC(pInputContext->hCompStr);
    00603
    00604     pInputContext->hCandInfo = ImmCreateIMCC(sizeof(CANDIDATEINFO));
    00605     if (!pInputContext->hCandInfo) {
    00606         RIPMSG0(RIP_WARNING, "CreateContext: Create hCandInfo failure");
    00607         goto CrIMCFreeCompStr;
    00608     }
    00609
    00610     pCandInfo = (PCANDIDATEINFO)ImmLockIMCC(pInputContext->hCandInfo);
    00611     if (!pCandInfo) {
    00612         RIPMSG1(RIP_WARNING,
    00613               "CreateContext: Lock hCandInfo %x failure", pInputContext->hCandInfo);
    00614         goto CrIMCFreeCandInfo;
    00615     }
    00616
    00617     pCandInfo->dwSize = sizeof(CANDIDATEINFO);
    00618     ImmUnlockIMCC(pInputContext->hCandInfo);
    00619
    00620     pInputContext->hGuideLine = ImmCreateIMCC(sizeof(GUIDELINE));
    00621     if (!pInputContext->hGuideLine) {
    00622         RIPMSG0(RIP_WARNING, "CreateContext: Create hGuideLine failure");
    00623         goto CrIMCFreeCandInfo;
    00624     }
    00625
    00626     pGuideLine = (PGUIDELINE)ImmLockIMCC(pInputContext->hGuideLine);
    00627     if (!pGuideLine) {
    00628         RIPMSG1(RIP_WARNING,
    00629               "CreateContext: Lock hGuideLine %x failure", pInputContext->hGuideLine);
    00630         goto CrIMCFreeGuideLine;
    00631     }
    00632
    00633     pGuideLine->dwSize = sizeof(GUIDELINE);
    00634     ImmUnlockIMCC(pInputContext->hGuideLine);
    00635
    00636     pInputContext->hMsgBuf = ImmCreateIMCC(sizeof(UINT));
    00637     if (!pInputContext->hMsgBuf) {
    00638         RIPMSG0(RIP_WARNING, "CreateContext: Create hMsgBuf failure");
    00639         goto CrIMCFreeGuideLine;
    00640     }
    00641
    00642     pInputContext->dwNumMsgBuf = 0;
    00643     pInputContext->fOpen = fInitOpen;
    00644     pInputContext->fdwConversion = fdwInitConvMode;
    00645     pInputContext->fdwSentence = 0;
    00646
    00647     for (i = 0; i < 4; i++) {
    00648         pInputContext->cfCandForm[i].dwIndex = (DWORD)(-1);
    00649     }
    00650
    00651     pImeDpi = ImmLockImeDpi(hKL);
    00652     if (pImeDpi != NULL) {
    00653         if ((pClientImc = ImmLockClientImc(hImc)) == NULL) {
    00654             RIPMSG0(RIP_WARNING, "CreateContext: ImmLockClientImc() failure");
    00655             ImmUnlockImeDpi(pImeDpi);
    00656             goto CrIMCFreeMsgBuf;
    00657         }
    00658
    00659         /*
    00660          * Unicode based IME expects an Uncode based input context.
    00661          */
    00662         if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
    00663             SetICF(pClientImc, IMCF_UNICODE);
    00664
    00665         pClientImc->dwCodePage = IMECodePage(pImeDpi);
    00666
    00667         ImmUnlockClientImc(pClientImc);
    00668
    00669         dwPrivateDataSize = pImeDpi->ImeInfo.dwPrivateDataSize;
    00670     }
    00671     else {
    00672         dwPrivateDataSize = sizeof(UINT);
    00673     }
    00674
    00675     pInputContext->hPrivate = ImmCreateIMCC(dwPrivateDataSize);
    00676     if (!pInputContext->hPrivate) {
    00677         RIPMSG0(RIP_WARNING, "CreateContext: Create hPrivate failure");
    00678         ImmUnlockImeDpi(pImeDpi);
    00679         goto CrIMCFreeMsgBuf;
    00680     }
    00681
    00682     pInputContext->pImeModeSaver = NULL;
    00683
    00684     if (pImeDpi != NULL) {
    00685         if (fCanCallImeSelect) {
    00686             (*pImeDpi->pfn.ImeSelect)(hImc, TRUE);
    00687         }
    00688         ImmUnlockImeDpi(pImeDpi);
    00689     }
    00690
    00691     ImmUnlockIMC(hImc);
    00692     return TRUE;
    00693
    00694     /*
    00695      * context failure case
    00696      */
    00697 CrIMCFreeMsgBuf:
    00698     ImmDestroyIMCC(pInputContext->hMsgBuf);
    00699 CrIMCFreeGuideLine:
    00700     ImmDestroyIMCC(pInputContext->hGuideLine);
    00701 CrIMCFreeCandInfo:
    00702     ImmDestroyIMCC(pInputContext->hCandInfo);
    00703 CrIMCFreeCompStr:
    00704     ImmDestroyIMCC(pInputContext->hCompStr);
    00705 CrIMCUnlockIMC:
    00706     ImmUnlockIMC(hImc);
    00707 CrIMCLockErrOut:
    00708     return FALSE;
    00709 }

BOOL DestroyInputContext | ( | HIMC | hImc,
|  | HKL | hKL,
|  | BOOL | bTerminate
| ) |

Definition at line 718 of file w32/ntuser/imm/context.c.

References BOOL, tagCLIENTIMC::cLockObj, DestroyImeModeSaver(), tagIMC::dwClientImcData, FALSE, GETPTI, tagCLIENTIMC::hInputContext, HMValidateHandle(), IMCF_DEFAULTIMC, IMCF_INDESTROY, tagIMEDPI::_tagImeFunctions::ImeSelect, ImmDestroyIMCC(), ImmLockIMC(), ImmLockImeDpi(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockImeDpi(), IS_IME_ENABLED, NtUserDestroyInputContext(), NULL, NULL_HIMC, tagIMEDPI::pfn, PtiCurrent, SetICF, TestICF, TRUE, and TYPE_INPUTCONTEXT.

    00722 {
    00723     PINPUTCONTEXT pInputContext;
    00724     PIMEDPI       pImeDpi;
    00725     PIMC          pImc;
    00726     PCLIENTIMC    pClientImc;
    00727
    00728     if (!IS_IME_ENABLED()) {
    00729         return FALSE;
    00730
    00731     }
    00732     if (hImc == NULL_HIMC) {
    00733         RIPMSG0(RIP_VERBOSE, "DestroyInputContext: hImc is NULL.");
    00734         return FALSE;
    00735     }
    00736
    00737     pImc = HMValidateHandle((HANDLE)hImc, TYPE_INPUTCONTEXT);
    00738
    00739     /*
    00740      * Cannot destroy input context from other thread.
    00741      */
    00742     if (pImc == NULL || GETPTI(pImc) != PtiCurrent())
    00743         return FALSE;
    00744
    00745     /*
    00746      * We are destroying this hImc so we don't bother calling
    00747      * ImmLockClientImc() to get the pClientImc. Instead, we
    00748      * reference the pImc->dwClientImcData directly and call
    00749      * InterlockedIncrement(&pClientImc->cLockObj) right after
    00750      * several quick checks.
    00751      */
    00752     pClientImc = (PCLIENTIMC)pImc->dwClientImcData;
    00753
    00754     if (pClientImc == NULL) {
    00755         /*
    00756          * Client side Imc has not been initialzed yet.
    00757          * We simply destroy this input context from kernel.
    00758          */
    00759         if (bTerminate) {
    00760             /*
    00761              * If called from THREAD_DETACH, we don't
    00762              * have to destroy kernel side Input Context.
    00763              */
    00764             return TRUE;
    00765         }
    00766         return NtUserDestroyInputContext(hImc);
    00767     }
    00768
    00769     if (TestICF(pClientImc, IMCF_DEFAULTIMC) && !bTerminate) {
    00770         /*
    00771          * Cannot destroy default input context unless the
    00772          * thread is terminating.
    00773          */
    00774         return FALSE;
    00775     }
    00776
    00777     if (TestICF(pClientImc, IMCF_INDESTROY)) {
    00778         /*
    00779          * This hImc is being destroyed. Returns as success.
    00780          */
    00781         return TRUE;
    00782     }
    00783
    00784     /*
    00785      * Time to lock up the pClientImc.
    00786      */
    00787     InterlockedIncrement(&pClientImc->cLockObj);
    00788
    00789     if (pClientImc->hInputContext != NULL) {
    00790
    00791         pInputContext = ImmLockIMC(hImc);
    00792         if (!pInputContext) {
    00793             RIPMSG1(RIP_WARNING, "DestroyContext: Lock hImc %x failure", hImc);
    00794             ImmUnlockClientImc(pClientImc);
    00795             return FALSE;
    00796         }
    00797
    00798         pImeDpi = ImmLockImeDpi(hKL);
    00799         if (pImeDpi != NULL) {
    00800             (*pImeDpi->pfn.ImeSelect)(hImc, FALSE);
    00801             ImmUnlockImeDpi(pImeDpi);
    00802         }
    00803
    00804         ImmDestroyIMCC(pInputContext->hPrivate);
    00805         ImmDestroyIMCC(pInputContext->hMsgBuf);
    00806         ImmDestroyIMCC(pInputContext->hGuideLine);
    00807         ImmDestroyIMCC(pInputContext->hCandInfo);
    00808         ImmDestroyIMCC(pInputContext->hCompStr);
    00809
    00810         /*
    00811          * Free all ImeModeSaver.
    00812          */
    00813         DestroyImeModeSaver(pInputContext);
    00814
    00815         ImmUnlockIMC(hImc);
    00816     }
    00817
    00818     SetICF(pClientImc, IMCF_INDESTROY);
    00819
    00820     /*
    00821      * ImmUnlockClientImc() will free up the pClientImc
    00822      * when InterlockedDecrement(&pClientImc->cLockObj)
    00823      * reaches 0.
    00824      */
    00825     ImmUnlockClientImc(pClientImc);
    00826
    00827     return (bTerminate) ? TRUE : NtUserDestroyInputContext(hImc);
    00828 }

UINT CALLBACK EnumRegisterWordProcA | ( | LPCSTR | lpszReading,
|  | DWORD | dwStyle,
|  | LPCSTR | lpszString,
|  | PENUMREGWORDDATA | pEnumRegWordData
| ) |

Definition at line 749 of file regword.c.

References CHAR, _ENUMREGWORDDATA::dwCodePage, DWORD, ImmAssert, ImmLocalAlloc(), ImmLocalFree, INT, L, _ENUMREGWORDDATA::lpData, _ENUMREGWORDDATA::lpfn, NULL, PENUMREGWORDDATA, strlen(), and UINT.

Referenced by ImmEnumRegisterWordW().

    00754 {
    00755     LPWSTR lpwszReading;
    00756     LPWSTR lpwszString;
    00757     INT    cchReading;
    00758     INT    cchString;
    00759     INT    i;
    00760     UINT   uRet;
    00761
    00762     ImmAssert(pEnumRegWordData != NULL);
    00763
    00764     if (lpszReading != NULL) {
    00765         cchReading = strlen(lpszReading) + sizeof(CHAR);
    00766         lpwszReading = ImmLocalAlloc(0, cchReading * sizeof(WCHAR));
    00767         if (lpwszReading == NULL) {
    00768             RIPMSG0(RIP_WARNING, "EnumRegisterWordProcA: memory failure.");
    00769             return 0;
    00770         }
    00771
    00772         i = MultiByteToWideChar(pEnumRegWordData->dwCodePage,
    00773                                 (DWORD)MB_PRECOMPOSED,
    00774                                 (LPSTR)lpszReading,              // src
    00775                                 (INT)strlen(lpszReading),
    00776                                 (LPWSTR)lpwszReading,            // dest
    00777                                 cchReading);
    00778         lpwszReading[i] = L'\0';
    00779     }
    00780     else {
    00781         lpwszReading = NULL;
    00782     }
    00783
    00784     if (lpszString != NULL) {
    00785         cchString  = strlen(lpszString) + sizeof(CHAR);
    00786         lpwszString = ImmLocalAlloc(0, cchString * sizeof(WCHAR));
    00787         if (lpwszString == NULL) {
    00788             RIPMSG0(RIP_WARNING, "EnumRegisterWordProcA: memory failure.");
    00789             if (lpwszReading != NULL)
    00790                 ImmLocalFree(lpwszReading);
    00791             return 0;
    00792         }
    00793
    00794         i = MultiByteToWideChar(pEnumRegWordData->dwCodePage,
    00795                                 (DWORD)MB_PRECOMPOSED,
    00796                                 (LPSTR)lpszString,              // src
    00797                                 (INT)strlen(lpszString),
    00798                                 (LPWSTR)lpwszString,            // dest
    00799                                 cchString);
    00800         lpwszString[i] = L'\0';
    00801     }
    00802     else {
    00803         lpwszString = NULL;
    00804     }
    00805
    00806     uRet = (*pEnumRegWordData->lpfn.w)(lpwszReading, dwStyle,
    00807                             lpwszString, pEnumRegWordData->lpData);
    00808
    00809     if (lpwszReading != NULL)
    00810         ImmLocalFree(lpwszReading);
    00811
    00812     if (lpwszString != NULL)
    00813         ImmLocalFree(lpwszString);
    00814
    00815     return uRet;
    00816 }

UINT CALLBACK EnumRegisterWordProcW | ( | LPCWSTR | lpwszReading,
|  | DWORD | dwStyle,
|  | LPCWSTR | lpwszString,
|  | PENUMREGWORDDATA | pEnumRegWordData
| ) |

Definition at line 819 of file regword.c.

References _ENUMREGWORDDATA::dwCodePage, DWORD, ImmAssert, ImmLocalAlloc(), ImmLocalFree, INT, _ENUMREGWORDDATA::lpData, _ENUMREGWORDDATA::lpfn, NULL, and UINT.

Referenced by ImmEnumRegisterWordA().

    00824 {
    00825     LPSTR lpszReading;
    00826     LPSTR lpszString;
    00827     INT   cchReading;
    00828     INT   cchString;
    00829     INT   i;
    00830     UINT  uRet;
    00831
    00832     ImmAssert(pEnumRegWordData != NULL);
    00833
    00834     if (lpwszReading != NULL) {
    00835         cchReading = (wcslen(lpwszReading) + 1) * sizeof(WCHAR);
    00836         lpszReading = ImmLocalAlloc(0, cchReading);
    00837         if (lpszReading == NULL) {
    00838             RIPMSG0(RIP_WARNING, "ImmRegisterWordW: memory failure.");
    00839             return 0;
    00840         }
    00841
    00842         i = WideCharToMultiByte(pEnumRegWordData->dwCodePage,
    00843                                 (DWORD)0,
    00844                                 (LPWSTR)lpwszReading,          // src
    00845                                 (INT)wcslen(lpwszReading),
    00846                                 (LPSTR)lpszReading,            // dest
    00847                                 cchReading,
    00848                                 (LPSTR)NULL,
    00849                                 (LPBOOL)NULL);
    00850         lpszReading[i] = '\0';
    00851     }
    00852     else {
    00853         lpszReading = NULL;
    00854     }
    00855
    00856     if (lpwszString != NULL) {
    00857         cchString  = (wcslen(lpwszString) + 1) * sizeof(WCHAR);
    00858         lpszString = ImmLocalAlloc(0, cchString);
    00859         if (lpszString == NULL) {
    00860             RIPMSG0(RIP_WARNING, "ImmRegisterWordW: memory failure.");
    00861             if (lpszReading != NULL)
    00862                 ImmLocalFree(lpszReading);
    00863             return 0;
    00864         }
    00865
    00866         i = WideCharToMultiByte(pEnumRegWordData->dwCodePage,
    00867                                 (DWORD)0,
    00868                                 (LPWSTR)lpwszString,          // src
    00869                                 (INT)wcslen(lpwszString),
    00870                                 (LPSTR)lpszString,            // dest
    00871                                 cchString,
    00872                                 (LPSTR)NULL,
    00873                                 (LPBOOL)NULL);
    00874         lpszString[i] = '\0';
    00875     }
    00876     else {
    00877         lpszString = NULL;
    00878     }
    00879
    00880     uRet = (*pEnumRegWordData->lpfn.a)(lpszReading, dwStyle,
    00881                             lpszString, pEnumRegWordData->lpData);
    00882
    00883     if (lpszReading != NULL)
    00884         ImmLocalFree(lpszReading);
    00885
    00886     if (lpszString != NULL)
    00887         ImmLocalFree(lpszString);
    00888
    00889     return uRet;
    00890 }

PIMEDPI FindOrLoadImeDpi | ( | HKL | hKL | ) |

Definition at line 327 of file immime.c.

References ImmLockImeDpi(), IS_IME_KBDLAYOUT, LoadImeDpi(), NULL, and TRUE.

Referenced by ImmConfigureIMEA(), ImmConfigureIMEW(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetProperty(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmPenAuxInput(), ImmRegisterWordA(), ImmRegisterWordW(), ImmUnregisterWordA(), and ImmUnregisterWordW().

    00329 {
    00330     PIMEDPI pImeDpi;
    00331
    00332     /*
    00333      * Non IME based keyboard layout doesn't have IMEDPI.
    00334      */
    00335     if (!IS_IME_KBDLAYOUT(hKL))
    00336         return (PIMEDPI)NULL;
    00337
    00338     pImeDpi = ImmLockImeDpi(hKL);
    00339     if (pImeDpi == NULL)
    00340         pImeDpi = LoadImeDpi(hKL, TRUE);
    00341
    00342     return pImeDpi;
    00343 }

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 }

VOID GetSystemPathName | ( | PWSTRpwszPath | ,
|  | PWSTR | pwszFileName,
|  | UINT | maxChar
| ) |

Definition at line 95 of file layime.c.

References L, UINT, and VOID().

Referenced by CopyImeFile(), ImmInstallIMEW(), LoadIME(), and LoadVersionInfo().

    00096 {
    00097     UINT fnLen = wcslen(pwszFileName);
    00098     UINT i = GetSystemDirectoryW(pwszPath, maxChar);
    00099
    00100     UserAssert(fnLen + 1 < maxChar);
    00101     // avoid error condition
    00102     if (fnLen + 1 >= maxChar) {
    00103         *pwszPath = L'\0';
    00104         return;
    00105     }
    00106     if (i > 0 || i < maxChar - fnLen - 1) {
    00107         pwszPath += i;
    00108         if (pwszPath[-1] != L'\\')
    00109             *pwszPath++ = L'\\';
    00110     }
    00111     wcscpy(pwszPath, pwszFileName);
    00112 }

BOOL HotKeyIDDispatcher | ( | HWND | hWnd,
|  | HIMC | hImc,
|  | HKL | hKL,
|  | DWORD | dwHotKeyID
| ) |

Definition at line 87 of file hotkey.c.

References BOOL, CIMENonIMEToggle(), CSymbolToggle(), FALSE, GetInputContextThread, hWnd, tagIMEDPI::_tagImeFunctions::ImeEscape, ImmAssert, ImmLockImeDpi(), ImmUnlockImeDpi(), JCloseOpen(), KEnglishHangul(), KHanjaConvert(), KShapeToggle(), NULL, NULL_HIMC, tagIMEDPI::pfn, and TShapeToggle().

Referenced by ImmProcessKey(), and ImmSimulateHotKey().

    00088 {
    00089     /*
    00090      * Dispatch the IME hotkey event for the specified hImc
    00091      * only if the calling thread owns the hImc.
    00092      */
    00093     if (hImc != NULL_HIMC &&
    00094             GetInputContextThread(hImc) != GetCurrentThreadId()) {
    00095         return FALSE;
    00096     }
    00097
    00098     switch ( dwHotKeyID ) {
    00099     case IME_CHOTKEY_IME_NONIME_TOGGLE:
    00100         return CIMENonIMEToggle(hImc, hKlCurrent, hWnd, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED));
    00101
    00102     case IME_THOTKEY_IME_NONIME_TOGGLE:
    00103         return CIMENonIMEToggle(hImc, hKlCurrent, hWnd, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL));
    00104
    00105     case IME_CHOTKEY_SYMBOL_TOGGLE:
    00106     case IME_THOTKEY_SYMBOL_TOGGLE:
    00107         return CSymbolToggle( hImc, hKlCurrent, hWnd);
    00108
    00109     case IME_JHOTKEY_CLOSE_OPEN:
    00110         return JCloseOpen( hImc, hKlCurrent, hWnd);
    00111
    00112     case IME_KHOTKEY_ENGLISH:           // VK_HANGUL : English/Hangul mode
    00113         return KEnglishHangul( hImc );
    00114
    00115     case IME_KHOTKEY_SHAPE_TOGGLE:      // VK_JUNJA : full/half width
    00116         return KShapeToggle( hImc );
    00117
    00118     case IME_KHOTKEY_HANJACONVERT:      // VK_HANJA : convert hangul to hanja
    00119         return KHanjaConvert( hImc );
    00120
    00121     case IME_CHOTKEY_SHAPE_TOGGLE:
    00122     case IME_THOTKEY_SHAPE_TOGGLE:
    00123         return TShapeToggle( hImc, hKlCurrent, hWnd);
    00124
    00125     default:
    00126         /*
    00127          * Direct swithing hotkey should have been handled in the kernel side.
    00128          */
    00129         ImmAssert(dwHotKeyID < IME_HOTKEY_DSWITCH_FIRST || dwHotKeyID > IME_HOTKEY_DSWITCH_LAST);
    00130
    00131         if ( dwHotKeyID >= IME_HOTKEY_PRIVATE_FIRST &&
    00132                     dwHotKeyID <= IME_HOTKEY_PRIVATE_LAST ) {
    00133
    00134             PIMEDPI pImeDpi;
    00135             BOOL    bRet = FALSE;
    00136
    00137             if ( (pImeDpi = ImmLockImeDpi(hKlCurrent)) != NULL ) {
    00138
    00139                 bRet = (BOOL)(*pImeDpi->pfn.ImeEscape)( hImc,
    00140                                                   IME_ESC_PRIVATE_HOTKEY,
    00141                                                   (PVOID)&dwHotKeyID );
    00142                 ImmUnlockImeDpi(pImeDpi);
    00143                 return bRet;
    00144             }
    00145         }
    00146     }
    00147     return (FALSE);
    00148 }

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 }

DWORD ImmGetCandidateListCountWorker | ( | HIMC | hImc,
|  | LPDWORD | lpdwListCount,
|  | BOOL | fAnsi
| ) |

Definition at line 879 of file ctxtinfo.c.

References CImcCodePage, DWORD, DWORD_ALIGN, IMCF_UNICODE, ImmLockClientImc(), ImmLockIMC(), ImmLockIMCC(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), INT, InternalGetCandidateListAtoW(), InternalGetCandidateListWtoA(), NULL, and TestICF.

Referenced by ImmGetCandidateListCountA(), and ImmGetCandidateListCountW().

    00883 {
    00884     PCLIENTIMC      pClientImc;
    00885     PINPUTCONTEXT   pInputContext;
    00886     LPCANDIDATEINFO lpCandInfo;
    00887     DWORD           dwRet = 0;
    00888     INT             i;
    00889     DWORD           dwCodePage;
    00890
    00891     if (lpdwListCount) {
    00892         *lpdwListCount = 0;
    00893     } else {
    00894         RIPMSG0(RIP_WARNING, "ImmGetCandidateListCount: NULL lpdwListCount.");
    00895         return dwRet;
    00896     }
    00897
    00898     pClientImc = ImmLockClientImc(hImc);
    00899     if (pClientImc == NULL) {
    00900         RIPMSG1(RIP_WARNING, "ImmGetCandidateListCount: Invalid hImc %lx.", hImc);
    00901         goto GetCandListCntExit;
    00902     }
    00903     dwCodePage = CImcCodePage(pClientImc);
    00904
    00905     pInputContext = ImmLockIMC(hImc);
    00906     if (pInputContext == NULL) {
    00907         RIPMSG1(RIP_WARNING, "ImmGetCandidateListCount: Lock hImc %lx failed.", hImc);
    00908         goto GetCandListCntUnlockClientImc;
    00909     }
    00910
    00911     lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(pInputContext->hCandInfo);
    00912     if (!lpCandInfo) {
    00913         RIPMSG1(RIP_WARNING,
    00914               "ImmGetCandidateListCount: Lock hCandInfo %x failed.",
    00915               pInputContext->hCandInfo);
    00916         goto GetCandListCntUnlockIMC;
    00917     }
    00918
    00919     if (lpCandInfo->dwSize < sizeof(CANDIDATEINFO)) {
    00920         RIPMSG0(RIP_WARNING, "ImmGetCandidateListCount: no candidate list.");
    00921         goto GetCandListCntUnlockIMC;
    00922     }
    00923
    00924     *lpdwListCount = lpCandInfo->dwCount;
    00925
    00926     if (fAnsi && TestICF(pClientImc, IMCF_UNICODE)) {
    00927         LPCANDIDATELIST lpCandListW;
    00928
    00929         dwRet = DWORD_ALIGN(sizeof(CANDIDATEINFO))
    00930               + DWORD_ALIGN(lpCandInfo->dwPrivateSize);
    00931
    00932         for (i = 0; i < (INT)lpCandInfo->dwCount; i++) {
    00933             lpCandListW = (LPCANDIDATELIST)((LPBYTE)lpCandInfo + lpCandInfo->dwOffset[i]);
    00934             dwRet += InternalGetCandidateListWtoA(lpCandListW, NULL, 0, dwCodePage);
    00935         }
    00936     }
    00937     else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE)) {
    00938         LPCANDIDATELIST lpCandListA;
    00939
    00940         dwRet = DWORD_ALIGN(sizeof(CANDIDATEINFO))
    00941               + DWORD_ALIGN(lpCandInfo->dwPrivateSize);
    00942
    00943         for (i = 0; i < (INT)lpCandInfo->dwCount; i++) {
    00944             lpCandListA = (LPCANDIDATELIST)((LPBYTE)lpCandInfo + lpCandInfo->dwOffset[i]);
    00945             dwRet += InternalGetCandidateListAtoW(lpCandListA, NULL, 0, dwCodePage);
    00946         }
    00947     }
    00948     else {
    00949         dwRet = lpCandInfo->dwSize;
    00950     }
    00951
    00952     ImmUnlockIMCC(pInputContext->hCandInfo);
    00953
    00954 GetCandListCntUnlockIMC:
    00955     ImmUnlockIMC(hImc);
    00956
    00957 GetCandListCntUnlockClientImc:
    00958     ImmUnlockClientImc(pClientImc);
    00959
    00960 GetCandListCntExit:
    00961     return dwRet;
    00962 }

DWORD ImmGetCandidateListWorker | ( | HIMC | hImc,
|  | DWORD | dwIndex,
|  | LPCANDIDATELIST | lpCandList,
|  | DWORD | dwBufLen,
|  | BOOL | fAnsi
| ) |

Definition at line 1014 of file ctxtinfo.c.

References CImcCodePage, DWORD, IMCF_UNICODE, ImmLockClientImc(), ImmLockIMC(), ImmLockIMCC(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), InternalGetCandidateListAtoW(), InternalGetCandidateListWtoA(), NULL, and TestICF.

Referenced by ImmGetCandidateListA(), and ImmGetCandidateListW().

    01020 {
    01021     PCLIENTIMC      pClientImc;
    01022     PINPUTCONTEXT   pInputContext;
    01023     LPCANDIDATEINFO lpCandInfo;
    01024     LPCANDIDATELIST lpCandListTemp;
    01025     DWORD           dwBufLenTemp;
    01026     DWORD           dwRet = 0;
    01027     DWORD           dwCodePage;
    01028
    01029     pClientImc = ImmLockClientImc(hImc);
    01030     if (pClientImc == NULL) {
    01031         RIPMSG1(RIP_WARNING, "ImmGetCandidateList: Invalid hImc %lx.", hImc);
    01032         goto GetCandListExit;
    01033
    01034     }
    01035
    01036     dwCodePage = CImcCodePage(pClientImc);
    01037
    01038     pInputContext = ImmLockIMC(hImc);
    01039     if (pInputContext == NULL) {
    01040         RIPMSG1(RIP_WARNING, "ImmGetCandidateList: Lock hImc %lx failed.", hImc);
    01041         goto GetCandListUnlockClientImc;
    01042     }
    01043
    01044     lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(pInputContext->hCandInfo);
    01045     if (!lpCandInfo) {
    01046         RIPMSG1(RIP_WARNING, "ImmGetCandidateList: Lock hCandInfo %x failed",
    01047               pInputContext->hCandInfo);
    01048         goto GetCandListUnlockIMC;
    01049     }
    01050
    01051     if (lpCandInfo->dwSize < sizeof(CANDIDATEINFO)) {
    01052         RIPMSG0(RIP_WARNING, "ImmGetCandidateList: no candidate list.");
    01053         goto GetCandListUnlockIMCC;
    01054     }
    01055
    01056     /*
    01057      * invalid access
    01058      */
    01059     if (dwIndex >= lpCandInfo->dwCount) {
    01060         RIPMSG0(RIP_WARNING, "ImmGetCandidateList: dwIndex >= lpCandInfo->dwCount.");
    01061         goto GetCandListUnlockIMCC;
    01062     }
    01063
    01064     lpCandListTemp = (LPCANDIDATELIST)((LPBYTE)lpCandInfo + lpCandInfo->dwOffset[dwIndex]);
    01065
    01066     if (fAnsi && TestICF(pClientImc, IMCF_UNICODE)) {
    01067         /*
    01068          * ANSI Caller with an Unicode hImc.
    01069          */
    01070         dwBufLenTemp = InternalGetCandidateListWtoA(lpCandListTemp, NULL, 0, dwCodePage);
    01071     }
    01072     else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE)) {
    01073         /*
    01074          * Unicode Caller with an ANSI hImc.
    01075          */
    01076         dwBufLenTemp = InternalGetCandidateListAtoW(lpCandListTemp, NULL, 0, dwCodePage);
    01077     }
    01078     else {
    01079         /*
    01080          * No conversion required.
    01081          */
    01082         dwBufLenTemp = lpCandListTemp->dwSize;
    01083     }
    01084
    01085     /*
    01086      * Query buffer size or early exit on error
    01087      */
    01088     if (dwBufLen == 0 || dwBufLenTemp == 0) {
    01089         dwRet = dwBufLenTemp;
    01090     }
    01091     else if (!lpCandList) {
    01092         RIPMSG0(RIP_WARNING, "ImmGetCandidateList: Null lpCandList.");
    01093     }
    01094     else if (dwBufLen < dwBufLenTemp) {
    01095         RIPMSG2(RIP_WARNING, "ImmGetCandidateList: dwBufLen = %d too small, require = %d.",
    01096               dwBufLen, dwBufLenTemp);
    01097     } else {
    01098         if (fAnsi && TestICF(pClientImc, IMCF_UNICODE)) {
    01099             dwRet = InternalGetCandidateListWtoA(lpCandListTemp, lpCandList, dwBufLenTemp, dwCodePage);
    01100         }
    01101         else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE)) {
    01102             dwRet = InternalGetCandidateListAtoW(lpCandListTemp, lpCandList, dwBufLenTemp, dwCodePage);
    01103         }
    01104         else {
    01105             RtlCopyMemory((LPBYTE)lpCandList, (LPBYTE)lpCandListTemp, dwBufLenTemp);
    01106             dwRet = dwBufLenTemp;
    01107         }
    01108     }
    01109
    01110 GetCandListUnlockIMCC:
    01111     ImmUnlockIMCC(pInputContext->hCandInfo);
    01112
    01113 GetCandListUnlockIMC:
    01114     ImmUnlockIMC(hImc);
    01115
    01116 GetCandListUnlockClientImc:
    01117     ImmUnlockClientImc(pClientImc);
    01118
    01119 GetCandListExit:
    01120     return dwRet;
    01121 }

DWORD ImmGetGuideLineWorker | ( | HIMC | hImc,
|  | DWORD | dwIndex,
|  | LPBYTE | lpBuf,
|  | DWORD | dwBufLen,
|  | BOOL | fAnsi
| ) |

Definition at line 1173 of file ctxtinfo.c.

References BOOL, CImcCodePage, DWORD, IMCF_UNICODE, ImmLockClientImc(), ImmLockIMC(), ImmLockIMCC(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), INT, InternalGetCandidateListAtoW(), InternalGetCandidateListWtoA(), NULL, and TestICF.

Referenced by ImmGetGuideLineA(), and ImmGetGuideLineW().

    01179 {
    01180     PCLIENTIMC    pClientImc;
    01181     PINPUTCONTEXT pInputContext;
    01182     LPGUIDELINE   lpGuideLine;
    01183     LPBYTE        lpBufTemp;
    01184     DWORD         dwRet = 0;
    01185     DWORD         dwBufLenNeeded;
    01186     BOOL          bUDC;
    01187     DWORD         dwCodePage;
    01188
    01189     pClientImc = ImmLockClientImc(hImc);
    01190     if (pClientImc == NULL) {
    01191         RIPMSG1(RIP_WARNING, "ImmGetGuideLine: Invalid hImc %lx.", hImc);
    01192         goto GetGuideLineExit;
    01193     }
    01194     dwCodePage = CImcCodePage(pClientImc);
    01195
    01196     pInputContext = ImmLockIMC(hImc);
    01197     if (pInputContext == NULL) {
    01198         RIPMSG1(RIP_WARNING, "ImmGetGuideLine: Lock hImc %lx failed.", hImc);
    01199         goto GetGuideLineUnlockClientImc;
    01200     }
    01201
    01202     lpGuideLine = (LPGUIDELINE)ImmLockIMCC(pInputContext->hGuideLine);
    01203     if (!lpGuideLine) {
    01204         RIPMSG1(RIP_WARNING, "ImmGetGuideLine: Lock hGuideLine %lx failed.",
    01205               pInputContext->hGuideLine);
    01206         goto GetGuideLineUnlockIMC;
    01207     }
    01208
    01209     switch (dwIndex) {
    01210     case GGL_LEVEL:
    01211         dwRet = lpGuideLine->dwLevel;
    01212         break;
    01213
    01214     case GGL_INDEX:
    01215         dwRet = lpGuideLine->dwIndex;
    01216         break;
    01217
    01218     case GGL_STRING:
    01219
    01220         lpBufTemp = (LPBYTE)lpGuideLine + lpGuideLine->dwStrOffset;
    01221
    01222         /*
    01223          * Calculate the required buffer length.
    01224          */
    01225         if (fAnsi && TestICF(pClientImc, IMCF_UNICODE)) {
    01226             dwBufLenNeeded = WideCharToMultiByte(dwCodePage,
    01227                                                  (DWORD)0,
    01228                                                  (LPWSTR)lpBufTemp,
    01229                                                  (INT)lpGuideLine->dwStrLen,
    01230                                                  (LPSTR)NULL,
    01231                                                  (INT)0,
    01232                                                  (LPSTR)NULL,
    01233                                                  (LPBOOL)&bUDC);
    01234         }
    01235         else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE)) {
    01236             dwBufLenNeeded = MultiByteToWideChar(dwCodePage,
    01237                                                  (DWORD)MB_PRECOMPOSED,
    01238                                                  (LPSTR)lpBufTemp,
    01239                                                  (INT)lpGuideLine->dwStrLen,
    01240                                                  (LPWSTR)NULL,
    01241                                                  (INT)0);
    01242             dwBufLenNeeded *= sizeof(WCHAR);
    01243         }
    01244         else {
    01245             dwBufLenNeeded = lpGuideLine->dwStrLen;
    01246             /*
    01247              * The dwStrLen records the strlen and not the byte count.
    01248              */
    01249             if (TestICF(pClientImc, IMCF_UNICODE))
    01250                 dwBufLenNeeded *= sizeof(WCHAR);
    01251         }
    01252
    01253         /*
    01254          * Query GuideLine string size only or early exit on error
    01255          */
    01256         if (dwBufLen == 0 || dwBufLenNeeded == 0) {
    01257             dwRet = dwBufLenNeeded;
    01258             goto GetGuideLineUnlockIMCC;
    01259         }
    01260
    01261         if (lpBuf == NULL || dwBufLen < dwBufLenNeeded)
    01262             goto GetGuideLineUnlockIMCC;
    01263
    01264         if (fAnsi && TestICF(pClientImc, IMCF_UNICODE)) {
    01265             dwRet = WideCharToMultiByte(dwCodePage,
    01266                                         (DWORD)0,
    01267                                         (LPWSTR)lpBufTemp,
    01268                                         (INT)lpGuideLine->dwStrLen,
    01269                                         (LPSTR)lpBuf,
    01270                                         (INT)dwBufLen,
    01271                                         (LPSTR)NULL,
    01272                                         (LPBOOL)&bUDC);
    01273         }
    01274         else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE)) {
    01275             dwRet = MultiByteToWideChar(dwCodePage,
    01276                                         (DWORD)MB_PRECOMPOSED,
    01277                                         (LPSTR)lpBufTemp,
    01278                                         (INT)lpGuideLine->dwStrLen,
    01279                                         (LPWSTR)lpBuf,
    01280                                         (INT)dwBufLen/sizeof(WCHAR));
    01281             dwRet *= sizeof(WCHAR);
    01282         }
    01283         else {
    01284             RtlCopyMemory(lpBuf, lpBufTemp, dwBufLenNeeded);
    01285             dwRet = dwBufLenNeeded;
    01286         }
    01287
    01288         break;
    01289
    01290     case GGL_PRIVATE:
    01291
    01292         lpBufTemp = (LPBYTE)lpGuideLine + lpGuideLine->dwPrivateOffset;
    01293
    01294         /*
    01295          * The dwPrivateOffset is an offset to a CANDIDATELIST when
    01296          * lpGuideLine->dwIndex == GL_ID_REVERSECONVERSION. Do conversion
    01297          * for this case only.
    01298          */
    01299         if (fAnsi && TestICF(pClientImc, IMCF_UNICODE) &&
    01300                 lpGuideLine->dwIndex == GL_ID_REVERSECONVERSION) {
    01301             dwBufLenNeeded = InternalGetCandidateListWtoA(
    01302                         (LPCANDIDATELIST)lpBufTemp, (LPCANDIDATELIST)NULL, 0, dwCodePage);
    01303         }
    01304         else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE) &&
    01305                 lpGuideLine->dwIndex == GL_ID_REVERSECONVERSION) {
    01306             dwBufLenNeeded = InternalGetCandidateListAtoW(
    01307                         (LPCANDIDATELIST)lpBufTemp, (LPCANDIDATELIST)NULL, 0, dwCodePage);
    01308         }
    01309         else {
    01310             dwBufLenNeeded = lpGuideLine->dwPrivateSize;
    01311         }
    01312
    01313         /*
    01314          * Query dwPrivateSize size only or early exit on error
    01315          */
    01316         if (dwBufLen == 0 || dwBufLenNeeded == 0) {
    01317             dwRet = dwBufLenNeeded;
    01318             goto GetGuideLineUnlockIMCC;
    01319         }
    01320
    01321         if (lpBuf == NULL || dwBufLen < dwBufLenNeeded)
    01322             goto GetGuideLineUnlockIMCC;
    01323
    01324         if (fAnsi && TestICF(pClientImc, IMCF_UNICODE) &&
    01325                 lpGuideLine->dwIndex == GL_ID_REVERSECONVERSION) {
    01326             dwRet = InternalGetCandidateListWtoA(
    01327                     (LPCANDIDATELIST)lpBufTemp, (LPCANDIDATELIST)lpBuf, dwBufLenNeeded, dwCodePage);
    01328         }
    01329         else if (!fAnsi && !TestICF(pClientImc, IMCF_UNICODE) &&
    01330                 lpGuideLine->dwIndex == GL_ID_REVERSECONVERSION) {
    01331             dwRet = InternalGetCandidateListAtoW(
    01332                     (LPCANDIDATELIST)lpBufTemp, (LPCANDIDATELIST)lpBuf, dwBufLenNeeded, dwCodePage);
    01333         }
    01334         else {
    01335             RtlCopyMemory(lpBuf, lpBufTemp, dwBufLenNeeded);
    01336             dwRet = dwBufLenNeeded;
    01337         }
    01338
    01339         break;
    01340
    01341     default:
    01342         break;
    01343     }
    01344
    01345 GetGuideLineUnlockIMCC:
    01346     ImmUnlockIMCC(pInputContext->hGuideLine);
    01347
    01348 GetGuideLineUnlockIMC:
    01349     ImmUnlockIMC(hImc);
    01350
    01351 GetGuideLineUnlockClientImc:
    01352     ImmUnlockClientImc(pClientImc);
    01353
    01354 GetGuideLineExit:
    01355     return dwRet;
    01356 }

PIMEDPI 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 }

HIMC ImmGetSaveContext | ( | HWND | hWnd,
|  | DWORD | dwFlag
| ) |

Definition at line 225 of file w32/ntuser/imm/context.c.

References tagWND::hImc, hWnd, IGSC_DEFIMCFALLBACK, IGSC_WINNLSCHECK, IMCF_WINNLSDISABLE, ImmLockClientImc(), ImmUnlockClientImc(), IS_IME_ENABLED, NtUserGetThreadState(), NtUserQueryWindow(), NULL, NULL_HIMC, TestICF, TestWindowProcess(), and ValidateHwnd.

Referenced by ImmGetContext(), ImmSetActiveContext(), ImmWINNLSGetEnableStatus(), and TranslateIMESubFunctions().

    00228 {
    00229     HIMC       hRetImc;
    00230     PCLIENTIMC pClientImc;
    00231     PWND  pwnd;
    00232
    00233     if (!IS_IME_ENABLED()) {
    00234         return NULL_HIMC;
    00235     }
    00236
    00237     if (hWnd == NULL) {
    00238         /*
    00239          * Retrieves the default input context of current thread.
    00240          */
    00241         hRetImc = (HIMC)NtUserGetThreadState(UserThreadStateDefaultInputContext);
    00242     }
    00243     else {
    00244         /*
    00245          * Retrieves the input context associated to the given window.
    00246          */
    00247         if ((pwnd = ValidateHwnd(hWnd)) == (PWND)NULL) {
    00248             RIPMSG1(RIP_WARNING,
    00249                   "ImmGetSaveContext: invalid window handle %x", hWnd);
    00250             return NULL_HIMC;
    00251         }
    00252         /*
    00253          * Don't allow other process to access input context
    00254          */
    00255         if (!TestWindowProcess(pwnd)) {
    00256             RIPMSG0(RIP_WARNING,
    00257                   "ImmGetSaveContext: can not get input context of other process");
    00258             return NULL_HIMC;
    00259         }
    00260         hRetImc = pwnd->hImc;
    00261
    00262         if (hRetImc == NULL_HIMC && (dwFlag & IGSC_DEFIMCFALLBACK)) {
    00263             /*
    00264              * hWnd associated with NULL input context, retrieves the
    00265              * default input context of the hWnd's creator thread.
    00266              */
    00267             hRetImc = (HIMC)NtUserQueryWindow(hWnd, WindowDefaultInputContext);
    00268         }
    00269     }
    00270
    00271     pClientImc = ImmLockClientImc(hRetImc);
    00272     if (pClientImc == NULL)
    00273         return NULL_HIMC;
    00274
    00275     if ((dwFlag & IGSC_WINNLSCHECK) && TestICF(pClientImc, IMCF_WINNLSDISABLE))
    00276         hRetImc = NULL_HIMC;
    00277
    00278     ImmUnlockClientImc(pClientImc);
    00279
    00280     return hRetImc;
    00281 }

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 }

VOID ImmPostMessages | ( | HWND | hwnd,
|  | HIMC | hImc,
|  | INT | iNum,
|  | PTRANSMSG | pTransMsg
| ) |

Definition at line 408 of file ntuser/imm/input.c.

References BOOL, DWORD, GetClientInfo, hWnd, IMCF_UNICODE, ImmLocalAlloc(), ImmLocalFree, ImmLockClientImc(), ImmUnlockClientImc(), INT, NULL, TestICF, TransGetLevel(), VER40, and WINNLSTranslateMessage().

Referenced by ImmTranslateMessage().

    00413 {
    00414     INT i;
    00415     BOOL fAnsiIME;
    00416     PCLIENTIMC pClientImc;
    00417     PTRANSMSG pTransMsgTemp, pTransMsgBuf = NULL;
    00418
    00419     //
    00420     // Check if the IME is unicode or not.
    00421     // The message buffer contains unicode messages
    00422     // if the IME is unicode.
    00423     //
    00424     pClientImc = ImmLockClientImc(hImc);
    00425     if (pClientImc == NULL) {
    00426         RIPMSG1(RIP_WARNING,
    00427                 "ImmPostMessages: Invalid hImc %lx.", hImc);
    00428         return;
    00429     }
    00430
    00431     fAnsiIME = ! TestICF(pClientImc, IMCF_UNICODE);
    00432     ImmUnlockClientImc(pClientImc);
    00433
    00434     //
    00435     // translate messages to 3.x format if the App's version is 3.x.
    00436     //
    00437     pTransMsgTemp = pTransMsg;
    00438     if (GetClientInfo()->dwExpWinVer < VER40) {
    00439         DWORD dwLangId = PRIMARYLANGID(
    00440                                       LANGIDFROMLCID(
    00441                                                     GetSystemDefaultLCID()));
    00442         if ( (dwLangId == LANG_KOREAN && TransGetLevel(hWnd) == 3) ||
    00443              dwLangId == LANG_JAPANESE ) {
    00444
    00445             pTransMsgBuf = ImmLocalAlloc(0, iNum * sizeof(TRANSMSG));
    00446             if (pTransMsgBuf != NULL) {
    00447                 RtlCopyMemory(pTransMsgBuf, pTransMsg, iNum * sizeof(TRANSMSG));
    00448                 iNum = WINNLSTranslateMessage(iNum,
    00449                                               pTransMsgBuf,
    00450                                               hImc,
    00451                                               fAnsiIME,
    00452                                               dwLangId );
    00453                 pTransMsgTemp = pTransMsgBuf;
    00454             }
    00455         }
    00456     }
    00457
    00458     for (i = 0; i < iNum; i++) {
    00459         if (fAnsiIME) {
    00460             PostMessageA(hWnd,
    00461                     pTransMsgTemp->message,
    00462                     pTransMsgTemp->wParam,
    00463                     pTransMsgTemp->lParam);
    00464         } else {
    00465             PostMessageW(hWnd,
    00466                     pTransMsgTemp->message,
    00467                     pTransMsgTemp->wParam,
    00468                     pTransMsgTemp->lParam);
    00469         }
    00470         pTransMsgTemp++;
    00471     }
    00472
    00473     if (pTransMsgBuf != NULL) {
    00474         ImmLocalFree(pTransMsgBuf);
    00475     }
    00476 }

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 }

VOID ImmSendNotification | ( | BOOL | fForProcess | ) |

Definition at line 1191 of file w32/ntuser/imm/context.c.

References DWORD, ImmEnumInputContext(), SendNotificationProc(), and VOID().

Referenced by ImmSystemHandler().

    01193 {
    01194     DWORD dwThreadId;
    01195
    01196     if (fForProcess) {
    01197         dwThreadId = -1;
    01198     } else {
    01199         dwThreadId = 0;
    01200     }
    01201
    01202     ImmEnumInputContext(dwThreadId, (IMCENUMPROC)SendNotificationProc, 0);
    01203 }

BOOL ImmSetCompositionStringWorker | ( | HIMC | hImc,
|  | DWORD | dwIndex,
|  | LPVOID | lpComp,
|  | DWORD | dwCompLen,
|  | LPVOID | lpRead,
|  | DWORD | dwReadLen,
|  | BOOL | fAnsi
| ) |

Definition at line 610 of file ctxtinfo.c.

References BOOL, CheckAttribute(), CheckClause(), CompositionString(), DWORD, FALSE, GetInputContextThread, GetKeyboardLayout(), IMECodePage, tagIMEDPI::ImeInfo, tagIMEDPI::_tagImeFunctions::ImeSetCompositionString, ImmLocalFree, ImmLockImeDpi(), ImmUnlockIMC(), ImmUnlockIMCC(), ImmUnlockImeDpi(), InternalSCS_CHANGEATTR(), InternalSCS_CHANGECLAUSE(), InternalSCS_RECONVERTSTRING(), InternalSCS_SETSTR(), NULL, tagIMEDPI::pfn, and TRUE.

Referenced by ImmSetCompositionStringA(), and ImmSetCompositionStringW().

    00618 {
    00619     PINPUTCONTEXT      pInputContext;
    00620     PCOMPOSITIONSTRING pCompStr;
    00621     DWORD              dwThreadId;
    00622     PIMEDPI            pImeDpi;
    00623     LPBYTE             lpCompBuf, lpReadBuf;
    00624     LPBYTE             lpNewComp = NULL, lpNewRead = NULL;
    00625     DWORD              dwNewCompLen, dwNewReadLen;
    00626     BOOL               fRet = FALSE;
    00627     BOOL               fCheckSize = TRUE;
    00628     BOOL               fNeedAWConversion;
    00629     LPBYTE             lpOrgComp, lpOrgRead;
    00630     DWORD              dwOrgCompLen, dwOrgReadLen;
    00631
    00632     dwThreadId = GetInputContextThread(hImc);
    00633     if (dwThreadId != GetCurrentThreadId()) {
    00634         RIPMSG1(RIP_WARNING,
    00635               "ImmSetCompositionString: Invalid input context access %lx.", hImc);
    00636         return FALSE;
    00637     }
    00638
    00639     pImeDpi = ImmLockImeDpi(GetKeyboardLayout(dwThreadId));
    00640     if (pImeDpi == NULL)
    00641         return FALSE;
    00642
    00643     lpCompBuf = lpReadBuf = NULL;
    00644
    00645     // Backup original pointers to copyback for QUERY.
    00646     lpOrgComp = lpComp;
    00647     lpOrgRead = lpRead;
    00648     dwOrgCompLen = dwCompLen;
    00649     dwOrgReadLen = dwReadLen;
    00650
    00651     /*
    00652      * Check if we need ANSI/Unicode conversion
    00653      */
    00654     if (( fAnsi && !(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)) ||
    00655         (!fAnsi &&  (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))) {
    00656         /*
    00657          * No A/W conversion needed.
    00658          */
    00659         fNeedAWConversion = FALSE;
    00660         goto start_scs;
    00661     }
    00662     fNeedAWConversion = TRUE;
    00663
    00664     switch (dwIndex) {
    00665     case SCS_SETSTR:
    00666         if ( lpComp &&
    00667             (lpCompBuf = InternalSCS_SETSTR(lpComp, dwCompLen,
    00668                                 &lpNewComp, &dwNewCompLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00669             goto callime_scs;
    00670         if ( lpRead &&
    00671             (lpReadBuf = InternalSCS_SETSTR(lpRead, dwReadLen,
    00672                                 &lpNewRead, &dwNewReadLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00673             goto callime_scs;
    00674
    00675         fCheckSize = FALSE;
    00676         break;
    00677
    00678     case SCS_CHANGEATTR:
    00679         if ( lpComp &&
    00680             (lpCompBuf = InternalSCS_CHANGEATTR(
    00681                                 hImc, lpComp, dwCompLen, GCS_COMPSTR,
    00682                                 &lpNewComp, &dwNewCompLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00683             goto callime_scs;
    00684         if ( lpRead &&
    00685             (lpReadBuf = InternalSCS_CHANGEATTR(
    00686                                 hImc, lpRead, dwReadLen, GCS_COMPREADSTR,
    00687                                 &lpNewRead, &dwNewReadLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00688             goto callime_scs;
    00689         break;
    00690
    00691     case SCS_CHANGECLAUSE:
    00692        if ( lpComp &&
    00693            (lpCompBuf = InternalSCS_CHANGECLAUSE(
    00694                                 hImc, lpComp, dwCompLen, GCS_COMPSTR,
    00695                                 (LPDWORD *)&lpNewComp, &dwNewCompLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00696             goto callime_scs;
    00697         if ( lpRead &&
    00698             (lpReadBuf = InternalSCS_CHANGECLAUSE(
    00699                                 hImc, lpRead, dwReadLen, GCS_COMPREADSTR,
    00700                                 (LPDWORD *)&lpNewRead, &dwNewReadLen, fAnsi, IMECodePage(pImeDpi))) == NULL)
    00701             goto callime_scs;
    00702         break;
    00703
    00704     case SCS_SETRECONVERTSTRING:
    00705     case SCS_QUERYRECONVERTSTRING:
    00706         if (lpComp &&
    00707             (lpCompBuf = InternalSCS_RECONVERTSTRING((LPRECONVERTSTRING)lpComp, dwCompLen,
    00708                                 (LPRECONVERTSTRING *)&lpNewComp, &dwNewCompLen,
    00709                                 fAnsi, IMECodePage(pImeDpi))) == NULL)
    00710             goto callime_scs;
    00711         if (lpRead &&
    00712             (lpReadBuf = InternalSCS_RECONVERTSTRING((LPRECONVERTSTRING)lpRead, dwReadLen,
    00713                                 (LPRECONVERTSTRING *)&lpNewRead, &dwNewReadLen,
    00714                                 fAnsi, IMECodePage(pImeDpi))) == NULL)
    00715             goto callime_scs;
    00716
    00717         fCheckSize = FALSE;
    00718         break;
    00719
    00720     default:
    00721         goto callime_scs;
    00722     }
    00723
    00724     if (lpCompBuf != NULL) {
    00725         lpComp    = lpNewComp;
    00726         dwCompLen = dwNewCompLen;
    00727     }
    00728
    00729     if (lpReadBuf != NULL) {
    00730         lpRead    = lpNewRead;
    00731         dwReadLen = dwNewReadLen;
    00732     }
    00733
    00734 start_scs:
    00735
    00736     if (CompositionString(hImc, &pInputContext, &pCompStr, fCheckSize) <= 0)
    00737         goto callime_scs;
    00738
    00739     switch (dwIndex)
    00740     {
    00741     case SCS_SETSTR:
    00742         fRet = TRUE;
    00743         break;
    00744
    00745     case SCS_CHANGEATTR:
    00746         if ( lpComp &&
    00747             !CheckAttribute((LPBYTE)lpComp, dwCompLen,
    00748                     (LPBYTE)((LPBYTE)pCompStr + pCompStr->dwCompAttrOffset),
    00749                     pCompStr->dwCompAttrLen,
    00750                     (LPDWORD)((LPBYTE)pCompStr + pCompStr->dwCompClauseOffset),
    00751                     pCompStr->dwCompClauseLen)) break;
    00752
    00753         if ( lpRead &&
    00754             !CheckAttribute((LPBYTE)lpRead, dwReadLen,
    00755                     (LPBYTE)((LPBYTE)pCompStr + pCompStr->dwCompReadAttrOffset),
    00756                     pCompStr->dwCompReadAttrLen,
    00757                     (LPDWORD)((LPBYTE)pCompStr + pCompStr->dwCompReadClauseOffset),
    00758                     pCompStr->dwCompReadClauseLen)) break;
    00759         fRet = TRUE;
    00760         break;
    00761
    00762     case SCS_CHANGECLAUSE:
    00763         if ( lpComp &&
    00764             !CheckClause((LPDWORD)lpComp, dwCompLen,
    00765                          (LPDWORD)((LPBYTE)pCompStr + pCompStr->dwCompClauseOffset),
    00766                          pCompStr->dwCompClauseLen)) break;
    00767         if ( lpRead &&
    00768             !CheckClause((LPDWORD)lpRead, dwReadLen,
    00769                          (LPDWORD)((LPBYTE)pCompStr + pCompStr->dwCompReadClauseOffset),
    00770                          pCompStr->dwCompReadClauseLen)) break;
    00771         fRet = TRUE;
    00772         break;
    00773
    00774     case SCS_SETRECONVERTSTRING:
    00775     case SCS_QUERYRECONVERTSTRING:
    00776         if (pImeDpi->ImeInfo.fdwSCSCaps & SCS_CAP_SETRECONVERTSTRING) {
    00777             fRet = TRUE;
    00778         }
    00779         break;
    00780
    00781     default:
    00782         break;
    00783     }
    00784
    00785     ImmUnlockIMCC(pInputContext->hCompStr);
    00786     ImmUnlockIMC(hImc);
    00787
    00788 callime_scs:
    00789
    00790     if (fRet) {
    00791         fRet = (*pImeDpi->pfn.ImeSetCompositionString)(hImc, dwIndex,
    00792                                     lpComp, dwCompLen, lpRead, dwReadLen);
    00793     }
    00794
    00795     /*
    00796      * Check if we need ANSI/Unicode back conversion
    00797      */
    00798     if (fNeedAWConversion) {
    00799         LPBYTE lpCompBufBack = NULL, lpReadBufBack = NULL;
    00800         /*
    00801          * A/W back conversion needed.
    00802          */
    00803         switch (dwIndex) {
    00804         case SCS_QUERYRECONVERTSTRING:
    00805             if (lpOrgComp &&
    00806                 (lpCompBufBack = InternalSCS_RECONVERTSTRING((LPRECONVERTSTRING)lpComp, dwCompLen,
    00807                                     (LPRECONVERTSTRING *)&lpNewComp, &dwNewCompLen,
    00808                                     !fAnsi, IMECodePage(pImeDpi)))) {
    00809                 RtlCopyMemory(lpOrgComp, lpNewComp, dwNewCompLen);
    00810             }
    00811             if (lpOrgRead &&
    00812                 (lpReadBufBack = InternalSCS_RECONVERTSTRING(
    00813                                     (LPRECONVERTSTRING)lpRead, dwReadLen,
    00814                                     (LPRECONVERTSTRING *)&lpNewRead, &dwNewReadLen,
    00815                                     !fAnsi, IMECodePage(pImeDpi)))) {
    00816                 RtlCopyMemory(lpOrgRead, lpNewRead, dwNewReadLen);
    00817             }
    00818         }
    00819         if (lpCompBufBack != NULL)
    00820             LocalFree(lpCompBufBack);
    00821         if (lpReadBufBack != NULL)
    00822             LocalFree(lpReadBufBack);
    00823     }
    00824
    00825     if (lpCompBuf != NULL)
    00826         ImmLocalFree(lpCompBuf);
    00827     if (lpReadBuf != NULL)
    00828         ImmLocalFree(lpReadBuf);
    00829
    00830     ImmUnlockImeDpi(pImeDpi);
    00831
    00832     return fRet;
    00833 }

BOOL InquireIme | ( | PIMEDPI | pImeDpi | ) |

Definition at line 40 of file immime.c.

References BOOL, BYTE, tagIMEDPI::dwCodePage, DWORD, FALSE, GetClientInfo, tagIMEDPI::hInst, IM_UI_CLASS_SIZE, IMECodePage, tagIMEDPI::ImeInfo, tagIMEDPI::_tagImeFunctions::ImeInquire, INT, L, NtUserGetThreadState(), tagIMEDPI::pfn, TIF_16BIT, TRUE, UINT, and tagIMEDPI::wszUIClass.

Referenced by LoadIME().

    00042 {
    00043     WNDCLASS    wc;
    00044     BYTE        ClassName[IM_UI_CLASS_SIZE * sizeof(WCHAR)];
    00045     DWORD       dwSystemInfoFlags;
    00046     PIMEINFO    pImeInfo = &pImeDpi->ImeInfo;
    00047
    00048     dwSystemInfoFlags = (NtUserGetThreadState(UserThreadStateIsWinlogonThread))
    00049                       ? IME_SYSINFO_WINLOGON : 0;
    00050
    00051     if (GetClientInfo()->dwTIFlags & TIF_16BIT)
    00052         dwSystemInfoFlags |= IME_SYSINFO_WOW16;
    00053
    00054     (*pImeDpi->pfn.ImeInquire.w)(pImeInfo, (PVOID)ClassName, dwSystemInfoFlags);
    00055
    00056     /*
    00057      * parameter checking for each fields.
    00058      */
    00059     if (pImeInfo->dwPrivateDataSize == 0)
    00060         pImeInfo->dwPrivateDataSize = sizeof(UINT);
    00061
    00062     if (pImeInfo->fdwProperty & ~(IME_PROP_ALL)) {
    00063         RIPMSG0(RIP_WARNING, "wrong property");
    00064         return FALSE;
    00065     }
    00066
    00067     if (pImeInfo->fdwConversionCaps & ~(IME_CMODE_ALL)) {
    00068         RIPMSG0(RIP_WARNING, "wrong conversion capabilities");
    00069         return FALSE;
    00070     }
    00071
    00072     if (pImeInfo->fdwSentenceCaps & ~(IME_SMODE_ALL)) {
    00073         RIPMSG0(RIP_WARNING, "wrong sentence capabilities");
    00074         return FALSE;
    00075     }
    00076
    00077     if (pImeInfo->fdwUICaps & ~(UI_CAP_ALL)) {
    00078         RIPMSG0(RIP_WARNING, "wrong UI capabilities");
    00079         return FALSE;
    00080     }
    00081
    00082     if (pImeInfo->fdwSCSCaps & ~(SCS_CAP_ALL)) {
    00083         RIPMSG0(RIP_WARNING, "wrong set comp string capabilities");
    00084         return FALSE;
    00085     }
    00086
    00087     if (pImeInfo->fdwSelectCaps & ~(SELECT_CAP_ALL)) {
    00088         RIPMSG0(RIP_WARNING, "wrong select capabilities");
    00089         return FALSE;
    00090     }
    00091
    00092     if (!(pImeInfo->fdwProperty & IME_PROP_UNICODE)) {
    00093
    00094         /*
    00095          * This is ANSI IME. Ensure that it is usable under current system
    00096          * codepage.
    00097          */
    00098         if (pImeDpi->dwCodePage != GetACP() && pImeDpi->dwCodePage != CP_ACP) {
    00099             // Note: in the future, if possible, these reference to dwCodepage
    00100             // should be IMECodePage()...
    00101             RIPMSG1(RIP_WARNING, "incompatible codepage(%d) for ANSI IME", pImeDpi->dwCodePage);
    00102             return FALSE;
    00103         }
    00104
    00105         /*
    00106          * ANSI -> Unicode Class name.
    00107          */
    00108         MultiByteToWideChar(IMECodePage(pImeDpi),
    00109                             (DWORD)MB_PRECOMPOSED,
    00110                             (LPSTR)ClassName,               // src
    00111                             (INT)-1,
    00112                             pImeDpi->wszUIClass,            // dest
    00113                             IM_UI_CLASS_SIZE);
    00114     } else {
    00115         RtlCopyMemory(pImeDpi->wszUIClass, ClassName, sizeof(ClassName));
    00116     }
    00117     pImeDpi->wszUIClass[IM_UI_CLASS_SIZE-1] = L'\0';
    00118
    00119     if (!GetClassInfoW((HINSTANCE)pImeDpi->hInst, pImeDpi->wszUIClass, &wc)) {
    00120         RIPMSG1(RIP_WARNING, "UI class (%ws) not found in this IME", pImeDpi->wszUIClass);
    00121         return FALSE;
    00122     } else if (wc.cbWndExtra < sizeof(DWORD) * 2) {
    00123         RIPMSG0(RIP_WARNING, "UI class cbWndExtra problem");
    00124         return FALSE;
    00125     }
    00126
    00127     return TRUE;
    00128 }

DWORD InternalGetCandidateListAtoW | ( | LPCANDIDATELIST | lpCandListA,
|  | LPCANDIDATELIST | lpCandListW,
|  | DWORD | dwBufLen,
|  | DWORD | dwCodePage
| ) |

Definition at line 2885 of file ctxtinfo.c.

References DWORD, DWORD_ALIGN, INT, and NULL.

Referenced by ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetConversionListW(), and ImmGetGuideLineWorker().

    02890 {
    02891     LPWSTR lpCandStrW;
    02892     LPSTR  lpCandStrA;
    02893     INT    i, j;
    02894     DWORD  dwCandListLen;
    02895
    02896     dwCandListLen = sizeof(CANDIDATELIST);
    02897
    02898     /*
    02899      * CANDIDATELIST has already contained the dwOffset[0]
    02900      */
    02901     if (lpCandListA->dwCount > 0)
    02902         dwCandListLen += sizeof(DWORD) * (lpCandListA->dwCount - 1);
    02903
    02904     for (i = 0; i < (INT)lpCandListA->dwCount; i++) {
    02905
    02906         lpCandStrA = (LPSTR)((LPBYTE)lpCandListA + lpCandListA->dwOffset[i]);
    02907
    02908         j = MultiByteToWideChar(dwCodePage,
    02909                                 (DWORD)MB_PRECOMPOSED,
    02910                                 lpCandStrA,
    02911                                 -1,
    02912                                 (LPWSTR)NULL,
    02913                                 0);
    02914
    02915         dwCandListLen += (j * sizeof(WCHAR));
    02916     }
    02917
    02918     dwCandListLen = DWORD_ALIGN(dwCandListLen);
    02919
    02920     if (dwBufLen == 0)
    02921         return dwCandListLen;
    02922
    02923     if (dwBufLen < dwCandListLen) {
    02924         RIPMSG0(RIP_WARNING, "InternalGetCandidateListAtoW: dwBufLen too small.");
    02925         return 0;
    02926     }
    02927
    02928     lpCandListW->dwSize = dwBufLen;
    02929     lpCandListW->dwStyle = lpCandListA->dwStyle;
    02930     lpCandListW->dwCount = lpCandListA->dwCount;
    02931     lpCandListW->dwSelection = lpCandListA->dwSelection;
    02932     lpCandListW->dwPageStart = lpCandListA->dwPageStart;
    02933     lpCandListW->dwPageSize = lpCandListA->dwPageSize;
    02934     lpCandListW->dwOffset[0] = sizeof(CANDIDATELIST);
    02935     if (lpCandListW->dwCount > 0)
    02936         lpCandListW->dwOffset[0] += sizeof(DWORD) * (lpCandListW->dwCount - 1);
    02937
    02938     dwCandListLen = dwBufLen - lpCandListW->dwOffset[0];
    02939
    02940     for  (i = 0; i < (INT)lpCandListW->dwCount; i++) {
    02941
    02942         lpCandStrA = (LPSTR) ((LPBYTE)lpCandListA + lpCandListA->dwOffset[i]);
    02943         lpCandStrW = (LPWSTR)((LPBYTE)lpCandListW + lpCandListW->dwOffset[i]);
    02944
    02945         j = MultiByteToWideChar(dwCodePage,
    02946                                 (DWORD)MB_PRECOMPOSED,
    02947                                 lpCandStrA,
    02948                                 -1,
    02949                                 lpCandStrW,
    02950                                 (INT)dwCandListLen/sizeof(WCHAR));
    02951
    02952         dwCandListLen -= (j * sizeof(WCHAR));
    02953
    02954         if (i < (INT)lpCandListW->dwCount - 1)
    02955             lpCandListW->dwOffset[i+1] = lpCandListW->dwOffset[i] + j * sizeof(WCHAR);
    02956     }
    02957
    02958     return dwBufLen;
    02959 }

DWORD InternalGetCandidateListWtoA | ( | LPCANDIDATELIST | lpCandListW,
|  | LPCANDIDATELIST | lpCandListA,
|  | DWORD | dwBufLen,
|  | DWORD | dwCodePage
| ) |

Definition at line 2962 of file ctxtinfo.c.

References BOOL, CHAR, DWORD, DWORD_ALIGN, INT, and NULL.

Referenced by ImmGetCandidateListCountWorker(), ImmGetCandidateListWorker(), ImmGetConversionListA(), and ImmGetGuideLineWorker().

    02967 {
    02968     LPWSTR lpCandStrW;
    02969     LPSTR  lpCandStrA;
    02970     INT    i, j;
    02971     DWORD  dwCandListLen;
    02972     BOOL   bUDC;
    02973
    02974     dwCandListLen = sizeof(CANDIDATELIST);
    02975
    02976     /*
    02977      * CANDIDATELIST has already contained the dwOffset[0]
    02978      */
    02979     if (lpCandListW->dwCount > 0)
    02980         dwCandListLen += sizeof(DWORD) * (lpCandListW->dwCount - 1);
    02981
    02982     for (i = 0; i < (INT)lpCandListW->dwCount; i++) {
    02983
    02984         lpCandStrW = (LPWSTR)((LPBYTE)lpCandListW + lpCandListW->dwOffset[i]);
    02985
    02986         j = WideCharToMultiByte(dwCodePage,
    02987                                 (DWORD)0,
    02988                                 lpCandStrW,
    02989                                 -1,
    02990                                 (LPSTR)NULL,
    02991                                 (INT)0,
    02992                                 (LPSTR)NULL,
    02993                                 (LPBOOL)&bUDC);
    02994
    02995         dwCandListLen += (j * sizeof(CHAR));
    02996     }
    02997
    02998     dwCandListLen = DWORD_ALIGN(dwCandListLen);
    02999
    03000     if (dwBufLen == 0)
    03001         return dwCandListLen;
    03002
    03003     if (dwBufLen < dwCandListLen) {
    03004         RIPMSG0(RIP_WARNING, "InternalGetCandidateListWtoA: dwBufLen too small.");
    03005         return 0;
    03006     }
    03007
    03008     lpCandListA->dwSize = dwBufLen;
    03009     lpCandListA->dwStyle = lpCandListW->dwStyle;
    03010     lpCandListA->dwCount = lpCandListW->dwCount;
    03011     lpCandListA->dwSelection = lpCandListW->dwSelection;
    03012     lpCandListA->dwPageStart = lpCandListW->dwPageStart;
    03013     lpCandListA->dwPageSize = lpCandListW->dwPageSize;
    03014     lpCandListA->dwOffset[0] = sizeof(CANDIDATELIST);
    03015     if (lpCandListA->dwCount > 0)
    03016         lpCandListA->dwOffset[0] += sizeof(DWORD) * (lpCandListA->dwCount - 1);
    03017
    03018     dwCandListLen = dwBufLen - lpCandListA->dwOffset[0];
    03019
    03020     for  (i = 0; i < (INT)lpCandListA->dwCount; i++) {
    03021
    03022         lpCandStrA = (LPSTR) ((LPBYTE)lpCandListA + lpCandListA->dwOffset[i]);
    03023         lpCandStrW = (LPWSTR)((LPBYTE)lpCandListW + lpCandListW->dwOffset[i]);
    03024
    03025         j = WideCharToMultiByte(dwCodePage,
    03026                                 (DWORD)0,
    03027                                 lpCandStrW,
    03028                                 -1,
    03029                                 (LPSTR)lpCandStrA,
    03030                                 (INT)dwCandListLen,
    03031                                 (LPSTR)NULL,
    03032                                 (LPBOOL)&bUDC);
    03033
    03034         dwCandListLen -= (j * sizeof(CHAR));
    03035
    03036         if (i < (INT)lpCandListA->dwCount - 1)
    03037             lpCandListA->dwOffset[i+1] = lpCandListA->dwOffset[i] + j * sizeof(CHAR);
    03038     }
    03039
    03040     return dwBufLen;
    03041 }

LONG InternalGetCompositionStringA | ( | LPCOMPOSITIONSTRING | lpCompStr,
|  | DWORD | dwIndex,
|  | LPVOID | lpBuf,
|  | DWORD | dwBufLen,
|  | BOOL | fAnsiImc,
|  | DWORD | dwCodePage
| ) |

| Referenced by ImmGetCompositionStringA(), InternalGetCompositionStringA(), and InternalGetCompositionStringW().

LONG InternalGetCompositionStringW | ( | LPCOMPOSITIONSTRING | lpCompStr,
|  | DWORD | dwIndex,
|  | LPVOID | lpBuf,
|  | DWORD | dwBufLen,
|  | BOOL | fAnsiImc,
|  | DWORD | dwCodePage
| ) |

| Referenced by ImmGetCompositionStringW(), InternalGetCompositionStringA(), and InternalGetCompositionStringW().

PINPUTCONTEXT 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 }

__inline int IsAnsiIMC | ( | HIMC | hIMC | ) |

Definition at line 456 of file immcli.h.

References BOOL, IMCF_UNICODE, ImmLockClientImc(), ImmUnlockClientImc(), NULL, and TestICF.

Referenced by ImmGetImeMenuItemsWorker().

    00457 {
    00458     BOOL bAnsi;
    00459
    00460     // get ansi mode of origin IMC
    00461     PCLIENTIMC pClientIMC = ImmLockClientImc(hIMC);
    00462     if (pClientIMC == NULL) {
    00463         return -1;
    00464     }
    00465     bAnsi = !TestICF(pClientIMC, IMCF_UNICODE);
    00466     ImmUnlockClientImc(pClientIMC);
    00467     return bAnsi;
    00468 }

VOID LFontAtoLFontW | ( | LPLOGFONTA | lfFontA,
|  | LPLOGFONTW | lfFontW
| ) |

Definition at line 3113 of file ctxtinfo.c.

References INT, L, strlen(), and VOID().

Referenced by ImmGetCompositionFontW(), ImmRequestMessageWorker(), ImmSetCompositionFontA(), MySetCompFont(), and SelectInputContext().

    03116 {
    03117     INT i;
    03118
    03119     RtlCopyMemory(lpLogFontW, lpLogFontA, sizeof(LOGFONTA)-LF_FACESIZE);
    03120
    03121     i = MultiByteToWideChar(CP_ACP,     // Note: font face name should use ACP for A/W conversion.
    03122                             MB_PRECOMPOSED,
    03123                             lpLogFontA->lfFaceName,
    03124                             strlen(lpLogFontA->lfFaceName),
    03125                             lpLogFontW->lfFaceName,
    03126                             LF_FACESIZE);
    03127
    03128     lpLogFontW->lfFaceName[i] = L'\0';
    03129
    03130     return;
    03131 }

VOID LFontWtoLFontA | ( | LPLOGFONTW | lfFontW,
|  | LPLOGFONTA | lfFontA
| ) |

Definition at line 3134 of file ctxtinfo.c.

References BOOL, INT, NULL, and VOID().

Referenced by ImmGetCompositionFontA(), ImmRequestMessageWorker(), ImmSetCompositionFontW(), and SelectInputContext().

    03137 {
    03138     INT  i;
    03139     BOOL bUDC;
    03140
    03141     RtlCopyMemory(lpLogFontA, lpLogFontW, sizeof(LOGFONTA)-LF_FACESIZE);
    03142
    03143     i = WideCharToMultiByte(CP_ACP,     // Note: font face name should use ACP for A/W conversion.
    03144                             0,
    03145                             lpLogFontW->lfFaceName,
    03146                             wcslen(lpLogFontW->lfFaceName),
    03147                             lpLogFontA->lfFaceName,
    03148                             LF_FACESIZE,
    03149                             (LPSTR)NULL,
    03150                             &bUDC);
    03151
    03152     lpLogFontA->lfFaceName[i] = '\0';
    03153
    03154     return;
    03155 }

BOOL LoadIME | ( | PIMEINFOEX | piiex,
|  | PIMEDPI | pImeDpi
| ) |

Definition at line 131 of file immime.c.

References BOOL, FALSE, tagIMEINFOEX::fLoadFlag, GET_IMEPROC, GET_IMEPROCT, GetSystemPathName(), tagIMEDPI::hInst, IMEF_LOADED, IMEF_LOADERROR, IMEF_NONLOAD, tagIMEDPI::_tagImeFunctions::ImeGetImeMenuItems, tagIMEINFOEX::ImeInfo, tagIMEDPI::ImeInfo, InquireIme(), MAX_PATH, NtUserSetImeInfoEx(), NULL, PBYTE, tagIMEDPI::pfn, TRUE, tagIMEINFOEX::wszImeFile, tagIMEINFOEX::wszUIClass, and tagIMEDPI::wszUIClass.

Referenced by LoadImeDpi().

    00134 {
    00135     WCHAR wszImeFile[MAX_PATH];
    00136     BOOL  fSuccess;
    00137
    00138     GetSystemPathName(wszImeFile, piiex->wszImeFile, MAX_PATH);
    00139
    00140     pImeDpi->hInst = LoadLibraryW(wszImeFile);
    00141
    00142     if (!pImeDpi->hInst) {
    00143         RIPMSG1(RIP_WARNING, "LoadIME: LoadLibraryW(%ws) failed", wszImeFile);
    00144         goto LoadIME_ErrOut;
    00145     }
    00146
    00147 #define GET_IMEPROCT(x) \
    00148     if (!(pImeDpi->pfn.##x.t = (PVOID) GetProcAddress(pImeDpi->hInst, #x))) { \
    00149         RIPMSG1(RIP_WARNING, "LoadIME: " #x " not supported in %ws", wszImeFile);           \
    00150         goto LoadIME_ErrOut; }
    00151
    00152 #define GET_IMEPROC(x) \
    00153     if (!(pImeDpi->pfn.##x = (PVOID) GetProcAddress(pImeDpi->hInst, #x))) {   \
    00154         RIPMSG1(RIP_WARNING, "LoadIME: " #x " not supported in %ws", wszImeFile);           \
    00155         goto LoadIME_ErrOut; }
    00156
    00157     GET_IMEPROCT(ImeInquire);
    00158     GET_IMEPROCT(ImeConversionList);
    00159     GET_IMEPROCT(ImeRegisterWord);
    00160     GET_IMEPROCT(ImeUnregisterWord);
    00161     GET_IMEPROCT(ImeGetRegisterWordStyle);
    00162     GET_IMEPROCT(ImeEnumRegisterWord);
    00163     GET_IMEPROC (ImeConfigure);
    00164     GET_IMEPROC (ImeDestroy);
    00165     GET_IMEPROC (ImeEscape);
    00166     GET_IMEPROC (ImeProcessKey);
    00167     GET_IMEPROC (ImeSelect);
    00168     GET_IMEPROC (ImeSetActiveContext);
    00169     GET_IMEPROC (ImeToAsciiEx);
    00170     GET_IMEPROC (NotifyIME);
    00171     GET_IMEPROC (ImeSetCompositionString);
    00172
    00173     // 4.0 IMEs don't have this entry. could be NULL.
    00174     pImeDpi->pfn.ImeGetImeMenuItems = (PVOID)GetProcAddress(pImeDpi->hInst, "ImeGetImeMenuItems");
    00175
    00176 #undef GET_IMEPROCT
    00177 #undef GET_IMEPROC
    00178
    00179     if (!InquireIme(pImeDpi)) {
    00180         RIPMSG0(RIP_WARNING, "LoadIME: InquireIme failed");
    00181 LoadIME_ErrOut:
    00182         FreeLibrary(pImeDpi->hInst);
    00183         pImeDpi->hInst = NULL;
    00184         fSuccess = FALSE;
    00185     }
    00186     else {
    00187         fSuccess = TRUE;
    00188     }
    00189
    00190     /*
    00191      * Update kernel side IMEINFOEX for this keyboard layout if
    00192      * this is its first loading.
    00193      */
    00194     if (piiex->fLoadFlag == IMEF_NONLOAD) {
    00195         if (fSuccess) {
    00196             RtlCopyMemory((PBYTE)&piiex->ImeInfo,
    00197                           (PBYTE)&pImeDpi->ImeInfo, sizeof(IMEINFO));
    00198             RtlCopyMemory((PBYTE)piiex->wszUIClass,
    00199                           (PBYTE)pImeDpi->wszUIClass, sizeof(pImeDpi->wszUIClass));
    00200             piiex->fLoadFlag = IMEF_LOADED;
    00201         }
    00202         else {
    00203             piiex->fLoadFlag = IMEF_LOADERROR;
    00204         }
    00205         NtUserSetImeInfoEx(piiex);
    00206     }
    00207
    00208     return fSuccess;
    00209 }

PIMEDPI LoadImeDpi | ( | HKL | hKL,
|  | BOOL | fLock
| ) |

Definition at line 234 of file immime.c.

References tagIMEDPI::cLock, tagIMEDPI::dwCodePage, tagIMEDPI::dwFlag, DWORD, FALSE, tagIMEINFOEX::fLoadFlag, gcsImeDpi, gpImeDpi, tagIMEDPI::hKL, IMEDPI_UNLOCKUNLOAD, IMEF_LOADERROR, ImeInfoExKeyboardLayout, ImmGetImeDpi(), ImmGetImeInfoEx(), ImmLocalAlloc(), ImmLocalFree, LoadIME(), NULL, tagIMEDPI::pNext, and UnloadIME().

Referenced by FindOrLoadImeDpi(), and ImmLoadIME().

    00237 {
    00238     PIMEDPI        pImeDpi, pImeDpiT;
    00239     IMEINFOEX      iiex;
    00240
    00241     /*
    00242      * Query the IME information.
    00243      */
    00244     if (!ImmGetImeInfoEx(&iiex, ImeInfoExKeyboardLayout, &hKL)) {
    00245         RIPMSG1(RIP_WARNING, "LoadImeDpi: ImmGetImeInfoEx(%lx) failed", hKL);
    00246         return NULL;
    00247     }
    00248
    00249     /*
    00250      * Win95 behaviour: If there was an IME load error for this layout,
    00251      * further attempt to load the same IME layout will be rejected.
    00252      */
    00253     if (iiex.fLoadFlag == IMEF_LOADERROR)
    00254         return NULL;
    00255
    00256     /*
    00257      * Allocate a new IMEDPI for this layout.
    00258      */
    00259     pImeDpi = (PIMEDPI)ImmLocalAlloc(HEAP_ZERO_MEMORY, sizeof(IMEDPI));
    00260     if (pImeDpi == NULL)
    00261         return NULL;
    00262
    00263     pImeDpi->hKL = hKL;
    00264
    00265     // get code page of IME
    00266     {
    00267         CHARSETINFO cs;
    00268         if (TranslateCharsetInfo((DWORD*)LOWORD(HandleToUlong(hKL)), &cs, TCI_SRCLOCALE)) {
    00269             pImeDpi->dwCodePage = cs.ciACP;
    00270         }
    00271         else {
    00272             pImeDpi->dwCodePage = CP_ACP;
    00273         }
    00274     }
    00275
    00276     /*
    00277      * Load up IME DLL.
    00278      */
    00279     if (!LoadIME(&iiex, pImeDpi)) {
    00280         ImmLocalFree(pImeDpi);
    00281         return NULL;
    00282     }
    00283
    00284     /*
    00285      * Link in the newly allocated entry.
    00286      */
    00287     RtlEnterCriticalSection(&gcsImeDpi);
    00288
    00289     pImeDpiT = ImmGetImeDpi(hKL);
    00290
    00291     if (pImeDpiT == NULL) {
    00292         if (fLock) {
    00293             /*
    00294              * Newly loaded with lock, will unload upon unlock.
    00295              */
    00296             pImeDpi->cLock = 1;
    00297             pImeDpi->dwFlag |= IMEDPI_UNLOCKUNLOAD;
    00298         }
    00299
    00300         /*
    00301          * Update the global list for this new pImeDpi entry.
    00302          */
    00303         pImeDpi->pNext = gpImeDpi;
    00304         gpImeDpi = pImeDpi;
    00305
    00306         RtlLeaveCriticalSection(&gcsImeDpi);
    00307     }
    00308     else {
    00309
    00310         if (!fLock) {
    00311             pImeDpiT->dwFlag &= ~IMEDPI_UNLOCKUNLOAD;
    00312         }
    00313
    00314         /*
    00315          * The same IME has been loaded, discard this extra entry.
    00316          */
    00317         RtlLeaveCriticalSection(&gcsImeDpi);
    00318         UnloadIME(pImeDpi, FALSE);
    00319         ImmLocalFree(pImeDpi);
    00320         pImeDpi = pImeDpiT;
    00321     }
    00322
    00323     return pImeDpi;
    00324 }

BOOL LoadVersionInfo | ( | PIMEINFOEX | piiex | ) |

Definition at line 305 of file layime.c.

References ARRAY_SIZE, BOOL, DWORD, FALSE, GET_PROC, GetSystemPathName(), ImmLocalAlloc(), ImmLocalFree, L, LoadFixVersionInfo(), LoadVarVersionInfo(), MAX_PATH, NULL, TRUE, VERSION_DLL, and tagIMEINFOEX::wszImeFile.

Referenced by ImmInstallIMEW(), and ImmLoadLayout().

    00307 {
    00308     WCHAR   szPath[MAX_PATH];
    00309     PWSTR   pszVersionBuffer;
    00310     HANDLE  hVersion;
    00311     DWORD   dwVersionSize;
    00312     DWORD   dwHandle = 0;
    00313     BOOL    fUnload, fReturn = FALSE;
    00314
    00315     hVersion = GetModuleHandle(VERSION_DLL);
    00316     if (hVersion != NULL) {
    00317         fUnload = FALSE;
    00318     }
    00319     else {
    00320         hVersion = LoadLibrary(VERSION_DLL);
    00321         if (hVersion == NULL) {
    00322             return FALSE;
    00323         }
    00324         fUnload = TRUE;
    00325     }
    00326
    00327 #define GET_PROC(x) \
    00328     if (!(pfn##x = (PVOID) GetProcAddress(hVersion, VERSION_##x))) { \
    00329         goto LoadVerInfoUnload; }
    00330
    00331     GET_PROC(GetFileVersionInfoW);
    00332     GET_PROC(GetFileVersionInfoSizeW);
    00333     GET_PROC(VerQueryValueW);
    00334
    00335 #undef GET_PROC
    00336
    00337     // szPath = fully qualified IME file name
    00338     GetSystemPathName(szPath, piiex->wszImeFile, ARRAY_SIZE(szPath));
    00339
    00340     dwVersionSize = (*pfnGetFileVersionInfoSizeW)(szPath, &dwHandle);
    00341
    00342     if (dwVersionSize == 0L)
    00343         goto LoadVerInfoUnload;
    00344
    00345     pszVersionBuffer = (PWSTR)ImmLocalAlloc(0, dwVersionSize);
    00346
    00347     if (pszVersionBuffer == NULL)    // can't get memory for version info, blow out
    00348         goto LoadVerInfoUnload;
    00349
    00350     if (!(*pfnGetFileVersionInfoW)(szPath, dwHandle, dwVersionSize, pszVersionBuffer))
    00351         goto LoadVerInfoFree;
    00352
    00353     /*
    00354      * Get the fixed block version information.
    00355      */
    00356     if (LoadFixVersionInfo(piiex, pszVersionBuffer)) {
    00357         /*
    00358          * Get the variable block version information.
    00359          */
    00360         fReturn = LoadVarVersionInfo(piiex, pszVersionBuffer);
    00361     }
    00362
    00363 LoadVerInfoFree:
    00364     ImmLocalFree((HLOCAL)pszVersionBuffer);
    00365
    00366 LoadVerInfoUnload:
    00367     if (fUnload)
    00368         FreeLibrary(hVersion);
    00369
    00370     return fReturn;
    00371 }

BOOL MakeIMENotify | ( | HIMC | hImc,
|  | HWND | hWnd,
|  | DWORD | dwAction,
|  | DWORD | dwIndex,
|  | DWORD | dwValue,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) |

Definition at line 3158 of file ctxtinfo.c.

References BOOL, DWORD, GetInputContextThread, GetKeyboardLayout(), hWnd, ImmLockImeDpi(), ImmUnlockImeDpi(), tagIMEDPI::_tagImeFunctions::NotifyIME, NULL, tagIMEDPI::pfn, SendMessage(), and TRUE.

Referenced by ImmSetCandidateWindow(), ImmSetCompositionFontA(), ImmSetCompositionFontW(), ImmSetCompositionWindow(), ImmSetConversionStatus(), ImmSetOpenStatus(), and ImmSetStatusWindowPos().

    03166 {
    03167     PIMEDPI pImeDpi;
    03168     DWORD   dwThreadId;
    03169
    03170 #ifdef LATER
    03171     // implement MakeIMENotifyEvent() later
    03172 #endif
    03173
    03174     if (dwAction != 0 && (dwThreadId = GetInputContextThread(hImc)) != 0) {
    03175
    03176         pImeDpi = ImmLockImeDpi(GetKeyboardLayout(dwThreadId));
    03177
    03178         if (pImeDpi != NULL) {
    03179             (*pImeDpi->pfn.NotifyIME)(hImc, dwAction, dwIndex, dwValue);
    03180             ImmUnlockImeDpi(pImeDpi);
    03181         }
    03182     }
    03183
    03184     if (hWnd != NULL && wParam != 0)
    03185         SendMessage(hWnd, WM_IME_NOTIFY, wParam, lParam);
    03186
    03187     return TRUE;
    03188 }

LPWSTR MakeStringFromRegFullInfo | ( | PKEY_VALUE_FULL_INFORMATION | pKey,
|  | size_t | limit
| ) |

BOOL OpenRegApi | ( | ADVAPI_FN * | pfn | ) |

Definition at line 461 of file immhotky.c.

References BOOL, GET, ADVAPI_FN::hModule, L, NULL, and TRUE.

Referenced by CliSaveImeHotKey().

    00462 {
    00463     pfn->hModule = LoadLibraryW(L"ADVAPI32.DLL");
    00464
    00465     if (pfn->hModule != NULL) {
    00466         GET(RegCreateKeyW);
    00467         GET(RegOpenKeyW);
    00468         GET(RegCloseKey);
    00469         GET(RegDeleteKeyW);
    00470         GET(RegCreateKeyExW);
    00471         GET(RegSetValueExW);
    00472         GET(RegQueryValueExW);
    00473
    00474         //
    00475         // Succeeded.
    00476         //
    00477         return TRUE;
    00478     }
    00479
    00480     //
    00481     // Failed to open registry APIs.
    00482     //
    00483     return TRUE;
    00484 }

VOID SelectInputContext | ( | HKL | hSelKL,
|  | HKL | hUnSelKL,
|  | HIMC | hImc
| ) |

Definition at line 837 of file w32/ntuser/imm/context.c.

References BOOL, ClrICF, tagCLIENTIMC::dwCodePage, DWORD, FALSE, tagIMEMODESAVER::fdwConversion, tagIMEMODESAVER::fdwInit, tagIMEMODESAVER::fdwSentence, tagIMEMODESAVER::fOpen, GetImeModeSaver(), IMCC_ALLOC_TOOLARGE, IMCF_UNICODE, IMECodePage, tagIMEDPI::ImeInfo, tagIMEDPI::_tagImeFunctions::ImeSelect, ImmAssert, ImmCreateIMCC(), ImmDestroyIMCC(), ImmGetIMCCLockCount(), ImmGetIMCCSize(), ImmLockClientImc(), ImmLockIMCC(), ImmLockImeDpi(), ImmReSizeIMCC(), ImmUnlockClientImc(), ImmUnlockIMC(), ImmUnlockIMCC(), ImmUnlockImeDpi(), InternalImmLockIMC(), LFontAtoLFontW(), LFontWtoLFontA(), max, NULL, tagIMEDPI::pfn, RestorePrivateMode(), SavePrivateMode(), SetICF, TestICF, TRUE, UINT, and VOID().

Referenced by SelectContextProc().

    00841 {
    00842     PIMEDPI            pSelImeDpi, pUnSelImeDpi;
    00843     PCLIENTIMC         pClientImc;
    00844     PINPUTCONTEXT      pInputContext;
    00845     DWORD              dwSelPriv = 0, dwUnSelPriv = 0, dwSize;
    00846     HIMCC              hImcc;
    00847     PCOMPOSITIONSTRING pCompStr;
    00848     PCANDIDATEINFO     pCandInfo;
    00849     PGUIDELINE         pGuideLine;
    00850     BOOLEAN            fLogFontInited;
    00851
    00852     TAGMSG3(DBGTAG_IMM, "SelectInputContext: called for sel=%08p unsel=%08p hImc=%08p",
    00853             hSelKL, hUnSelKL, hImc);
    00854
    00855     pClientImc = ImmLockClientImc(hImc);
    00856     if (pClientImc == NULL) {
    00857         RIPMSG0(RIP_VERBOSE, "SelectInputContext: cannot lock client Imc. Bailing out.");
    00858         return;
    00859     }
    00860
    00861     pSelImeDpi   = ImmLockImeDpi(hSelKL);
    00862
    00863     if (hSelKL != hUnSelKL) {
    00864         /*
    00865          * If those new sel and unsel do no match but
    00866          * somehow SelectInput is called, that means
    00867          * we should initialize the input contex again
    00868          * without dumping the old information.
    00869          */
    00870         pUnSelImeDpi = ImmLockImeDpi(hUnSelKL);
    00871     } else {
    00872         pUnSelImeDpi = NULL;
    00873     }
    00874
    00875     if (pSelImeDpi != NULL) {
    00876         /*
    00877          * According to private memory size of the two layout, we decide
    00878          * whether we nee to reallocate this memory block
    00879          */
    00880         dwSelPriv = pSelImeDpi->ImeInfo.dwPrivateDataSize;
    00881
    00882         /*
    00883          * Setup the code page of the newly selected IME.
    00884          */
    00885         pClientImc->dwCodePage = IMECodePage(pSelImeDpi);
    00886     }
    00887     else {
    00888         pClientImc->dwCodePage = CP_ACP;
    00889     }
    00890
    00891     if (pUnSelImeDpi != NULL)
    00892         dwUnSelPriv = pUnSelImeDpi->ImeInfo.dwPrivateDataSize;
    00893
    00894     dwSelPriv   = max(dwSelPriv,   sizeof(UINT));
    00895     dwUnSelPriv = max(dwUnSelPriv, sizeof(UINT));
    00896
    00897     /*
    00898      * Unselect the input context.
    00899      */
    00900     if (pUnSelImeDpi != NULL)
    00901         (*pUnSelImeDpi->pfn.ImeSelect)(hImc, FALSE);
    00902
    00903     /*
    00904      * Reinitialize the client side input context for the selected layout.
    00905      */
    00906     if ((pInputContext = InternalImmLockIMC(hImc, FALSE)) != NULL) {
    00907         DWORD fdwOldConversion = pInputContext->fdwConversion;
    00908         DWORD fdwOldSentence = pInputContext->fdwSentence;
    00909         BOOL fOldOpen = pInputContext->fOpen;
    00910         PIMEMODESAVER pUnSelModeSaver, pSelModeSaver;
    00911         const DWORD fdwConvPreserve = IME_CMODE_EUDC;
    00912
    00913         fLogFontInited = ((pInputContext->fdwInit & INIT_LOGFONT) == INIT_LOGFONT);
    00914
    00915         if (TestICF(pClientImc, IMCF_UNICODE) && pSelImeDpi != NULL &&
    00916                 !(pSelImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)) {
    00917             /*
    00918              * Check if there is any LOGFONT to be converted.
    00919              */
    00920             if (fLogFontInited) {
    00921                 LOGFONTA LogFontA;
    00922
    00923                 LFontWtoLFontA(&pInputContext->lfFont.W, &LogFontA);
    00924                 RtlCopyMemory(&pInputContext->lfFont.A, &LogFontA, sizeof(LOGFONTA));
    00925             }
    00926
    00927             ClrICF(pClientImc, IMCF_UNICODE);
    00928         }
    00929         else if (!TestICF(pClientImc, IMCF_UNICODE) && pSelImeDpi != NULL &&
    00930                  (pSelImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)) {
    00931             /*
    00932              * Check if there is any LOGFONT to be converted.
    00933              */
    00934             if (fLogFontInited) {
    00935                 LOGFONTW LogFontW;
    00936
    00937                 LFontAtoLFontW(&pInputContext->lfFont.A, &LogFontW);
    00938                 RtlCopyMemory(&pInputContext->lfFont.W, &LogFontW, sizeof(LOGFONTW));
    00939             }
    00940
    00941             SetICF(pClientImc, IMCF_UNICODE);
    00942         }
    00943
    00944         /*
    00945          * hPrivate
    00946          */
    00947         if (dwUnSelPriv != dwSelPriv) {
    00948             hImcc = ImmReSizeIMCC(pInputContext->hPrivate, dwSelPriv);
    00949             if (hImcc) {
    00950                 pInputContext->hPrivate = hImcc;
    00951             }
    00952             else {
    00953                 RIPMSG1(RIP_WARNING,
    00954                       "SelectContext: resize hPrivate %lX failure",
    00955                       pInputContext->hPrivate);
    00956                 ImmDestroyIMCC(pInputContext->hPrivate);
    00957                 pInputContext->hPrivate = ImmCreateIMCC(dwSelPriv);
    00958             }
    00959         }
    00960
    00961         /*
    00962          * hMsgBuf
    00963          */
    00964         dwSize = ImmGetIMCCSize(pInputContext->hMsgBuf);
    00965
    00966         if (ImmGetIMCCLockCount(pInputContext->hMsgBuf) != 0 ||
    00967                 dwSize > IMCC_ALLOC_TOOLARGE) {
    00968
    00969             RIPMSG0(RIP_WARNING, "SelectContext: create new hMsgBuf");
    00970             ImmDestroyIMCC(pInputContext->hMsgBuf);
    00971             pInputContext->hMsgBuf = ImmCreateIMCC(sizeof(UINT));
    00972             pInputContext->dwNumMsgBuf = 0;
    00973         }
    00974
    00975         /*
    00976          * hGuideLine
    00977          */
    00978         dwSize = ImmGetIMCCSize(pInputContext->hGuideLine);
    00979
    00980         if (ImmGetIMCCLockCount(pInputContext->hGuideLine) != 0 ||
    00981                 dwSize < sizeof(GUIDELINE) || dwSize > IMCC_ALLOC_TOOLARGE) {
    00982
    00983             RIPMSG0(RIP_WARNING, "SelectContext: create new hGuideLine");
    00984             ImmDestroyIMCC(pInputContext->hGuideLine);
    00985             pInputContext->hGuideLine = ImmCreateIMCC(sizeof(GUIDELINE));
    00986             pGuideLine = (PGUIDELINE)ImmLockIMCC(pInputContext->hGuideLine);
    00987
    00988             if (pGuideLine != NULL) {
    00989                 pGuideLine->dwSize = sizeof(GUIDELINE);
    00990                 ImmUnlockIMCC(pInputContext->hGuideLine);
    00991             }
    00992         }
    00993
    00994         /*
    00995          * hCandInfo
    00996          */
    00997         dwSize = ImmGetIMCCSize(pInputContext->hCandInfo);
    00998
    00999         if (ImmGetIMCCLockCount(pInputContext->hCandInfo) != 0 ||
    01000                 dwSize < sizeof(CANDIDATEINFO) || dwSize > IMCC_ALLOC_TOOLARGE) {
    01001
    01002             RIPMSG0(RIP_WARNING, "SelectContext: create new hCandInfo");
    01003             ImmDestroyIMCC(pInputContext->hCandInfo);
    01004             pInputContext->hCandInfo = ImmCreateIMCC(sizeof(CANDIDATEINFO));
    01005             pCandInfo = (PCANDIDATEINFO)ImmLockIMCC(pInputContext->hCandInfo);
    01006
    01007             if (pCandInfo != NULL) {
    01008                 pCandInfo->dwSize = sizeof(CANDIDATEINFO);
    01009                 ImmUnlockIMCC(pInputContext->hCandInfo);
    01010             }
    01011         }
    01012
    01013         /*
    01014          * hCompStr
    01015          */
    01016         dwSize = ImmGetIMCCSize(pInputContext->hCompStr);
    01017
    01018         if (ImmGetIMCCLockCount(pInputContext->hCompStr) != 0 ||
    01019                 dwSize < sizeof(COMPOSITIONSTRING) || dwSize > IMCC_ALLOC_TOOLARGE) {
    01020
    01021             RIPMSG0(RIP_WARNING, "SelectContext: create new hCompStr");
    01022             ImmDestroyIMCC(pInputContext->hCompStr);
    01023             pInputContext->hCompStr = ImmCreateIMCC(sizeof(COMPOSITIONSTRING));
    01024             pCompStr = (PCOMPOSITIONSTRING)ImmLockIMCC(pInputContext->hCompStr);
    01025
    01026             if (pCompStr != NULL) {
    01027                 pCompStr->dwSize = sizeof(COMPOSITIONSTRING);
    01028                 ImmUnlockIMCC(pInputContext->hCompStr);
    01029             }
    01030         }
    01031
    01032         //
    01033         // Save and restore the IME modes when the primary
    01034         // language changes.
    01035         //
    01036
    01037         if (pUnSelImeDpi) {
    01038             //
    01039             // If UnSelKL is IME, get ModeSaver per language.
    01040             //
    01041             pUnSelModeSaver = GetImeModeSaver(pInputContext, hUnSelKL);
    01042             TAGMSG1(DBGTAG_IMM, "pUnSelModeSaver=%p", pUnSelModeSaver);
    01043
    01044             //
    01045             // Firstly save the private sentence mode per IME.
    01046             //
    01047             SavePrivateMode(pInputContext, pUnSelModeSaver, hUnSelKL);
    01048         }
    01049         else {
    01050             pUnSelModeSaver = NULL;
    01051         }
    01052
    01053         if (pSelImeDpi) {
    01054             //
    01055             // If SelKL is IME, get is ModeSaver per language.
    01056             //
    01057             pSelModeSaver = GetImeModeSaver(pInputContext, hSelKL);
    01058             TAGMSG1(DBGTAG_IMM, "pSelImeDpi. pImeModeSaver=%p", pSelModeSaver);
    01059         }
    01060         else {
    01061             pSelModeSaver = NULL;
    01062         }
    01063
    01064         //
    01065         // If the primary language of KL changes, save the current mode
    01066         // and restore the previous modes of new language.
    01067         //
    01068         if (pUnSelModeSaver != pSelModeSaver) {
    01069             //
    01070             // If old KL is IME, save the current conversion, sentence and open mode.
    01071             //
    01072             if (pUnSelModeSaver) {
    01073                 pUnSelModeSaver->fOpen = (pInputContext->fOpen != FALSE);
    01074
    01075                 //
    01076                 // Don't have to save the preserved bits for conversion mode.
    01077                 //
    01078                 pUnSelModeSaver->fdwConversion = pInputContext->fdwConversion & ~fdwConvPreserve;
    01079
    01080                 pUnSelModeSaver->fdwSentence = LOWORD(pInputContext->fdwSentence);
    01081                 pUnSelModeSaver->fdwInit = pInputContext->fdwInit;
    01082             }
    01083
    01084             //
    01085             // If new KL is IME, restore the previous conversion, sentence and open mode.
    01086             //
    01087             if (pSelModeSaver) {
    01088                 if (pInputContext->fdwDirty & IMSS_INIT_OPEN) {
    01089                     //
    01090                     // HKL change may be kicked from private IME hotkey, and
    01091                     // a user wants it opened when switched.
    01092                     //
    01093                     pInputContext->fOpen = TRUE;
    01094                     pInputContext->fdwDirty &= ~IMSS_INIT_OPEN;
    01095                 } else {
    01096                     pInputContext->fOpen = pSelModeSaver->fOpen;
    01097                 }
    01098
    01099                 //
    01100                 // Some bits are preserved across the languages.
    01101                 //
    01102                 pInputContext->fdwConversion &= fdwConvPreserve;
    01103                 ImmAssert((pSelModeSaver->fdwConversion & fdwConvPreserve) == 0);
    01104                 pInputContext->fdwConversion |= pSelModeSaver->fdwConversion & ~fdwConvPreserve;
    01105
    01106                 ImmAssert(HIWORD(pSelModeSaver->fdwSentence) == 0);
    01107                 pInputContext->fdwSentence = pSelModeSaver->fdwSentence;
    01108                 pInputContext->fdwInit = pSelModeSaver->fdwInit;
    01109             }
    01110         }
    01111         if (pSelModeSaver) {
    01112             //
    01113             // Restore the private sentence mode per IME.
    01114             //
    01115             RestorePrivateMode(pInputContext, pSelModeSaver, hSelKL);
    01116         }
    01117
    01118         /*
    01119          * Select the input context.
    01120          */
    01121         if (pSelImeDpi != NULL)
    01122             (*pSelImeDpi->pfn.ImeSelect)(hImc, TRUE);
    01123
    01124         //
    01125         // Set the dirty bits so that IMM can send notifications later.
    01126         // See SendNotificatonProc.
    01127         //
    01128         pInputContext->fdwDirty = 0;
    01129         if (pInputContext->fOpen != fOldOpen) {
    01130             pInputContext->fdwDirty |= IMSS_UPDATE_OPEN;
    01131         }
    01132         if (pInputContext->fdwConversion != fdwOldConversion) {
    01133             pInputContext->fdwDirty |= IMSS_UPDATE_CONVERSION;
    01134         }
    01135         if (pInputContext->fdwSentence != fdwOldSentence) {
    01136             pInputContext->fdwDirty |= IMSS_UPDATE_SENTENCE;
    01137         }
    01138         TAGMSG4(DBGTAG_IMM, "fOpen:%d fdwConv:%08x fdwSent:%08x dirty:%02x",
    01139                 pInputContext->fOpen, pInputContext->fdwConversion, pInputContext->fdwSentence, pInputContext->fdwDirty);
    01140
    01141         ImmUnlockIMC(hImc);
    01142     }
    01143     else {
    01144         //
    01145         // To keep the backward compatibility,
    01146         // select the input context here.
    01147         //
    01148         if (pSelImeDpi != NULL)
    01149             (*pSelImeDpi->pfn.ImeSelect)(hImc, TRUE);
    01150     }
    01151
    01152     ImmUnlockImeDpi(pUnSelImeDpi);
    01153     ImmUnlockImeDpi(pSelImeDpi);
    01154     ImmUnlockClientImc(pClientImc);
    01155 }

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 }

LRESULT TransCodeConvert | ( | HIMC | hImc,
|  | LPIMESTRUCT | lpIme
| ) |

Definition at line 647 of file kcodecnv.c.

References BanjaToJunja(), JohabToKs(), JunjaToBanja(), KsToJohab(), lpDest, and lpSource.

Referenced by TranslateIMESubFunctions().

    00654                    :
    00655
    00656 Arguments:
    00657
    00658 Return Value:
    00659
    00660 --*/
    00661
    00662 {
    00663     UNREFERENCED_PARAMETER(hIMC);
    00664
    00665     switch (lpIme->wParam)
    00666     {
    00667         case IME_JUNJAtoBANJA:
    00668             lpIme->wCount = JunjaToBanja(lpSource(lpIme), lpDest(lpIme));
    00669             break;
    00670
    00671         case IME_BANJAtoJUNJA:
    00672             lpIme->wCount = BanjaToJunja(lpSource(lpIme), lpDest(lpIme));
    00673             break;
    00674
    00675         case IME_JOHABtoKS:
    00676             lpIme->wCount = JohabToKs(lpSource(lpIme), lpDest(lpIme));
    00677             break;
    00678
    00679         case IME_KStoJOHAB:
    00680             lpIme->wCount = KsToJohab(lpSource(lpIme), lpDest(lpIme));
    00681             break;
    00682
    00683         default:
    00684             lpIme->wCount = 0;
    00685     }
    00686     return (lpIme->wCount);
    00687 }

LRESULT TransConvertList | ( | HIMC | hImc,
|  | LPIMESTRUCT | lpIme
| ) |

Definition at line 689 of file kcodecnv.c.

References GetKeyboardLayout(), ImmGetConversionListA(), lpDest, lpSource, NULL, and UINT.

Referenced by TranslateIMESubFunctions().

    00690 {
    00691     LPSTR           lpSrc;
    00692     LPSTR           lpDst;
    00693     HGLOBAL         hCandList;
    00694     LPCANDIDATELIST lpCandList;
    00695     LPSTR           lpCandStr;
    00696     UINT            i, uBufLen;
    00697     LRESULT         lRet = 0;
    00698
    00699     lpSrc = lpSource(lpIme);
    00700     lpDst = lpDest(lpIme);
    00701     uBufLen = ImmGetConversionListA(GetKeyboardLayout(0), hImc, (LPCSTR)lpSrc,
    00702             NULL, 0, GCL_CONVERSION);
    00703     if (uBufLen)
    00704     {
    00705         hCandList = GlobalAlloc(GHND, uBufLen);
    00706         lpCandList = (LPCANDIDATELIST)GlobalLock(hCandList);
    00707         lRet = ImmGetConversionListA(GetKeyboardLayout(0), hImc, (LPCSTR)lpSrc,
    00708                 lpCandList, uBufLen, GCL_CONVERSION);
    00709         for (i = 0; i < lpCandList->dwCount; i++)
    00710         {
    00711             lpCandStr = (LPSTR)lpCandList + lpCandList->dwOffset[i];
    00712             *lpDst++ = *lpCandStr++;
    00713             *lpDst++ = *lpCandStr++;
    00714         }
    00715         *lpDst = '\0';
    00716         lpIme->wCount = (WORD)lpCandList->dwCount * 2;
    00717         GlobalUnlock(hCandList);
    00718         GlobalFree(hCandList);
    00719     }
    00720     return (lRet);
    00721 }

LRESULT TransGetLevel | ( | HWND | hWndApp | ) |

Definition at line 1099 of file transsub.c.

References NtUserGetAppImeLevel(), and UINT.

Referenced by ImmGenerateMessage(), ImmPostMessages(), and TranslateIMESubFunctions().

    01100 {
    01101     UINT lRet;
    01102
    01103     if ( (lRet = NtUserGetAppImeLevel( hWndApp )) == 0 )
    01104         lRet = 1;       // default level
    01105
    01106     return lRet;
    01107 }

LRESULT TransGetMNTable | ( | HIMC | hImc,
|  | LPIMESTRUCT | lpIme
| ) |

Definition at line 723 of file kcodecnv.c.

References HIBYTE, HMNTable, IDD_2BEOL, L, LOBYTE, and TRUE.

Referenced by TranslateIMESubFunctions().

    00724 {
    00725     LPSTR   lpMnemonic;
    00726     int     iCount, iCIM;
    00727
    00728     UNREFERENCED_PARAMETER(hImc);
    00729
    00730     lpMnemonic = (LPSTR)(lpIme->lParam1);
    00731 // BUGBUG: Will be changed to use Registry instead of WIN.INI
    00732     iCIM = GetProfileInt(L"WANSUNG", L"InputMethod", IDD_2BEOL) - IDD_2BEOL;
    00733     for (iCount = 0; iCount < 96; iCount++, lpMnemonic += 2)
    00734         {
    00735         *lpMnemonic = LOBYTE(HMNTable[iCIM][iCount]);
    00736         *(lpMnemonic+1) = HIBYTE(HMNTable[iCIM][iCount]);
    00737         }
    00738     return TRUE;
    00739 }

LRESULT TranslateIMESubFunctions | ( | HWND | hWndApp,
|  | LPIMESTRUCT | lpIme,
|  | BOOL | fAnsi
| ) |

Definition at line 54 of file transsub.c.

References DestroyWindow, DWORD, FALSE, GetKeyboardLayout(), IGSC_DEFIMCFALLBACK, ImmGetSaveContext(), IsWindow(), NULL, NULL_HIMC, TransCodeConvert(), TransConvertList(), TransEnterWordRegisterMode(), TransGetConversionMode(), TransGetLevel(), TransGetMNTable(), TransGetMode(), TransGetOpenJ(), TransGetOpenK(), TransHanjaMode(), TransMoveImeWindow(), TransSendVKey(), TransSetConversionFontEx(), TransSetConversionMode(), TransSetConversionWindow(), TransSetLevel(), TransSetMode(), TransSetOpenJ(), TransSetOpenK(), and TRUE.

Referenced by SendIMEMessageAll().

    00058 {
    00059     HIMC        hImc;
    00060     LRESULT     lRet;
    00061     DWORD       dwLangID;
    00062
    00063     hImc = ImmGetSaveContext( hWndApp, IGSC_DEFIMCFALLBACK );
    00064     if ( hImc == NULL_HIMC ) {
    00065         return FALSE;
    00066     }
    00067
    00068     dwLangID = PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID()));
    00069
    00070     switch (lpIme->fnc) {
    00071     case 0x03:  // IME_QUERY, IME_GETIMECAPS: KOREAN & JAPANESE
    00072         lRet = TRUE;
    00073         break;
    00074
    00075     case 0x04:  // IME_SETOPEN: KOREAN & JAPANESE
    00076         if ( dwLangID == LANG_KOREAN )
    00077             lRet = TransSetOpenK( hWndApp, hImc, lpIme );
    00078         else
    00079             lRet = TransSetOpenJ( hWndApp, hImc, lpIme );
    00080         break;
    00081
    00082     case 0x05:  // IME_GETOPEN: KOREAN & JAPANESE
    00083         if ( dwLangID == LANG_KOREAN )
    00084             lRet = TransGetOpenK( hWndApp, hImc, lpIme, fAnsi );
    00085         else
    00086             lRet = TransGetOpenJ( hWndApp, hImc, lpIme, fAnsi );
    00087         break;
    00088
    00089     case 0x06:  // IME_ENABLEDOSIME, IME_ENABLE
    00090     // internal functions are not supported
    00091         lRet = FALSE;
    00092         break;
    00093
    00094     case 0x07:  // IME_GETVERSION: KOREAN & JAPANESE
    00095         lRet = IMEVER_31;
    00096         break;
    00097
    00098     case 0x08:  // IME_MOVEIMEWINDOW, IME_SETCONVERSIONWINDOW: KOREAN & JAPANESE
    00099
    00100         if ( dwLangID == LANG_KOREAN ) {
    00101             //
    00102             // IME_MOVEIMEWINDOW for KOREAN
    00103             //
    00104             lRet = TransMoveImeWindow(hWndApp, hImc, lpIme);
    00105         } else {
    00106             //
    00107             // IME_MOVECONVERTWINDOW or IME_SETCONVERSIONWINDOW for JAPANESE
    00108             //
    00109             lRet = TransSetConversionWindow( hWndApp, hImc, lpIme );
    00110         }
    00111         break;
    00112
    00113 //  case 0x09:  // undefined
    00114
    00115     case 0x10:  // IME_SETCONVERSIONMODE: JAPANESE
    00116         if ( dwLangID == LANG_JAPANESE ) {
    00117             lRet = TransSetConversionMode( hImc, lpIme );
    00118         } else {
    00119             lRet = FALSE;
    00120         }
    00121         break;
    00122
    00123     case 0x11:  // IME_GETCONVERSIONMODE, IME_GETMODE: // KOREAN & JAPANESE
    00124         // Use hSaveIMC, If WINNSEnableIME(FALSE).
    00125         if ( dwLangID == LANG_KOREAN ) {
    00126         //
    00127         // IME_GETMODE for KOREAN
    00128         //
    00129             lRet = TransGetMode( hImc );
    00130         } else {
    00131         //
    00132         // IME_GETCONVERSIONMODE for JAPANESE
    00133         //
    00134             lRet = TransGetConversionMode( hImc );
    00135         }
    00136         break;
    00137
    00138     case 0x12:  // IME_SET_MODE, IME_SETFONT, IME_SETCONVERSIONFONT: KOREAN & JAPANESE
    00139         if ( dwLangID == LANG_KOREAN ) {
    00140             //
    00141             // IME_SET_MODE for KOREAN
    00142             //
    00143             lRet = TransSetMode( hImc, lpIme );
    00144         } else {
    00145             //
    00146             // IME_SETCONVERSIONFONT for JAPANESE
    00147             //
    00148             lRet = FALSE;   // should not be called. use SETCONVERSIONFONTEX instead
    00149         }
    00150         break;
    00151
    00152     case 0x13:  // IME_SENDVKEY, IME_SENDKEY: JAPANESE only
    00153         if ( dwLangID == LANG_JAPANESE ) {
    00154             lRet = TransSendVKey( hWndApp, hImc, lpIme, fAnsi );
    00155         } else {
    00156             lRet = FALSE;
    00157         }
    00158         break;
    00159
    00160 //
    00161 // internal sub functions are not supported
    00162 //
    00163 //  case 0x14: // IME_DESTROY, IME_DESTROYIME
    00164 //  case 0x15: // IME_PRIVATE
    00165 //  case 0x16: // IME_WINDOWUPDATE
    00166 //  case 0x17: // IME_SELECT
    00167
    00168     case 0x18: // IME_ENTERWORDREGISTERMODE: JAPANESE only
    00169         if ( dwLangID == LANG_JAPANESE ) {
    00170             lRet = TransEnterWordRegisterMode( hWndApp, lpIme, fAnsi);
    00171         } else {
    00172             lRet = FALSE;
    00173         }
    00174         break;
    00175
    00176     case 0x19:  // IME_SETCONVERSIONFONTEX: JAPANESE only
    00177         if ( dwLangID == LANG_JAPANESE ) {
    00178             lRet = TransSetConversionFontEx( hWndApp, hImc, lpIme, fAnsi);
    00179         } else {
    00180             lRet = FALSE;
    00181         }
    00182         break;
    00183
    00184 //
    00185 // internal sub functions are not supported
    00186 //
    00187 //  case 0x1A: // IME_DBCSNAME
    00188 //  case 0x1B: // IME_MAXKEY
    00189 //  case 0x1C: // IME_WINNLS_SK
    00190
    00191     case 0x20:  // IME_CODECONVERT: KOREAN only
    00192         if ( dwLangID == LANG_KOREAN ) {
    00193             if (TransCodeConvert( hImc, lpIme))
    00194                 lRet = lpIme->wParam;
    00195             else
    00196                 lRet = 0;
    00197         } else {
    00198             lRet = 0;
    00199         }
    00200         break;
    00201
    00202     case 0x21:  // IME_CONVERTLIST: KOREAN only
    00203         if ( dwLangID == LANG_KOREAN ) {
    00204             lRet = TransConvertList( hImc, lpIme);
    00205         } else {
    00206             lRet = FALSE;
    00207         }
    00208         break;
    00209
    00210 //
    00211 // internal sub functions and undefined sub functions are not supported
    00212 //
    00213 //  case 0x22:  // IME_INPUTKEYTOSEQUENCE
    00214 //  case 0x23:  // IME_SEQUENCETOINTERNAL
    00215 //  case 0x24:  // IME_QUERYIMEINFO
    00216 //  case 0x25:  // IME_DIALOG
    00217 //  case 0x26 - 0x2f:   // undefined
    00218
    00219     case 0x30:  // IME_AUTOMATA: KOREAN only
    00220         if ( dwLangID == LANG_KOREAN ) {
    00221             lRet = ImmEscape(GetKeyboardLayout(0), hImc, IME_AUTOMATA, lpIme);
    00222         } else {
    00223             lRet = FALSE;
    00224         }
    00225         break;
    00226
    00227     case 0x31:  // IME_HANJAMODE: KOREAN only
    00228         if ( dwLangID == LANG_KOREAN ) {
    00229             lRet = TransHanjaMode( hWndApp,  hImc, lpIme);
    00230         } else {
    00231             lRet = FALSE;
    00232         }
    00233         break;
    00234 //
    00235 //  case 0x32 - 0x3f: // undefined
    00236 //
    00237     case 0x40:  // IME_GETLEVEL: KOREAN only
    00238         if ( dwLangID == LANG_KOREAN ) {
    00239             lRet = TransGetLevel( hWndApp );
    00240         } else {
    00241             lRet = FALSE;
    00242         }
    00243         break;
    00244
    00245     case 0x41:  // IME_SETLEVEL: KOREAN only
    00246         if ( dwLangID == LANG_KOREAN ) {
    00247             lRet = TransSetLevel( hWndApp, lpIme);
    00248         } else {
    00249             lRet = FALSE;
    00250         }
    00251         break;
    00252
    00253     case 0x42:  // IME_GETMNTABLE: KOREAN only
    00254         if ( dwLangID == LANG_KOREAN ) {
    00255             lRet = TransGetMNTable( hImc, lpIme);
    00256         } else {
    00257             lRet = FALSE;
    00258         }
    00259         break;
    00260
    00261 #if defined(PENAPI)
    00262     case IME_SETUNDETERMINESTRING:
    00263         lRet = FSetUndetermine( hImc, (HGLOBAL)lpIME->lParam1);
    00264         break;
    00265
    00266     case IME_SETCAPTURE:
    00267         lRet = FEnablePenUi((HWND)lpIME->wParam, (lpIME->wParam != NULL));
    00268         break;
    00269 #endif
    00270
    00271 #ifdef LATER // IME_NOTIFYWOWTASKEXIT
    00272     case IME_NOTIFYWOWTASKEXIT:
    00273       //
    00274       // Destroy the default IME window of WOW 16bit
    00275       // applications now. We should not wait for the
    00276       // server wow thread clean up that will destroy the
    00277       // IME window because usrsrv won't send WM_DESTROY
    00278       // to non-server side window procedures. Some IMEs
    00279       // must receive WM_DESTROY to free up 32 bit objects.
    00280       //
    00281       //  kksuzuka #7982:IME memory leak on WOW16 applications.
    00282       //
    00283       PIMMTHREADINFO piti = PitiCurrent();
    00284
    00285       if ( piti != NULL && IsWindow( piti->hwndDefaultIme ) ) {
    00286           DestroyWindow( piti->hwndDefaultIme );
    00287       }
    00288       return TRUE;
    00289 #endif
    00290     default:
    00291         //
    00292         // private/internal/undefined functions are not supported
    00293         //
    00294         lRet = FALSE;
    00295         break;
    00296     }
    00297
    00298     return (lRet);
    00299 }

LRESULT TransSetLevel | ( | HWND | hWndApp,
|  | LPIMESTRUCT | lpIme
| ) |

Definition at line 1116 of file transsub.c.

References DWORD, FALSE, NtUserSetAppImeLevel(), and TRUE.

Referenced by TranslateIMESubFunctions().

    01117 {
    01118     DWORD dwLevel;
    01119
    01120     dwLevel = (DWORD)lpIme->wParam;
    01121     if ( dwLevel >= 1 && dwLevel <= 5 ) {
    01122         if ( NtUserSetAppImeLevel(hWndApp, dwLevel) ) {
    01123             return TRUE;
    01124         }
    01125     }
    01126     return FALSE;
    01127 }

VOID UnloadIME | ( | PIMEDPI | pImeDpi,
|  | BOOL | fTerminateIme
| ) |

Definition at line 212 of file immime.c.

References tagIMEDPI::hInst, tagIMEDPI::_tagImeFunctions::ImeDestroy, NULL, tagIMEDPI::pfn, and VOID().

Referenced by ImmDisableIME(), ImmUnloadIME(), ImmUnlockImeDpi(), and LoadImeDpi().

    00215 {
    00216     if (pImeDpi->hInst == NULL) {
    00217         RIPMSG0(RIP_WARNING, "UnloadIME: No IME's hInst.");
    00218         return;
    00219     }
    00220
    00221     if (fTerminateIme) {
    00222         /*
    00223          * Destroy IME first.
    00224          */
    00225         (*pImeDpi->pfn.ImeDestroy)(0);
    00226     }
    00227
    00228     FreeLibrary(pImeDpi->hInst);
    00229     pImeDpi->hInst = NULL;
    00230
    00231     return;
    00232 }

UINT WINNLSTranslateMessage | ( | INT | iNum,
|  | PTRANSMSG | pTransMsg,
|  | HIMC | hImc,
|  | BOOL | fAnsi,
|  | DWORD | dwLangId
| ) |

Definition at line 478 of file ntuser/imm/input.c.

References ImmLockIMC(), ImmLockIMCC(), ImmUnlockIMC(), ImmUnlockIMCC(), NULL, UINT, WINNLSTranslateMessageJ(), and WINNLSTranslateMessageK().

Referenced by ImmGenerateMessage(), and ImmPostMessages().

    00484 {
    00485     LPINPUTCONTEXT      pInputContext;
    00486     LPCOMPOSITIONSTRING pCompStr;
    00487     UINT uiRet = 0;
    00488
    00489     pInputContext = ImmLockIMC(hImc);
    00490     if (pInputContext == NULL) {
    00491         return uiRet;
    00492     }
    00493
    00494     pCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC( pInputContext->hCompStr );
    00495
    00496     if (dwLangId == LANG_KOREAN) {
    00497         uiRet = WINNLSTranslateMessageK((UINT)iNum,
    00498                                         pTransMsg,
    00499                                         pInputContext,
    00500                                         pCompStr,
    00501                                         fAnsi );
    00502     } else if ( dwLangId == LANG_JAPANESE ) {
    00503         uiRet = WINNLSTranslateMessageJ((UINT)iNum,
    00504                                         pTransMsg,
    00505                                         pInputContext,
    00506                                         pCompStr,
    00507                                         fAnsi );
    00508     }
    00509
    00510     if (pCompStr != NULL) {
    00511         ImmUnlockIMCC(pInputContext->hCompStr);
    00512     }
    00513     ImmUnlockIMC(hImc);
    00514
    00515     return uiRet;
    00516 }

UINT WINNLSTranslateMessageJ | ( | UINT | uiNumMsg,
|  | PTRANSMSG | pTransMsg,
|  | LPINPUTCONTEXT | lpIMC,
|  | LPCOMPOSITIONSTRING | lpCompStr,
|  | BOOL | bAnsiIMC
| ) |

Definition at line 582 of file jtranmsg.c.

References BOOL, DWORD, FALSE, hWnd, ImmGetDefaultIMEWnd(), ImmLocalAlloc(), ImmLocalFree, IsWindow(), IsWindowUnicode(), JTransCompositionA(), JTransCompositionW(), L, NULL, SendMessage(), TRUE, and UINT.

Referenced by WINNLSTranslateMessage().

    00592                    :
    00593
    00594 Arguments:
    00595
    00596 Return Value:
    00597
    00598 --*/
    00599
    00600 {
    00601     PTRANSMSG       pTransMsgBuf, pTransMsgTemp;
    00602     UINT            uiNewNum = 0;
    00603     UINT            uiTempNum;
    00604     DWORD           dwTempSize;
    00605     HWND            hDefIMEWnd;
    00606     UINT            i;
    00607     BOOL            bAnsiWnd;
    00608
    00609     hDefIMEWnd = ImmGetDefaultIMEWnd((HWND)lpIMC->hWnd);
    00610
    00611     bAnsiWnd = (! IsWindowUnicode(lpIMC->hWnd)) ? TRUE : FALSE;
    00612
    00613     dwTempSize = uiNumMsg * sizeof(TRANSMSG);
    00614
    00615     //
    00616     // Allocate one more TRANSMSG and ZEROINIT the whole thing!
    00617     //
    00618
    00619     pTransMsgBuf = (PTRANSMSG)ImmLocalAlloc( HEAP_ZERO_MEMORY,
    00620                                              dwTempSize + sizeof(TRANSMSG)
    00621                                            );
    00622     if ( pTransMsgBuf == NULL )
    00623         goto wtmsg2_j_10;
    00624
    00625     RtlCopyMemory(pTransMsgBuf, pTransMsg, dwTempSize);
    00626     pTransMsgTemp = pTransMsgBuf;
    00627
    00628     //
    00629     // When MCW_HIDDEN mode, WM_IME_ENDCOMPOSITION will be translated to
    00630     // IR_UNDETERMINE with 0 string. So that, this message have to be
    00631     // generated after all messages.
    00632     //
    00633
    00634     if (lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN) {
    00635
    00636         for (i = 0; i < uiNumMsg; i++, pTransMsgTemp++) {
    00637             if (pTransMsgTemp->message == WM_IME_ENDCOMPOSITION) {
    00638                 break;
    00639             }
    00640         }
    00641
    00642         if (pTransMsgTemp->message == WM_IME_ENDCOMPOSITION) {
    00643
    00644             PTRANSMSG pTransMsgSrc = pTransMsgTemp + 1;
    00645
    00646             while (pTransMsgSrc->message != 0) {
    00647                 *pTransMsgTemp++ = *pTransMsgSrc++;
    00648             }
    00649
    00650             pTransMsgTemp->message = WM_IME_ENDCOMPOSITION;
    00651             pTransMsgTemp->wParam  = 0L;
    00652             pTransMsgTemp->lParam  = 0L;
    00653
    00654         }
    00655
    00656         pTransMsgTemp = pTransMsgBuf;
    00657     }
    00658
    00659     while (pTransMsgTemp->message != 0) {
    00660
    00661         switch (pTransMsgTemp->message)
    00662         {
    00663             case WM_IME_COMPOSITION:
    00664
    00665                 if (bAnsiIMC)
    00666                     uiTempNum = JTransCompositionA(lpIMC,lpCompStr,pTransMsgTemp,pTransMsg);
    00667                 else
    00668                     uiTempNum = JTransCompositionW(lpIMC,lpCompStr,pTransMsgTemp,pTransMsg);
    00669
    00670                 uiNewNum  += uiTempNum;
    00671                 pTransMsg += uiTempNum;
    00672
    00673                 if ( !(lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN) )
    00674                 {
    00675                     if ( lpIMC->cfCompForm.dwStyle != CFS_DEFAULT ) {
    00676                         SendMessage((HWND)lpIMC->hWnd, WM_IME_REPORT, IR_CHANGECONVERT, 0L);
    00677                     }
    00678                 }
    00679
    00680                 break;
    00681
    00682             case WM_IME_STARTCOMPOSITION:
    00683
    00684                 if ( !(lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN) )
    00685                 {
    00686                     if ( lpIMC->cfCompForm.dwStyle != CFS_DEFAULT ) {
    00687                         SendMessage((HWND)lpIMC->hWnd, WM_IME_REPORT, IR_OPENCONVERT, 0L);
    00688                     }
    00689
    00690                     *pTransMsg++ = *pTransMsgTemp;
    00691                     uiNewNum++;
    00692                 }
    00693
    00694                 break;
    00695
    00696             case WM_IME_ENDCOMPOSITION:
    00697
    00698                 if ( !(lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN) )
    00699                 {
    00700                     if ( lpIMC->cfCompForm.dwStyle != CFS_DEFAULT ) {
    00701                         SendMessage((HWND)lpIMC->hWnd, WM_IME_REPORT, IR_CLOSECONVERT, 0L);
    00702                     }
    00703
    00704                     *pTransMsg++ = *pTransMsgTemp;
    00705                     uiNewNum++;
    00706
    00707                 }
    00708                 else {
    00709
    00710                     HWND hWnd = (HWND)lpIMC->hWnd;
    00711                     HGLOBAL hUndet = 0L;
    00712
    00713                     if (hUndet = GlobalAlloc(GHND | GMEM_SHARE, sizeof(UNDETERMINESTRUCT)))
    00714                     {
    00715                         if (! IsWindowUnicode(lpIMC->hWnd))
    00716                             SendMessageA(hWnd,WM_IME_REPORT, IR_UNDETERMINE, (LPARAM)hUndet);
    00717                         else
    00718                             SendMessageW(hWnd,WM_IME_REPORT, IR_UNDETERMINE, (LPARAM)hUndet);
    00719
    00720                         GlobalFree(hUndet);
    00721                     }
    00722                 }
    00723
    00724                 break;
    00725
    00726             case WM_IME_NOTIFY:
    00727
    00728                 switch (pTransMsgTemp->wParam)
    00729                 {
    00730                     case IMN_OPENCANDIDATE:
    00731
    00732                         //
    00733                         // When 3.1 Application want to set MCW_HIDDEN,
    00734                         // the candidate window of Chicago IME go way
    00735                         // from the restangle of the composition string
    00736                         // that will be drawn by the application.
    00737                         //
    00738
    00739                         if (IsWindow((HWND)lpIMC->hWnd) &&
    00740                             (lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN)) {
    00741                             CANDIDATEFORM cfCandForm;
    00742                             DWORD i;
    00743                             DWORD dwNumCand = 0;
    00744
    00745                             for (i = 0; i < 32; i++)
    00746                             {
    00747                                 //
    00748                                 // Only the opened candidate should be updated.
    00749                                 //
    00750                                 if (!(pTransMsgTemp->lParam & (01L << i)))
    00751                                     continue;
    00752
    00753                                 cfCandForm.dwIndex = i;
    00754                                 cfCandForm.dwStyle = CFS_EXCLUDE;
    00755                                 cfCandForm.ptCurrentPos = lpIMC->cfCompForm.ptCurrentPos;
    00756                                 cfCandForm.rcArea       = lpIMC->cfCompForm.rcArea;
    00757                                 SendMessage(hDefIMEWnd, WM_IME_CONTROL, IMC_SETCANDIDATEPOS,
    00758                                                (LPARAM)(LPCANDIDATEFORM)&cfCandForm);
    00759                             }
    00760                         }
    00761
    00762                         break;
    00763
    00764                     default :
    00765                         break;
    00766                 }
    00767
    00768                 if (!(lpIMC->fdw31Compat & F31COMPAT_MCWHIDDEN)) {
    00769                     *pTransMsg++ = *pTransMsgTemp;
    00770                     uiNewNum++;
    00771                 }
    00772                 else {
    00773                     //
    00774                     // For win31 apps who set MCW_HIDDEN, we won't give them
    00775                     // IMN_OPENCANDIDATE here. Instead, send it directly to the
    00776                     // default IME window.
    00777                     //
    00778                     SendMessage( hDefIMEWnd,
    00779                                  pTransMsgTemp->message,
    00780                                  pTransMsgTemp->wParam,
    00781                                  pTransMsgTemp->lParam
    00782                                );
    00783                 }
    00784
    00785                 break;
    00786
    00787             default :
    00788                 *pTransMsg++ = *pTransMsgTemp;
    00789                 uiNewNum++;
    00790                 break;
    00791         }
    00792
    00793         pTransMsgTemp++;
    00794     }
    00795
    00796     ImmLocalFree(pTransMsgBuf);
    00797
    00798 wtmsg2_j_10:
    00799     return (uiNewNum);
    00800 }

UINT WINNLSTranslateMessageK | ( | int | iNumMsg,
|  | PTRANSMSG | pTransMsg,
|  | LPINPUTCONTEXT | lpIMC,
|  | LPCOMPOSITIONSTRING | lpCompStr,
|  | BOOL | bAnsiIMC
| ) |

Definition at line 128 of file ktranmsg.c.

References BOOL, BYTE, CHAR, FALSE, HIBYTE, hWnd, ImmGetDefaultIMEWnd(), IsWindowUnicode(), L, LOBYTE, NULL, TRUE, and UINT.

Referenced by WINNLSTranslateMessage().

    00133 {
    00134     HWND    hDefIMEWnd;
    00135     int     i, j;
    00136     static  BYTE bp1stInterim = 0;
    00137     static  BYTE bp2ndInterim = 0;
    00138     BOOL    bAnsiWnd;
    00139     HWND    hWnd;
    00140     WCHAR   wchUni;
    00141     CHAR    chAnsi[2];
    00142     BYTE    bchLow, bchHi, bCh;
    00143     BOOL (WINAPI* fpPostMessage)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
    00144     LRESULT (WINAPI* fpSendMessage)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
    00145
    00146     hWnd = (HWND)lpIMC->hWnd;
    00147
    00148     hDefIMEWnd = ImmGetDefaultIMEWnd(hWnd);
    00149
    00150     bAnsiWnd = !IsWindowUnicode(hWnd) ? TRUE : FALSE;
    00151     if (bAnsiWnd) {
    00152         fpPostMessage = PostMessageA;
    00153         fpSendMessage = SendMessageA;
    00154     } else {
    00155         fpPostMessage = PostMessageW;
    00156         fpSendMessage = SendMessageW;
    00157     }
    00158
    00159     for (i = 0; i < iNumMsg; i++) {
    00160
    00161         switch (pTransMsg[i].message) {
    00162
    00163         case WM_IME_COMPOSITION :
    00164
    00165             if (pTransMsg[i].lParam & GCS_RESULTSTR) {
    00166
    00167                 fpPostMessage(hWnd, WM_IME_REPORT, IR_STRINGSTART, 0L);
    00168
    00169                 for (j = 0; j < (int)lpCompStr->dwResultStrLen; j++) {
    00170                     LPARAM  lParam;
    00171                     bCh = 0;
    00172                     if (bAnsiIMC) {
    00173                         bCh = *((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset + j);
    00174                         if (bAnsiWnd) {
    00175                             if (IsDBCSLeadByte(bCh)) {
    00176                                 lParam = (bCh >= 0xB0 && bCh <= 0xC8)? 0xFFF10001L: 0xFFF20001L;
    00177                                 PostMessageA(hWnd, WM_CHAR, bCh, lParam);
    00178                                 bCh = *((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset + ++j);
    00179                             } else
    00180                                 lParam = 1L;
    00181                             PostMessageA(hWnd, WM_CHAR, bCh, lParam);
    00182                         } else {
    00183                             chAnsi[0] = bCh;
    00184                             chAnsi[1] = *((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset + ++j);
    00185
    00186                             MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, chAnsi, 2, &wchUni, 1);
    00187
    00188                             PostMessageW(hWnd, WM_CHAR, wchUni, lParam);
    00189                         }
    00190                     } else {    // !bAnsiIMC
    00191                         bCh = *((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset + j * sizeof(WCHAR));
    00192                         wchUni = bCh | ( *((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset +
    00193                                            (j * sizeof(WCHAR) + 1)) << 8);
    00194
    00195                         if (bAnsiWnd) {
    00196                             WideCharToMultiByte(CP_ACP, 0, &wchUni, 1, chAnsi, 2, NULL, NULL);
    00197
    00198                             bchLow = chAnsi[0];
    00199                             bchHi  = chAnsi[0]; //(BYTE)chAnsi;
    00200
    00201                             if (IsDBCSLeadByte(bchLow)) {
    00202                                 lParam = (bchLow >= 0xB0 && bchLow <= 0xC8) ? 0xFFF10001L: 0xFFF20001L;
    00203                                 PostMessageA(hWnd, WM_CHAR, bchLow, lParam);
    00204                                 bchHi = chAnsi[1];
    00205                             } else
    00206                                 lParam = 1L;
    00207
    00208                             PostMessageA(hWnd, WM_CHAR, bchHi, lParam);
    00209                         } else {
    00210                             PostMessageW(hWnd, WM_CHAR, wchUni, lParam);
    00211                         }
    00212                     }
    00213                 }
    00214
    00215                 fpPostMessage(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00216
    00217             } else {    // !(pTransMsg[i].lParam & GCS_RESULTSTR)
    00218
    00219                 if (pTransMsg[i].wParam) {
    00220
    00221                     fpPostMessage(hWnd, WM_IME_REPORT, IR_STRINGSTART, 0L);
    00222
    00223                     bp1stInterim = HIBYTE(LOWORD(pTransMsg[i].wParam));
    00224                     bp2ndInterim = LOBYTE(LOWORD(pTransMsg[i].wParam));
    00225
    00226                     if (bAnsiIMC) {
    00227                         if (bAnsiWnd) {
    00228                             PostMessageA(hWnd, WM_INTERIM, bp1stInterim, 0x00F00001L);
    00229                             PostMessageA(hWnd, WM_INTERIM, bp2ndInterim, 0x00F00001L);
    00230                             PostMessageA(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00231                         } else {
    00232                             chAnsi[0] = bp1stInterim;
    00233                             chAnsi[1] = bp2ndInterim;
    00234
    00235                             if (MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, chAnsi, 2, &wchUni, 1))
    00236                                 PostMessageW(hWnd, WM_INTERIM, wchUni, 0x00F00001L);
    00237                             PostMessageW(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00238                         }
    00239
    00240                     } else {
    00241                         if (bAnsiWnd) {
    00242                             wchUni = (bp1stInterim << 8) | bp2ndInterim;  //(WORD)lpdwTransKey[i*3 + 1];
    00243                             WideCharToMultiByte(CP_ACP, 0, &wchUni, 1, chAnsi, 2, NULL, NULL);
    00244
    00245                             bchLow = chAnsi[0];
    00246                             bchHi  = chAnsi[1];
    00247
    00248                             PostMessageA(hWnd, WM_INTERIM, bchLow, 0x00F00001L);
    00249                             PostMessageA(hWnd, WM_INTERIM, bchHi,  0x00F00001L);
    00250                             PostMessageA(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00251                         } else {
    00252                             PostMessageW(hWnd, WM_INTERIM, pTransMsg[i].wParam, 0x00F00001L);
    00253                             PostMessageW(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00254                         }
    00255                     }
    00256                     fpSendMessage(hDefIMEWnd, WM_IME_ENDCOMPOSITION, 0, 0L);
    00257
    00258                 } else {    // !pTransMsg[i].wParam
    00259
    00260                     fpPostMessage(hWnd, WM_IME_REPORT, IR_STRINGSTART, 0L);
    00261
    00262                     if (bAnsiIMC) {
    00263                         if (bAnsiWnd) {
    00264                             PostMessageA(hWnd, WM_CHAR, bp1stInterim, 0xFFF10001L);
    00265                             PostMessageA(hWnd, WM_CHAR, bp2ndInterim, 0xFFF10001L);
    00266                             PostMessageA(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00267                             PostMessageA(hWnd, WM_KEYDOWN, VK_BACK, 0x000E0001L);
    00268                         } else {
    00269                             chAnsi[0] = bp1stInterim;
    00270                             chAnsi[1] = bp2ndInterim;
    00271
    00272                             if (MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, chAnsi, 2, &wchUni, 1))
    00273                                 PostMessageW(hWnd, WM_CHAR, wchUni, 0xFFF10001L);
    00274
    00275                             PostMessageW(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00276                             PostMessageW(hWnd, WM_KEYDOWN, VK_BACK, 0x000E0001L);
    00277                         }
    00278                     } else {    // !bAnsiIMC
    00279                         if (bAnsiWnd) {
    00280                             wchUni = (bp1stInterim << 8 ) | bp2ndInterim;
    00281
    00282                             WideCharToMultiByte(CP_ACP, 0, &wchUni, 1, chAnsi, 2, NULL, NULL);
    00283
    00284                             bchLow = chAnsi[0];
    00285                             bchHi  = chAnsi[1];
    00286
    00287                             PostMessageA(hWnd, WM_CHAR, bchLow, 0xFFF10001L);
    00288                             PostMessageA(hWnd, WM_CHAR, bchHi,  0xFFF10001L);
    00289                             PostMessageA(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00290                             PostMessageA(hWnd, WM_KEYDOWN, VK_BACK, 0x000E0001L);
    00291                         } else {
    00292                             wchUni = bp1stInterim | (bp2ndInterim << 8);
    00293
    00294                             PostMessageW(hWnd, WM_CHAR, wchUni, 0xFFF10001L);
    00295                             PostMessageW(hWnd, WM_IME_REPORT, IR_STRINGEND, 0L);
    00296                             PostMessageW(hWnd, WM_KEYDOWN, VK_BACK, 0x000E0001L);
    00297                         }
    00298                     }
    00299                 }
    00300             }
    00301             break;
    00302
    00303         case WM_IME_STARTCOMPOSITION :
    00304         case WM_IME_ENDCOMPOSITION :
    00305             break;
    00306
    00307         case WM_IME_KEYDOWN:
    00308             fpPostMessage(hWnd, WM_KEYDOWN, LOWORD(pTransMsg[i].wParam),
    00309                           pTransMsg[i].lParam);
    00310             break;
    00311
    00312         case WM_IME_KEYUP:
    00313             fpPostMessage(hWnd, WM_KEYUP, LOWORD(pTransMsg[i].wParam),
    00314                           pTransMsg[i].lParam);
    00315             break;
    00316
    00317         default :
    00318             fpSendMessage(hDefIMEWnd, pTransMsg[i].message,
    00319                           pTransMsg[i].wParam, pTransMsg[i].lParam);
    00320             break;
    00321         }
    00322     }
    00323
    00324     return 0;   // indicates all messages are post/sent within this function.
    00325 }

## Variable Documentation

CRITICAL_SECTION gcsImeDpi

| Definition at line 96 of file immcli.h. Referenced by ImmDisableIME(), ImmDllInitialize(), ImmFreeLayout(), ImmGetImeDpi(), ImmGetImeMenuItemsInterProcess(), ImmInitializeGlobals(), ImmLockImeDpi(), ImmUnloadIME(), ImmUnlockImeDpi(), and LoadImeDpi().

BOOLEAN gfInitialized

| Definition at line 89 of file immcli.h. Referenced by ImmDllInitialize(), and ImmInitializeGlobals().

HINSTANCE ghInst

| Definition at line 90 of file immcli.h. Referenced by ImmCreateSoftKeyboard(), ImmDllInitialize(), ImmInitializeGlobals(), RegisterSoftKeyboard(), SKC1DrawBitmap(), SKC1DrawLabel(), SKT1DrawBitmap(), and SKT1DrawLabel().

PIMEDPI gpImeDpi

| Definition at line 95 of file immcli.h. Referenced by ImmDisableIME(), ImmFreeLayout(), ImmGetImeDpi(), ImmLockImeDpi(), ImmUnloadIME(), ImmUnlockImeDpi(), and LoadImeDpi().

PSERVERINFO gpsi

| Definition at line 92 of file immcli.h.

POINT gptRaiseEdge

| Definition at line 99 of file immcli.h. Referenced by GetSoftKeyboardDimension(), ImmCreateSoftKeyboard(), and InitSKT1ButtonPos().

POINT gptWorkArea

| Definition at line 98 of file immcli.h.

SHAREDINFO gSharedInfo

| Definition at line 93 of file immcli.h.

CONST WCHAR gszRegKbdLayout[]

| Definition at line 102 of file immcli.h. Referenced by GetImeLayout(), ImmLoadLayout(), and WriteImeLayout().

CONST WCHAR gszRegKbdOrder[]

| Definition at line 106 of file immcli.h. Referenced by WriteImeLayout().

CONST WCHAR gszValImeFile[]

| Definition at line 109 of file immcli.h. Referenced by GetImeLayout(), ImmLoadLayout(), and WriteImeLayout().

CONST WCHAR gszValLayoutFile[]

| Definition at line 108 of file immcli.h. Referenced by WriteImeLayout().

CONST WCHAR gszValLayoutText[]

| Definition at line 107 of file immcli.h. Referenced by WriteImeLayout().

UINT guScanCode[0XFF]

| Definition at line 100 of file immcli.h. Referenced by ImmCreateSoftKeyboard(), SKC1ButtonUp(), SKT1ButtonUp(), and SKT1SetCursor().

PVOID pImmHeap

| Definition at line 91 of file immcli.h. Referenced by ImmLocalAlloc().

PTHREADINFO PtiCurrent(VOID)