The Windows Driver documentation says that a the iUniq field in a SURFOBJ can be used to determine if a surface has not changed and that the driver can used cached information to re-render the surface. I assume that if my driver is called with a SURFOBJ that has the same hsurf and iUniq values, the pixels of the SURFOBJ have not changed. Additionally, the documentation says that if the iUniq value is zero, the SURFOBJ pixels should not be cached.
While that all does seem to be true, I wonder if it's actually too stringent? When following this rubric, the only surface I see being cached is the desktop background. Icons on the desktop all have iUniq values of 0 (maybe because the background behind them and what they're being combined with is changing). Application buttons usually have an iUniq of zero or the number is always increasing, indicating they can't be reused.
With Windows Terminal Services and the Remote Desktop Connection client, the Start Menu, scroll bars, and other window decorations are all cached. Is there a way to get normal GDI to give the same information?