Repository navigation
Conversation
flatstik
force-pushed
the
fix-1982-clear-keys-latch
branch
from
November 2, 2026 20:15
9739f99 to
2632683
Compare
… restart "Clear encryption keys from memory if a new device is inserted" can be disabled at any time without a restart: by unchecking it, by changing its registry value, or by stopping the VeraCrypt system service, which is what clears the keys. Someone at an unlocked machine can then connect a device without the keys being cleared. When the option is enabled, offer to also prevent it from being disabled until Windows restarts. The service then asks the driver to lock it, and the driver keeps this state until Windows restarts. While locked: - the service clears the keys on new device insertion whatever the registry value, and does not rebuild its list of known devices; - the service does not accept SERVICE_CONTROL_STOP. Setup already replaces a service that cannot be stopped when Windows restarts; it now also tells the running service that it is superseded, so that it does not reinstall its own, older boot loader until then; - the settings dialog shows the option as checked and disabled. The lock is requested after the other settings are saved; if it cannot be confirmed through the driver, an error is shown. This does not protect against an administrator, who can still terminate the service process. Fixes veracrypt#1982
flatstik
force-pushed
the
fix-1982-clear-keys-latch
branch
from
November 3, 2026 17:04
2632683 to
cc92bb5
Compare
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.
Fixes #1982.
"Clear encryption keys from memory if a new device is inserted" can be disabled at any time without a restart: by unchecking it, by changing its registry value, or by stopping the VeraCrypt system service, which is what clears the keys.
This PR offers, when the option is enabled, to also prevent it from being disabled until Windows restarts. The prompt defaults to No, so nothing changes for users who answer No.
NotifyServicepath, to lock the option. The service locks it in the driver with a new admin-only IOCTL; the driver keeps that state until Windows restarts. A second IOCTL reports the state.SERVICE_CONTROL_STOP;The Linux and macOS counterpart is in #1984.
Testing:
Ntdriver.c), Mount, Format, ExpandVolume, Setup and SetupDLL; no compiler warnings came from the changed files.Since I cannot test on Windows (or macOS), please feel free to merge this, close it, or take it as a basis for your own implementation, as you see fit.