Click to See Complete Forum and Search --> : ShellExecuteEx
r-22
January 22nd, 2003, 01:52 PM
I want to ShellExecuteEx the program cmd.exe on my system with my own program and have it redirect all input and output form cmd.exe to my application instead for processing and displaying. Is this possible with ShellExecuteEx and if so, what do I need to do or read about to learn how to do this?
graphicsMan
January 22nd, 2003, 02:21 PM
In unix-like OSs, you can use pipes to detirmine what the STDIN and STDOUT filestreams actually point to... try looking into pipes for win32...
Brian
r-22
January 22nd, 2003, 05:25 PM
well that helps, im going to go look on MSDN for some more information on that, i found _pipe() and _spawnvp() and some sample source for doing exactly what i want with a single application, what im trying to do is make a pseudo telnetd that all i have is a check for login/pass, open sockets for listening and i/o and pipe everything to and from cmd.exe or command.com
windows 98 did not have a built in telnetd and i didnt like the windows nt one so i wanted one of my own that i had the source for that would have the same type of interface as far as the user is concerned for either type of os
any other help or ideas would be greatly appreciated
graphicsMan
January 22nd, 2003, 06:20 PM
I actually don't know very much about low level windows programming... but on unix, if you use the shell to execute a command, you can't get ahold of the processes information... in other words, the process isn't your child process.
In order to have a process which "belongs" to you (in unix, remember), you have to exec the process (use fork and exec).
In addition, pipes aren't exactly the friendliest little beasties...
What are you using the shell execution for? Isn't it possible to just write a console app called telnetd?
Lastly, why are you using telnet? The telnet protocol is old and sucky and insecure :( (Though of course, it may just be a project you are writing for fun?)
Brian
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.