<rant>
While working on std.process, I have developed a deep and intense loathing for Windows process handling in particular, and the Win32 API in general.
On Windows XP, what do you think will happen when you run the following program?
int main()
{
if (TerminateProcess(INVALID_HANDLE_VALUE, 123))
{
writeln("TerminateProcess succeeded, but it shouldn't have...");
return 1;
}
else
{
writeln("TerminateProcess failed, as it should.");
return 0;
}
}
As you may already have guessed, it does *not* print "TerminateProcess failed" and exit with code 0.
But does it print "TerminateProcess succeeded" and exit with code 1? NO! It prints NOTHING and exits with code 123, because TerminateProcess() terminates the CURRENT process when it is passed INVALID_HANDLE_VALUE. Aaaaargh!
</rant>
Sorry, just had to get that off my chest. I just spent quite some time trying to figure out why the Win32 unittests were failing when there was no assert error or any other indication of what went wrong.