Author: jimtabor
Date: Wed Jul 4 23:16:17 2012
New Revision: 56833
URL:
http://svn.reactos.org/svn/reactos?rev=56833&view=rev
Log:
[Win32SS]
- Add callback to find character set information.
Modified:
trunk/reactos/win32ss/include/callback.h
trunk/reactos/win32ss/pch.h
trunk/reactos/win32ss/user/ntuser/callback.c
trunk/reactos/win32ss/user/ntuser/callback.h
trunk/reactos/win32ss/user/ntuser/kbdlayout.c
trunk/reactos/win32ss/user/ntuser/main.c
trunk/reactos/win32ss/user/user32/misc/dllmain.c
Modified: trunk/reactos/win32ss/include/callback.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/callback.h…
==============================================================================
--- trunk/reactos/win32ss/include/callback.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/include/callback.h [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -10,7 +10,8 @@
#define USER32_CALLBACK_LOADMENU (6)
#define USER32_CALLBACK_CLIENTTHREADSTARTUP (7)
#define USER32_CALLBACK_CLIENTLOADLIBRARY (8)
-#define USER32_CALLBACK_MAXIMUM (8)
+#define USER32_CALLBACK_GETCHARSETINFO (9)
+#define USER32_CALLBACK_MAXIMUM (9)
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
{
@@ -85,6 +86,12 @@
BOOL ApiHook;
} CLIENT_LOAD_LIBRARY_ARGUMENTS, *PCLIENT_LOAD_LIBRARY_ARGUMENTS;
+typedef struct _GET_CHARSET_INFO
+{
+ LCID Locale;
+ CHARSETINFO Cs;
+} GET_CHARSET_INFO, *PGET_CHARSET_INFO;
+
NTSTATUS WINAPI
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS WINAPI
@@ -103,4 +110,6 @@
User32CallClientThreadSetupFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS WINAPI
User32CallClientLoadLibraryFromKernel(PVOID Arguments, ULONG ArgumentLength);
+NTSTATUS WINAPI
+User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength);
#endif /* __INCLUDE_USER32_CALLBACK_H */
Modified: trunk/reactos/win32ss/pch.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/pch.h?rev=56833&am…
==============================================================================
--- trunk/reactos/win32ss/pch.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/pch.h [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -3,7 +3,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem
- * FILE: subsystems/win32/win32k/pch.h
+ * FILE: win32ss/pch.h
* PURPOSE: Main Win32K Header
* PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
*/
@@ -63,6 +63,7 @@
#include <prntfont.h>
#include <dde.h>
#include <wincon.h>
+#include <winnls.h>
#define _NOCSECT_TYPE
#include <ddrawi.h>
Modified: trunk/reactos/win32ss/user/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callba…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -824,4 +824,63 @@
return Status;
}
+BOOL
+APIENTRY
+co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs)
+{
+ NTSTATUS Status;
+ ULONG ArgumentLength, ResultLength;
+ PVOID Argument, ResultPointer;
+ PGET_CHARSET_INFO Common;
+
+ ArgumentLength = sizeof(GET_CHARSET_INFO);
+
+ Argument = IntCbAllocateMemory(ArgumentLength);
+ if (NULL == Argument)
+ {
+ ERR("GetCharsetInfo callback failed: out of memory\n");
+ return 0;
+ }
+ Common = (PGET_CHARSET_INFO) Argument;
+
+ Common->Locale = Locale;
+
+ ResultPointer = NULL;
+ ResultLength = ArgumentLength;
+
+ UserLeaveCo();
+
+ Status = KeUserModeCallback(USER32_CALLBACK_GETCHARSETINFO,
+ Argument,
+ ArgumentLength,
+ &ResultPointer,
+ &ResultLength);
+
+ _SEH2_TRY
+ {
+ /* Need to copy into our local buffer */
+ RtlMoveMemory(Argument, ResultPointer, ArgumentLength);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("Failed to copy result from user mode!\n");
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ UserEnterCo();
+
+ RtlCopyMemory(pCs, &Common->Cs, sizeof(CHARSETINFO));
+
+ IntCbFreeMemory(Argument);
+
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("GetCharsetInfo Failed!!\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* EOF */
Modified: trunk/reactos/win32ss/user/ntuser/callback.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callba…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/callback.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/callback.h [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -61,3 +61,6 @@
BOOL Unload,
BOOL ApiHook);
+BOOL
+APIENTRY
+co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs);
Modified: trunk/reactos/win32ss/user/ntuser/kbdlayout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/kbdlay…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -201,6 +201,8 @@
static PKL
UserLoadKbdLayout(PUNICODE_STRING pwszKLID, HKL hKL)
{
+ LCID lCid;
+ CHARSETINFO cs;
PKL pKl;
/* Create keyboard layout object */
@@ -223,6 +225,23 @@
ERR("UserLoadKbdFile(%wZ) failed!\n", pwszKLID);
UserDeleteObject(pKl->head.h, otKBDlayout);
return NULL;
+ }
+
+ // Up to Language Identifiers..
+ RtlUnicodeStringToInteger(pwszKLID, (ULONG)16, (PULONG)&lCid);
+ TRACE("Language Identifiers %wZ LCID 0x%x\n", pwszKLID, lCid);
+ if (co_IntGetCharsetInfo(lCid, &cs))
+ {
+ pKl->iBaseCharset = cs.ciCharset;
+ pKl->dwFontSigs = cs.fs.fsCsb[0];
+ pKl->CodePage = (USHORT)cs.ciACP;
+ TRACE("Charset %d Font Sig %d CodePage %d\n", pKl->iBaseCharset,
pKl->dwFontSigs, pKl->CodePage);
+ }
+ else
+ {
+ pKl->iBaseCharset = ANSI_CHARSET;
+ pKl->dwFontSigs = FS_LATIN1;
+ pKl->CodePage = CP_ACP;
}
return pKl;
Modified: trunk/reactos/win32ss/user/ntuser/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Wed Jul 4 23:16:17 2012
@@ -283,7 +283,10 @@
pci->fsHooks = ptiCurrent->fsHooks;
pci->dwTIFlags = ptiCurrent->TIF_flags;
if (ptiCurrent->KeyboardLayout)
+ {
pci->hKL = ptiCurrent->KeyboardLayout->hkl;
+ pci->CodePage = ptiCurrent->KeyboardLayout->CodePage;
+ }
/* Assign a default window station and desktop to the process */
/* Do not try to open a desktop or window station before winlogon initializes */
Modified: trunk/reactos/win32ss/user/user32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/d…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] Wed Jul 4 23:16:17
2012
@@ -219,6 +219,8 @@
(PVOID)User32CallClientThreadSetupFromKernel;
KernelCallbackTable[USER32_CALLBACK_CLIENTLOADLIBRARY] =
(PVOID)User32CallClientLoadLibraryFromKernel;
+ KernelCallbackTable[USER32_CALLBACK_GETCHARSETINFO] =
+ (PVOID)User32CallGetCharsetInfo;
NtUserProcessConnect( NtCurrentProcess(),
&UserCon,
@@ -352,3 +354,16 @@
return ZwCallbackReturn(NULL, 0, STATUS_SUCCESS);
}
+NTSTATUS
+WINAPI
+User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength)
+{
+ BOOL Ret;
+ PGET_CHARSET_INFO pgci = (PGET_CHARSET_INFO)Arguments;
+
+ TRACE("GetCharsetInfo\n");
+
+ Ret = TranslateCharsetInfo((DWORD *)pgci->Locale, &pgci->Cs, TCI_SRCLOCALE);
+
+ return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS :
STATUS_UNSUCCESSFUL);
+}