mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[USER32] Simplify CliSaveImeHotKey (#7199)
Code diet. RegCreateKeyExW will create sub-keys recursively, so this code is okay. JIRA issue: CORE-19268 Simplify registry key creation code.
This commit is contained in:
parent
dcf0788f59
commit
063e5e2514
1 changed files with 20 additions and 43 deletions
|
@ -211,36 +211,19 @@ CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bD
|
|||
{
|
||||
WCHAR szName[MAX_PATH];
|
||||
LONG error;
|
||||
HKEY hControlPanel = NULL, hInputMethod = NULL, hHotKeys = NULL, hKey = NULL;
|
||||
HKEY hKey;
|
||||
BOOL ret = FALSE, bRevertOnFailure = FALSE;
|
||||
|
||||
StringCchPrintfW(szName, _countof(szName),
|
||||
L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
|
||||
|
||||
if (bDelete)
|
||||
{
|
||||
StringCchPrintfW(szName, _countof(szName),
|
||||
L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
|
||||
error = RegDeleteKeyW(HKEY_CURRENT_USER, szName);
|
||||
return (error == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
// Open "Control Panel"
|
||||
error = RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel", 0, NULL, 0, KEY_ALL_ACCESS,
|
||||
NULL, &hControlPanel, NULL);
|
||||
if (error == ERROR_SUCCESS)
|
||||
{
|
||||
// Open "Input Method"
|
||||
error = RegCreateKeyExW(hControlPanel, L"Input Method", 0, NULL, 0, KEY_ALL_ACCESS,
|
||||
NULL, &hInputMethod, NULL);
|
||||
if (error == ERROR_SUCCESS)
|
||||
{
|
||||
// Open "Hot Keys"
|
||||
error = RegCreateKeyExW(hInputMethod, L"Hot Keys", 0, NULL, 0, KEY_ALL_ACCESS,
|
||||
NULL, &hHotKeys, NULL);
|
||||
if (error == ERROR_SUCCESS)
|
||||
{
|
||||
// Open "Key"
|
||||
StringCchPrintfW(szName, _countof(szName), L"%08lX", dwID);
|
||||
error = RegCreateKeyExW(hHotKeys, szName, 0, NULL, 0, KEY_ALL_ACCESS,
|
||||
NULL, &hKey, NULL);
|
||||
error = RegCreateKeyExW(HKEY_CURRENT_USER, szName, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
|
||||
if (error == ERROR_SUCCESS)
|
||||
{
|
||||
bRevertOnFailure = TRUE;
|
||||
|
@ -268,12 +251,6 @@ CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bD
|
|||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
RegCloseKey(hHotKeys);
|
||||
}
|
||||
RegCloseKey(hInputMethod);
|
||||
}
|
||||
RegCloseKey(hControlPanel);
|
||||
}
|
||||
|
||||
if (bRevertOnFailure)
|
||||
CliSaveImeHotKey(dwID, uVirtualKey, uModifiers, hKL, TRUE);
|
||||
|
|
Loading…
Reference in a new issue