ReadConsoleOutput fails with ERROR_ACCESS_DENIED across IL boundary #7547

Open
opened 2026-01-31 01:06:59 +00:00 by claunia · 0 comments
Owner

Originally created by @luke1961 on GitHub (Apr 22, 2020).

Environment:
Microsoft Windows [Version 10.0.18363.720]

Conhost:
Version 10.0.18362.1

Steps to reproduce:

  1. Make sure you are not using the 'legacy mode' or the problem will not occur
  2. Launch Program A on SYSTEM account with CREATE_NEW_CONSOLE flag
  3. Program A calls LogonUser, gets a token and then Uses CreateProcessAsUser to launch CMD.EXE for that user. CMD.EXE shares the same console with Program A.

Expected behavior:
Both Program A and processes running from CMD.exe should be able to use ReadConsoleOutput.

Actual behavior:
Processes running from CMD.exe get error 5 (access denied) but Process A can call the API without error.

Originally created by @luke1961 on GitHub (Apr 22, 2020). Environment: Microsoft Windows [Version 10.0.18363.720] Conhost: Version 10.0.18362.1 Steps to reproduce: 1. Make sure you are not using the 'legacy mode' or the problem will not occur 2. Launch Program A on SYSTEM account with CREATE_NEW_CONSOLE flag 3. Program A calls LogonUser, gets a token and then Uses CreateProcessAsUser to launch CMD.EXE for that user. CMD.EXE shares the same console with Program A. Expected behavior: Both Program A and processes running from CMD.exe should be able to use ReadConsoleOutput. Actual behavior: Processes running from CMD.exe get error 5 (access denied) but Process A can call the API without error.
claunia added the Product-ConhostResolution-By-DesignNeeds-Tag-Fix labels 2026-01-31 01:06:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7547