mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-05 16:46:35 -05:00
Run display discovery asynchronously and bound batched disk-image inventory queries. Filter auxiliary mounts by basename, filesystem and owner, and keep unresolved candidates separate from verified volumes. Allow targeted dismounts despite incomplete discovery while requiring complete results for slot allocation and empty-inventory decisions. Use nonthrowing GUI snapshots with monotonic freshness, completion events and safe window lifetimes. Suspend inactivity decisions while the snapshot is stale, without restarting idle timers: activity counters are cumulative per volume instance. Refresh logout targets and retry only failed ones. Show a progress dialog for interactive unmounts, but keep automatic ones synchronous, so a quit or logout request that arrives meanwhile is handled afterwards rather than refused. Guard core operations against reentry and route wait-dialog requests only from worker threads, so a main-thread message cannot wait for itself. Bind teardown to captured mount and service identities, including process start time. Report a service exit that cannot be confirmed after auxiliary mount removal as a distinct error that keeps the original details. Such volumes are not retried, and a multi-volume unmount reports all of them together with any other failure or a declined prompt. Warn about it after automatic unmounts and at quit, and keep the background application until the warning is acknowledged. Keep rollback responsive, and let services remove their auxiliary directories without probing mounted paths. Preserve released /control compatibility and perform best-effort cleanup for older services. Reap bounded subprocesses as soon as their output ends. A child that survives SIGKILL is reaped by a later call, which starts no new child until then. Keep subjects and subprocess command, status and error output when formatting exceptions for wrapping and logs. Clarify discovery and rollback diagnostics. Fix the localization-dependent busy-volume regression assertion and extend discovery, snapshot, process identity, cleanup, GUI lifecycle, inactivity and teardown coverage.
121 lines
3.3 KiB
C++
121 lines
3.3 KiB
C++
/*
|
|
Derived from source code of TrueCrypt 7.1a, which is
|
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
|
by the TrueCrypt License 3.0.
|
|
|
|
Modifications and additions to the original source code (contained in this file)
|
|
and all other portions of this file are Copyright (c) 2013-2026 AM Crypto
|
|
and are governed by the Apache License 2.0 the full text of which is
|
|
contained in the file License.txt included in VeraCrypt binary and source
|
|
code distribution packages.
|
|
*/
|
|
|
|
#ifndef TC_HEADER_Main_CommandInterface
|
|
#define TC_HEADER_Main_CommandInterface
|
|
|
|
#include "System.h"
|
|
#include "Main.h"
|
|
#include "Volume/VolumeInfo.h"
|
|
#include "Core/MountOptions.h"
|
|
#include "Core/VolumeCreator.h"
|
|
#include "UserPreferences.h"
|
|
#include "UserInterfaceType.h"
|
|
#include "Volume/Pkcs5Kdf.h"
|
|
|
|
namespace VeraCrypt
|
|
{
|
|
struct CommandId
|
|
{
|
|
enum Enum
|
|
{
|
|
None,
|
|
AutoMountDevices,
|
|
AutoMountDevicesFavorites,
|
|
AutoMountFavorites,
|
|
BackupHeaders,
|
|
ChangePassword,
|
|
CreateKeyfile,
|
|
CreateVolume,
|
|
DeleteSecurityTokenKeyfiles,
|
|
DismountVolumes,
|
|
DisplayVersion,
|
|
DisplayVolumeProperties,
|
|
ExportTokenKeyfile,
|
|
Help,
|
|
ImportTokenKeyfiles,
|
|
ListTokenKeyfiles,
|
|
ListSecurityTokenKeyfiles,
|
|
ListEMVTokenKeyfiles,
|
|
ListVolumes,
|
|
MountVolume,
|
|
RestoreHeaders,
|
|
SavePreferences,
|
|
Test
|
|
};
|
|
};
|
|
|
|
struct CommandLineInterface
|
|
{
|
|
public:
|
|
CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType);
|
|
virtual ~CommandLineInterface ();
|
|
|
|
|
|
CommandId::Enum ArgCommand;
|
|
bool ArgDisplayPassword;
|
|
shared_ptr <EncryptionAlgorithm> ArgEncryptionAlgorithm;
|
|
#ifdef TC_LINUX
|
|
bool ArgEmergencyUnmount;
|
|
#endif
|
|
shared_ptr <FilePath> ArgFilePath;
|
|
VolumeCreationOptions::FilesystemType::Enum ArgFilesystem;
|
|
bool ArgForce;
|
|
shared_ptr <Pkcs5Kdf> ArgHash;
|
|
shared_ptr <KeyfileList> ArgKeyfiles;
|
|
MountOptions ArgMountOptions;
|
|
shared_ptr <DirectoryPath> ArgMountPoint;
|
|
shared_ptr <Pkcs5Kdf> ArgNewHash;
|
|
shared_ptr <KeyfileList> ArgNewKeyfiles;
|
|
shared_ptr <VolumePassword> ArgNewPassword;
|
|
int ArgNewPim;
|
|
bool ArgNoHiddenVolumeProtection;
|
|
shared_ptr <VolumePassword> ArgPassword;
|
|
int ArgPim;
|
|
bool ArgQuick;
|
|
FilesystemPath ArgRandomSourcePath;
|
|
uint64 ArgSize;
|
|
shared_ptr <VolumePath> ArgVolumePath;
|
|
VolumeInfoList ArgVolumes;
|
|
list <DirectoryPath> ArgUnresolvedMounts;
|
|
VolumeType::Enum ArgVolumeType;
|
|
shared_ptr<SecureBuffer> ArgTokenPin;
|
|
bool ArgAllowScreencapture;
|
|
bool ArgDisableFileSizeCheck;
|
|
bool ArgUseLegacyPassword;
|
|
bool ArgUseDummySudoPassword;
|
|
|
|
#if defined(TC_UNIX)
|
|
bool ArgAllowInsecureMount;
|
|
#endif
|
|
|
|
bool StartBackgroundTask;
|
|
UserPreferences Preferences;
|
|
|
|
protected:
|
|
void CheckCommandSingle () const;
|
|
shared_ptr <KeyfileList> ToKeyfileList (const wxString &arg) const;
|
|
VolumeInfoList GetMountedVolumes (const wxString &filter);
|
|
|
|
private:
|
|
CommandLineInterface (const CommandLineInterface &);
|
|
CommandLineInterface &operator= (const CommandLineInterface &);
|
|
};
|
|
|
|
shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
|
|
shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
|
|
|
|
extern unique_ptr <CommandLineInterface> CmdLine;
|
|
}
|
|
|
|
#endif // TC_HEADER_Main_CommandInterface
|