dllinject: Track actual attribute writes instead of the requesting flag #500
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opening a file with the
FILE_WRITE_ATTRIBUTES
access right merely requests write access to attributes, and does not constitute a write in itself.In particular, this caused a problem with MS-DOS Player, which needs to open every file with
FILE_WRITE_ATTRIBUTES
. DOS does not require such a flag for changing a file's mtime through a previously opened file handle, so an emulator needs to open every file with this flag just in case the emulated DOS process decides to change file times later.Using MS-DOS Player to run Turbo C++ 4.0 through Tup then caused this to happen:
None of these were actually written to or had their date changed.
Tup then does in fact delete all files from outside the source tree that MS-DOS Player loaded with
FILE_WRITE_ATTRIBUTES
. In this case, this removes the build tool's executable and any#include
d standard library headers, forcing you to either reinstall the build tool or recover the missing files from a backup. (Thankfully, write-protecting the compiler's directory prevents this from succeeding!)This change should still address the node.js use case that initially prompted the check for
FILE_WRITE_ATTRIBUTES
in c7160c8. I couldn't find a definitive list of everything that counts as "attributes", but it does seem to be limited to the timestamps and attribute bits covered by theFILE_BASIC_INFORMATION
structure.