Add support for the DECRQCRA checksum report#14989
Merged
DHowett merged 5 commits intomicrosoft:mainfrom Mar 14, 2023
Merged
Conversation
Collaborator
Author
|
Not sure if the build is failing is because I've done something wrong with the feature flag configuration, or it's just one of the usual CI failures. But as far as I can see, it's complaining about a circular dependency in TerminalAzBridge.vcxproj, which I don't think is related to anything I've changed. |
Member
|
Yea that looked like another #14581 hit to me. Weird that it hit there, but 🤷 |
zadjii-msft
approved these changes
Mar 14, 2023
Member
zadjii-msft
left a comment
There was a problem hiding this comment.
I think it's really impressive how this all came together. More than happy to check this in as a debugging tool
DHowett
added a commit
that referenced
this pull request
Dec 2, 2025
Support for DECRQCRA Request Checksum of Rectangular Area was added in #14989, but left disabled at build time because it could be considered a security risk. In #17895, we unconditionally added it to Terminal's settings UI. For users on Stable and Preview, it didn't actually enable anything. Whoops. Since we have a way to turn it off (and in so doing, mitigate the risk) in Terminal, it's high time for us to remove the feature gating. Conhost doesn't support turning it off for now and so conhost can still have it compiled out, as a treat.
DHowett
added a commit
that referenced
this pull request
Dec 2, 2025
Support for DECRQCRA Request Checksum of Rectangular Area was added in #14989, but left disabled at build time because it could be considered a security risk. In #17895, we unconditionally added a toggle for it to Terminal's settings UI and settings schema (`compatibility.allowDECRQCRA`). For users on Stable and Preview, it didn't actually enable anything. Whoops. Since we have a way to turn it off (and in so doing, mitigate the risk) in Terminal, it's high time for us to remove the feature gating. Conhost doesn't support turning it off for now and so conhost can still have it compiled out, as a treat.
DHowett
added a commit
that referenced
this pull request
Dec 9, 2025
Support for DECRQCRA Request Checksum of Rectangular Area was added in #14989, but left disabled at build time because it could be considered a security risk. In #17895, we unconditionally added a toggle for it to Terminal's settings UI and settings schema (`compatibility.allowDECRQCRA`). For users on Stable and Preview, it didn't actually enable anything. Whoops. Since we have a way to turn it off (and in so doing, mitigate the risk) in Terminal, it's high time for us to remove the feature gating. Conhost doesn't support turning it off for now and so conhost can still have it compiled out, as a treat. (cherry picked from commit 3e29d2a) Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiA9JY Service-Version: 1.24
DHowett
added a commit
that referenced
this pull request
Dec 9, 2025
Support for DECRQCRA Request Checksum of Rectangular Area was added in #14989, but left disabled at build time because it could be considered a security risk. In #17895, we unconditionally added a toggle for it to Terminal's settings UI and settings schema (`compatibility.allowDECRQCRA`). For users on Stable and Preview, it didn't actually enable anything. Whoops. Since we have a way to turn it off (and in so doing, mitigate the risk) in Terminal, it's high time for us to remove the feature gating. Conhost doesn't support turning it off for now and so conhost can still have it compiled out, as a treat. (cherry picked from commit 3e29d2a) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgiA9Jg Service-Version: 1.23
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.
This PR implements the
DECRQCRAescape sequence, which lets yourequest a checksum of a portion of the screen. This is most useful in
automated testing to verify that the generated screen content is what it
was expected to be.
For now this functionality is gated behind a feature flag which is only
enabled for dev builds.
Detailed Description of the Pull Request / Additional comments
I've done my best to match the DEC checksum algorithm as closely as
possible, which we've determined by testing on a real VT525 terminal
(many thanks to @al20878 for that).
The checksum is an unsigned 16-bit value that starts off at zero, and
from which you then subtract the ordinal value of every character in the
selected range. It's also affected by the rendition attributes in the
selected cells.
I should note that our ordinal calculation only matches DEC for the
characters in the ASCII and Latin-1 range, because the original
algorithm predates Unicode. If we want to support the other character
sets correctly we'll need custom mapping tables, but I didn't think that
was essential for now.
It's also worth mentioning that we don't handle "empty" cells correctly,
but that's not the fault of the checksum calculation - it's just that
our default fill character is a space rather than a
NUL.Validation Steps Performed
I've manually compared our implementation against the tests results that
@al20878 got from the VT525, and confirmed that we match as well as was
expected (i.e. taking into account the limitations mentioned above).
I've also added a few basic unit tests that verify we're generating the
expected checksums for the various renditions and color attributes.
Closes #14974