Author: ekohl Date: Sun Feb 14 18:57:12 2016 New Revision: 70745
URL: http://svn.reactos.org/svn/reactos?rev=70745&view=rev Log: [USERINIT] Select the current keyboard layout in the keyloard layout list.
Modified: trunk/reactos/base/system/userinit/livecd.c
Modified: trunk/reactos/base/system/userinit/livecd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/userinit/livecd... ============================================================================== --- trunk/reactos/base/system/userinit/livecd.c [iso-8859-1] (original) +++ trunk/reactos/base/system/userinit/livecd.c [iso-8859-1] Sun Feb 14 18:57:12 2016 @@ -302,12 +302,16 @@ HWND hItemsList) { HKEY hKey; - WCHAR szLayoutID[9], KeyName[MAX_PATH]; + WCHAR szLayoutId[9], szCurrentLayoutId[9]; + WCHAR KeyName[MAX_PATH]; DWORD dwIndex = 0; DWORD dwSize; INT iIndex; LONG lError; - ULONG ulLayoutID; + ULONG ulLayoutId; + + if (!GetKeyboardLayoutNameW(szCurrentLayoutId)) + wcscpy(szCurrentLayoutId, L"00000409");
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"System\CurrentControlSet\Control\Keyboard Layouts", @@ -319,11 +323,11 @@
while (TRUE) { - dwSize = sizeof(szLayoutID) / sizeof(WCHAR); + dwSize = sizeof(szLayoutId) / sizeof(WCHAR);
lError = RegEnumKeyExW(hKey, dwIndex, - szLayoutID, + szLayoutId, &dwSize, NULL, NULL, @@ -332,15 +336,14 @@ if (lError != ERROR_SUCCESS) break;
- GetLayoutName(szLayoutID, KeyName); + GetLayoutName(szLayoutId, KeyName);
iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
- ulLayoutID = wcstoul(szLayoutID, NULL, 16); - SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutID); - - // FIXME! - if (wcscmp(szLayoutID, L"00000409") == 0) + ulLayoutId = wcstoul(szLayoutId, NULL, 16); + SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutId); + + if (wcscmp(szLayoutId, szCurrentLayoutId) == 0) { SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0); }