Memory elimination
Why is the code so inconsistently formated?
It's full of things without spaces "if(" instead of "if (", or extra spaces "MoveFile( ... )" instead of "MoveFile(...)".
It's not even a different formating, it's even inconsistent with itself.
Why do you explicitly turn off wipe for boot build?
Does not work
Yes. Because it is never called.
Why to ignore it?
Because the value is read from the non-existent config.
That's what default values for in config.cpp.
Wipe of temporary files was done by rewind + write using a file descriptor before closing it. Because temporary files are created in Windows with the flag delete_on_close, and on POSIX unlink() called before closing the handle. Compressed temp files cannot be wiped. Rewind + write can not be used since after rewriting the compressed file its size will be changed and stored to other parts of the hard disk. Wipe of file through direct access to the disk will not work. Direct access to the disk has been limited starting with Windows Vista and Windows Server 2008. As a result, if the wipe of files is enabled the use of compressed temporary files are not allowed.
Compressed temp files cannot be wiped. Rewind + write can not be used since after rewriting the compressed file its size will be changed and stored to other parts of the hard disk.
May I ask for a proof from MSDN?..
At least here you can find description of the original problem. Encrypted and compressed files may consist of parts located in other places afer rewriting. https://technet.microsoft.com/en-gb/sysinternals/bb897443.aspx Starting with Vista+ MS prohibited such access. But we cannot find direct eplanation of it. The link has info about ability to run on Vista+ but the talk is exactly about Windows NT/2000's. We check and it seems that SDelete leave uncompressed files untouched. Probably it rewrites file parts but then override free'd space. I suggest to raise an exception for now in this case and make good comment. It could be improved later.
Does it make sense to care about such ancient operating systems? (I'm sure that our posix builds will not run on OS from previous century.)
I'd care about it if someone will really need it.
Why is it looping to wipe byte by byte? This should be done by preallocating three "static" pages: the first filled with 0x00, the second with 0xFF, and the third with random values. Then, write or copy them as a whole.