mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Reboot is still needed for IME settings. CORE-11700, CORE-18364
This commit is contained in:
parent
596f04be6b
commit
87f2950e1a
1 changed files with 63 additions and 1 deletions
|
@ -352,6 +352,53 @@ OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL IsRebootNeeded(VOID)
|
||||
{
|
||||
INPUT_LIST_NODE *pNode;
|
||||
|
||||
for (pNode = InputList_GetFirst(); pNode != NULL; pNode = pNode->pNext)
|
||||
{
|
||||
if (IS_IME_HKL(pNode->hkl)) /* IME? */
|
||||
{
|
||||
if (pNode->wFlags & (INPUT_LIST_NODE_FLAG_ADDED |
|
||||
INPUT_LIST_NODE_FLAG_EDITED |
|
||||
INPUT_LIST_NODE_FLAG_DEFAULT))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable)
|
||||
{
|
||||
HANDLE hToken;
|
||||
LUID luid;
|
||||
TOKEN_PRIVILEGES tokenPrivileges;
|
||||
BOOL Ret;
|
||||
|
||||
Ret = OpenProcessToken(GetCurrentProcess(),
|
||||
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
||||
&hToken);
|
||||
if (!Ret)
|
||||
return Ret; // failure
|
||||
|
||||
Ret = LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid);
|
||||
if (Ret)
|
||||
{
|
||||
tokenPrivileges.PrivilegeCount = 1;
|
||||
tokenPrivileges.Privileges[0].Luid = luid;
|
||||
tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
|
||||
|
||||
Ret = AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0);
|
||||
}
|
||||
|
||||
CloseHandle(hToken);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
static VOID
|
||||
OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
|
||||
{
|
||||
|
@ -370,8 +417,23 @@ OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
|
|||
|
||||
case PSN_APPLY:
|
||||
{
|
||||
BOOL bRebootNeeded = IsRebootNeeded();
|
||||
|
||||
/* Write Input Methods list to registry */
|
||||
InputList_Process();
|
||||
if (InputList_Process() && bRebootNeeded)
|
||||
{
|
||||
/* Needs reboot */
|
||||
WCHAR szNeedsReboot[128], szLanguage[64];
|
||||
LoadStringW(hApplet, IDS_REBOOT_NOW, szNeedsReboot, _countof(szNeedsReboot));
|
||||
LoadStringW(hApplet, IDS_LANGUAGE, szLanguage, _countof(szLanguage));
|
||||
|
||||
if (MessageBoxW(hwndDlg, szNeedsReboot, szLanguage,
|
||||
MB_ICONINFORMATION | MB_YESNOCANCEL) == IDYES)
|
||||
{
|
||||
EnableProcessPrivileges(SE_SHUTDOWN_NAME, TRUE);
|
||||
ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue