Author: jimtabor Date: Sun Jan 4 19:27:40 2015 New Revision: 65977
URL: http://svn.reactos.org/svn/reactos?rev=65977&view=rev Log: [Win32s] - Implement Ime (only) class support. This is for the new synced class tests. Recommending Developers choice for testing real Imm32.dll support. Should include registry Loading of IMM via Win32k. - Based on patch by Piotr Caban : Move IME window procedure to user32.
Modified: trunk/reactos/win32ss/include/ntuser.h trunk/reactos/win32ss/user/user32/controls/regcontrol.c trunk/reactos/win32ss/user/user32/include/regcontrol.h trunk/reactos/win32ss/user/user32/include/user32p.h trunk/reactos/win32ss/user/user32/misc/dllmain.c trunk/reactos/win32ss/user/user32/misc/imm.c trunk/reactos/win32ss/user/user32/misc/stubs.c
Modified: trunk/reactos/win32ss/include/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?re... ============================================================================== --- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -1120,6 +1120,32 @@ INT fCUASLayer:1; }; } IMEINFOEX, *PIMEINFOEX; + +typedef struct tagIMEUI +{ + PWND spwnd; + HIMC hIMC; + HWND hwndIMC; + HKL hKL; + HWND hwndUI; + INT nCntInIMEProc; + struct { + UINT fShowStatus:1; + UINT fActivate:1; + UINT fDestroy:1; + UINT fDefault:1; + UINT fChildThreadDef:1; + UINT fCtrlShowStatus:1; + UINT fFreeActiveEvent:1; + }; +} IMEUI, *PIMEUI; + +// Window Extra data container. +typedef struct _IMEWND +{ + WND; + PIMEUI pimeui; +} IMEWND, *PIMEWND;
DWORD
Modified: trunk/reactos/win32ss/user/user32/controls/regcontrol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/control... ============================================================================== --- trunk/reactos/win32ss/user/user32/controls/regcontrol.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/regcontrol.c [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -99,6 +99,12 @@ FALSE); if (atom) RegisterDefaultClasses |= ICLASS_TO_MASK(g_SysClasses[i].ClsId); + } + + if ( //gpsi->dwSRVIFlags & SRVINFO_IMM32 && Not supported yet, need NlsMbCodePageTag working in Win32k. + !(RegisterDefaultClasses & ICLASS_TO_MASK(ICLS_IME))) // So, work like XP. + { + RegisterIMEClass(); }
return TRUE; @@ -170,8 +176,8 @@ pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW; pfnClientA.pfnStaticWndProc = StaticWndProcA; pfnClientW.pfnStaticWndProc = StaticWndProcW; - pfnClientA.pfnImeWndProc = DefWindowProcA; - pfnClientW.pfnImeWndProc = DefWindowProcW; + pfnClientA.pfnImeWndProc = ImeWndProcA; + pfnClientW.pfnImeWndProc = ImeWndProcW; pfnClientA.pfnGhostWndProc = DefWindowProcA; pfnClientW.pfnGhostWndProc = DefWindowProcW; pfnClientA.pfnHkINLPCWPSTRUCT = DefWindowProcA; @@ -195,7 +201,7 @@ pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common; pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common; pfnClientWorker.pfnStaticWndProc = StaticWndProc_common; - pfnClientWorker.pfnImeWndProc = User32DefWindowProc; + pfnClientWorker.pfnImeWndProc = ImeWndProc_common; pfnClientWorker.pfnGhostWndProc = User32DefWindowProc; pfnClientWorker.pfnCtfHookProc = User32DefWindowProc;
Modified: trunk/reactos/win32ss/user/user32/include/regcontrol.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/include... ============================================================================== --- trunk/reactos/win32ss/user/user32/include/regcontrol.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/include/regcontrol.h [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -41,3 +41,8 @@
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *,LPDWORD,WORD,DWORD,BOOL); BOOL FASTCALL VersionRegisterClass(PCWSTR,LPCWSTR,HANDLE,HMODULE *); + +LRESULT WINAPI ImeWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL); +LRESULT WINAPI ImeWndProcA(HWND,UINT,WPARAM,LPARAM); +LRESULT WINAPI ImeWndProcW(HWND,UINT,WPARAM,LPARAM); +BOOL WINAPI RegisterIMEClass(VOID);
Modified: trunk/reactos/win32ss/user/user32/include/user32p.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/include... ============================================================================== --- trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -17,22 +17,49 @@ #include "resource.h" #include "ntwrapper.h"
+ +typedef struct +{ + BOOL (WINAPI* pImmIsIME) (HKL); + LRESULT (WINAPI* pImmEscapeA) (HKL, HIMC, UINT, LPVOID); + LRESULT (WINAPI* pImmEscapeW) (HKL, HIMC, UINT, LPVOID); + LONG (WINAPI* pImmGetCompositionStringA) (HIMC, DWORD, LPVOID, DWORD); + LONG (WINAPI* pImmGetCompositionStringW) (HIMC, DWORD, LPVOID, DWORD); + BOOL (WINAPI* pImmGetCompositionFontA) (HIMC, LPLOGFONTA); + BOOL (WINAPI* pImmGetCompositionFontW) (HIMC, LPLOGFONTW); + BOOL (WINAPI* pImmSetCompositionFontA)(HIMC, LPLOGFONTA); + BOOL (WINAPI* pImmSetCompositionFontW)(HIMC, LPLOGFONTW); + BOOL (WINAPI* pImmGetCompositionWindow) (HIMC, LPCOMPOSITIONFORM); + BOOL (WINAPI* pImmSetCompositionWindow) (HIMC, LPCOMPOSITIONFORM); + HIMC (WINAPI* pImmAssociateContext) (HWND, HIMC); + BOOL (WINAPI* pImmReleaseContext) (HWND, HIMC); + HIMC (WINAPI* pImmGetContext) (HWND); + HWND (WINAPI* pImmGetDefaultIMEWnd) (HWND); + BOOL (WINAPI* pImmNotifyIME) (HIMC, DWORD, DWORD, DWORD); + BOOL (WINAPI* pImmRegisterClient) (PVOID, HINSTANCE); + UINT (WINAPI* pImmProcessKey) (HWND, HKL, UINT, LPARAM, DWORD); + +} Imm32ApiTable; + + /* global variables */ extern HINSTANCE User32Instance; #define user32_module User32Instance extern PPROCESSINFO g_ppi; extern ULONG_PTR g_ulSharedDelta; extern PSERVERINFO gpsi; +extern SHAREDINFO gSharedInfo; extern BOOLEAN gfLogonProcess; extern BOOLEAN gfServerProcess; extern PUSER_HANDLE_TABLE gHandleTable; extern PUSER_HANDLE_ENTRY gHandleEntries; extern CRITICAL_SECTION U32AccelCacheLock; -extern HINSTANCE hImmInstance; +extern HINSTANCE ghImm32; extern RTL_CRITICAL_SECTION gcsUserApiHook; extern USERAPIHOOK guah; extern HINSTANCE ghmodUserApiHook; extern HICON hIconSmWindows, hIconWindows; +extern Imm32ApiTable gImmApiEntries;
#define IS_ATOM(x) \ (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000)) @@ -105,5 +132,6 @@ VOID DeleteFrameBrushes(VOID); BOOL WINAPI GdiValidateHandle(HGDIOBJ); HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom); +BOOL WINAPI InitializeImmEntryTable(VOID);
/* EOF */
Modified: trunk/reactos/win32ss/user/user32/misc/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dl... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -14,6 +14,7 @@ PUSER_HANDLE_TABLE gHandleTable = NULL; PUSER_HANDLE_ENTRY gHandleEntries = NULL; PSERVERINFO gpsi = NULL; +SHAREDINFO gSharedInfo = {0}; ULONG_PTR g_ulSharedDelta; BOOLEAN gfLogonProcess = FALSE; BOOLEAN gfServerProcess = FALSE; @@ -262,6 +263,7 @@ gpsi = SharedPtrToUser(UserCon.siClient.psi); gHandleTable = SharedPtrToUser(UserCon.siClient.aheList); gHandleEntries = SharedPtrToUser(gHandleTable->handles); + gSharedInfo = UserCon.siClient;
// ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi, UserCon.siClient.aheList, g_ulSharedDelta); } @@ -414,6 +416,7 @@ gpsi = SharedPtrToUser(UserCon->siClient.psi); gHandleTable = SharedPtrToUser(UserCon->siClient.aheList); gHandleEntries = SharedPtrToUser(gHandleTable->handles); + gSharedInfo = UserCon->siClient; }
// FIXME: Yet another hack... This call should normally not be done here, but @@ -518,13 +521,22 @@ if (!Init(&ConnectInfo)) return FALSE;
+ if (!gfServerProcess) + { + InitializeImmEntryTable(); + // + // Wine is stub and throws an exception so save this for real Imm32.dll testing!!!! + // + //gImmApiEntries.pImmRegisterClient(&gSharedInfo, ghImm32); + } + break; }
case DLL_PROCESS_DETACH: { - if (hImmInstance) - FreeLibrary(hImmInstance); + if (ghImm32) + FreeLibrary(ghImm32);
Cleanup(); break;
Modified: trunk/reactos/win32ss/user/user32/misc/imm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/im... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/imm.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/imm.c [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -13,38 +13,31 @@ #include <winnls32.h>
#include <wine/debug.h> +#include <strsafe.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
- -typedef struct -{ - BOOL (WINAPI* pImmIsIME) (HKL); - LRESULT (WINAPI* pImmEscapeA) (HKL, HIMC, UINT, LPVOID); - LRESULT (WINAPI* pImmEscapeW) (HKL, HIMC, UINT, LPVOID); - LONG (WINAPI* pImmGetCompositionStringA) (HIMC, DWORD, LPVOID, DWORD); - LONG (WINAPI* pImmGetCompositionStringW) (HIMC, DWORD, LPVOID, DWORD); - BOOL (WINAPI* pImmGetCompositionFontA) (HIMC, LPLOGFONTA); - BOOL (WINAPI* pImmGetCompositionFontW) (HIMC, LPLOGFONTW); - BOOL (WINAPI* pImmSetCompositionFontA)(HIMC, LPLOGFONTA); - BOOL (WINAPI* pImmSetCompositionFontW)(HIMC, LPLOGFONTW); - BOOL (WINAPI* pImmGetCompositionWindow) (HIMC, LPCOMPOSITIONFORM); - BOOL (WINAPI* pImmSetCompositionWindow) (HIMC, LPCOMPOSITIONFORM); - HIMC (WINAPI* pImmAssociateContext) (HWND, HIMC); - BOOL (WINAPI* pImmReleaseContext) (HWND, HIMC); - HIMC (WINAPI* pImmGetContext) (HWND); - HWND (WINAPI* pImmGetDefaultIMEWnd) (HWND); - BOOL (WINAPI* pImmNotifyIME) (HIMC, DWORD, DWORD, DWORD); -} Imm32ApiTable; - -Imm32ApiTable *pImmApiTable = {0}; -HINSTANCE hImmInstance = NULL; - - -static BOOL IsInitialized() -{ - return (hImmInstance != NULL) ? TRUE : FALSE; -} +#define IMM_INIT_MAGIC 0x19650412 + + +Imm32ApiTable gImmApiEntries = {0}; +HINSTANCE ghImm32 = NULL; +BOOL bImmInitializing = FALSE; +BOOL ImmApiTableZero = TRUE; + +HRESULT WINAPI GetImmFileName(PWSTR lpBuffer, UINT uSize) +{ + UINT length; + STRSAFE_LPWSTR Safe = lpBuffer; + + length = GetSystemDirectoryW(lpBuffer, uSize); + if ( length && length < uSize ) + { + StringCchCatW(Safe, uSize, L"\"); + return StringCchCatW(Safe, uSize, L"IMM32.DLL"); + } + return StringCchCopyW(Safe, uSize, L"IMM32.DLL"); +}
/* * This function should not be implemented, it is used, @@ -63,101 +56,276 @@ HIMC WINAPI IMM_ImmGetContext(HWND hwnd) { return 0; } HWND WINAPI IMM_ImmGetDefaultIMEWnd(HWND hwnd) { return 0; } BOOL WINAPI IMM_ImmNotifyIME(HIMC himc, DWORD dword1, DWORD dword2, DWORD dword3) { return 0; } - -/* - * @unimplemented - */ -BOOL WINAPI User32InitializeImmEntryTable(DWORD dwUnknown) -{ - UNIMPLEMENTED; - - if (dwUnknown != 0x19650412) /* FIXME */ - return FALSE; - - if (IsInitialized()) +BOOL WINAPI IMM_ImmRegisterClient(PVOID ptr, HINSTANCE hMod) { return 0; } +UINT WINAPI IMM_ImmProcessKey(HWND hwnd, HKL hkl, UINT Vk, LPARAM lParam, DWORD HotKey) { return 0; } + +/* + * @unimplemented + */ +BOOL WINAPI IntInitializeImmEntryTable(VOID) +{ + WCHAR ImmFile[MAX_PATH]; + HMODULE imm32 = ghImm32;; + + if (gImmApiEntries.pImmIsIME != 0) + { + ERR("Imm Api Table Init 1\n"); + return TRUE; + } + + GetImmFileName(ImmFile, sizeof(ImmFile)); + TRACE("File %ws\n",ImmFile); + + if (imm32 == NULL) + { + imm32 = GetModuleHandleW(ImmFile); + } + + if (imm32 == NULL) + { + imm32 = ghImm32 = LoadLibraryW(ImmFile); + if (imm32 == NULL) + { + ERR("Did not load!\n"); + return FALSE; + } return TRUE; - - hImmInstance = LoadLibraryW(L"imm32.dll"); - if (!hImmInstance) - return FALSE; - - ZeroMemory(pImmApiTable, sizeof(Imm32ApiTable)); - - pImmApiTable->pImmIsIME = (BOOL (WINAPI*)(HKL)) GetProcAddress(hImmInstance, "ImmIsIME"); - if (!pImmApiTable->pImmIsIME) - pImmApiTable->pImmIsIME = IMM_ImmIsIME; - - pImmApiTable->pImmEscapeA = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(hImmInstance, "ImmEscapeA"); - if (!pImmApiTable->pImmEscapeA) - pImmApiTable->pImmEscapeA = IMM_ImmEscapeAW; - - pImmApiTable->pImmEscapeW = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(hImmInstance, "ImmEscapeW"); - if (!pImmApiTable->pImmEscapeW) - pImmApiTable->pImmEscapeW = IMM_ImmEscapeAW; - - pImmApiTable->pImmGetCompositionStringA = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(hImmInstance, "ImmGetCompositionStringA"); - if (!pImmApiTable->pImmGetCompositionStringA) - pImmApiTable->pImmGetCompositionStringA = IMM_ImmGetCompositionStringAW; - - pImmApiTable->pImmGetCompositionStringW = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(hImmInstance, "ImmGetCompositionStringW"); - if (!pImmApiTable->pImmGetCompositionStringW) - pImmApiTable->pImmGetCompositionStringW = IMM_ImmGetCompositionStringAW; - - pImmApiTable->pImmGetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(hImmInstance, "ImmGetCompositionFontA"); - if (!pImmApiTable->pImmGetCompositionFontA) - pImmApiTable->pImmGetCompositionFontA = IMM_ImmGetCompositionFontA; - - pImmApiTable->pImmGetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(hImmInstance, "ImmGetCompositionFontW"); - if (!pImmApiTable->pImmGetCompositionFontW) - pImmApiTable->pImmGetCompositionFontW = IMM_ImmGetCompositionFontW; - - pImmApiTable->pImmSetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(hImmInstance, "ImmSetCompositionFontA"); - if (!pImmApiTable->pImmSetCompositionFontA) - pImmApiTable->pImmSetCompositionFontA = IMM_ImmSetCompositionFontA; - - pImmApiTable->pImmSetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(hImmInstance, "ImmSetCompositionFontW"); - if (!pImmApiTable->pImmSetCompositionFontW) - pImmApiTable->pImmSetCompositionFontW = IMM_ImmSetCompositionFontW; - - pImmApiTable->pImmGetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(hImmInstance, "ImmGetCompositionWindow"); - if (!pImmApiTable->pImmGetCompositionWindow) - pImmApiTable->pImmGetCompositionWindow = IMM_ImmSetGetCompositionWindow; - - pImmApiTable->pImmSetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(hImmInstance, "ImmSetCompositionWindow"); - if (!pImmApiTable->pImmSetCompositionWindow) - pImmApiTable->pImmSetCompositionWindow = IMM_ImmSetGetCompositionWindow; - - pImmApiTable->pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC)) GetProcAddress(hImmInstance, "ImmAssociateContext"); - if (!pImmApiTable->pImmAssociateContext) - pImmApiTable->pImmAssociateContext = IMM_ImmAssociateContext; - - pImmApiTable->pImmReleaseContext = (BOOL (WINAPI*)(HWND, HIMC)) GetProcAddress(hImmInstance, "ImmReleaseContext"); - if (!pImmApiTable->pImmReleaseContext) - pImmApiTable->pImmReleaseContext = IMM_ImmReleaseContext; - - pImmApiTable->pImmGetContext = (HIMC (WINAPI*)(HWND)) GetProcAddress(hImmInstance, "ImmGetContext"); - if (!pImmApiTable->pImmGetContext) - pImmApiTable->pImmGetContext = IMM_ImmGetContext; - - pImmApiTable->pImmGetDefaultIMEWnd = (HWND (WINAPI*)(HWND)) GetProcAddress(hImmInstance, "ImmGetDefaultIMEWnd"); - if (!pImmApiTable->pImmGetDefaultIMEWnd) - pImmApiTable->pImmGetDefaultIMEWnd = IMM_ImmGetDefaultIMEWnd; - - pImmApiTable->pImmNotifyIME = (BOOL (WINAPI*)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(hImmInstance, "ImmNotifyIME"); - if (!pImmApiTable->pImmNotifyIME) - pImmApiTable->pImmNotifyIME = IMM_ImmNotifyIME; + } + + if (ImmApiTableZero) + { + ImmApiTableZero = FALSE; + ZeroMemory(&gImmApiEntries, sizeof(Imm32ApiTable)); + } + + gImmApiEntries.pImmIsIME = (BOOL (WINAPI*)(HKL)) GetProcAddress(imm32, "ImmIsIME"); + if (!gImmApiEntries.pImmIsIME) + gImmApiEntries.pImmIsIME = IMM_ImmIsIME; + + gImmApiEntries.pImmEscapeA = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeA"); + if (!gImmApiEntries.pImmEscapeA) + gImmApiEntries.pImmEscapeA = IMM_ImmEscapeAW; + + gImmApiEntries.pImmEscapeW = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeW"); + if (!gImmApiEntries.pImmEscapeW) + gImmApiEntries.pImmEscapeW = IMM_ImmEscapeAW; + + gImmApiEntries.pImmGetCompositionStringA = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringA"); + if (!gImmApiEntries.pImmGetCompositionStringA) + gImmApiEntries.pImmGetCompositionStringA = IMM_ImmGetCompositionStringAW; + + gImmApiEntries.pImmGetCompositionStringW = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringW"); + if (!gImmApiEntries.pImmGetCompositionStringW) + gImmApiEntries.pImmGetCompositionStringW = IMM_ImmGetCompositionStringAW; + + gImmApiEntries.pImmGetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmGetCompositionFontA"); + if (!gImmApiEntries.pImmGetCompositionFontA) + gImmApiEntries.pImmGetCompositionFontA = IMM_ImmGetCompositionFontA; + + gImmApiEntries.pImmGetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmGetCompositionFontW"); + if (!gImmApiEntries.pImmGetCompositionFontW) + gImmApiEntries.pImmGetCompositionFontW = IMM_ImmGetCompositionFontW; + + gImmApiEntries.pImmSetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmSetCompositionFontA"); + if (!gImmApiEntries.pImmSetCompositionFontA) + gImmApiEntries.pImmSetCompositionFontA = IMM_ImmSetCompositionFontA; + + gImmApiEntries.pImmSetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmSetCompositionFontW"); + if (!gImmApiEntries.pImmSetCompositionFontW) + gImmApiEntries.pImmSetCompositionFontW = IMM_ImmSetCompositionFontW; + + gImmApiEntries.pImmGetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmGetCompositionWindow"); + if (!gImmApiEntries.pImmGetCompositionWindow) + gImmApiEntries.pImmGetCompositionWindow = IMM_ImmSetGetCompositionWindow; + + gImmApiEntries.pImmSetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmSetCompositionWindow"); + if (!gImmApiEntries.pImmSetCompositionWindow) + gImmApiEntries.pImmSetCompositionWindow = IMM_ImmSetGetCompositionWindow; + + gImmApiEntries.pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmAssociateContext"); + if (!gImmApiEntries.pImmAssociateContext) + gImmApiEntries.pImmAssociateContext = IMM_ImmAssociateContext; + + gImmApiEntries.pImmReleaseContext = (BOOL (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmReleaseContext"); + if (!gImmApiEntries.pImmReleaseContext) + gImmApiEntries.pImmReleaseContext = IMM_ImmReleaseContext; + + gImmApiEntries.pImmGetContext = (HIMC (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetContext"); + if (!gImmApiEntries.pImmGetContext) + gImmApiEntries.pImmGetContext = IMM_ImmGetContext; + + gImmApiEntries.pImmGetDefaultIMEWnd = (HWND (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetDefaultIMEWnd"); + if (!gImmApiEntries.pImmGetDefaultIMEWnd) + gImmApiEntries.pImmGetDefaultIMEWnd = IMM_ImmGetDefaultIMEWnd; + + gImmApiEntries.pImmNotifyIME = (BOOL (WINAPI*)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(imm32, "ImmNotifyIME"); + if (!gImmApiEntries.pImmNotifyIME) + gImmApiEntries.pImmNotifyIME = IMM_ImmNotifyIME;
/* * TODO: Load more functions from imm32.dll * Function like IMPSetIMEW, IMPQueryIMEW etc. call functions - * from imm32.dll through pointers in the structure pImmApiTable. + * from imm32.dll through pointers in the structure gImmApiEntries. * I do not know whether it is necessary to initialize a table * of functions to load user32 (DLL_PROCESS_ATTACH) */
+ gImmApiEntries.pImmRegisterClient = (BOOL (WINAPI*)(PVOID, HINSTANCE)) GetProcAddress(imm32, "ImmRegisterClient"); + if (!gImmApiEntries.pImmRegisterClient) + gImmApiEntries.pImmRegisterClient = IMM_ImmRegisterClient; + + gImmApiEntries.pImmProcessKey = (UINT (WINAPI*)(HWND, HKL, UINT, LPARAM, DWORD)) GetProcAddress(imm32, "ImmProcessKey"); + if (!gImmApiEntries.pImmProcessKey) + gImmApiEntries.pImmProcessKey = IMM_ImmProcessKey; + return TRUE; }
+BOOL WINAPI InitializeImmEntryTable(VOID) +{ + bImmInitializing = TRUE; + return IntInitializeImmEntryTable(); +} + +BOOL WINAPI User32InitializeImmEntryTable(DWORD magic) +{ + TRACE("(%x)\n", magic); + + if (magic != IMM_INIT_MAGIC) + return FALSE; + + if (gImmApiEntries.pImmIsIME != 0) + { + ERR("Imm Api Table Init 2\n"); + return TRUE; + } + + IntInitializeImmEntryTable(); + + if (ghImm32 == NULL && !bImmInitializing) + { + WCHAR ImmFile[MAX_PATH]; + ERR("IMM32 not installed!\n"); + GetImmFileName(ImmFile, sizeof(ImmFile)); + ERR("File %ws\n",ImmFile); + ghImm32 = LoadLibraryW(ImmFile); + if (ghImm32 == NULL) + { + ERR("Did not load! 2\n"); + return FALSE; + } + } +#if 0 // For real Imm32.dll testing!!!! + if (ghImm32 && !gImmApiEntries.pImmRegisterClient(&gSharedInfo, ghImm32)) + { + ERR("Wine is stubed!\n"); + } +#endif + return TRUE; +} + +LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) // ReactOS +{ + PWND pWnd; + PIMEUI pimeui; + + pWnd = ValidateHwnd(hwnd); + if (pWnd) + { + if (!pWnd->fnid) + { + if (msg != WM_NCCREATE) + { + if (unicode) + return DefWindowProcW(hwnd, msg, wParam, lParam); + return DefWindowProcA(hwnd, msg, wParam, lParam); + } + NtUserSetWindowFNID(hwnd, FNID_IME); + pimeui = HeapAlloc( GetProcessHeap(), 0, sizeof(IMEUI) ); + SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui); + } + else + { + if (pWnd->fnid != FNID_IME) + { + ERR("Wrong window class for Ime! fnId 0x%x\n",pWnd->fnid); + return 0; + } + pimeui = ((PIMEWND)pWnd)->pimeui; + if (pimeui == NULL) + { + ERR("Window is not set to IME!\n"); + return 0; + } + } + } + + if (msg==WM_CREATE || msg==WM_NCCREATE) + return TRUE; + + if (msg==WM_NCDESTROY) + { + HeapFree( GetProcessHeap(), 0, pimeui ); + SetWindowLongPtrW(hwnd, 0, 0); + NtUserSetWindowFNID(hwnd, FNID_DESTROY); + } + + if (unicode) + return DefWindowProcW(hwnd, msg, wParam, lParam); + return DefWindowProcA(hwnd, msg, wParam, lParam); +} + +LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + return ImeWndProc_common(hwnd, msg, wParam, lParam, FALSE); +} + +LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + return ImeWndProc_common(hwnd, msg, wParam, lParam, TRUE); +} + +static const WCHAR imeW[] = {'I','M','E',0}; + +BOOL +WINAPI +RegisterIMEClass(VOID) +{ + WNDCLASSEXW WndClass; + ATOM atom; + + ZeroMemory(&WndClass, sizeof(WndClass)); + + WndClass.cbSize = sizeof(WndClass); + WndClass.lpszClassName = imeW; + WndClass.style = CS_GLOBALCLASS; + WndClass.lpfnWndProc = ImeWndProcW; + WndClass.cbWndExtra = sizeof(LONG_PTR); + WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW); + + atom = RegisterClassExWOWW( &WndClass, + 0, + FNID_IME, + 0, + FALSE); + if (atom) + { + RegisterDefaultClasses |= ICLASS_TO_MASK(ICLS_IME); + return TRUE; + } + ERR("Failed to register IME Class!\n"); + return FALSE; +} + +/* + * @unimplemented + */ +BOOL WINAPI CliImmSetHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl) +{ + UNIMPLEMENTED; + return FALSE; +} + /* * @unimplemented */ @@ -269,12 +437,11 @@ }
/* - * @unimplemented + * @implemented */ UINT WINAPI WINNLSGetIMEHotkey(HWND hwnd) { - UNIMPLEMENTED; - return FALSE; -} + return FALSE; +}
Modified: trunk/reactos/win32ss/user/user32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/st... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] Sun Jan 4 19:27:40 2015 @@ -471,15 +471,6 @@ * @unimplemented */ BOOL WINAPI DdeGetQualityOfService(HWND hWnd, DWORD Reserved, PSECURITY_QUALITY_OF_SERVICE pqosPrev) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL WINAPI CliImmSetHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl) { UNIMPLEMENTED; return FALSE;