Repository navigation
Exclude Strongbox's clipboard writes from Windows Clipboard History / cloud sync - #32
Merged
Merged
Conversation
…loud sync reveal's copy-to-clipboard (and any other real-value clipboard write) now goes through a P/Invoke Win32 clipboard write that additionally sets the two clipboard formats Windows documents for opting a write out of Clipboard History (Win+V) and cloud clipboard sync - Set-Clipboard has no way to set those. Clearing to an empty string (the auto-clear job, and set --from-clipboard's post-ingest clear) stays on plain Set-Clipboard, since there's nothing to protect there. Closes #29. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh
…up cost - Check GlobalAlloc/GlobalLock/SetClipboardData return values instead of discarding them - a null pointer previously would have reached Marshal.Copy and crashed the process uncatchably - Free any GlobalAlloc'd block whose SetClipboardData call never succeeded, instead of leaking it (ownership only transfers on success) - Retry OpenClipboard a few times before giving up, matching Set-Clipboard's own tolerance for transient clipboard contention - Move the Add-Type compile behind a lazy Install-StrongboxWin32ClipboardType call, invoked only by the two code paths that actually write a real value, instead of unconditionally on every Windows invocation - Treat a failed history-exclusion flag write as a warning, not a failure of the whole clipboard write (the real value already succeeded by that point) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh
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.
Summary
reveal's copy) now go through a P/Invoke Win32 clipboard write (OpenClipboard/EmptyClipboard/SetClipboardData) that also registersCanIncludeInClipboardHistory/CanUploadToCloudClipboardas 0 (excluded) — Microsoft's documented format names for legacy apps to opt out of Clipboard History and cloud clipboard syncSet-Clipboard(nothing to protect there), so the auto-clear ThreadJob doesn't need the P/Invoke type re-declared in its init scriptTest plan
Invoke-Pester -Path Tests/Strongbox.Tests.ps1— 43 passed, 1 pre-existing skipInvoke-Pester -Path Tests/Strongbox.Cli.Tests.ps1— 18/18 passedstrongbox reveal tools.StrongboxSelfTestthenGet-Clipboard -Rawround-trips the correct value via the new P/Invoke pathClipboard.IsHistoryEnabled()/history API first — that type failed to load from thispwshprocess (Unable to find type [...ContentType=WindowsRuntime]), which is exactly the WinRT-from-unpackaged-process reliability gap the plan flagged as the reason to use P/Invoke instead ofSetContentWithOptionsas primary. No way to verify the history-exclusion outcome itself without a human checking Win+V.Closes #29.
🤖 Generated with Claude Code
https://claude.ai/code/session_01RbfuHLCmCUaTFi6A1gKugh