Commit 2887388
Delay-load user32 in sshd-auth to survive restricted window stations
sshd-auth runs as a privsep helper under a different user with no
desktop/window-station access. user32's DllMain binds to the process
window station and fails with STATUS_DLL_INIT_FAILED in restricted
environments like WinPE, crashing the helper before auth can run.
Add delayimp.lib and /DELAYLOAD:user32.dll so user32 is only loaded
when one of its APIs is actually called. sshd-auth's only transitive
user32 references come from console.c's ConRestoreViewRect_NoPtyHack
(ShowWindow / GetWindowPlacement), which sshd-auth never executes,
so in practice user32 is never loaded at all.
The ItemDefinitionGroup carrying /DELAYLOAD is placed after
Microsoft.Cpp.props, where the Link item type becomes defined.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4a2ccb8 commit 2887388
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
4 | 18 | | |
5 | 19 | | |
6 | 20 | | |
| |||
112 | 126 | | |
113 | 127 | | |
114 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
115 | 134 | | |
116 | 135 | | |
117 | 136 | | |
| |||
0 commit comments