Read the Dev Drive designation as volume flags, not as localized text - #112
Merged
Conversation
…d text The run decided whether the new Dev Drive was trusted by matching an English sentence in fsutil's output. That sentence is localized, so every successful run on a non-English Windows ended by handing the reader an answer it could not read and asking them to judge it. Windows carries the designation as two documented bits, readable through FSCTL_QUERY_PERSISTENT_VOLUME_STATE and unaffected by language. Measured on two scratch Dev Drives: a trusted one answers 0x6001, the same volume after untrust answers 0x2001, plain NTFS answers 0x0000, and the trusted bit follows fsutil's trust and untrust exactly. The read needs no administrator rights, and the forced dismount leaves no window: twenty reads fired straight after it all answered. fsutil is now asked for text only where that read itself fails, and in that path the report no longer turns a non-zero exit code into a verdict it has not established. A run whose format did not produce a Dev Drive at all is reported as such, and no longer ends with "All done" - a question nothing here could ask before. An earlier attempt at this concluded the flags read back as zero, and AGENTS.md and the plan recorded that no language-independent signal existed. That attempt used control code 141, found by sweeping numbers until one answered; the one wanted is 143. Corrected in both places. Closes #111 Closes #105 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #111
Closes #105
The run decided whether the new Dev Drive was trusted by matching an English sentence in
fsutil devdrv queryoutput. That sentence is localized, so on the German machine in #3 every successful run ended like this:Windows carries the designation as two documented bits instead:
Both come back from one
FSCTL_QUERY_PERSISTENT_VOLUME_STATEcall, and a bit has no language.What a run now prints
Two states the script could not tell apart before now have their own answers:
The last one is a question nothing here could ask before: a format that did not produce a Dev Drive passed unnoticed, and the run still ended "All done".
#105, which this also closes
The trust report used to call a non-zero exit code a failure while printing the volume saying otherwise. It now reads the volume and reports that.
fsutilis asked for text only where the flag read itself fails, and in that path the report states the exit code without turning it into a verdict.Reproduced live, on a scratch NTFS volume:
fsutil devdrv trust /freturned exit code 1, and the run named what was actually wrong rather than announcing a failure to mark it.Measured, on scratch
.vhdxvolumesFormat-Volume -DevDrive0x00006001fsutil devdrv untrust0x00002001fsutil devdrv trust /fagain0x000060010x00000000The trusted bit follows
trustanduntrustexactly. The read needs no administrator rights, while the per-volumefsutil devdrv querydoes.Three things must be right at once, and an earlier attempt had all three wrong — which is why
AGENTS.mdand the plan both recorded that no language-independent signal existed:\\?\X:\withFILE_FLAG_BACKUP_SEMANTICS. The raw device refuses this code.Versionmust be1, andFlagMaskmust be0xFFFFFFFF— a mask naming the two Dev Drive bits is refused outright on NTFS, which does not know them.AGENTS.mdandREADME.mdare corrected accordingly.Tested
794 Pester tests pass (786 before), analyzer clean, parse clean.
Eight deliberate breakages were run, each in its own process, and seven were caught: the control code back to the sweep number, the mask narrowed, the handle opened without backup semantics, a short answer trusted, the flags dropped from the report call, the Dev Drive bit no longer asked first,
fsutilasked unconditionally, and the run called done whatever the verdict. The one not caught is the short-answer guard, which cannot be reached from a real volume.Beyond the unit suite, the sequence itself was run on real volumes — the four functions lifted out of the syntax tree,
dev_drive.ps1never executed. The trust call force-dismounts the volume and the flag read follows with nothing in between; had that left a window, every real run would have fallen into the "could not read" path while the whole suite stayed green. Twenty reads fired back to back straight after the dismount, across two volumes, and every one answered. All three screens above are copied from that run.