mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[KBSWITCH] Delete SHLoadRegUIString hack (#5260)
Because shlwapi!SHLoadRegUIString function is already implemented, so we don't need the hack any more. CORE-10667
This commit is contained in:
parent
7eda556c64
commit
7ee41e9e60
2 changed files with 9 additions and 44 deletions
|
@ -2,7 +2,7 @@
|
|||
add_rc_deps(kbswitch.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/kbswitch.ico)
|
||||
add_executable(kbswitch kbswitch.c kbswitch.rc)
|
||||
set_module_type(kbswitch win32gui UNICODE)
|
||||
add_importlibs(kbswitch advapi32 imm32 user32 shell32 gdi32 msvcrt kernel32)
|
||||
add_importlibs(kbswitch advapi32 imm32 user32 shell32 shlwapi gdi32 msvcrt kernel32)
|
||||
add_cd_file(TARGET kbswitch DESTINATION reactos/system32 FOR all)
|
||||
|
||||
add_subdirectory(kbsdll)
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
|
||||
#include "kbswitch.h"
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi_undoc.h>
|
||||
#include <imm.h>
|
||||
|
||||
/*
|
||||
|
@ -96,11 +98,10 @@ static BOOL
|
|||
GetLayoutName(LPCTSTR szLayoutNum, LPTSTR szName, SIZE_T NameLength)
|
||||
{
|
||||
HKEY hKey;
|
||||
HRESULT hr;
|
||||
DWORD dwBufLen;
|
||||
TCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
|
||||
TCHAR szBuf[MAX_PATH];
|
||||
TCHAR szLCID[CCH_LAYOUT_ID + 1];
|
||||
HANDLE hLib;
|
||||
UINT i, j, k;
|
||||
|
||||
if (!GetLayoutID(szLayoutNum, szLCID, ARRAYSIZE(szLCID)))
|
||||
return FALSE;
|
||||
|
@ -109,50 +110,14 @@ GetLayoutName(LPCTSTR szLayoutNum, LPTSTR szName, SIZE_T NameLength)
|
|||
_T("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s"), szLCID);
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szBuf, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Use "Layout Display Name" value as an entry name if possible */
|
||||
dwBufLen = sizeof(szDispName);
|
||||
if (RegQueryValueEx(hKey, _T("Layout Display Name"), NULL, NULL,
|
||||
(LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
|
||||
hr = SHLoadRegUIString(hKey, _T("Layout Display Name"), szName, NameLength);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
/* FIXME: Use shlwapi!SHLoadRegUIStringW instead if it was implemented */
|
||||
if (szDispName[0] == '@')
|
||||
{
|
||||
size_t len = _tcslen(szDispName);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
|
||||
{
|
||||
for (j = i + 2, k = 0; j < _tcslen(szDispName)+1; j++, k++)
|
||||
{
|
||||
szIndex[k] = szDispName[j];
|
||||
}
|
||||
szDispName[i - 1] = '\0';
|
||||
break;
|
||||
}
|
||||
else szDispName[i] = szDispName[i + 1];
|
||||
}
|
||||
|
||||
if (ExpandEnvironmentStrings(szDispName, szPath, ARRAYSIZE(szPath)))
|
||||
{
|
||||
hLib = LoadLibrary(szPath);
|
||||
if (hLib)
|
||||
{
|
||||
if (LoadString(hLib, _ttoi(szIndex), szPath, ARRAYSIZE(szPath)))
|
||||
{
|
||||
StringCchCopy(szName, NameLength, szPath);
|
||||
RegCloseKey(hKey);
|
||||
FreeLibrary(hLib);
|
||||
return TRUE;
|
||||
}
|
||||
FreeLibrary(hLib);
|
||||
}
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Otherwise, use "Layout Text" value as an entry name */
|
||||
|
|
Loading…
Reference in a new issue