1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Enable screen protection by default to block screenshots, recordings & Windows Recall. Add configurable setting in Preferences, Installer, and MSI.

This update introduces a screen protection mechanism that leverages the Windows Display Affinity API to prevent screen capture, screen recording, and inclusion in the Windows 11 Recall feature. By default, all VeraCrypt windows, menus, and tooltips are protected. Users can enable or disable this feature through a new setting available in the application Preferences, as well as in the installer and MSI configurations.

This enhances user privacy by mitigating potential leaks of sensitive interface content.

Note: Due to a regression in Windows 11 affecting layered windows, ComboBox dropdowns cannot currently be protected by this mechanism.
This commit is contained in:
Mounir IDRASSI
2025-05-24 15:28:39 +09:00
parent 44a9f8bcff
commit 9ea5ccc4aa
68 changed files with 691 additions and 40 deletions

View File

@@ -355,6 +355,8 @@ uint32 ReadServiceConfigurationFlags ();
uint32 ReadEncryptionThreadPoolFreeCpuCountLimit ();
BOOL ReadMemoryProtectionConfig ();
BOOL WriteMemoryProtectionConfig (BOOL bEnable);
BOOL ReadScreenProtectionConfig();
BOOL WriteScreenProtectionConfig(BOOL bEnable);
BOOL LoadSysEncSettings ();
int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm);
void RemoveNonSysInPlaceEncNotifications (void);
@@ -602,6 +604,9 @@ DWORD FastResizeFile (const wchar_t* filePath, __int64 fileSize);
void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed);
#endif
BOOL IsInternetConnected();
BOOL AttachProtectionToCurrentThread(HWND hwnd);
void DetachProtectionFromCurrentThread();
#if defined(SETUP) && !defined (PORTABLE)
typedef struct _SECURITY_INFO_BACKUP {
PSID pOrigOwner;
@@ -815,6 +820,27 @@ BOOL GetHibernateStatus (BOOL& bHibernateEnabled, BOOL& bHiberbootEnabled);
bool GetKbList (std::vector<std::wstring>& kbList);
bool OneOfKBsInstalled (const wchar_t* szKBs[], int count);
class ScreenCaptureBlocker
{
public:
ScreenCaptureBlocker(HWND hwnd = NULL)
: m_hwnd(hwnd), m_attached(false)
{
m_attached = AttachProtectionToCurrentThread(m_hwnd);
}
~ScreenCaptureBlocker()
{
if (m_attached)
DetachProtectionFromCurrentThread();
}
private:
HWND m_hwnd;
bool m_attached;
};
#endif // __cplusplus
#endif // TC_HEADER_DLGCODE