• Expect for Windows

    From saito@saitology9@gmail.com to comp.lang.tcl on Thu Jul 3 13:35:39 2025
    From Newsgroup: comp.lang.tcl

    Is Expect available at all for Windows? If not, is there any way to
    build it on Windows? I am almost certain that Activestate used to have
    it in their Tcl version at one point so it seems technically possible.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Sun Aug 10 18:39:39 2025
    From Newsgroup: comp.lang.tcl

    On 7/3/2025 10:35 AM, saito wrote:
    Is Expect available at all for Windows? If not, is there any way to
    build it on Windows?  I am almost certain that Activestate used to have
    it in their Tcl version at one point so it seems technically possible.



    It won't build 64-bit due to forced executable code that doesn't have an equivalent for 64. It's evil anyways and triggers security problems on protected system executables. IOW, E4W behaves like a virus. It needs
    to be reworked to replace the debugger method to use something called
    Detours.

    https://github.com/microsoft/Detours
    https://github.com/davygrvy/expect4win

    https://github.com/davygrvy/expect4win/blob/47859c05d05c6c624517dac1552316d448e864b4/win/expWinConsoleDebugger.hpp#L208

    The evil stuff starts here: https://github.com/davygrvy/expect4win/blob/47859c05d05c6c624517dac1552316d448e864b4/win/expWinConsoleDebugger.cpp#L662

    All the breakpoints should be detours instead that would end-up doing
    the same. It can be done by something with some code Fu. This isn't me anymore. Maybe one day when I relearn how to code. It is on my list.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Aug 11 08:40:13 2025
    From Newsgroup: comp.lang.tcl

    Dear David,
    thanks for the great answer.
    Is expect a candidate for the orphaned repository?
    Ashok already works 25 hours per day on Tcl, but this might be
    interesting for him. Are you ready to support?

    Thanks for all,
    Harald

    Am 11.08.2025 um 03:39 schrieb David Gravereaux:
    On 7/3/2025 10:35 AM, saito wrote:
    Is Expect available at all for Windows? If not, is there any way to
    build it on Windows?  I am almost certain that Activestate used to
    have it in their Tcl version at one point so it seems technically
    possible.



    It won't build 64-bit due to forced executable code that doesn't have an equivalent for 64.  It's evil anyways and triggers security problems on protected system executables.  IOW, E4W behaves like a virus.  It needs
    to be reworked to replace the debugger method to use something called Detours.

    https://github.com/microsoft/Detours
    https://github.com/davygrvy/expect4win

    https://github.com/davygrvy/expect4win/ blob/47859c05d05c6c624517dac1552316d448e864b4/win/ expWinConsoleDebugger.hpp#L208

    The evil stuff starts here:
    https://github.com/davygrvy/expect4win/ blob/47859c05d05c6c624517dac1552316d448e864b4/win/ expWinConsoleDebugger.cpp#L662

    All the breakpoints should be detours instead that would end-up doing
    the same.  It can be done by something with some code Fu.  This isn't me anymore.  Maybe one day when I relearn how to code.  It is on my list.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Tue Aug 12 04:16:32 2025
    From Newsgroup: comp.lang.tcl

    On 8/10/2025 11:40 PM, Harald Oehlmann wrote:
    Dear David,
    thanks for the great answer.
    Is expect a candidate for the orphaned repository?
    Ashok already works 25 hours per day on Tcl, but this might be
    interesting for him. Are you ready to support?

    The best I can do, for now, is to point a willful C++ coder in the right direction. The breakpoint trap method and detours do essentially the
    same thing.

    Start here https://github.com/davygrvy/expect4win/blob/47859c05d05c6c624517dac1552316d448e864b4/win/expWinSpawnChan.cpp#L110

    Make a new class that also derives from ConsoleDebuggerCallback similar
    to ConsoleDebugger but uses Detours to do the same work. One wouldn't
    need to destroy the existing code. Just add some compile-time macros. Something like:

    #ifndef USE_DETOURS
    debugger = new ConsoleDebugger(cmdline, env, dir, show, injPath,
    outLL, errLL, readyUp, *this);
    #else
    debugger = new ConsoleDetourDbgr(cmdline, env, dir, show, injPath,
    outLL, errLL, readyUp, *this);
    #endif


    Now fill in the responsibilities of the new ConsoleDetourDbgr class
    according to the template.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Tue Aug 12 04:35:36 2025
    From Newsgroup: comp.lang.tcl

    On 8/12/2025 2:16 AM, David Gravereaux wrote:
    according to the template

    Not templated enough from base classes though, sorry. It will be work
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Tue Aug 12 14:33:07 2025
    From Newsgroup: comp.lang.tcl

    On 8/10/2025 9:39 PM, David Gravereaux wrote:

    It won't build 64-bit due to forced executable code that doesn't have an equivalent for 64.  It's evil anyways and triggers security problems on protected system executables.  IOW, E4W behaves like a virus.  It needs
    to be reworked to replace the debugger method to use something called Detours.

    ...

    All the breakpoints should be detours instead that would end-up doing
    the same.  It can be done by something with some code Fu.  This isn't me anymore.  Maybe one day when I relearn how to code.  It is on my list.

    Hi,

    I had seen your name mentioned in AS documents pertaining to Expect. I
    am glad you are working on a new version. If it builds for 32bit, that
    is fine. I am confused though: is it in a finished or usable state now?
    I saw your later comments laying out some of the future work which added
    to my confusion.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Helmut Giese@hgiese@ratiosoft.com to comp.lang.tcl on Tue Aug 12 22:35:50 2025
    From Newsgroup: comp.lang.tcl

    Hi saito,
    On 8/10/2025 9:39 PM, David Gravereaux wrote:

    It won't build 64-bit due to forced executable code that doesn't have an
    equivalent for 64.  It's evil anyways and triggers security problems on
    protected system executables.  IOW, E4W behaves like a virus.  It needs

    Hi,

    I had seen your name mentioned in AS documents pertaining to Expect. I
    am glad you are working on a new version. If it builds for 32bit, that
    is fine. I am confused though: is it in a finished or usable state now?
    I saw your later comments laying out some of the future work which added
    to my confusion.

    I am afraid you misunderstood David. In the posting you cite above it
    says near (or practically at) the end
    This isn't me anymore.
    Sorry
    Helmut
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Tue Aug 12 19:01:09 2025
    From Newsgroup: comp.lang.tcl

    On 8/12/2025 1:33 PM, saito wrote:

    I had seen your name mentioned in AS documents pertaining to Expect.  I
    am glad you are working on a new version. If it builds for 32bit, that
    is fine. I am confused though: is it in a finished or usable state now?
    I saw your later comments laying out some of the future work which added
    to my confusion.

    What is on my github is the old original code from about 2003 plus fixes
    that AS maintained. It had worked on XP then. It does not work now.
    I'm busy with other stuff, that isn't programming. I know what needs to
    be done, but I'm not much of a coder these days due to health issues. I
    might get to it once I relearn C++. Use it or lose it is no joke.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Tue Aug 12 21:58:05 2025
    From Newsgroup: comp.lang.tcl

    On 8/12/2025 8:01 PM, David Gravereaux wrote:
    On 8/12/2025 1:33 PM, saito wrote:

    What is on my github is the old original code from about 2003 plus fixes that AS maintained.  It had worked on XP then.  It does not work now.
    I'm busy with other stuff, that isn't programming.  I know what needs to
    be done, but I'm not much of a coder these days due to health issues.  I might get to it once I relearn C++.  Use it or lose it is no joke.

    No worries and best wishes! That is what I thought you were saying as well.

    In any case, Expect seemed like an interesting choice at the time when I posted about it but it turned out to be a no-go solution. No big deal.



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Wed Aug 13 16:28:07 2025
    From Newsgroup: comp.lang.tcl

    Harald,

    Yes, E4W is orphaned. I don't have the focus. I see the forest, but
    not the trees. Add the injector.dll to the spawned process with this.
    All security issues are fixed using the Detours API. The trampoline
    functions will be similar to the breakpoints (ConsoleDebugger::On*)

    https://github.com/microsoft/Detours/wiki/DetourCreateProcessWithDlls
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Wed Aug 13 17:57:56 2025
    From Newsgroup: comp.lang.tcl

    On 8/13/2025 4:28 PM, David Gravereaux wrote:
    The trampoline functions will be similar to the breakpoints (ConsoleDebugger::On*)


    Wow, no.

    There is a huge architecture shift going on with Detours. The
    trampoline functions are run in the slave's process (the hooks/traps
    would be part of injector.dll) not just a thread processing breakpoints
    in the host like my work. This will make [interact] an even further
    away feature and more like Gordon's original code that converted calls
    like FillConsoleOutputCharacter into a stream with VT100 escape
    sequences. It would be more like a unix tty, though. I'd have to add
    another mailboxed IPC stream but going from injector into expect for the [read] direction. VT100 escape sequences would then have to be decoded
    into Console API calls to emulate [interact].

    This is too heavy of a lift for me.

    Maybe I could just read through the Detours source and come up with
    better clues how to force-load dlls that won't trigger DEP?

    https://github.com/microsoft/Detours/blob/main/src/uimports.cpp#L17

    Detours goes directly to the import table. I can't grok this ;) I'm
    done. This is too beyond me.


    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Wed Aug 13 19:35:41 2025
    From Newsgroup: comp.lang.tcl

    On 8/13/2025 4:28 PM, David Gravereaux wrote:
    Harald,

    Yes, E4W is orphaned.  I don't have the focus.  I see the forest, but
    not the trees.  Add the injector.dll to the spawned process with this.
    All security issues are fixed using the Detours API.  The trampoline functions will be similar to the breakpoints (ConsoleDebugger::On*)

    https://github.com/microsoft/Detours/wiki/DetourCreateProcessWithDlls


    Maybe, just maybe only replace CreateProcess with
    DetourCreateProcessWithDlls keeping DEBUG_PROCESS and not load any
    trampolines and keep doing things with the system debugger as is for the
    least modifying?

    https://github.com/davygrvy/expect4win/blob/47859c05d05c6c624517dac1552316d448e864b4/win/expWinConsoleDebugger.cpp#L347

    I also see that Jeff Hobbs turned on [interact]. I was scared. I
    wonder if it works?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Thu Aug 14 09:30:40 2025
    From Newsgroup: comp.lang.tcl

    Am 14.08.2025 um 02:35 schrieb David Gravereaux:
    On 8/13/2025 4:28 PM, David Gravereaux wrote:
    Harald,

    Yes, E4W is orphaned.  I don't have the focus.  I see the forest, but
    not the trees.  Add the injector.dll to the spawned process with this.
    All security issues are fixed using the Detours API.  The trampoline
    functions will be similar to the breakpoints (ConsoleDebugger::On*)

    https://github.com/microsoft/Detours/wiki/DetourCreateProcessWithDlls


    Maybe, just maybe only replace CreateProcess with DetourCreateProcessWithDlls keeping DEBUG_PROCESS and not load any trampolines and keep doing things with the system debugger as is for the least modifying?

    https://github.com/davygrvy/expect4win/ blob/47859c05d05c6c624517dac1552316d448e864b4/win/ expWinConsoleDebugger.cpp#L347

    I also see that Jeff Hobbs turned on [interact].  I was scared.  I
    wonder if it works?

    David,
    thanks for all your information and work.
    My compassion for your health situation.
    I will personally not invest in Expect for Windows.
    No maintainer, no action...
    Thanks for all,
    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@davygrvy@pobox.com to comp.lang.tcl on Thu Aug 14 03:01:11 2025
    From Newsgroup: comp.lang.tcl

    On 8/14/2025 2:30 AM, Harald Oehlmann wrote:
    I will personally not invest in Expect for Windows.

    I might get a successful build in few days. Watch this space.
    Debuggers work different on WIN64, I'm fighting that now.

    Everything is different with GetThreadContext() and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-context
    --- Synchronet 3.21a-Linux NewsLink 1.2