05/25/03 - CAPOUT: Capture stdout

The idea here is to capture stdout output to a buffer and return it to VEE as
a string array.

Ok, I took the code from the SDK and modified it a little. There's no stdin
redirection any more but the rest is still basically the same. My next trick
is to make the read buffer dynamic, and then to parse the read buffer to get
rid of the \r\n on every line. Actually, I should take a look at the memory.
The debugger was showing the whole buffer so I'm not sure what the eol is.

Ok. I decided not to parse out the eol. Converting to dll code now, and I need
to get the command processor and get the command line together.

Fascinating. It only works from a console.

Kick ass. It all works fine, and you can't even see the console pop up. So I
put the dll code in the program and it's ready to go. This is good. I've
wanted this for a long time.

05/26/03

Ok, I'm quitting for now, but here's the cheese: I shouldn't have converted it
to use vee's input buffer. It's the VEE tokenizing that's taking so long, not
the pipe operations. I might be able to do better with vdc. Also, I need a
reliable way to dtermine when the damn thing is done. Sometimes I get one line,
sometimes I get almost the whole listing.

WaitForInputIdle won't do and I don't have a clue.

05/28/03

Ok, so it's some goofy deadlock deal. If the pipe buffer is too small to
fully contain the command output, the pipe stalls. The parent thread is
waiting on the child thread, and that's waiting on the parent thread to
start reading from the pipe. Ain't gonna work.

No, actually the waits don't work at all. Ok. What about a huge pipe and a
huge chunk size? Nope. Don't have a clue. Ok, the way to fix it is to use a
really small chunk size - like 16-bytes. God, that sucks. But it's the only
way to get the auto-alertable to work. If I could use the pipe asynchronously
it wouldn't be a problem, but I can't. I *could* do the reading as an APC
routine, but I'd have to make the thing multi-threaded to do that so screw it.

So there it is. We call ReadFile and HeapReAlloc a billion times too many,
but in order to get the pipe to do it's thing that's what has to happen.