- 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.

svn path=/trunk/; revision=65977
This commit is contained in:
James Tabor 2015-01-04 19:27:40 +00:00
parent b74720f96d
commit ee1b62f7f1
7 changed files with 337 additions and 102 deletions

View file

@ -1121,6 +1121,32 @@ typedef struct tagIMEINFOEX
}; };
} IMEINFOEX, *PIMEINFOEX; } 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 DWORD
NTAPI NTAPI

View file

@ -101,6 +101,12 @@ BOOL WINAPI RegisterSystemControls(VOID)
RegisterDefaultClasses |= ICLASS_TO_MASK(g_SysClasses[i].ClsId); 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; return TRUE;
} }
@ -170,8 +176,8 @@ BOOL WINAPI RegisterClientPFN(VOID)
pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW; pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW;
pfnClientA.pfnStaticWndProc = StaticWndProcA; pfnClientA.pfnStaticWndProc = StaticWndProcA;
pfnClientW.pfnStaticWndProc = StaticWndProcW; pfnClientW.pfnStaticWndProc = StaticWndProcW;
pfnClientA.pfnImeWndProc = DefWindowProcA; pfnClientA.pfnImeWndProc = ImeWndProcA;
pfnClientW.pfnImeWndProc = DefWindowProcW; pfnClientW.pfnImeWndProc = ImeWndProcW;
pfnClientA.pfnGhostWndProc = DefWindowProcA; pfnClientA.pfnGhostWndProc = DefWindowProcA;
pfnClientW.pfnGhostWndProc = DefWindowProcW; pfnClientW.pfnGhostWndProc = DefWindowProcW;
pfnClientA.pfnHkINLPCWPSTRUCT = DefWindowProcA; pfnClientA.pfnHkINLPCWPSTRUCT = DefWindowProcA;
@ -195,7 +201,7 @@ BOOL WINAPI RegisterClientPFN(VOID)
pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common; pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common;
pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common; pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common;
pfnClientWorker.pfnStaticWndProc = StaticWndProc_common; pfnClientWorker.pfnStaticWndProc = StaticWndProc_common;
pfnClientWorker.pfnImeWndProc = User32DefWindowProc; pfnClientWorker.pfnImeWndProc = ImeWndProc_common;
pfnClientWorker.pfnGhostWndProc = User32DefWindowProc; pfnClientWorker.pfnGhostWndProc = User32DefWindowProc;
pfnClientWorker.pfnCtfHookProc = User32DefWindowProc; pfnClientWorker.pfnCtfHookProc = User32DefWindowProc;

View file

@ -41,3 +41,8 @@ extern const struct builtin_class_descr STATIC_builtin_class;
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *,LPDWORD,WORD,DWORD,BOOL); ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *,LPDWORD,WORD,DWORD,BOOL);
BOOL FASTCALL VersionRegisterClass(PCWSTR,LPCWSTR,HANDLE,HMODULE *); 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);

View file

@ -17,22 +17,49 @@
#include "resource.h" #include "resource.h"
#include "ntwrapper.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 */ /* global variables */
extern HINSTANCE User32Instance; extern HINSTANCE User32Instance;
#define user32_module User32Instance #define user32_module User32Instance
extern PPROCESSINFO g_ppi; extern PPROCESSINFO g_ppi;
extern ULONG_PTR g_ulSharedDelta; extern ULONG_PTR g_ulSharedDelta;
extern PSERVERINFO gpsi; extern PSERVERINFO gpsi;
extern SHAREDINFO gSharedInfo;
extern BOOLEAN gfLogonProcess; extern BOOLEAN gfLogonProcess;
extern BOOLEAN gfServerProcess; extern BOOLEAN gfServerProcess;
extern PUSER_HANDLE_TABLE gHandleTable; extern PUSER_HANDLE_TABLE gHandleTable;
extern PUSER_HANDLE_ENTRY gHandleEntries; extern PUSER_HANDLE_ENTRY gHandleEntries;
extern CRITICAL_SECTION U32AccelCacheLock; extern CRITICAL_SECTION U32AccelCacheLock;
extern HINSTANCE hImmInstance; extern HINSTANCE ghImm32;
extern RTL_CRITICAL_SECTION gcsUserApiHook; extern RTL_CRITICAL_SECTION gcsUserApiHook;
extern USERAPIHOOK guah; extern USERAPIHOOK guah;
extern HINSTANCE ghmodUserApiHook; extern HINSTANCE ghmodUserApiHook;
extern HICON hIconSmWindows, hIconWindows; extern HICON hIconSmWindows, hIconWindows;
extern Imm32ApiTable gImmApiEntries;
#define IS_ATOM(x) \ #define IS_ATOM(x) \
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000)) (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
@ -105,5 +132,6 @@ HWND* WIN_ListChildren (HWND hWndparent);
VOID DeleteFrameBrushes(VOID); VOID DeleteFrameBrushes(VOID);
BOOL WINAPI GdiValidateHandle(HGDIOBJ); BOOL WINAPI GdiValidateHandle(HGDIOBJ);
HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom); HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom);
BOOL WINAPI InitializeImmEntryTable(VOID);
/* EOF */ /* EOF */

View file

@ -14,6 +14,7 @@ PPROCESSINFO g_ppi = NULL;
PUSER_HANDLE_TABLE gHandleTable = NULL; PUSER_HANDLE_TABLE gHandleTable = NULL;
PUSER_HANDLE_ENTRY gHandleEntries = NULL; PUSER_HANDLE_ENTRY gHandleEntries = NULL;
PSERVERINFO gpsi = NULL; PSERVERINFO gpsi = NULL;
SHAREDINFO gSharedInfo = {0};
ULONG_PTR g_ulSharedDelta; ULONG_PTR g_ulSharedDelta;
BOOLEAN gfLogonProcess = FALSE; BOOLEAN gfLogonProcess = FALSE;
BOOLEAN gfServerProcess = FALSE; BOOLEAN gfServerProcess = FALSE;
@ -262,6 +263,7 @@ ClientThreadSetupHelper(BOOL IsCallback)
gpsi = SharedPtrToUser(UserCon.siClient.psi); gpsi = SharedPtrToUser(UserCon.siClient.psi);
gHandleTable = SharedPtrToUser(UserCon.siClient.aheList); gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
gHandleEntries = SharedPtrToUser(gHandleTable->handles); 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); // ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi, UserCon.siClient.aheList, g_ulSharedDelta);
} }
@ -414,6 +416,7 @@ Init(PUSERCONNECT UserCon /*PUSERSRV_API_CONNECTINFO*/)
gpsi = SharedPtrToUser(UserCon->siClient.psi); gpsi = SharedPtrToUser(UserCon->siClient.psi);
gHandleTable = SharedPtrToUser(UserCon->siClient.aheList); gHandleTable = SharedPtrToUser(UserCon->siClient.aheList);
gHandleEntries = SharedPtrToUser(gHandleTable->handles); gHandleEntries = SharedPtrToUser(gHandleTable->handles);
gSharedInfo = UserCon->siClient;
} }
// FIXME: Yet another hack... This call should normally not be done here, but // FIXME: Yet another hack... This call should normally not be done here, but
@ -518,13 +521,22 @@ DllMain(
if (!Init(&ConnectInfo)) if (!Init(&ConnectInfo))
return FALSE; 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; break;
} }
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
{ {
if (hImmInstance) if (ghImm32)
FreeLibrary(hImmInstance); FreeLibrary(ghImm32);
Cleanup(); Cleanup();
break; break;

View file

@ -13,38 +13,31 @@
#include <winnls32.h> #include <winnls32.h>
#include <wine/debug.h> #include <wine/debug.h>
#include <strsafe.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32); WINE_DEFAULT_DEBUG_CHANNEL(user32);
#define IMM_INIT_MAGIC 0x19650412
typedef struct
Imm32ApiTable gImmApiEntries = {0};
HINSTANCE ghImm32 = NULL;
BOOL bImmInitializing = FALSE;
BOOL ImmApiTableZero = TRUE;
HRESULT WINAPI GetImmFileName(PWSTR lpBuffer, UINT uSize)
{ {
BOOL (WINAPI* pImmIsIME) (HKL); UINT length;
LRESULT (WINAPI* pImmEscapeA) (HKL, HIMC, UINT, LPVOID); STRSAFE_LPWSTR Safe = lpBuffer;
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}; length = GetSystemDirectoryW(lpBuffer, uSize);
HINSTANCE hImmInstance = NULL; if ( length && length < uSize )
{
StringCchCatW(Safe, uSize, L"\\");
static BOOL IsInitialized() return StringCchCatW(Safe, uSize, L"IMM32.DLL");
{ }
return (hImmInstance != NULL) ? TRUE : FALSE; return StringCchCopyW(Safe, uSize, L"IMM32.DLL");
} }
/* /*
* This function should not be implemented, it is used, * This function should not be implemented, it is used,
@ -63,101 +56,276 @@ BOOL WINAPI IMM_ImmSetGetCompositionWindow(HIMC himc, LPCOMPOSITIONFORM lpcf) {
HIMC WINAPI IMM_ImmGetContext(HWND hwnd) { return 0; } HIMC WINAPI IMM_ImmGetContext(HWND hwnd) { return 0; }
HWND WINAPI IMM_ImmGetDefaultIMEWnd(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; } BOOL WINAPI IMM_ImmNotifyIME(HIMC himc, DWORD dword1, DWORD dword2, DWORD dword3) { return 0; }
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 * @unimplemented
*/ */
BOOL WINAPI User32InitializeImmEntryTable(DWORD dwUnknown) BOOL WINAPI IntInitializeImmEntryTable(VOID)
{ {
UNIMPLEMENTED; WCHAR ImmFile[MAX_PATH];
HMODULE imm32 = ghImm32;;
if (dwUnknown != 0x19650412) /* FIXME */ if (gImmApiEntries.pImmIsIME != 0)
return FALSE; {
ERR("Imm Api Table Init 1\n");
return TRUE;
}
if (IsInitialized()) 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; return TRUE;
}
hImmInstance = LoadLibraryW(L"imm32.dll"); if (ImmApiTableZero)
if (!hImmInstance) {
return FALSE; ImmApiTableZero = FALSE;
ZeroMemory(&gImmApiEntries, sizeof(Imm32ApiTable));
}
ZeroMemory(pImmApiTable, sizeof(Imm32ApiTable)); gImmApiEntries.pImmIsIME = (BOOL (WINAPI*)(HKL)) GetProcAddress(imm32, "ImmIsIME");
if (!gImmApiEntries.pImmIsIME)
gImmApiEntries.pImmIsIME = IMM_ImmIsIME;
pImmApiTable->pImmIsIME = (BOOL (WINAPI*)(HKL)) GetProcAddress(hImmInstance, "ImmIsIME"); gImmApiEntries.pImmEscapeA = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeA");
if (!pImmApiTable->pImmIsIME) if (!gImmApiEntries.pImmEscapeA)
pImmApiTable->pImmIsIME = IMM_ImmIsIME; gImmApiEntries.pImmEscapeA = IMM_ImmEscapeAW;
pImmApiTable->pImmEscapeA = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(hImmInstance, "ImmEscapeA"); gImmApiEntries.pImmEscapeW = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeW");
if (!pImmApiTable->pImmEscapeA) if (!gImmApiEntries.pImmEscapeW)
pImmApiTable->pImmEscapeA = IMM_ImmEscapeAW; gImmApiEntries.pImmEscapeW = IMM_ImmEscapeAW;
pImmApiTable->pImmEscapeW = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(hImmInstance, "ImmEscapeW"); gImmApiEntries.pImmGetCompositionStringA = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringA");
if (!pImmApiTable->pImmEscapeW) if (!gImmApiEntries.pImmGetCompositionStringA)
pImmApiTable->pImmEscapeW = IMM_ImmEscapeAW; gImmApiEntries.pImmGetCompositionStringA = IMM_ImmGetCompositionStringAW;
pImmApiTable->pImmGetCompositionStringA = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(hImmInstance, "ImmGetCompositionStringA"); gImmApiEntries.pImmGetCompositionStringW = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringW");
if (!pImmApiTable->pImmGetCompositionStringA) if (!gImmApiEntries.pImmGetCompositionStringW)
pImmApiTable->pImmGetCompositionStringA = IMM_ImmGetCompositionStringAW; gImmApiEntries.pImmGetCompositionStringW = IMM_ImmGetCompositionStringAW;
pImmApiTable->pImmGetCompositionStringW = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(hImmInstance, "ImmGetCompositionStringW"); gImmApiEntries.pImmGetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmGetCompositionFontA");
if (!pImmApiTable->pImmGetCompositionStringW) if (!gImmApiEntries.pImmGetCompositionFontA)
pImmApiTable->pImmGetCompositionStringW = IMM_ImmGetCompositionStringAW; gImmApiEntries.pImmGetCompositionFontA = IMM_ImmGetCompositionFontA;
pImmApiTable->pImmGetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(hImmInstance, "ImmGetCompositionFontA"); gImmApiEntries.pImmGetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmGetCompositionFontW");
if (!pImmApiTable->pImmGetCompositionFontA) if (!gImmApiEntries.pImmGetCompositionFontW)
pImmApiTable->pImmGetCompositionFontA = IMM_ImmGetCompositionFontA; gImmApiEntries.pImmGetCompositionFontW = IMM_ImmGetCompositionFontW;
pImmApiTable->pImmGetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(hImmInstance, "ImmGetCompositionFontW"); gImmApiEntries.pImmSetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmSetCompositionFontA");
if (!pImmApiTable->pImmGetCompositionFontW) if (!gImmApiEntries.pImmSetCompositionFontA)
pImmApiTable->pImmGetCompositionFontW = IMM_ImmGetCompositionFontW; gImmApiEntries.pImmSetCompositionFontA = IMM_ImmSetCompositionFontA;
pImmApiTable->pImmSetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(hImmInstance, "ImmSetCompositionFontA"); gImmApiEntries.pImmSetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmSetCompositionFontW");
if (!pImmApiTable->pImmSetCompositionFontA) if (!gImmApiEntries.pImmSetCompositionFontW)
pImmApiTable->pImmSetCompositionFontA = IMM_ImmSetCompositionFontA; gImmApiEntries.pImmSetCompositionFontW = IMM_ImmSetCompositionFontW;
pImmApiTable->pImmSetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(hImmInstance, "ImmSetCompositionFontW"); gImmApiEntries.pImmGetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmGetCompositionWindow");
if (!pImmApiTable->pImmSetCompositionFontW) if (!gImmApiEntries.pImmGetCompositionWindow)
pImmApiTable->pImmSetCompositionFontW = IMM_ImmSetCompositionFontW; gImmApiEntries.pImmGetCompositionWindow = IMM_ImmSetGetCompositionWindow;
pImmApiTable->pImmGetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(hImmInstance, "ImmGetCompositionWindow"); gImmApiEntries.pImmSetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmSetCompositionWindow");
if (!pImmApiTable->pImmGetCompositionWindow) if (!gImmApiEntries.pImmSetCompositionWindow)
pImmApiTable->pImmGetCompositionWindow = IMM_ImmSetGetCompositionWindow; gImmApiEntries.pImmSetCompositionWindow = IMM_ImmSetGetCompositionWindow;
pImmApiTable->pImmSetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(hImmInstance, "ImmSetCompositionWindow"); gImmApiEntries.pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmAssociateContext");
if (!pImmApiTable->pImmSetCompositionWindow) if (!gImmApiEntries.pImmAssociateContext)
pImmApiTable->pImmSetCompositionWindow = IMM_ImmSetGetCompositionWindow; gImmApiEntries.pImmAssociateContext = IMM_ImmAssociateContext;
pImmApiTable->pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC)) GetProcAddress(hImmInstance, "ImmAssociateContext"); gImmApiEntries.pImmReleaseContext = (BOOL (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmReleaseContext");
if (!pImmApiTable->pImmAssociateContext) if (!gImmApiEntries.pImmReleaseContext)
pImmApiTable->pImmAssociateContext = IMM_ImmAssociateContext; gImmApiEntries.pImmReleaseContext = IMM_ImmReleaseContext;
pImmApiTable->pImmReleaseContext = (BOOL (WINAPI*)(HWND, HIMC)) GetProcAddress(hImmInstance, "ImmReleaseContext"); gImmApiEntries.pImmGetContext = (HIMC (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetContext");
if (!pImmApiTable->pImmReleaseContext) if (!gImmApiEntries.pImmGetContext)
pImmApiTable->pImmReleaseContext = IMM_ImmReleaseContext; gImmApiEntries.pImmGetContext = IMM_ImmGetContext;
pImmApiTable->pImmGetContext = (HIMC (WINAPI*)(HWND)) GetProcAddress(hImmInstance, "ImmGetContext"); gImmApiEntries.pImmGetDefaultIMEWnd = (HWND (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetDefaultIMEWnd");
if (!pImmApiTable->pImmGetContext) if (!gImmApiEntries.pImmGetDefaultIMEWnd)
pImmApiTable->pImmGetContext = IMM_ImmGetContext; gImmApiEntries.pImmGetDefaultIMEWnd = IMM_ImmGetDefaultIMEWnd;
pImmApiTable->pImmGetDefaultIMEWnd = (HWND (WINAPI*)(HWND)) GetProcAddress(hImmInstance, "ImmGetDefaultIMEWnd"); gImmApiEntries.pImmNotifyIME = (BOOL (WINAPI*)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(imm32, "ImmNotifyIME");
if (!pImmApiTable->pImmGetDefaultIMEWnd) if (!gImmApiEntries.pImmNotifyIME)
pImmApiTable->pImmGetDefaultIMEWnd = IMM_ImmGetDefaultIMEWnd; gImmApiEntries.pImmNotifyIME = IMM_ImmNotifyIME;
pImmApiTable->pImmNotifyIME = (BOOL (WINAPI*)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(hImmInstance, "ImmNotifyIME");
if (!pImmApiTable->pImmNotifyIME)
pImmApiTable->pImmNotifyIME = IMM_ImmNotifyIME;
/* /*
* TODO: Load more functions from imm32.dll * TODO: Load more functions from imm32.dll
* Function like IMPSetIMEW, IMPQueryIMEW etc. call functions * 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 * I do not know whether it is necessary to initialize a table
* of functions to load user32 (DLL_PROCESS_ATTACH) * 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; 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 * @unimplemented
*/ */
@ -269,12 +437,11 @@ WINNLSGetEnableStatus(HWND hwnd)
} }
/* /*
* @unimplemented * @implemented
*/ */
UINT UINT
WINAPI WINAPI
WINNLSGetIMEHotkey(HWND hwnd) WINNLSGetIMEHotkey(HWND hwnd)
{ {
UNIMPLEMENTED;
return FALSE; return FALSE;
} }

View file

@ -476,15 +476,6 @@ BOOL WINAPI DdeGetQualityOfService(HWND hWnd, DWORD Reserved, PSECURITY_QUALITY_
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
BOOL WINAPI CliImmSetHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @implemented * @implemented
*/ */