X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 1 May 2009 15:58:13 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: DOS programs under "screen" Message-ID: <20090501195813.GB24793@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <416096c60905011226j27e942bcrf7661fb1693b5df1 AT mail DOT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <416096c60905011226j27e942bcrf7661fb1693b5df1@mail.gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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: >> >>http://console.sourceforge.net > >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 >screen. 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. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/