KpyM Telnet/SSH Server - Forum
|Me again - edit.com and WriteConsole etc.
||Me again - edit.com and WriteConsole etc.
||Apr 28 2006 21:43
I know how to write a very simple telnet server, but I would like to implement the feature that you can start and use edit.com remotely. It has something to do with the "video memory"...
Can you give me a hint ? What do I have to do to make it work? Or how can i redirect all the output to the socket, even edit.com's.
Thx for answers..
||Apr 29 2006 10:25
Playing with 'edit.com' apps is little tricky
Actualy there are 2 problems
1) Sending input
2) Reading output
1) On how to send input to extermnal app, you can check my blog post [url=l0c41://www.kpym.com/blog/2005/12/srcsending-keyboard-input-to-external.html]"sending keyboard input to external application"[/url].
2) Reading console; edit.com writes output directly to "console memory", that's why you can't get its output using std handles. Instead you have to use the following "algorithm"
- You create the console process so that it uses the same console as the "telnet server" process using [url=l0c41://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp]CreateProcess[/url].
- Now get the std out handle of your "telnet server" process by calling [url=l0c41://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getstdhandle.asp]GetStdHandle[/url]. The handle you get can be used to read output of "edit.com" process too, because the two processes share the same console (remember the previous point)
- Having the output handle just use "low level" console function as [url=l0c41://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/readconsoleoutput.asp]ReadConsoleOutput[/url].
© 2007 - 2008 Kroum Grigorov