This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DOS programs under "screen"

On Fri, May 01, 2009 at 08:26:31PM +0100, Andy Koppe wrote:
>2009/4/21 Barry Kelly:
>> Windows implements console mode as a client-server protocol between the
>> executable (ntvdm.exe for DOS apps) and winsrv.dll (hosted in
>> csrss.exe), but the protocol isn't easily hookable. I guess one would
>> have to hijack the console APIs, perhaps by stepping into the
>> application using debugging APIs and overwriting the DLL imports, but it
>> would be pretty painful.
>Hi Barry, have you got any pointers to documentation or reverse
>engineering attempts for that console protocol?
>2009/4/21 Christopher Faylor:
>>It can be done using the same technique as Console2:
>I don't understand how.  ReadConsoleOutput() on the hidden console only
>gives you the cooked output in terms of character cell contents and
>attributes, whereas the raw output as it came from the console app
>would need to be sent to the pty to be displayed by the likes of

If you can get the character cell contents and attributes and you can
push data into the consoles input buffer then, AFAIK, that's really all
you need to create a pty.  You can see that Console is doing something
like that because of the barely noticeable lag when you type things.
Obviously it's sending things back and forth between a hidden console
and displaying what it receives on the screen.

(You can also see it doing this in the source code if you are so inclined)

What would probably be problematic would be accommodating programs which
try to manipulate console attributes since a "pty" program would need to
maintain strict control of the hidden console.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]