Expand description
Delayed clipboard rendering: know exactly when the target read the clipboard.
The “it pasted my previous clipboard” bug exists because the injector restores on a timer while the target reads the clipboard whenever its message pump gets round to it. Any fixed delay is a guess, and under load the guess is wrong. Tuning the delay upward — which is the shipped mitigation in every tool surveyed — only moves the threshold.
Delayed rendering removes the guess. Instead of publishing the text, publish a promise:
SetClipboardData(CF_UNICODETEXT, NULL) with this process as clipboard owner. Windows then
sends WM_RENDERFORMAT to the owner at the instant a consumer actually asks for the data, and
the owner supplies it then. That message is the “the target has read it” signal, so the
restore can be sequenced strictly after the read instead of racing it.
Requires a window with a running message pump, so this owns a hidden window on its own thread.
Structs§
- Offer
- A promise of text placed on the clipboard, not yet materialized.