Just to clarify to anyone following this thread, the change from SystemParametersInfo to
sending a message isn't incorrect.
kbswitch is meant to be a sort of makeshift ctfmon.exe, and isn't meant for switching
keyboards system-wide as intl.cpl does.
The buffer overflow problems still stand though.
Ged.
-----Original Message-----
From: gedmurphy [mailto:gedmurphy@gmail.com]
Sent: 22 April 2008 21:03
To: 'ros-dev(a)reactos.org'
Subject: RE: [ros-diffs] [dchapyshev] 33106: - Keyboard layout
switching works now in ReactOS!
dchapyshev(a)svn.reactos.org wrote:
Author: dchapyshev
Date: Tue Apr 22 14:01:56 2008
New Revision: 33106
URL:
http://svn.reactos.org/svn/reactos?rev=33106&view=rev
Log:
- Keyboard layout switching works now in ReactOS!
Hi, just a few points about this patch.
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,
_T("Keyboard
Layout\\Substitutes"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ dwBufLen = MAX_PATH;
+
+ if (RegQueryValueEx(hKey, szTempLCID, NULL, NULL,
(LPBYTE)szLCID, &dwBufLen) != ERROR_SUCCESS)
Firstly, Reg functions work on bytes, so you introduced a potential
buffer overflow here.
But this is irrelevant due to the next point ;)
- Ret =
SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &hKl,
SPIF_SENDWININICHANGE);
+ EnumWindows(EnumWindowsProc, (LPARAM) hKl);
This looks like a hack. The original method was correct, it just need
implementing in win32k.
Have a look in NtUserSystemParametersInfo.
Thirdly, what is this kbswitch app? It's not a standard windows tool,
yet it's included in our base.
Keyboard switching is done in intl.cpl, or via ctfmon (which we don't
yet have) on a per app basis.
Regards,
Ged.