Author: dchapyshev
Date: Tue Jan 27 15:23:44 2009
New Revision: 39150
URL:
http://svn.reactos.org/svn/reactos?rev=39150&view=rev
Log:
- Partially implement User32InitializeImmEntryTable
Modified:
trunk/reactos/dll/win32/user32/include/user32p.h
trunk/reactos/dll/win32/user32/misc/dllmain.c
trunk/reactos/dll/win32/user32/misc/imm.c
Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Tue Jan 27 15:23:44
2009
@@ -131,6 +131,7 @@
/* Internal Thread Data */
extern HINSTANCE User32Instance;
+extern HINSTANCE hImmInstance;
/* Critical Section*/
extern RTL_CRITICAL_SECTION User32Crit;
Modified: trunk/reactos/dll/win32/user32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dllm…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/dllmain.c [iso-8859-1] Tue Jan 27 15:23:44 2009
@@ -310,6 +310,7 @@
break;
case DLL_PROCESS_DETACH:
+ if (hImmInstance) FreeLibrary(hImmInstance);
CleanupThread();
Cleanup();
break;
Modified: trunk/reactos/dll/win32/user32/misc/imm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/imm.…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/imm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/imm.c [iso-8859-1] Tue Jan 27 15:23:44 2009
@@ -12,18 +12,77 @@
#include <wine/debug.h>
-
WINE_DEFAULT_DEBUG_CHANNEL(user32);
-/*
- * @unimplemented
- */
-DWORD WINAPI User32InitializeImmEntryTable(PVOID p)
-{
- UNIMPLEMENTED;
+
+typedef struct
+{
+ BOOL (WINAPI* pImmIsIME) (HKL);
+ HIMC (WINAPI* pImmAssociateContext) (HWND, HIMC);
+} Imm32ApiTable;
+
+Imm32ApiTable *pImmApiTable = {0};
+HINSTANCE hImmInstance = NULL;
+
+
+static BOOL IsInitialized()
+{
+ return (hImmInstance != NULL) ? TRUE : FALSE;
+}
+
+/*
+ * This function should not be implemented, it is used,
+ * if you can not load function from imm32.dll
+ */
+BOOL WINAPI IMM_ImmIsIME(HKL hKL)
+{
return 0;
}
+/* See comment for IMM_ImmIsIME */
+HIMC WINAPI IMM_ImmAssociateContext(HWND hwnd, HIMC himc)
+{
+ return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL WINAPI User32InitializeImmEntryTable(DWORD dwUnknown)
+{
+ UNIMPLEMENTED;
+
+ if (dwUnknown != 0x19650412) /* FIXME */
+ return FALSE;
+
+ if (IsInitialized())
+ 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->pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC))
GetProcAddress(hImmInstance, "ImmAssociateContext");
+ if (!pImmApiTable->pImmAssociateContext)
+ pImmApiTable->pImmAssociateContext = IMM_ImmAssociateContext;
+
+ /*
+ * TODO: Load more functions from imm32.dll
+ * Function like IMPSetIMEW, IMPQueryIMEW etc. call functions
+ * from imm32.dll through pointers in the structure pImmApiTable.
+ * I do not know whether it is necessary to initialize a table
+ * of functions to load user32 (DLL_PROCESS_ATTACH)
+ */
+
+ return TRUE;
+}
+
/*
* @unimplemented
*/