-
Notifications
You must be signed in to change notification settings - Fork 52
Fix WOF handle access and DeviceIoControl error handling - #100
Open
wefalltomorrow wants to merge 1 commit into
Open
Fix WOF handle access and DeviceIoControl error handling #100wefalltomorrow wants to merge 1 commit into
wefalltomorrow wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fix the low-level WOF compression/decompression calls so Win32 return values and errors are handled correctly.
Changes
Treat DeviceIoControl as returning a Win32 BOOL, rather than passing its result to SUCCEEDED() as though it were an HRESULT.
Read the actual Win32 error with last_os_error() when DeviceIoControl fails.
Continue treating ERROR_COMPRESSION_NOT_BENEFICIAL as a normal no-benefit result rather than a hard error.
Open WOF targets with FILE_READ_DATA | FILE_WRITE_ATTRIBUTES, which are the access rights required by these WOF operations.
Apply the same corrected BOOL handling to removal of external backing.
These fixes are already used in my maintained fork and are included in v0.11.2:
https://github.com/wefalltomorrow/Compactor/releases/tag/v0.11.2
I’m splitting the fork improvements into focused upstream PRs rather than submitting the full fork diff at once; this PR is intentionally limited to the low-level WOF path.