* CompareObjectHandles is a documented API, and presumably it could be
faster. The tests actually do run a little faster now on Win10,
dropping from 6.5sec to 3.6sec or so.
* Also make the NtQuerySystemInformation buffer static so we don't have to
repeat the double-buffer-in-a-loop process on every ntHandlePointer
call.
* The read end of a pipe is translated to NULL by the special
bInheritHandles=FALSE, no-STARTF_USESTDHANDLES inheritance mode. The
write end of the pipe works fine.
* Passing bInheritHandles=TRUE with an inheritable pipe handle fixes it.
Adding STARTF_USESTDHANDLES to this also works.
* To version detect 8.1, we need GetVersionEx to return something greater
than Windows 8, which requires creating an app manifest. For now at
least, put the manifest XML next to the EXE. It can be built into the
EXE, but this is good enough (at least for now).
* Add Test_CreateProcess_SpecialInherit
* Add traditional Test_HandleDuplication
* Make handle.dup() use a GetCurrentProcess() target while
handle.dup(handle.worker()) uses a non-pseudo handle.
* Allow creating a RemoteWorker object without spawning a new worker.
It can be used like so:
{
Worker w(Worker::DoNotSpawn);
if (...) {
w = ...;
} else {
w = ...;
}
}
* Remove the weird RemoteWorker(std::string) ctor. The computation of the
worker name should be inside the ctor.
* It now becomes possible to initialize a RemoteWorker using syntax like:
Worker w({ true, 0 });
However, these are still ambiguous:
Worker w({}) // could be move-init from a default-init Worker
Worker w({1}) // could be move-init from a Worker(SpawnParams{1})
* Make the Event ctor explicit. The SpawnParams ctor needs to be
non-explicit so it can be used with the braced initializer list.
* Add Test_Active_ScreenBuffer_Order
* Add Test_GetStdHandle_SetStdHandle
* Also test a STARTF_USESTDHANDLES process in
Test_Detach_Does_Not_Change_Standard_Handles.
* Test combos of CREATE_NEW_CONSOLE, DETACHED_PROCESS, CREATE_NO_WINDOW.
* Test use of PROC_THREAD_ATTRIBUTE_HANDLE_LIST. It cannot be used with
GetCurrentProcess(), but it also can't be used with traditional
console handles.
* Prefer nullptr over INVALID_HANDLE_VALUE. Change ntHandlePointer.
* Also add a public Worker::exit() for killing workers more conveniently.
* Previously, a Worker was either:
(1) fully initialized and running (m_valid==true), or
(2) moved out of (m_valid==false)
Now RemoteWorker::trySpawn() can return an invalid RemoteWorker object.
* TestCommon.h is a convenience header for the test cases. It aliases
Remote{Worker,Handle} back to {Worker,Handle}, and it includes many
basic C/C++ headers, as well as the parts of the harness suitable for
test cases.
* I'm still going to try to include what is used in each module.
* At some point, I should implement these in the main project. It will
need more testing on the various compilers. It really needs to be
on-by-default everywhere. If it's off, then at least pch.h should be
included everywhere, to minimize configuration differences between my
checkout and other people's checkouts.
* There should be some way to configure it off to check whether includes
are correct.
* The change reduces build times from 27.6s to 15.2s on a single-core VM.
* The files in the repo are natively LF.
* These days, I'm using Cygwin git, which is creating a checkout full of
LF files.
* I think this .gitattributes file will instruct git to use the default
line ending for almost all the files. I'm forcing LF on shell scripts,
because Cygwin/MSYS chokes on CRLF shell scripts.
* For my Cygwin git checkouts, the default is LF. I'll get a warning if
I try to checkin an CRLF file, but that's OK.
* Instead of reading the output line-by-line, figure out what lines we
need ahead-of-time and issue as few read calls as possible. On Windows
8 and up, we issue just one read call. On earlier versions, we avoid
reading more than a certain amount.
* This change reduces the CPU usage. e.g. In my Windows 10 VM, the idle
CPU usage of winpty-agent.exe+conhost.exe combined, with an empty
console, dropped from ~3.6% to ~1.4%. In a Windows 7 VM, I measured a
reduction of CPU from ~1.6% to 0.6%.
* Increase the MAX_CONSOLE_WIDTH from 500 to 2500. The limiting factor
now is that LargeConsoleRead reads at least one line at a line, but we
don't want to read more than 2500 characters in one call on old operating
systems.
* Fix the attribute handling in scanForDirtyLines. (The assignment to
newAttr was dead.)
The 2500 limit is arbitrary and could probably be increased. The actual
hard limit depends on the OS and is around 17000. My understanding is that
the limit is based upon the need to allocate I/O buffers within a shared
64KiB heap, and I'm worried about heap fragmentation. I know that 2500
is safe, because winpty has been issuing reads of almost 3000 characters
already to find the sync marker.
Fixes https://github.com/rprichard/winpty/issues/44