Skip to content

Commit

Permalink
Force running in foreground on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
smessmer committed Sep 25, 2024
1 parent 34a7fdb commit 6ca3ce6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Version 0.12.0 (unreleased)
* Fixes/Improvements
* Added a man page for `cryfs-unmount`
* Fixed small inaccuracy in calculation of free space in statvfs
* On Windows, when running and the wrong DokanY version is installed, show an error instead of letting it look like mounting succeeded.
* On Windows
* when the wrong DokanY version is installed, or DokanY is not installed, show an error instead of letting it look like mounting succeeded.
* always run CryFS in foreground mode. Background mode didn't work anyways but attempting to use it would swallow logs and errors. Now they show up correctly.
* Build changes
* Requires CMake 3.25
* Remove Windows 32bit build, only 64bit remains supported
Expand Down
11 changes: 11 additions & 0 deletions src/cryfs-cli/program_options/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ using boost::optional;
using boost::none;
using namespace cpputils::logging;

#if defined(_MSC_VER)
// Haven't figured out how to make it run in background on Windows yet, so let's just force it to run in foreground.
# define FORCE_RUN_IN_FOREGROUND
#endif

Parser::Parser(int argc, const char **argv)
:_options(_argsToVector(argc, argv)) {
}
Expand Down Expand Up @@ -55,7 +60,11 @@ ProgramOptions Parser::parse(const vector<string> &supportedCiphers) const {
if (vm.count("config")) {
configfile = bf::absolute(vm["config"].as<string>());
}
#ifndef FORCE_RUN_IN_FOREGROUND
const bool foreground = vm.count("foreground");
#else
const bool foreground = true;
#endif
const bool allowFilesystemUpgrade = vm.count("allow-filesystem-upgrade");
const bool allowReplacedFilesystem = vm.count("allow-replaced-filesystem");
const bool createMissingBasedir = vm.count("create-missing-basedir");
Expand Down Expand Up @@ -159,7 +168,9 @@ void Parser::_addAllowedOptions(po::options_description *desc) {
options.add_options()
("help,h", "show help message")
("config,c", po::value<string>(), "Configuration file")
#ifndef FORCE_RUN_IN_FOREGROUND
("foreground,f", "Run CryFS in foreground.")
#endif
("fuse-option,o", po::value<vector<string>>(), "Add a fuse mount option. Example: atime or noatime.")
("cipher", po::value<string>(), cipher_description.c_str())
("blocksize", po::value<uint32_t>(), blocksize_description.c_str())
Expand Down

0 comments on commit 6ca3ce6

Please sign in to comment.