Skip to content

Commit fbd676f

Browse files
committed
[WINLOGON] Register hotkeys for 'Lock Workstation' and 'Accessibility' (UtilMan) (reactos#8083)
- The hotkeys are respectively: Win+L and Win+U . - Use instead the hotkey IDs in the WM_HOTKEY handler.
1 parent dfe30e5 commit fbd676f

File tree

2 files changed

+54
-14
lines changed

2 files changed

+54
-14
lines changed

base/system/winlogon/sas.c

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#define WINLOGON_SAS_CLASS L"SAS Window class"
2727
#define WINLOGON_SAS_TITLE L"SAS window"
2828

29-
#define HK_CTRL_ALT_DEL 0
30-
#define HK_CTRL_SHIFT_ESC 1
29+
#define IDHK_CTRL_ALT_DEL 0
30+
#define IDHK_CTRL_SHIFT_ESC 1
31+
#define IDHK_WIN_L 2
32+
#define IDHK_WIN_U 3
3133

3234
// #define EWX_FLAGS_MASK 0x00000014
3335
// #define EWX_ACTION_MASK ~EWX_FLAGS_MASK
@@ -1246,17 +1248,28 @@ RegisterHotKeys(
12461248
IN PWLSESSION Session,
12471249
IN HWND hwndSAS)
12481250
{
1249-
/* Register Ctrl+Alt+Del Hotkey */
1250-
if (!RegisterHotKey(hwndSAS, HK_CTRL_ALT_DEL, MOD_CONTROL | MOD_ALT, VK_DELETE))
1251+
/* Register Ctrl+Alt+Del hotkey */
1252+
if (!RegisterHotKey(hwndSAS, IDHK_CTRL_ALT_DEL, MOD_CONTROL | MOD_ALT, VK_DELETE))
12511253
{
1252-
ERR("WL: Unable to register Ctrl+Alt+Del hotkey!\n");
1254+
ERR("WL: Unable to register Ctrl+Alt+Del hotkey\n");
12531255
return FALSE;
12541256
}
12551257

1256-
/* Register Ctrl+Shift+Esc (optional) */
1257-
Session->TaskManHotkey = RegisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC, MOD_CONTROL | MOD_SHIFT, VK_ESCAPE);
1258+
/* Register Ctrl+Shift+Esc "Task Manager" hotkey (optional) */
1259+
Session->TaskManHotkey = RegisterHotKey(hwndSAS, IDHK_CTRL_SHIFT_ESC, MOD_CONTROL | MOD_SHIFT, VK_ESCAPE);
12581260
if (!Session->TaskManHotkey)
1259-
WARN("WL: Warning: Unable to register Ctrl+Alt+Esc hotkey!\n");
1261+
WARN("WL: Unable to register Ctrl+Shift+Esc hotkey\n");
1262+
1263+
/* Register Win+L "Lock Workstation" hotkey (optional) */
1264+
Session->LockWkStaHotkey = RegisterHotKey(hwndSAS, IDHK_WIN_L, MOD_WIN, 'L');
1265+
if (!Session->LockWkStaHotkey)
1266+
WARN("WL: Unable to register Win+L hotkey\n");
1267+
1268+
/* Register Win+U "Accessibility Utility" hotkey (optional) */
1269+
Session->UtilManHotkey = RegisterHotKey(hwndSAS, IDHK_WIN_U, MOD_WIN, 'U');
1270+
if (!Session->UtilManHotkey)
1271+
WARN("WL: Unable to register Win+U hotkey\n");
1272+
12601273
return TRUE;
12611274
}
12621275

@@ -1266,11 +1279,17 @@ UnregisterHotKeys(
12661279
IN PWLSESSION Session,
12671280
IN HWND hwndSAS)
12681281
{
1269-
/* Unregister hotkeys */
1270-
UnregisterHotKey(hwndSAS, HK_CTRL_ALT_DEL);
1282+
/* Unregister the hotkeys */
1283+
UnregisterHotKey(hwndSAS, IDHK_CTRL_ALT_DEL);
12711284

12721285
if (Session->TaskManHotkey)
1273-
UnregisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC);
1286+
UnregisterHotKey(hwndSAS, IDHK_CTRL_SHIFT_ESC);
1287+
1288+
if (Session->LockWkStaHotkey)
1289+
UnregisterHotKey(hwndSAS, IDHK_WIN_L);
1290+
1291+
if (Session->UtilManHotkey)
1292+
UnregisterHotKey(hwndSAS, IDHK_WIN_U);
12741293

12751294
return TRUE;
12761295
}
@@ -1326,23 +1345,35 @@ SASWindowProc(
13261345
{
13271346
case WM_HOTKEY:
13281347
{
1329-
switch (lParam)
1348+
switch (wParam)
13301349
{
1331-
case MAKELONG(MOD_CONTROL | MOD_ALT, VK_DELETE):
1350+
case IDHK_CTRL_ALT_DEL:
13321351
{
13331352
TRACE("SAS: CONTROL+ALT+DELETE\n");
13341353
if (!Session->Gina.UseCtrlAltDelete)
13351354
break;
13361355
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_CTRL_ALT_DEL, 0);
13371356
return TRUE;
13381357
}
1339-
case MAKELONG(MOD_CONTROL | MOD_SHIFT, VK_ESCAPE):
1358+
case IDHK_CTRL_SHIFT_ESC:
13401359
{
13411360
TRACE("SAS: CONTROL+SHIFT+ESCAPE\n");
13421361
if (Session->LogonState == STATE_LOGGED_ON)
13431362
DoGenericAction(Session, WLX_SAS_ACTION_TASKLIST);
13441363
return TRUE;
13451364
}
1365+
case IDHK_WIN_L:
1366+
{
1367+
TRACE("SAS: WIN+L\n");
1368+
PostMessageW(Session->SASWindow, WM_LOGONNOTIFY, LN_LOCK_WORKSTATION, 0);
1369+
return TRUE;
1370+
}
1371+
case IDHK_WIN_U:
1372+
{
1373+
TRACE("SAS: WIN+U\n");
1374+
// PostMessageW(Session->SASWindow, WM_LOGONNOTIFY, LN_ACCESSIBILITY, 0);
1375+
return TRUE;
1376+
}
13461377
}
13471378
break;
13481379
}
@@ -1397,6 +1428,13 @@ SASWindowProc(
13971428
DispatchSAS(Session, WLX_SAS_TYPE_SCRNSVR_TIMEOUT);
13981429
break;
13991430
}
1431+
#if 0
1432+
case LN_ACCESSIBILITY:
1433+
{
1434+
ERR("LN_ACCESSIBILITY(lParam = %lu)\n", lParam);
1435+
break;
1436+
}
1437+
#endif
14001438
case LN_LOCK_WORKSTATION:
14011439
{
14021440
DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);

base/system/winlogon/winlogon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ typedef struct _WLSESSION
223223
DWORD SASAction;
224224
BOOL SuppressStatus;
225225
BOOL TaskManHotkey;
226+
BOOL LockWkStaHotkey;
227+
BOOL UtilManHotkey;
226228
HWND SASWindow;
227229
HWINSTA InteractiveWindowStation;
228230
LPWSTR InteractiveWindowStationName;

0 commit comments

Comments
 (0)