CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: ShellExecuteEx

  1. #1
    Join Date
    Jan 2003
    Posts
    2

    ShellExecuteEx

    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?

  2. #2
    Join Date
    Sep 2002
    Location
    Davis, CA
    Posts
    8
    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

  3. #3
    Join Date
    Jan 2003
    Posts
    2
    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

  4. #4
    Join Date
    Sep 2002
    Location
    Davis, CA
    Posts
    8
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured