Author: dchapyshev Date: Tue Aug 16 18:33:50 2016 New Revision: 72235
URL: http://svn.reactos.org/svn/reactos?rev=72235&view=rev Log: [INPUT] - Show localized keyboard layout name
Modified: trunk/reactos/dll/cpl/input/layout_list.c
Modified: trunk/reactos/dll/cpl/input/layout_list.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/layout_list.c... ============================================================================== --- trunk/reactos/dll/cpl/input/layout_list.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/layout_list.c [iso-8859-1] Tue Aug 16 18:33:50 2016 @@ -148,13 +148,73 @@ dwSize = sizeof(szBuffer);
if (RegQueryValueExW(hLayoutKey, - L"Layout Text", + L"Layout Display Name", NULL, NULL, - (LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS) + (LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS && + szBuffer[0] == L'@') { - DWORD dwLayoutId = DWORDfromString(szLayoutId); - - LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer); + WCHAR szPath[MAX_PATH]; + WCHAR *pBuffer; + WCHAR *pIndex; + INT iIndex; + + /* Move to the position after the character "@" */ + pBuffer = szBuffer + 1; + + /* Get a pointer to the beginning ",-" */ + pIndex = wcsstr(pBuffer, L",-"); + + /* Convert the number in the string after the ",-" */ + iIndex = _wtoi(pIndex + 2); + + pIndex[0] = 0; + + if (ExpandEnvironmentStringsW(pBuffer, szPath, ARRAYSIZE(szPath)) != 0) + { + HANDLE hHandle; + + hHandle = LoadLibraryW(szPath); + if (hHandle != NULL) + { + INT iLength = LoadStringW(hHandle, iIndex, szBuffer, ARRAYSIZE(szBuffer)); + + FreeLibrary(hHandle); + + if (iLength != 0) + { + DWORD dwLayoutId = DWORDfromString(szLayoutId); + + LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer); + } + else + { + goto NotTranslated; + } + } + else + { + goto NotTranslated; + } + } + else + { + goto NotTranslated; + } + } + else + { +NotTranslated: + dwSize = sizeof(szBuffer); + + if (RegQueryValueExW(hLayoutKey, + L"Layout Text", + NULL, NULL, + (LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS) + { + DWORD dwLayoutId = DWORDfromString(szLayoutId); + + LayoutList_AppendNode(dwLayoutId, dwSpecialId, szBuffer); + } } } }