VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/CommandLineInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/CommandLineInterface.cpp')
-rwxr-xr-x[-rw-r--r--]src/Main/CommandLineInterface.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 541f66d0..b1bb4bd0 100644..100755
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -19,9 +19,11 @@ namespace VeraCrypt
{
CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) :
ArgCommand (CommandId::None),
ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown),
+ ArgNewPim (-1),
ArgNoHiddenVolumeProtection (false),
+ ArgPim (-1),
ArgSize (0),
ArgVolumeType (VolumeType::Unknown),
ArgTrueCryptMode (false),
StartBackgroundTask (false)
@@ -62,14 +64,17 @@ namespace VeraCrypt
parser.AddSwitch (L"", L"mount", _("Mount volume interactively"));
parser.AddOption (L"m", L"mount-options", _("VeraCrypt volume mount options"));
parser.AddOption (L"", L"new-keyfiles", _("New keyfiles"));
parser.AddOption (L"", L"new-password", _("New password"));
+ parser.AddOption (L"", L"new-pim", _("New PIM"));
parser.AddSwitch (L"", L"non-interactive", _("Do not interact with user"));
parser.AddOption (L"p", L"password", _("Password"));
+ parser.AddOption (L"", L"pim", _("PIM"));
parser.AddOption (L"", L"protect-hidden", _("Protect hidden volume"));
parser.AddOption (L"", L"protection-hash", _("Hash algorithm for protected hidden volume"));
parser.AddOption (L"", L"protection-keyfiles", _("Keyfiles for protected hidden volume"));
parser.AddOption (L"", L"protection-password", _("Password for protected hidden volume"));
+ parser.AddOption (L"", L"protection-pim", _("PIM for protected hidden volume"));
parser.AddOption (L"", L"random-source", _("Use file as source of random data"));
parser.AddSwitch (L"", L"restore-headers", _("Restore volume headers"));
parser.AddSwitch (L"", L"save-preferences", _("Save user preferences"));
parser.AddSwitch (L"", L"quick", _("Enable quick format"));
@@ -367,8 +372,22 @@ namespace VeraCrypt
if (parser.Found (L"new-password", &str))
ArgNewPassword.reset (new VolumePassword (wstring (str)));
+ if (parser.Found (L"new-pim", &str))
+ {
+ try
+ {
+ ArgNewPim = StringConverter::ToInt32 (wstring (str));
+ if (ArgNewPim < 0)
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ catch (...)
+ {
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ }
+
if (parser.Found (L"non-interactive"))
{
if (interfaceType != UserInterfaceType::Text)
throw_err (L"--non-interactive is supported only in text mode");
@@ -377,8 +396,22 @@ namespace VeraCrypt
}
if (parser.Found (L"password", &str))
ArgPassword.reset (new VolumePassword (wstring (str)));
+
+ if (parser.Found (L"pim", &str))
+ {
+ try
+ {
+ ArgPim = StringConverter::ToInt32 (wstring (str));
+ if (ArgPim < 0)
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ catch (...)
+ {
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ }
if (parser.Found (L"protect-hidden", &str))
{
if (str == L"yes")
@@ -402,8 +435,25 @@ namespace VeraCrypt
{
ArgMountOptions.ProtectionPassword.reset (new VolumePassword (wstring (str)));
ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
}
+
+ if (parser.Found (L"protection-pim", &str))
+ {
+ int pim = -1;
+ try
+ {
+ pim = StringConverter::ToInt32 (wstring (str));
+ if (pim < 0)
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ catch (...)
+ {
+ throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str);
+ }
+ ArgMountOptions.ProtectionPim = pim;
+ ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly;
+ }
if (parser.Found (L"protection-hash", &str))
{
bool bHashFound = false;