简体   繁体   中英

AllocConsole() doesnt show up

I'm trying to inject a dll into a testprogam and use AllocConsole() for debugging.

AllocConsole();

However, the console wont show up and I realized that the program I was trying to inject is running under SYSTEM and I was using an administrator account so the console wont show up on my desktop. Only the conhost process was created.

So... How to make a console from AllocConsole() show up on every accounts desktop?

The program is running as SYSTEM so likely it's a service running in the services session (session 0). It's not possible to allocate a console and show it in another session (eg the console session). It's not possible for a process to have a window (or console) that is visible in all sessions or even on multiple desktops.

If you don't know what Session Isolation is best start reading here: Application Compatibility - Session 0 Isolation

If you want to output simple debugging, an easy method is using OutputDebugString (and use a tool like DbgView to read the output) or writing to the eventlog. For more detailed output you could setup a named pipe or some other inter processs communication.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM