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

conime.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define LockConsoleTable()   RtlEnterCriticalSection(&ConsoleTableLock)
#define UnlockConsoleTable()   RtlLeaveCriticalSection(&ConsoleTableLock)
#define InputExceptionFilter(pexi)   EXCEPTION_EXECUTE_HANDLER

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
BOOL InitConsoleIME (HINSTANCE hInstance)
LRESULT FAR PASCAL WndProc (HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
VOID ExitList (HWND hWnd)
BOOL InsertConsole (HWND hWnd, HANDLE hConsole, HWND hWndConsole)
BOOL GrowConsoleTable (VOID)
PCONSOLE_TABLE SearchConsole (HANDLE hConsole)
BOOL RemoveConsole (HWND hwnd, HANDLE hConsole)
BOOL RemoveConsoleWorker (HWND hwnd, PCONSOLE_TABLE ConTbl)
BOOL InsertNewConsole (HWND hWnd, HANDLE hConsole, HWND hWndConsole)
BOOL ConsoleSetFocus (HWND hWnd, HANDLE hConsole, HKL hKL)
BOOL ConsoleKillFocus (HWND hWnd, HANDLE hConsole)
BOOL ConsoleScreenBufferSize (HWND hWnd, HANDLE hConsole, COORD ScreenBufferSize)
BOOL ConImeInputLangchangeRequest (HWND hWnd, HANDLE hConsole, HKL hkl, int Direction)
BOOL ConImeInputLangchange (HWND hWnd, HANDLE hConsole, HKL hkl)
BOOL InputLangchange (HWND hWnd, DWORD CharSet, HKL hkl)
LRESULT ConsoleImeSendMessage (HWND hWndConsoleIME, WPARAM wParam, LPARAM lParam)

Variables

HANDLE LastConsole
HIMC ghDefaultIMC
PCONSOLE_TABLEConsoleTable
ULONG NumberOfConsoleTable
CRITICAL_SECTION ConsoleTableLock
BOOL gfDoNotKillFocus
DWORD dwConsoleThreadId


Define Documentation

#define InputExceptionFilter pexi   )     EXCEPTION_EXECUTE_HANDLER
 

Definition at line 56 of file ntcon/conime/conime.c.

Referenced by ConsoleInputThread(), WinMain(), and WndProc().

 
#define LockConsoleTable  )     RtlEnterCriticalSection(&ConsoleTableLock)
 

Definition at line 33 of file ntcon/conime/conime.c.

Referenced by ExitList(), InsertNewConsole(), RemoveConsole(), SearchConsole(), and WndProc().

 
#define UnlockConsoleTable  )     RtlLeaveCriticalSection(&ConsoleTableLock)
 

Definition at line 34 of file ntcon/conime/conime.c.

Referenced by ExitList(), InsertNewConsole(), RemoveConsole(), SearchConsole(), and WndProc().


Function Documentation

BOOL ConImeInputLangchange HWND  hWnd,
HANDLE  hConsole,
HKL  hkl
 

Definition at line 1094 of file ntcon/conime/conime.c.

References ActivateKeyboardLayout, ASSERT, CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _HKL_TABLE::dwConversion, _CONSOLE_TABLE::dwConversion, FALSE, _CONSOLE_TABLE::fOpen, GetIMEName(), _HKL_TABLE::hkl, HKL_TABLE, HKL_TABLE_INCREMENT, _CONSOLE_TABLE::hklActive, _CONSOLE_TABLE::hklListMax, hWnd, _CONSOLE_TABLE::hWndCon, IME_CMODE_OPEN, ImeUIMakeInfoString(), ImeUIOpenStatusWindow(), _CONSOLE_TABLE::ImmGetProperty, ImmGetProperty(), INT, IS_IME_KBDLAYOUT, LastConsole, LPCONIME_UIMODEINFO, _CONSOLE_TABLE::lphklList, _CONIME_UIMODEINFO::ModeStringLen, NULL, _CONIME_UIMODEINFO::Position, SearchConsole(), SetNLSMode(), TRUE, and VIEW_RIGHT.

Referenced by WndProc().

01099 { 01100 PCONSOLE_TABLE ConTbl; 01101 LPCONIME_UIMODEINFO lpModeInfo; 01102 COPYDATASTRUCT CopyData; 01103 INT counter ; 01104 LPHKL_TABLE lphklListNew ; 01105 01106 ConTbl = SearchConsole(hConsole); 01107 if (ConTbl == NULL) { 01108 // cannot find specified console. 01109 // It might be last console lost focus. 01110 // try Last Console. 01111 ConTbl = SearchConsole(LastConsole); 01112 if (ConTbl == NULL) { 01113 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 01114 return FALSE; 01115 } 01116 } 01117 01118 if (ConTbl->lphklList == NULL) { 01119 return FALSE; 01120 } 01121 01122 if (IS_IME_KBDLAYOUT(ConTbl->hklActive)) { 01123 for (counter = 0 ; counter < ConTbl->hklListMax ;counter ++) 01124 { 01125 if (ConTbl->lphklList[counter].hkl == 0 || ConTbl->lphklList[counter].hkl == ConTbl->hklActive) { 01126 break; 01127 } 01128 } 01129 01130 if (counter >= ConTbl->hklListMax) 01131 { 01132 ASSERT(counter == ConTbl->hklListMax); 01133 // reallocation 01134 lphklListNew = LocalAlloc(LPTR, sizeof(HKL_TABLE) * (ConTbl->hklListMax + HKL_TABLE_INCREMENT) ) ; 01135 if (lphklListNew != NULL) 01136 { 01137 CopyMemory(lphklListNew , ConTbl->lphklList , sizeof(HKL_TABLE) * ConTbl->hklListMax) ; 01138 ConTbl->hklListMax += HKL_TABLE_INCREMENT ; 01139 LocalFree(ConTbl->lphklList); 01140 ConTbl->lphklList = lphklListNew; 01141 } 01142 else { 01143 return FALSE ; 01144 } 01145 } 01146 ASSERT(ConTbl->lphklList != NULL); 01147 ConTbl->lphklList[counter].hkl = ConTbl->hklActive; 01148 ConTbl->lphklList[counter].dwConversion = ConTbl->dwConversion | (ConTbl->fOpen ? IME_CMODE_OPEN : 0) ; 01149 } 01150 01151 ActivateKeyboardLayout(hkl, 0); 01152 ConTbl->hklActive = hkl; 01153 GetIMEName( ConTbl ); 01154 ImeUIOpenStatusWindow(hWnd); 01155 ConTbl->ImmGetProperty = ImmGetProperty(ConTbl->hklActive , IGP_PROPERTY); 01156 01157 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc( LPTR, sizeof(CONIME_UIMODEINFO) ) ; 01158 if ( lpModeInfo == NULL) { 01159 return FALSE; 01160 } 01161 CopyData.dwData = CI_CONIMEMODEINFO ; 01162 CopyData.cbData = sizeof(CONIME_UIMODEINFO) ; 01163 CopyData.lpData = lpModeInfo ; 01164 01165 if (IS_IME_KBDLAYOUT(hkl)) { 01166 01167 for (counter=0; counter < ConTbl->hklListMax ; counter++) 01168 { 01169 if (ConTbl->lphklList[counter].hkl == hkl) 01170 { 01171 SetNLSMode(hWnd, hConsole,ConTbl->lphklList[counter].dwConversion ) ; 01172 ImeUIOpenStatusWindow(hWnd) ; 01173 if (ImeUIMakeInfoString(ConTbl, 01174 lpModeInfo)) 01175 { 01176 ConsoleImeSendMessage( ConTbl->hWndCon, 01177 (WPARAM)hWnd, 01178 (LPARAM)&CopyData 01179 ) ; 01180 } 01181 } 01182 } 01183 } 01184 else 01185 { 01186 01187 SetNLSMode(hWnd, hConsole,ConTbl->dwConversion & ~IME_CMODE_OPEN ) ; 01188 lpModeInfo->ModeStringLen = 0 ; 01189 lpModeInfo->Position = VIEW_RIGHT ; 01190 ConsoleImeSendMessage( ConTbl->hWndCon, 01191 (WPARAM)hWnd, 01192 (LPARAM)&CopyData 01193 ) ; 01194 } 01195 01196 LocalFree( lpModeInfo ); 01197 01198 return TRUE; 01199 }

BOOL ConImeInputLangchangeRequest HWND  hWnd,
HANDLE  hConsole,
HKL  hkl,
int  Direction
 

Definition at line 1000 of file ntcon/conime/conime.c.

References CM_CONIME_KL_ACTIVATE, CONIME_DIRECT, _CONSOLE_TABLE::ConsoleOutputCP, DBGPRINT, DWORD, FALSE, HKL_TO_LANGID, _CONSOLE_TABLE::hklActive, _CONSOLE_TABLE::hWndCon, IS_IME_KBDLAYOUT, JAPAN_CODEPAGE, KOREA_CODEPAGE, LANG_ID_JAPAN, LANG_ID_KOREA, LANG_ID_PRC, LANG_ID_TAIWAN, NULL, PostMessage(), PRC_CODEPAGE, SearchConsole(), TAIWAN_CODEPAGE, and TRUE.

Referenced by WndProc().

01006 { 01007 PCONSOLE_TABLE ConTbl; 01008 int nLayouts; 01009 LPHKL lphkl; 01010 DWORD RequiredLID = 0; 01011 int StartPos; 01012 int CurrentHklPos; 01013 int i; 01014 01015 ConTbl = SearchConsole(hConsole); 01016 if (ConTbl == NULL) { 01017 DBGPRINT(("CONIME: cannot find registered Console\n")); 01018 return FALSE; 01019 } 01020 01021 switch (ConTbl->ConsoleOutputCP) { 01022 case JAPAN_CODEPAGE: 01023 RequiredLID = LANG_ID_JAPAN; 01024 break; 01025 case PRC_CODEPAGE: 01026 RequiredLID = LANG_ID_PRC; 01027 break; 01028 case KOREA_CODEPAGE: 01029 RequiredLID = LANG_ID_KOREA; 01030 break; 01031 case TAIWAN_CODEPAGE: 01032 RequiredLID = LANG_ID_TAIWAN; 01033 break; 01034 default: 01035 break; 01036 } 01037 01038 if ( !IS_IME_KBDLAYOUT(hkl) || 01039 ( HKL_TO_LANGID(hkl) == RequiredLID)) { 01040 return TRUE; 01041 } 01042 if (Direction == CONIME_DIRECT) { 01043 return FALSE; 01044 } 01045 01046 nLayouts = GetKeyboardLayoutList(0, NULL); 01047 if (nLayouts == 0) { 01048 return FALSE; 01049 } 01050 lphkl = LocalAlloc(LPTR, nLayouts * sizeof(HKL)); 01051 if (lphkl == NULL) { 01052 return FALSE; 01053 } 01054 GetKeyboardLayoutList(nLayouts, lphkl); 01055 01056 for (CurrentHklPos = 0; CurrentHklPos < nLayouts; CurrentHklPos++) { 01057 if (ConTbl->hklActive == lphkl[CurrentHklPos] ) { 01058 break; 01059 } 01060 } 01061 if (CurrentHklPos >= nLayouts) { 01062 LocalFree(lphkl); 01063 return FALSE; 01064 } 01065 01066 StartPos = CurrentHklPos; 01067 01068 for (i = 0; i < nLayouts; i++) { 01069 StartPos+=Direction; 01070 if (StartPos < 0) { 01071 StartPos = nLayouts-1; 01072 } 01073 else if (StartPos >= nLayouts) { 01074 StartPos = 0; 01075 } 01076 01077 if ((( HandleToUlong(lphkl[StartPos]) & 0xf0000000) == 0x00000000) || 01078 (( HandleToUlong(lphkl[StartPos]) & 0x0000ffff) == RequiredLID)) { 01079 PostMessage( ConTbl->hWndCon, 01080 CM_CONIME_KL_ACTIVATE, 01081 HandleToUlong(lphkl[StartPos]), 01082 0); 01083 LocalFree(lphkl); 01084 return FALSE; 01085 } 01086 } 01087 01088 LocalFree(lphkl); 01089 return FALSE; 01090 01091 }

LRESULT ConsoleImeSendMessage HWND  hWndConsoleIME,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1227 of file ntcon/conime/conime.c.

References CONIME_SENDMSG_TIMEOUT, FALSE, NULL, SendMessageTimeout(), and TRUE.

Referenced by CloseCandidateJapan(), CloseCandidateKorea(), CloseCandidatePRC(), CloseCandidateTaiwan(), ConImeInputLangchange(), GetCompStrJapan(), GetCompStrKorea(), GetCompStrPRC(), GetCompStrTaiwan(), ImeSysPropertyWindow(), ImeUIGuideLine(), ImeUIOpenStatusWindow(), ImeUISetConversionMode(), ImeUISetOpenStatus(), OpenCandidateJapan(), OpenCandidateKorea(), OpenCandidatePRC(), OpenCandidateTaiwan(), ReDisplayCompStrJapan(), ReDisplayCompStrKorea(), ReDisplayCompStrPRC(), and ReDisplayCompStrTaiwan().

01232 { 01233 LRESULT lResult; 01234 LRESULT fNoTimeout; 01235 01236 if (hWndConsoleIME == NULL) 01237 { 01238 return FALSE; 01239 } 01240 01241 fNoTimeout = SendMessageTimeout(hWndConsoleIME, 01242 WM_COPYDATA, 01243 wParam, 01244 lParam, 01245 SMTO_ABORTIFHUNG | SMTO_NORMAL, 01246 CONIME_SENDMSG_TIMEOUT, 01247 &lResult); 01248 01249 if (fNoTimeout) 01250 { 01251 return TRUE; 01252 } 01253 01254 01255 /* 01256 * ConsoleImeMessagePump give up SendMessage to conime. 01257 * CONIME is hung up. 01258 * probably, consrv also hung up. 01259 */ 01260 KdPrint(("ConsoleImeSendMessage: CONIME_SENDMSG_COUNT is hung up\n")); 01261 01262 return FALSE; 01263 01264 }

BOOL ConsoleKillFocus HWND  hWnd,
HANDLE  hConsole
 

Definition at line 950 of file ntcon/conime/conime.c.

References DBGPRINT, FALSE, gfDoNotKillFocus, ghDefaultIMC, hWnd, ImmAssociateContext(), ImmSetActiveContextConsoleIME(), NULL, SearchConsole(), and TRUE.

Referenced by WndProc().

00954 { 00955 PCONSOLE_TABLE ConTbl; 00956 00957 ConTbl = SearchConsole(hConsole); 00958 if (ConTbl == NULL) { 00959 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00960 return FALSE; 00961 } 00962 00963 if ( gfDoNotKillFocus ){ 00964 gfDoNotKillFocus = FALSE; 00965 } 00966 else{ 00967 //v-hirshi Jun.13.1996 #if defined(LATER_DBCS) // kazum 00968 ImmSetActiveContextConsoleIME(hWnd, FALSE); 00969 //v-hirshi Jun.13.1996 #endif 00970 ImmAssociateContext(hWnd, ghDefaultIMC); 00971 } 00972 00973 #ifdef DEBUG_MODE 00974 DisplayInformation(hWnd, hConsole); 00975 #endif 00976 00977 return TRUE; 00978 }

BOOL ConsoleScreenBufferSize HWND  hWnd,
HANDLE  hConsole,
COORD  ScreenBufferSize
 

Definition at line 981 of file ntcon/conime/conime.c.

References DBGPRINT, FALSE, NULL, _CONSOLE_TABLE::ScreenBufferSize, SearchConsole(), and TRUE.

Referenced by WndProc().

00986 { 00987 PCONSOLE_TABLE ConTbl; 00988 00989 ConTbl = SearchConsole(hConsole); 00990 if (ConTbl == NULL) { 00991 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00992 return FALSE; 00993 } 00994 00995 ConTbl->ScreenBufferSize = ScreenBufferSize; 00996 return TRUE; 00997 }

BOOL ConsoleSetFocus HWND  hWnd,
HANDLE  hConsole,
HKL  hKL
 

Definition at line 903 of file ntcon/conime/conime.c.

References ActivateKeyboardLayout, DBGPRINT, FALSE, GetIMEName(), gfDoNotKillFocus, _CONSOLE_TABLE::hIMC_Current, _CONSOLE_TABLE::hklActive, hWnd, ImeUISetOpenStatus(), ImmAssociateContext(), _CONSOLE_TABLE::ImmGetProperty, ImmGetProperty(), ImmSetActiveContextConsoleIME(), LastConsole, _CONSOLE_TABLE::lpCompStrMem, NULL, ReDisplayCompositionStr(), SearchConsole(), and TRUE.

Referenced by WndProc().

00908 { 00909 PCONSOLE_TABLE ConTbl; 00910 HKL OldhKL; 00911 00912 ConTbl = SearchConsole(hConsole); 00913 if (ConTbl == NULL) { 00914 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00915 return FALSE; 00916 } 00917 00918 if ( gfDoNotKillFocus ){ 00919 gfDoNotKillFocus = FALSE; 00920 } 00921 00922 OldhKL = ConTbl->hklActive ; 00923 ConTbl->hklActive = hKL; 00924 ActivateKeyboardLayout(ConTbl->hklActive, 0); 00925 ImmAssociateContext(hWnd, ConTbl->hIMC_Current); 00926 00927 if (OldhKL == 0) { 00928 GetIMEName( ConTbl ); 00929 ConTbl->ImmGetProperty = ImmGetProperty(ConTbl->hklActive , IGP_PROPERTY); 00930 } 00931 00932 //v-hirshi Jun.13.1996 #if defined(LATER_DBCS) // kazum 00933 ImmSetActiveContextConsoleIME(hWnd, TRUE); 00934 //v-hirshi Jun.13.1996 #endif 00935 00936 LastConsole = hConsole; 00937 00938 #ifdef DEBUG_MODE 00939 DisplayInformation(hWnd, hConsole); 00940 #endif 00941 00942 ImeUISetOpenStatus( hWnd ); 00943 if (ConTbl->lpCompStrMem != NULL) 00944 ReDisplayCompositionStr( hWnd ); 00945 00946 return TRUE; 00947 }

VOID ExitList HWND  hWnd  ) 
 

Definition at line 611 of file ntcon/conime/conime.c.

References _CONSOLE_TABLE::CandListMemAllocSize, _CONSOLE_TABLE::CandSep, _CONSOLE_TABLE::CandSepAllocSize, ConsoleTable, DBGPRINT, dwConsoleThreadId, _CONSOLE_TABLE::Enable, FALSE, ghDefaultIMC, _CONSOLE_TABLE::hConsole, _CONSOLE_TABLE::hIMC_Original, hWnd, ImmAssociateContext(), ImmDestroyContext(), _CONSOLE_TABLE::LateRemove, LockConsoleTable, _CONSOLE_TABLE::lpCandListMem, _CONSOLE_TABLE::lpCompStrMem, MAX_LISTCAND, NULL, NumberOfConsoleTable, TRUE, and UnlockConsoleTable.

Referenced by WndProc().

00614 { 00615 ULONG i ,j; 00616 PCONSOLE_TABLE FocusedConsole; 00617 00618 DBGPRINT(("CONIME:ExitList Processing\n")); 00619 ImmAssociateContext(hWnd,ghDefaultIMC); 00620 00621 LockConsoleTable(); 00622 00623 for (i = 1; i < NumberOfConsoleTable; i++) { 00624 FocusedConsole = ConsoleTable[i]; 00625 if (FocusedConsole != NULL) 00626 { 00627 if (FocusedConsole->hConsole != NULL) { 00628 if (FocusedConsole->Enable) { 00629 ImmDestroyContext(FocusedConsole->hIMC_Original); 00630 if ( FocusedConsole->lpCompStrMem != NULL) { 00631 LocalFree( FocusedConsole->lpCompStrMem ); 00632 FocusedConsole->lpCompStrMem = NULL; 00633 } 00634 for (j = 0; j < MAX_LISTCAND; j++){ 00635 if (FocusedConsole->lpCandListMem[j] != NULL) { 00636 LocalFree(FocusedConsole->lpCandListMem[j]); 00637 FocusedConsole->lpCandListMem[j] = NULL; 00638 FocusedConsole->CandListMemAllocSize[j] = 0; 00639 } 00640 } 00641 if (FocusedConsole->CandSep != NULL) { 00642 LocalFree(FocusedConsole->CandSep); 00643 FocusedConsole->CandSepAllocSize = 0; 00644 } 00645 FocusedConsole->Enable = FALSE; 00646 } 00647 else 00648 FocusedConsole->LateRemove = TRUE; 00649 } 00650 } 00651 } 00652 LocalFree( ConsoleTable ); 00653 UnlockConsoleTable(); 00654 00655 if (dwConsoleThreadId) 00656 { 00657 AttachThreadInput(GetCurrentThreadId(), dwConsoleThreadId, FALSE); 00658 UnregisterConsoleIME(); 00659 dwConsoleThreadId = 0; 00660 } 00661 }

BOOL GrowConsoleTable VOID   ) 
 

Definition at line 742 of file ntcon/conime/conime.c.

References CONSOLE_CONSOLE_TABLE_INCREMENT, ConsoleTable, FALSE, NULL, NumberOfConsoleTable, PCONSOLE_TABLE, and TRUE.

Referenced by InsertConsole().

00745 { 00746 PCONSOLE_TABLE *NewTable; 00747 PCONSOLE_TABLE *OldTable; 00748 ULONG MaxConsoleTable; 00749 00750 MaxConsoleTable = NumberOfConsoleTable + CONSOLE_CONSOLE_TABLE_INCREMENT; 00751 NewTable = (PCONSOLE_TABLE *)LocalAlloc(LPTR, MaxConsoleTable * sizeof(PCONSOLE_TABLE)); 00752 if (NewTable == NULL) { 00753 return FALSE; 00754 } 00755 CopyMemory(NewTable, ConsoleTable, NumberOfConsoleTable * sizeof(PCONSOLE_TABLE)); 00756 00757 OldTable = ConsoleTable; 00758 ConsoleTable = NewTable; 00759 NumberOfConsoleTable = MaxConsoleTable; 00760 00761 LocalFree(OldTable); 00762 00763 return TRUE; 00764 }

BOOL InitConsoleIME HINSTANCE  hInstance  ) 
 

Definition at line 109 of file ntcon/conime/conime.c.

References CONSOLE_INITIAL_TABLE, CONSOLEIME_EVENT, ConsoleTable, ConsoleTableLock, CVMAX, DBGPRINT, DestroyWindow, dwConsoleThreadId, ErrorExit(), FALSE, GetSystemMetrics(), hWnd, ID_CONSOLEIME_ICON, IDS_APPNAME, IDS_CLASSNAME, IDS_MENUNAME, IDS_TITLE, L, LPVOID, NULL, NumberOfConsoleTable, PCONSOLE_TABLE, RegisterClass, RtlInitializeCriticalSection(), SetWindowText(), ShowWindow, szTitle, TRUE, UNICODE_SPACE, UnregisterClass(), UpdateWindow(), and WndProc().

Referenced by WinMain().

00112 { 00113 HANDLE hEvent; 00114 ATOM atom; 00115 HWND hWnd; 00116 WNDCLASS ConsoleIMEClass; 00117 int cxExecStart; 00118 int cyExecStart; 00119 WCHAR szMenuName[16]; // The name of Menu 00120 WCHAR szClassName[16]; // The class name of this application 00121 WCHAR szTitle[16]; // The title bar text 00122 00123 #ifdef DEBUG_MODE 00124 WCHAR szAppName[16]; // The name of this application 00125 00126 LoadString(hInstance, IDS_TITLE, szTitle, sizeof(szTitle)); 00127 #else 00128 szTitle[0] = L'\0'; 00129 #endif 00130 00131 DBGPRINT(("CONIME: Enter InitConsoleIMEl!\n")); 00132 00133 RtlInitializeCriticalSection(&ConsoleTableLock); 00134 00135 ConsoleTable = (PCONSOLE_TABLE *)LocalAlloc(LPTR, CONSOLE_INITIAL_TABLE * sizeof(PCONSOLE_TABLE)); 00136 if (ConsoleTable == NULL) { 00137 return FALSE; 00138 } 00139 RtlZeroMemory(ConsoleTable, CONSOLE_INITIAL_TABLE * sizeof(PCONSOLE_TABLE)); 00140 NumberOfConsoleTable = CONSOLE_INITIAL_TABLE; 00141 00142 // Load the application name and description strings. 00143 LoadString(hInstance, IDS_MENUNAME, szMenuName, sizeof(szMenuName)); 00144 LoadString(hInstance, IDS_CLASSNAME, szClassName, sizeof(szClassName)); 00145 00146 hEvent = OpenEvent(EVENT_MODIFY_STATE, // Access flag 00147 FALSE, // Inherit 00148 CONSOLEIME_EVENT); // Event object name 00149 if (hEvent == NULL) 00150 { 00151 DBGPRINT(("CONIME: OpenEvent failure! %d\n",GetLastError())); 00152 goto ErrorExit; 00153 } 00154 00155 // Fill in window class structure with parameters that describe the 00156 // main window. 00157 00158 ConsoleIMEClass.style = 0; // Class style(s). 00159 ConsoleIMEClass.lpfnWndProc = WndProc; // Window Procedure 00160 ConsoleIMEClass.cbClsExtra = 0; // No per-class extra data. 00161 ConsoleIMEClass.cbWndExtra = 0; // No per-window extra data. 00162 ConsoleIMEClass.hInstance = hInstance; // Owner of this class 00163 ConsoleIMEClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_CONSOLEIME_ICON)); 00164 ConsoleIMEClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Cursor 00165 ConsoleIMEClass.hbrBackground = GetStockObject(WHITE_BRUSH); // Default color 00166 ConsoleIMEClass.lpszMenuName = szMenuName; // Menu name from .RC 00167 ConsoleIMEClass.lpszClassName = szClassName; // Class Name 00168 00169 // Register the window class and return FALSE if unsuccesful. 00170 00171 atom = RegisterClass(&ConsoleIMEClass); 00172 if (atom == 0) 00173 { 00174 DBGPRINT(("CONIME: RegisterClass failure! %d\n",GetLastError())); 00175 goto ErrorExit; 00176 } 00177 else { 00178 DBGPRINT(("CONIME: RegisterClass Successful!\n")); 00179 } 00180 00181 // Guess size for now. 00182 cxExecStart = GetSystemMetrics(SM_CXSCREEN); 00183 cyExecStart = GetSystemMetrics(SM_CYMENU); 00184 00185 // Create a main window for this application instance. 00186 hWnd = CreateWindow(szClassName, // See RegisterClass() call. 00187 szTitle, // Text for window title bar. 00188 WS_OVERLAPPEDWINDOW, 00189 cxExecStart - (cxExecStart / 3) , 00190 cyExecStart , 00191 cxExecStart / 3 , 00192 cyExecStart * 10 , 00193 NULL, // Overlapped has no parent. 00194 NULL, // Use the window class menu. 00195 hInstance, 00196 (LPVOID)NULL); 00197 00198 // If window could not be created, return "failure" 00199 if (hWnd == NULL) { 00200 DBGPRINT(("CONIME: CreateWindow failured! %d\n",GetLastError())); 00201 goto ErrorExit; 00202 } 00203 else{ 00204 DBGPRINT(("CONIME: CreateWindow Successful!\n")); 00205 } 00206 00207 if (! RegisterConsoleIME(hWnd, &dwConsoleThreadId)) 00208 { 00209 DBGPRINT(("CONIME: RegisterConsoleIME failured! %d\n",GetLastError())); 00210 goto ErrorExit; 00211 } 00212 00213 if (! AttachThreadInput(GetCurrentThreadId(), dwConsoleThreadId, TRUE)) 00214 { 00215 DBGPRINT(("CONIME: AttachThreadInput failured! %d\n",GetLastError())); 00216 goto ErrorExit; 00217 } 00218 00219 /* 00220 * dwConsoleThreadId is locked until event sets of hEvent 00221 */ 00222 SetEvent(hEvent); 00223 CloseHandle(hEvent); 00224 00225 #ifdef DEBUG_MODE 00226 LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName)); 00227 00228 // Make the window visible; update its client area; and return "success" 00229 ShowWindow(hWnd, SW_MINIMIZE); // Show the window 00230 SetWindowText(hWnd, szAppName); 00231 UpdateWindow(hWnd); // Sends WM_PAINT message 00232 00233 { 00234 int i; 00235 00236 for (i = 0; i < CVMAX; i++) { 00237 ConvertLine[i] = UNICODE_SPACE; 00238 ConvertLineAtr[i] = 0; 00239 } 00240 xPos = 0; 00241 xPosLast = 0; 00242 } 00243 00244 #endif 00245 00246 return TRUE; // We succeeded... 00247 00248 ErrorExit: 00249 if (dwConsoleThreadId) 00250 UnregisterConsoleIME(); 00251 if (hWnd) 00252 DestroyWindow(hWnd); 00253 if (atom) 00254 UnregisterClass(szClassName,hInstance); 00255 if (hEvent) 00256 { 00257 SetEvent(hEvent); 00258 CloseHandle(hEvent); 00259 } 00260 return FALSE; 00261 }

BOOL InputLangchange HWND  hWnd,
DWORD  CharSet,
HKL  hkl
 

Definition at line 1202 of file ntcon/conime/conime.c.

References ActivateKeyboardLayout, DBGPRINT, FALSE, GetIMEName(), _CONSOLE_TABLE::hklActive, hWnd, ImeUIOpenStatusWindow(), LastConsole, NULL, SearchConsole(), and TRUE.

Referenced by WndProc().

01207 { 01208 PCONSOLE_TABLE ConTbl; 01209 01210 ConTbl = SearchConsole(LastConsole); 01211 if (ConTbl == NULL) { 01212 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 01213 return FALSE; 01214 } 01215 01216 ConTbl->hklActive = hkl; 01217 ActivateKeyboardLayout(ConTbl->hklActive, 0); 01218 GetIMEName( ConTbl ); 01219 ImeUIOpenStatusWindow(hWnd); 01220 return TRUE; 01221 }

BOOL InsertConsole HWND  hWnd,
HANDLE  hConsole,
HWND  hWndConsole
 

Definition at line 664 of file ntcon/conime/conime.c.

References _CONSOLE_TABLE::CompAttrColor, CONSOLE_TABLE, ConsoleTable, DBGPRINT, DEFAULT_COMP_ALREADY_CONVERTED, DEFAULT_COMP_CONVERSION, DEFAULT_COMP_ENTERED, DEFAULT_COMP_INPUT_ERROR, DEFAULT_COMP_YET_CONVERTED, DEFAULT_TEMP_WIDTH, _CONSOLE_TABLE::Enable, FALSE, GetIMEName(), GrowConsoleTable(), _CONSOLE_TABLE::hConsole, _CONSOLE_TABLE::hIMC_Current, _CONSOLE_TABLE::hIMC_Original, HKL_INITIAL_TABLE, HKL_TABLE, _CONSOLE_TABLE::hklListMax, hWnd, _CONSOLE_TABLE::hWndCon, ImmCreateContext(), _CONSOLE_TABLE::LateRemove, _CONSOLE_TABLE::lphklList, NULL, NumberOfConsoleTable, RemoveConsoleWorker(), _CONSOLE_TABLE::ScreenBufferSize, and TRUE.

Referenced by InsertNewConsole().

00669 { 00670 ULONG i; 00671 PCONSOLE_TABLE FocusedConsole; 00672 00673 i = 1; 00674 00675 do { 00676 for (; i < NumberOfConsoleTable; i++) { 00677 FocusedConsole = ConsoleTable[i]; 00678 00679 if (FocusedConsole == NULL) 00680 { 00681 FocusedConsole = LocalAlloc(LPTR, sizeof(CONSOLE_TABLE)); 00682 if (FocusedConsole == NULL) 00683 return FALSE; 00684 ConsoleTable[i] = FocusedConsole; 00685 } 00686 00687 if ((FocusedConsole->hConsole != NULL) && 00688 (FocusedConsole->LateRemove)&& 00689 (FocusedConsole->Enable)) { 00690 RemoveConsoleWorker(hWnd, FocusedConsole); 00691 } 00692 00693 if (FocusedConsole->hConsole == NULL) { 00694 RtlZeroMemory(FocusedConsole, sizeof(CONSOLE_TABLE)); 00695 FocusedConsole->lphklList = LocalAlloc(LPTR, sizeof(HKL_TABLE)*HKL_INITIAL_TABLE); 00696 if (FocusedConsole->lphklList == NULL) 00697 { 00698 return FALSE; 00699 } 00700 RtlZeroMemory(FocusedConsole->lphklList, sizeof(HKL_TABLE)*HKL_INITIAL_TABLE); 00701 FocusedConsole->hklListMax = HKL_INITIAL_TABLE ; 00702 00703 FocusedConsole->hIMC_Current = ImmCreateContext(); 00704 if (FocusedConsole->hIMC_Current == (HIMC)NULL) { 00705 LocalFree(FocusedConsole); 00706 FocusedConsole = NULL; 00707 return FALSE; 00708 } 00709 00710 FocusedConsole->hIMC_Original = FocusedConsole->hIMC_Current; 00711 FocusedConsole->hConsole = hConsole; 00712 FocusedConsole->hWndCon = hWndConsole; 00713 // FocusedConsole->hklActive = NULL; 00714 FocusedConsole->Enable = TRUE; 00715 // FocusedConsole->LateRemove = FALSE; 00716 // FocusedConsole->fNestCandidate = FALSE; 00717 // FocusedConsole->fInComposition = FALSE; 00718 // FocusedConsole->fInCandidate = FALSE; 00719 FocusedConsole->ScreenBufferSize.X = DEFAULT_TEMP_WIDTH; 00720 00721 FocusedConsole->CompAttrColor[0] = DEFAULT_COMP_ENTERED; 00722 FocusedConsole->CompAttrColor[1] = DEFAULT_COMP_ALREADY_CONVERTED; 00723 FocusedConsole->CompAttrColor[2] = DEFAULT_COMP_CONVERSION; 00724 FocusedConsole->CompAttrColor[3] = DEFAULT_COMP_YET_CONVERTED; 00725 FocusedConsole->CompAttrColor[4] = DEFAULT_COMP_INPUT_ERROR; 00726 FocusedConsole->CompAttrColor[5] = DEFAULT_COMP_INPUT_ERROR; 00727 FocusedConsole->CompAttrColor[6] = DEFAULT_COMP_INPUT_ERROR; 00728 FocusedConsole->CompAttrColor[7] = DEFAULT_COMP_INPUT_ERROR; 00729 00730 GetIMEName(FocusedConsole); 00731 00732 return TRUE; 00733 } 00734 } 00735 } while (GrowConsoleTable()); 00736 00737 DBGPRINT(("CONIME: Cannot grow Console Table\n")); 00738 return FALSE; 00739 }

BOOL InsertNewConsole HWND  hWnd,
HANDLE  hConsole,
HWND  hWndConsole
 

Definition at line 869 of file ntcon/conime/conime.c.

References FALSE, hWnd, ImeUISetOpenStatus(), InsertConsole(), LockConsoleTable, NULL, SearchConsole(), TRUE, and UnlockConsoleTable.

Referenced by WndProc().

00874 { 00875 // conime receive ime message from console before 1st console registered. 00876 // this will happen after restart conime when conime dead by bogus ime's AV or 00877 // other problem 00878 // so this fail safe code is necessary to protect consrv. 00879 if (SearchConsole(hConsole) != NULL) { 00880 return TRUE; 00881 } 00882 00883 LockConsoleTable(); 00884 00885 if (!InsertConsole(hWnd, hConsole, hWndConsole)) { 00886 UnlockConsoleTable(); 00887 return FALSE; 00888 } 00889 00890 #ifdef DEBUG_MODE 00891 DisplayInformation(hWnd, hConsole); 00892 #endif 00893 00894 ImeUISetOpenStatus( hWndConsole ); 00895 00896 UnlockConsoleTable(); 00897 00898 return TRUE; 00899 }

BOOL RemoveConsole HWND  hwnd,
HANDLE  hConsole
 

Definition at line 801 of file ntcon/conime/conime.c.

00805 { 00806 PCONSOLE_TABLE ConTbl; 00807 BOOL ret; 00808 00809 LockConsoleTable(); 00810 00811 ConTbl = SearchConsole(hConsole); 00812 if (ConTbl == NULL) 00813 { 00814 UnlockConsoleTable(); 00815 return FALSE; 00816 } 00817 ret = RemoveConsoleWorker(hwnd, ConTbl); 00818 00819 UnlockConsoleTable(); 00820 return ret; 00821 }

BOOL RemoveConsoleWorker HWND  hwnd,
PCONSOLE_TABLE  ConTbl
 

Definition at line 824 of file ntcon/conime/conime.c.

References _CONSOLE_TABLE::CandSep, _CONSOLE_TABLE::ConsoleCP, _CONSOLE_TABLE::ConsoleOutputCP, DWORD, _CONSOLE_TABLE::Enable, FALSE, _CONSOLE_TABLE::hConsole, _CONSOLE_TABLE::hIMC_Original, _CONSOLE_TABLE::hklActive, ImmDestroyContext(), _CONSOLE_TABLE::LateRemove, _CONSOLE_TABLE::lpCandListMem, _CONSOLE_TABLE::lpCompStrMem, _CONSOLE_TABLE::lphklList, MAX_LISTCAND, NULL, _CONSOLE_TABLE::ScreenBufferSize, and TRUE.

Referenced by InsertConsole(), and RemoveConsole().

00828 { 00829 DWORD j; 00830 00831 if (ConTbl->Enable) { 00832 ConTbl->hConsole = NULL; 00833 ConTbl->ScreenBufferSize.X = 0; 00834 ConTbl->ConsoleCP = 0; 00835 ConTbl->ConsoleOutputCP = 0; 00836 ConTbl->hklActive = 0; 00837 00838 ImmDestroyContext(ConTbl->hIMC_Original); 00839 00840 if (ConTbl->lpCompStrMem != NULL){ 00841 LocalFree(ConTbl->lpCompStrMem); 00842 } 00843 for (j = 0; j < MAX_LISTCAND; j++){ 00844 if (ConTbl->lpCandListMem[j] != NULL) { 00845 LocalFree(ConTbl->lpCandListMem[j]); 00846 } 00847 } 00848 if (ConTbl->CandSep != NULL) { 00849 LocalFree(ConTbl->CandSep); 00850 } 00851 00852 if (ConTbl->lphklList != NULL) { 00853 LocalFree(ConTbl->lphklList) ; 00854 } 00855 00856 ConTbl->Enable = FALSE; 00857 ConTbl->LateRemove = FALSE; 00858 } 00859 else 00860 ConTbl->LateRemove = TRUE; 00861 00862 #ifdef DEBUG_MODE 00863 InvalidateRect(hwnd,NULL,TRUE); 00864 #endif 00865 return TRUE; 00866 }

PCONSOLE_TABLE SearchConsole HANDLE  hConsole  ) 
 

Definition at line 767 of file ntcon/conime/conime.c.

References ConsoleTable, _CONSOLE_TABLE::hConsole, LastConsole, _CONSOLE_TABLE::LateRemove, LockConsoleTable, NULL, NumberOfConsoleTable, and UnlockConsoleTable.

Referenced by CharHandlerToConsole(), ConImeInputLangchange(), ConImeInputLangchangeRequest(), ConsoleCodepageChange(), ConsoleKillFocus(), ConsoleScreenBufferSize(), ConsoleSetFocus(), GetCompositionStr(), GetNLSMode(), ImeSysPropertyWindow(), ImeUICloseCandidate(), ImeUIEndComposition(), ImeUIGuideLine(), ImeUIOpenCandidate(), ImeUIOpenStatusWindow(), ImeUISetConversionMode(), ImeUISetOpenStatus(), ImeUIStartComposition(), InputLangchange(), InsertNewConsole(), ReDisplayCompositionStr(), RemoveConsole(), SetNLSMode(), and WndProc().

00770 { 00771 ULONG i; 00772 PCONSOLE_TABLE FocusedConsole; 00773 00774 LockConsoleTable(); 00775 00776 // conime receive ime message from console before 1st console registered. 00777 // this will happen after restart conime when conime dead by bogus ime's AV or 00778 // other problem 00779 // so this fail safe code is necessary to protect consrv. 00780 if (LastConsole == 0) { 00781 LastConsole = hConsole ; 00782 } 00783 00784 for (i = 1; i < NumberOfConsoleTable; i++) { 00785 FocusedConsole = ConsoleTable[i]; 00786 if (FocusedConsole != NULL) 00787 { 00788 if ((FocusedConsole->hConsole == hConsole)&& 00789 (!FocusedConsole->LateRemove)) { 00790 00791 UnlockConsoleTable(); 00792 return FocusedConsole; 00793 } 00794 } 00795 } 00796 UnlockConsoleTable(); 00797 return NULL; 00798 }

int APIENTRY WinMain HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
int  nCmdShow
 

Definition at line 62 of file ntcon/conime/conime.c.

00068 { 00069 MSG msg; 00070 WCHAR systemPath[MAX_PATH]; 00071 00072 GetSystemDirectory ( systemPath, MAX_PATH ); 00073 SetCurrentDirectory ( systemPath ); 00074 00075 if (!InitConsoleIME(hInstance) ) { 00076 DBGPRINT(("CONIME: InitConsoleIME failure!\n")); 00077 return FALSE; 00078 } 00079 else { 00080 DBGPRINT(("CONIME: InitConsoleIME successful!\n")); 00081 } 00082 00083 try { 00084 00085 while (TRUE) { 00086 if (GetMessage(&msg, NULL, 0, 0)) { 00087 TranslateMessage(&msg); 00088 DispatchMessage(&msg); 00089 } else { 00090 break; 00091 } 00092 } 00093 00094 } except (InputExceptionFilter(GetExceptionInformation())) { 00095 00096 if (dwConsoleThreadId) 00097 { 00098 DBGPRINT(("CONIME: Exception on WinMain!!\n")); 00099 UnregisterConsoleIME(); 00100 dwConsoleThreadId = 0; 00101 } 00102 00103 } 00104 00105 return (int)msg.wParam; 00106 }

LRESULT FAR PASCAL WndProc HWND  hWnd,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 288 of file ntcon/conime/conime.c.

Referenced by InitConsoleIME(), and InitializeInstance().

00292 { 00293 DWORD dwImmRet = 0; // return value of ImmSrvProcessKey() 00294 00295 try { 00296 00297 switch (Message) 00298 { 00299 case CONIME_CREATE: 00300 DBGPRINT(("CONIME: CONIME_CREATE: Console Handle=%08x\n", wParam)); 00301 return InsertNewConsole(hWnd,(HANDLE)wParam,(HWND)lParam); 00302 00303 case CONIME_DESTROY: 00304 DBGPRINT(("CONIME: CONIME_DESTROY: Console Handle=%08x\n", wParam)); 00305 return RemoveConsole(hWnd, (HANDLE)wParam); 00306 00307 case CONIME_SETFOCUS: 00308 DBGPRINT(("CONIME: CONIME_SETFOCUS: Console Handle=%08x\n", wParam)); 00309 return ConsoleSetFocus(hWnd, (HANDLE)wParam, (HKL)lParam); 00310 00311 case CONIME_KILLFOCUS: 00312 DBGPRINT(("CONIME: CONIME_KILLFOCUS: Console Handle=%08x\n", wParam)); 00313 return ConsoleKillFocus(hWnd, (HANDLE)wParam); 00314 00315 case CONIME_GET_NLSMODE: 00316 DBGPRINT(("CONIME: CONIME_GET_NLSMODE: Console Handle=%08x\n", wParam)); 00317 return GetNLSMode(hWnd, (HANDLE)wParam); 00318 00319 case CONIME_SET_NLSMODE: 00320 DBGPRINT(("CONIME: CONIME_SET_NLSMODE: Console Handle=%08x\n", wParam)); 00321 return SetNLSMode(hWnd, (HANDLE)wParam, (DWORD)lParam); 00322 00323 case CONIME_HOTKEY: 00324 DBGPRINT(("CONIME: CONIME_HOTKEY\n")); 00325 return ConimeHotkey(hWnd, (HANDLE)wParam, (DWORD)lParam); 00326 00327 case CONIME_NOTIFY_VK_KANA: 00328 DBGPRINT(("CONIME: CONIME_NOTIFY_VK_KANA\n")); 00329 return ImeUISetConversionMode(hWnd); 00330 00331 case CONIME_NOTIFY_SCREENBUFFERSIZE: { 00332 COORD ScreenBufferSize; 00333 DBGPRINT(("CONIME: CONIME_NOTIFY_SCREENBUFFERSIZE: Console Handle=%08x\n", wParam)); 00334 ScreenBufferSize.X = LOWORD(lParam); 00335 ScreenBufferSize.Y = HIWORD(lParam); 00336 return ConsoleScreenBufferSize(hWnd, (HANDLE)wParam, ScreenBufferSize); 00337 } 00338 00339 case CONIME_INPUTLANGCHANGE: { 00340 DBGPRINT(("CONIME: CONIME_INPUTLANGCHANGE: Console Handle=%08x \n",wParam)); 00341 ConImeInputLangchange(hWnd, (HANDLE)wParam, (HKL)lParam ); 00342 return TRUE; 00343 } 00344 00345 case CONIME_NOTIFY_CODEPAGE: { 00346 BOOL Output; 00347 WORD Codepage; 00348 00349 Codepage = HIWORD(lParam); 00350 Output = LOWORD(lParam); 00351 DBGPRINT(("CONIME: CONIME_NOTIFY_CODEPAGE: Console Handle=%08x %04x %04x\n",wParam, Output, Codepage)); 00352 return ConsoleCodepageChange(hWnd, (HANDLE)wParam, Output, Codepage); 00353 } 00354 00355 case WM_KEYDOWN +CONIME_KEYDATA: 00356 case WM_KEYUP +CONIME_KEYDATA: 00357 case WM_SYSKEYDOWN +CONIME_KEYDATA: 00358 case WM_SYSKEYUP +CONIME_KEYDATA: 00359 case WM_DEADCHAR +CONIME_KEYDATA: 00360 case WM_SYSDEADCHAR+CONIME_KEYDATA: 00361 case WM_SYSCHAR +CONIME_KEYDATA: 00362 case WM_CHAR +CONIME_KEYDATA: 00363 CharHandlerFromConsole( hWnd, Message, (ULONG)wParam, (ULONG)lParam ); 00364 break; 00365 case WM_KEYDOWN: 00366 case WM_KEYUP: 00367 case WM_SYSKEYDOWN: 00368 case WM_SYSKEYUP: 00369 case WM_DEADCHAR: 00370 case WM_SYSDEADCHAR: 00371 case WM_SYSCHAR: 00372 case WM_CHAR: 00373 CharHandlerToConsole( hWnd, Message, (ULONG)wParam, (ULONG)lParam ); 00374 break; 00375 00376 case WM_INPUTLANGCHANGE: 00377 DBGPRINT(("CONIME: CONIME_INPUTLANGCHANGE: Console Handle=%08x \n",wParam)); 00378 InputLangchange(hWnd, (DWORD)wParam, (HKL)lParam ); 00379 return TRUE; 00380 00381 case WM_INPUTLANGCHANGEREQUEST: 00382 // Console IME never receive this message for this window is hidden 00383 // and doesn't have focus. 00384 // 00385 // However, Hot key of IME_CHOTKEY_IME_NONIME_TOGGLE/IME_THOTKEY_IME_NONIME_TOGGLE 00386 // are send this message by ImmSimulateHotKey API. 00387 // 00388 // If nothing processing by this message, then DefWindowProc calls 00389 // ActivateKeyboardLayout on kernel side. 00390 // And, ActivateKeyboardLayout send WM_INPUTLANGCHANGE message to focus window 00391 // on this message queue. 00392 // It window is console window procedure. 00393 // Console window procedure can do send CONIME_INPUTLANGCHANGE message to 00394 // console IME window. 00395 // In console window is windowed case, this sequence as well. 00396 // But, In console window is full screen case, message queue have not focus. 00397 // WM_INPUTLANGCHANGE message can not send to console window procedure. 00398 // 00399 // This code avoid console full screen mode problem. 00400 // Send message to console window procedure when this window receive it. 00401 // 00402 { 00403 PCONSOLE_TABLE ConTbl; 00404 00405 ConTbl = SearchConsole(LastConsole); 00406 if (ConTbl == NULL) { 00407 return DefWindowProc(hWnd, Message, wParam, lParam); 00408 } 00409 00410 PostMessage(ConTbl->hWndCon, Message, wParam, lParam); 00411 } 00412 return TRUE; // TRUE : process this message by application 00413 00414 case CONIME_INPUTLANGCHANGEREQUEST: 00415 DBGPRINT(("CONIME: CONIME_INPUTLANGCHANGEREQUEST: Console Handle=%08x \n",wParam)); 00416 return ConImeInputLangchangeRequest(hWnd, (HANDLE)wParam, (HKL)lParam, CONIME_DIRECT); 00417 00418 case CONIME_INPUTLANGCHANGEREQUESTFORWARD: 00419 DBGPRINT(("CONIME: CONIME_INPUTLANGCHANGEREQUEST: Console Handle=%08x \n",wParam)); 00420 return ConImeInputLangchangeRequest(hWnd, (HANDLE)wParam, (HKL)lParam, CONIME_FORWARD); 00421 00422 case CONIME_INPUTLANGCHANGEREQUESTBACKWARD: 00423 DBGPRINT(("CONIME: CONIME_INPUTLANGCHANGEREQUEST: Console Handle=%08x \n",wParam)); 00424 return ConImeInputLangchangeRequest(hWnd, (HANDLE)wParam, (HKL)lParam, CONIME_BACKWARD); 00425 00426 #ifdef DEBUG_MODE 00427 case WM_MOVE: 00428 ImeUIMoveCandWin( hWnd ); 00429 break; 00430 00431 case WM_COMMAND: // message: command from application menu 00432 00433 // Message packing of wparam and lparam have changed for Win32, 00434 // so use the GET_WM_COMMAND macro to unpack the commnad 00435 00436 switch (LOWORD(wParam)) { 00437 case MM_EXIT: 00438 PostMessage(hWnd,WM_CLOSE,0,0L); 00439 break; 00440 00441 case MM_ACCESS_VIOLATION: 00442 { 00443 PBYTE p = 0; 00444 *p = 0; 00445 } 00446 break; 00447 } 00448 break; 00449 #endif 00450 00451 case WM_IME_STARTCOMPOSITION: 00452 ImeUIStartComposition( hWnd ); 00453 break; 00454 case WM_IME_ENDCOMPOSITION: 00455 ImeUIEndComposition( hWnd ); 00456 break; 00457 case WM_IME_COMPOSITION: 00458 ImeUIComposition( hWnd, wParam, lParam ); 00459 break; 00460 case WM_IME_COMPOSITIONFULL: 00461 break; 00462 case WM_IME_NOTIFY: 00463 if ( !ImeUINotify( hWnd, wParam, lParam ) ) { 00464 return DefWindowProc(hWnd, Message, wParam, lParam); 00465 } 00466 break; 00467 case WM_IME_SETCONTEXT: 00468 // 00469 // The application have to pass WM_IME_SETCONTEXT to DefWindowProc. 00470 // When the application want to handle the IME at the timing of 00471 // focus changing, the application should use WM_GETFOCUS or 00472 // WM_KILLFOCUS. 00473 // 00474 lParam &= ~ISC_SHOWUIALL; 00475 00476 return DefWindowProc( hWnd, Message, wParam, lParam ); 00477 case WM_IME_SYSTEM: 00478 switch (wParam) { 00479 case IMS_CLOSEPROPERTYWINDOW: 00480 case IMS_OPENPROPERTYWINDOW: 00481 ImeSysPropertyWindow(hWnd, wParam, lParam); 00482 break; 00483 default: 00484 return DefWindowProc( hWnd, Message, wParam, lParam ); 00485 } 00486 break; 00487 00488 case WM_CREATE: 00489 return Create(hWnd); 00490 break; 00491 00492 case WM_DESTROY: 00493 DBGPRINT(("CONIME:Recieve WM_DESTROY\n")); 00494 ExitList(hWnd); 00495 PostQuitMessage(0); 00496 return 0; 00497 break; 00498 00499 case WM_CLOSE: 00500 DBGPRINT(("CONIME:Recieve WM_CLOSE\n")); 00501 DestroyWindow(hWnd); 00502 return 0; 00503 break; 00504 00505 case WM_ENABLE:{ 00506 PCONSOLE_TABLE FocusedConsole; 00507 if (!wParam) { 00508 FocusedConsole = SearchConsole(LastConsole); 00509 if (FocusedConsole != NULL && 00510 FocusedConsole->hConsole != NULL) { 00511 FocusedConsole->Enable = FALSE; 00512 EnableWindow(FocusedConsole->hWndCon,FALSE); 00513 gfDoNotKillFocus = TRUE; 00514 } 00515 } 00516 else{ 00517 DWORD i; 00518 LockConsoleTable(); 00519 for ( i = 1; i < NumberOfConsoleTable; i ++){ 00520 FocusedConsole = ConsoleTable[i]; 00521 if (FocusedConsole != NULL) 00522 { 00523 if ((FocusedConsole->hConsole != NULL)&& 00524 (!FocusedConsole->Enable)&& 00525 (!IsWindowEnabled(FocusedConsole->hWndCon))){ 00526 EnableWindow(FocusedConsole->hWndCon,TRUE); 00527 FocusedConsole->Enable = TRUE; 00528 if (!FocusedConsole->LateRemove) 00529 SetForegroundWindow(FocusedConsole->hWndCon); 00530 } 00531 } 00532 } 00533 UnlockConsoleTable(); 00534 } 00535 return DefWindowProc(hWnd, Message, wParam, lParam); 00536 break; 00537 } 00538 00539 #ifdef DEBUG_MODE 00540 case WM_SETFOCUS: 00541 CreateCaret( hWnd, 00542 NULL, 00543 IsUnicodeFullWidth( ConvertLine[xPos] ) ? 00544 CaretWidth*2 : CaretWidth, 00545 (UINT)cyMetrics ); 00546 SetCaretPos( xPos * cxMetrics, 0 ); 00547 ShowCaret( hWnd ); 00548 break; 00549 00550 case WM_KILLFOCUS: 00551 HideCaret( hWnd ); 00552 DestroyCaret(); 00553 break; 00554 00555 case WM_PAINT: 00556 { 00557 PAINTSTRUCT pstruc; 00558 HDC hDC; 00559 hDC = BeginPaint(hWnd,&pstruc); 00560 ReDraw(hWnd); 00561 EndPaint(hWnd,&pstruc); 00562 break; 00563 } 00564 #endif 00565 00566 case WM_QUERYENDSESSION: 00567 #ifdef HIRSHI_DEBUG 00568 /* 00569 * If specified ntsd debugger on this process, 00570 * then never catch WM_QUERYENDSESSION when logoff/shutdown because 00571 * this process will terminate when ntsd process terminated. 00572 */ 00573 { 00574 int i; 00575 i = MessageBox(hWnd,TEXT("Could you approve exit session?"), TEXT("Console IME"), 00576 MB_ICONSTOP | MB_YESNO); 00577 return (i == IDYES ? TRUE : FALSE); 00578 } 00579 #endif 00580 return TRUE; // Logoff or shutdown time. 00581 00582 case WM_ENDSESSION: 00583 DBGPRINT(("CONIME:Recieve WM_ENDSESSION\n")); 00584 ExitList(hWnd); 00585 return 0; 00586 00587 default: // Passes it on if unproccessed 00588 return DefWindowProc(hWnd, Message, wParam, lParam); 00589 } 00590 00591 } except (InputExceptionFilter(GetExceptionInformation())) { 00592 00593 if (dwConsoleThreadId) 00594 { 00595 DBGPRINT(("CONIME: Exception on WndProc!!\n")); 00596 UnregisterConsoleIME(); 00597 dwConsoleThreadId = 0; 00598 00599 DestroyWindow(hWnd); 00600 return 0; 00601 } 00602 00603 } 00604 00605 00606 return TRUE; 00607 }


Variable Documentation

PCONSOLE_TABLE* ConsoleTable
 

Definition at line 29 of file ntcon/conime/conime.c.

Referenced by ExitList(), GrowConsoleTable(), InitConsoleIME(), InsertConsole(), SearchConsole(), and WndProc().

CRITICAL_SECTION ConsoleTableLock
 

Definition at line 32 of file ntcon/conime/conime.c.

Referenced by InitConsoleIME().

DWORD dwConsoleThreadId
 

Definition at line 40 of file ntcon/conime/conime.c.

Referenced by AllocateConsole(), ExitList(), InitConsoleIME(), WinMain(), and WndProc().

BOOL gfDoNotKillFocus
 

Definition at line 37 of file ntcon/conime/conime.c.

Referenced by ConsoleKillFocus(), ConsoleSetFocus(), and WndProc().

HIMC ghDefaultIMC
 

Definition at line 27 of file ntcon/conime/conime.c.

Referenced by ConsoleKillFocus(), Create(), and ExitList().

HANDLE LastConsole
 

Definition at line 26 of file ntcon/conime/conime.c.

Referenced by CharHandlerToConsole(), ConImeInputLangchange(), ConsoleSetFocus(), GetCompositionStr(), ImeSysPropertyWindow(), ImeUICloseCandidate(), ImeUIEndComposition(), ImeUIGuideLine(), ImeUIOpenCandidate(), ImeUIOpenStatusWindow(), ImeUISetConversionMode(), ImeUISetOpenStatus(), ImeUIStartComposition(), InputLangchange(), ReDisplayCompositionStr(), SearchConsole(), and WndProc().

ULONG NumberOfConsoleTable
 

Definition at line 30 of file ntcon/conime/conime.c.

Referenced by ExitList(), GrowConsoleTable(), InitConsoleIME(), InsertConsole(), SearchConsole(), and WndProc().


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