mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-05-22 12:31:31 +00:00
Linux: allow mounting NTFS volumes with ntfs3 (#1695)
* Linux: allow mounting volumes with ntfs3 * Linux: add ntfs3 preference for NTFS mounts * Linux: wrap ntfs3 preference help text * Add Linux ntfs3 mount preference * Remove Russian translation changes from ntfs3 PR * XML Translations: Add English fallback entries for ntfs3 preference --------- Co-authored-by: Mounir IDRASSI <mounir.idrassi@amcrypto.jp>
This commit is contained in:
@@ -361,6 +361,11 @@ namespace VeraCrypt
|
||||
ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4;
|
||||
else if (str.IsSameAs (L"NTFS", false))
|
||||
ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS;
|
||||
else if (str.IsSameAs (L"ntfs3", false))
|
||||
{
|
||||
ArgMountOptions.FilesystemType = L"ntfs3";
|
||||
ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS;
|
||||
}
|
||||
else if (str.IsSameAs (L"exFAT", false))
|
||||
ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT;
|
||||
else if (str.IsSameAs (L"Btrfs", false))
|
||||
|
||||
@@ -1142,4 +1142,3 @@ namespace VeraCrypt
|
||||
};
|
||||
|
||||
} // namespace VeraCrypt
|
||||
|
||||
|
||||
@@ -55,6 +55,48 @@ namespace VeraCrypt
|
||||
MountRemovableCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.Removable));
|
||||
|
||||
FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions);
|
||||
#ifdef TC_LINUX
|
||||
wxBoxSizer *ntfs3PreferenceSizer = new wxBoxSizer (wxHORIZONTAL);
|
||||
MountNtfsWithNtfs3CheckBox = new wxCheckBox (FilesystemSizer->GetStaticBox(), wxID_ANY, LangString["LINUX_PREF_MOUNT_NTFS_WITH_NTFS3"]);
|
||||
MountNtfsWithNtfs3CheckBox->SetToolTip (LangString["LINUX_PREF_MOUNT_NTFS_WITH_NTFS3_HELP"]);
|
||||
ntfs3PreferenceSizer->Add (MountNtfsWithNtfs3CheckBox, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
|
||||
wxWindow *ntfs3HelpIcon = new wxWindow (FilesystemSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize (16, 16));
|
||||
ntfs3HelpIcon->SetMinSize (wxSize (16, 16));
|
||||
ntfs3HelpIcon->SetToolTip (LangString["LINUX_PREF_MOUNT_NTFS_WITH_NTFS3_HELP"]);
|
||||
ntfs3HelpIcon->Bind (wxEVT_PAINT, [ntfs3HelpIcon] (wxPaintEvent&)
|
||||
{
|
||||
wxPaintDC dc (ntfs3HelpIcon);
|
||||
wxSize size = ntfs3HelpIcon->GetClientSize();
|
||||
wxColour backgroundColor = ntfs3HelpIcon->GetBackgroundColour();
|
||||
wxColour color = ntfs3HelpIcon->GetForegroundColour();
|
||||
int diameter = (size.GetWidth() < size.GetHeight() ? size.GetWidth() : size.GetHeight()) - 1;
|
||||
int x = (size.GetWidth() - diameter) / 2;
|
||||
int y = (size.GetHeight() - diameter) / 2;
|
||||
wxCoord textWidth, textHeight;
|
||||
|
||||
if (ntfs3HelpIcon->GetParent())
|
||||
backgroundColor = ntfs3HelpIcon->GetParent()->GetBackgroundColour();
|
||||
if (!backgroundColor.IsOk())
|
||||
backgroundColor = wxSystemSettings::GetColour (wxSYS_COLOUR_WINDOW);
|
||||
if (!color.IsOk())
|
||||
color = wxSystemSettings::GetColour (wxSYS_COLOUR_WINDOWTEXT);
|
||||
|
||||
dc.SetBackground (wxBrush (backgroundColor));
|
||||
dc.Clear();
|
||||
dc.SetPen (wxPen (color, 1));
|
||||
dc.SetBrush (*wxTRANSPARENT_BRUSH);
|
||||
dc.SetTextForeground (color);
|
||||
dc.DrawEllipse (x, y, diameter, diameter);
|
||||
dc.GetTextExtent (L"?", &textWidth, &textHeight);
|
||||
dc.DrawText (L"?", (size.GetWidth() - textWidth) / 2, (size.GetHeight() - textHeight) / 2 - 1);
|
||||
});
|
||||
ntfs3PreferenceSizer->Add (ntfs3HelpIcon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
|
||||
|
||||
FilesystemSizer->Add (ntfs3PreferenceSizer, 0, wxALL, 5);
|
||||
|
||||
MountNtfsWithNtfs3CheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.MountNtfsWithNtfs3));
|
||||
#endif
|
||||
|
||||
int index, prfInitialIndex = 0;
|
||||
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace VeraCrypt
|
||||
};
|
||||
|
||||
KeyfilesPanel *DefaultKeyfilesPanel;
|
||||
#ifdef TC_LINUX
|
||||
wxCheckBox *MountNtfsWithNtfs3CheckBox;
|
||||
#endif
|
||||
int LastVirtualKeyPressed;
|
||||
unique_ptr <wxTimer> mTimer;
|
||||
UserPreferences Preferences;
|
||||
|
||||
@@ -1259,6 +1259,19 @@ const FileManager fileManagers[] = {
|
||||
" with option -t. Default type is 'auto'. When creating a new volume, this\n"
|
||||
" option specifies the filesystem to be created on the new volume.\n"
|
||||
" Filesystem type 'none' disables mounting or creating a filesystem.\n"
|
||||
#ifdef TC_LINUX
|
||||
" On Linux, filesystem type 'ntfs3' mounts an NTFS volume using the\n"
|
||||
" in-kernel ntfs3 driver. The ntfs3 kernel module must be available\n"
|
||||
" and allowed by the distribution; otherwise mounting may fail.\n"
|
||||
" The Linux preference \"Mount NTFS volumes with the Linux kernel ntfs3\n"
|
||||
" driver\" is disabled by default. When enabled, VeraCrypt probes the\n"
|
||||
" decrypted virtual device with blkid -p and applies ntfs3 only when\n"
|
||||
" NTFS is detected and no explicit filesystem type was supplied. If\n"
|
||||
" detection fails, VeraCrypt uses the normal automatic filesystem\n"
|
||||
" selection. This can avoid suspend or hibernate hangs caused by frozen\n"
|
||||
" user-space FUSE filesystems during kernel filesystem sync; use findmnt\n"
|
||||
" to verify the actual mounted filesystem type.\n"
|
||||
#endif
|
||||
"\n"
|
||||
"--force\n"
|
||||
" Force mounting of a volume in use, unmounting of a volume in use, or\n"
|
||||
@@ -1398,6 +1411,11 @@ const FileManager fileManagers[] = {
|
||||
"Mount a volume prompting only for its password:\n"
|
||||
"veracrypt -t -k \"\" --pim=0 --protect-hidden=no volume.hc /media/veracrypt1\n"
|
||||
"\n"
|
||||
#ifdef TC_LINUX
|
||||
"Mount an NTFS volume using the Linux in-kernel ntfs3 driver:\n"
|
||||
"veracrypt -t --filesystem=ntfs3 volume.hc /media/veracrypt1\n"
|
||||
"\n"
|
||||
#endif
|
||||
"Unmount a volume:\n"
|
||||
"veracrypt -u volume.hc\n"
|
||||
"\n"
|
||||
|
||||
@@ -102,6 +102,9 @@ namespace VeraCrypt
|
||||
if (configMap.count(L"MountVolumesReadOnly") > 0) { SetValue (configMap[L"MountVolumesReadOnly"], readOnly); configMap.erase (L"MountVolumesReadOnly"); }
|
||||
DefaultMountOptions.Protection = readOnly ? VolumeProtection::ReadOnly : VolumeProtection::None;
|
||||
|
||||
#ifdef TC_LINUX
|
||||
if (configMap.count(L"MountNtfsWithNtfs3") > 0) { SetValue (configMap[L"MountNtfsWithNtfs3"], DefaultMountOptions.MountNtfsWithNtfs3); configMap.erase (L"MountNtfsWithNtfs3"); }
|
||||
#endif
|
||||
if (configMap.count(L"MountVolumesRemovable") > 0) { SetValue (configMap[L"MountVolumesRemovable"], DefaultMountOptions.Removable); configMap.erase (L"MountVolumesRemovable"); }
|
||||
if (configMap.count(L"NoHardwareCrypto") > 0) { SetValue (configMap[L"NoHardwareCrypto"], DefaultMountOptions.NoHardwareCrypto); configMap.erase (L"NoHardwareCrypto"); }
|
||||
if (configMap.count(L"NoKernelCrypto") > 0) { SetValue (configMap[L"NoKernelCrypto"], DefaultMountOptions.NoKernelCrypto); configMap.erase (L"NoKernelCrypto"); }
|
||||
@@ -221,6 +224,9 @@ namespace VeraCrypt
|
||||
TC_CONFIG_ADD (MountDevicesOnLogon);
|
||||
TC_CONFIG_ADD (MountFavoritesOnLogon);
|
||||
formatter.AddEntry (L"MountVolumesReadOnly", DefaultMountOptions.Protection == VolumeProtection::ReadOnly);
|
||||
#ifdef TC_LINUX
|
||||
formatter.AddEntry (L"MountNtfsWithNtfs3", DefaultMountOptions.MountNtfsWithNtfs3);
|
||||
#endif
|
||||
formatter.AddEntry (L"MountVolumesRemovable", DefaultMountOptions.Removable);
|
||||
formatter.AddEntry (L"NoHardwareCrypto", DefaultMountOptions.NoHardwareCrypto);
|
||||
formatter.AddEntry (L"NoKernelCrypto", DefaultMountOptions.NoKernelCrypto);
|
||||
|
||||
Reference in New Issue
Block a user