VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
authorDeniz Türkoglu <denizt@users.noreply.github.com>2024-09-17 08:05:21 +1000
committerGitHub <noreply@github.com>2024-09-17 00:05:21 +0200
commite0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c (patch)
tree82da3181639c72a07e90950ae49fe40ca9b02e35 /src/Main/Forms
parenteb0eec7b39534b0bec5566ef92985f163e1f7025 (diff)
downloadVeraCrypt-e0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c.tar.gz
VeraCrypt-e0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c.zip
Add Option to Enable/Disable Screen Capture (#1418)
Veracrypt currently appears in screenshots and screen captures, which can unintentionally expose sensitive information, such as the fact that Veracrypt is running or the location of your volumes. Both Windows and macOS offer mechanisms to exclude specific windows from being captured. While not foolproof, this is a useful preventative measure. The method is a no-op for Linux/FreeBSD. For more details on the wxWidgets API, see: https://docs.wxwidgets.org/3.2/classwx_top_level_window.html#a337b9cec62b0cbd3b1b1545a83270f64
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--src/Main/Forms/MainFrame.cpp7
-rw-r--r--src/Main/Forms/MainFrame.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 6355f139..77f371d8 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -52,70 +52,71 @@ namespace VeraCrypt
ListItemRightClickEventPending (false),
SelectedItemIndex (-1),
SelectedSlotNumber (0),
ShowRequestFifo (-1)
{
wxBusyCursor busy;
SetName (Application::GetName());
SetTitle (Application::GetName());
SetIcon (Resources::GetVeraCryptIcon());
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
string fifoPath = GetShowRequestFifoPath();
remove (fifoPath.c_str());
throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1);
ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK);
throw_sys_if (ShowRequestFifo == -1);
}
catch (...)
{
#ifdef DEBUG
throw;
#endif
}
#endif
InitControls();
InitPreferences();
InitTaskBarIcon();
InitEvents();
InitMessageFilter();
+ InitWindowPrivacy();
if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized())
{
try
{
Gui->InitSecurityTokenLibrary();
}
catch (exception &e)
{
Gui->ShowError (e);
}
}
Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnQuit ) );
Connect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
#ifdef TC_MACOSX
Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
#endif
}
MainFrame::~MainFrame ()
{
#if defined(TC_UNIX) && !defined(TC_MACOSX)
if (ShowRequestFifo != -1)
{
try
{
close (ShowRequestFifo);
remove (string (GetShowRequestFifoPath()).c_str());
}
catch (...) { }
}
@@ -438,70 +439,76 @@ namespace VeraCrypt
static LRESULT CALLBACK MainFrameWndProcFilter (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_DEVICECHANGE && !Core->IsDeviceChangeInProgress())
{
MainFrame *frame = dynamic_cast <MainFrame *> (Gui->GetMainFrame());
PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam;
if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME)
{
PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam;
for (wchar_t driveNo = 0; driveNo < 26; ++driveNo)
{
if (vol->dbcv_unitmask & (1 << driveNo))
frame->OnDeviceChange (wstring (StringFormatter (L"{0}:\\", wchar_t (L'A' + driveNo))));
}
}
else
{
frame->OnDeviceChange ();
}
}
return CallWindowProc (MainFrameWndProc, hwnd, message, wParam, lParam);
}
#endif
void MainFrame::InitMessageFilter ()
{
#ifdef TC_WINDOWS
HWND mainFrameHwnd = static_cast <HWND> (GetHandle());
MainFrameWndProc = (WNDPROC) GetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC);
SetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC, (LONG_PTR) MainFrameWndProcFilter);
#endif
}
+
+ void MainFrame::InitWindowPrivacy ()
+ {
+ Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture);
+ }
+
void MainFrame::InitPreferences ()
{
try
{
LoadPreferences();
VolumeSlotNumber lastSelectedSlotNumber = GetPreferences().LastSelectedSlotNumber;
if (Core->IsSlotNumberValid (lastSelectedSlotNumber))
{
long slotIndex = SlotNumberToItemIndex (lastSelectedSlotNumber);
if (slotIndex >= 0)
{
SlotListCtrl->SetItemState (slotIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
SlotListCtrl->EnsureVisible (slotIndex);
}
}
LoadFavoriteVolumes();
VolumeHistory::Load();
if (VolumePathComboBox->GetValue().empty() && !VolumeHistory::Get().empty())
SetVolumePath (VolumeHistory::Get().front());
}
catch (exception &e)
{
Gui->ShowError (e);
Gui->ShowError (LangString["LINUX_ERROR_LOADING_CONFIG"] + wstring (Application::GetConfigFilePath (L"")));
}
}
void MainFrame::InitTaskBarIcon ()
{
class TaskBarIcon : public wxTaskBarIcon
{
public:
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index ab70eae3..ed1c44f7 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -52,70 +52,71 @@ namespace VeraCrypt
GtkWidget *indicator_item_mountfavorites;
GtkWidget *indicator_item_dismountall;
GtkWidget *indicator_item_prefs;
GtkWidget *indicator_item_exit;
void SetBusy (bool busy);
#endif
protected:
enum
{
ColumnSlot = 0,
ColumnPath,
ColumnSize,
#ifdef TC_WINDOWS
ColumnEA,
#else
ColumnMountPoint,
#endif
ColumnType
};
void AddToFavorites (const VolumeInfoList &volumes);
bool CanExit () const;
void ChangePassword (ChangePasswordDialog::Mode::Enum mode = ChangePasswordDialog::Mode::ChangePasswordAndKeyfiles);
void CheckFilesystem (bool repair = false);
bool CheckVolumePathNotEmpty () const;
void DismountVolume (shared_ptr <VolumeInfo> volume = shared_ptr <VolumeInfo> ());
const UserPreferences &GetPreferences () const { return Gui->GetPreferences(); }
shared_ptr <VolumeInfo> GetSelectedVolume () const;
shared_ptr <VolumePath> GetSelectedVolumePath () const { return make_shared <VolumePath> (wstring (VolumePathComboBox->GetValue())); }
void InitControls ();
void InitEvents ();
void InitMessageFilter ();
void InitPreferences ();
void InitTaskBarIcon ();
+ void InitWindowPrivacy();
bool IsFreeSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
bool IsMountedSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && !Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
void LoadFavoriteVolumes ();
void LoadPreferences ();
void MountAllDevices ();
void MountVolume ();
void OnAboutMenuItemSelected (wxCommandEvent& event);
void OnQuit(wxCommandEvent& event) { Close(true); }
void OnActivate (wxActivateEvent& event);
void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event);
void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event);
void OnBackupVolumeHeadersMenuItemSelected (wxCommandEvent& event);
void OnBeginnersTutorialMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"tutorial"); }
void OnBenchmarkMenuItemSelected (wxCommandEvent& event);
void OnChangeKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangeKeyfiles); }
void OnChangePasswordMenuItemSelected (wxCommandEvent& event) { ChangePassword (); }
void OnChangePkcs5PrfMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangePkcs5Prf); }
void OnCheckFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (); }
void OnClearSlotSelectionMenuItemSelected (wxCommandEvent& event);
void OnClose (wxCloseEvent& event);
void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event);
void OnDonateMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"donate"); }
void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); }
void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
Gui->CreateKeyfile();
}
void OnCreateVolumeButtonClick (wxCommandEvent& event);
void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event);
void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event );
void OnDismountAllButtonClick (wxCommandEvent& event);