MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / mount_crypt_fs

Function mount_crypt_fs

cppcryptfs/dokan/cryptdokan.cpp:2019–2372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2017}
2018
2019int mount_crypt_fs(const WCHAR* mountpoint, const WCHAR *path,
2020 const WCHAR *config_path, const WCHAR *password,
2021 wstring &mes, bool reverse, bool readonly, const CryptMountOptions& opts) {
2022 mes.clear();
2023
2024 if (config_path && *config_path == '\0')
2025 config_path = NULL;
2026
2027 if (mountpoint == NULL) {
2028 mes = LocUtils::GetStringFromResources(IDS_INVALID_MPOINT);
2029 return -1;
2030 }
2031
2032 bool mount_point_is_a_dir = is_mountpoint_a_dir(mountpoint);
2033
2034 if (mount_point_is_a_dir && !is_suitable_mountpoint(mountpoint)) {
2035 if (!PathFileExists(mountpoint)) {
2036 mes = LocUtils::GetStringFromResources(IDS_MPOINT_DIR_NOT_EXIST);
2037 } else {
2038 mes = LocUtils::GetStringFromResources(IDS_MPOINT_DIR_EMPTY_NTFS);
2039 }
2040 return -1;
2041 }
2042
2043 wstring dummy;
2044 bool already_mounted = MountPointManager::getInstance().find(mountpoint, dummy);
2045
2046 if (already_mounted) {
2047 mes = LocUtils::GetStringFromResources(IDS_LETTER_MPOINT_ALREADY_USE);
2048 return -1;
2049 }
2050
2051
2052
2053 int retval = 0;
2054 CryptThreadData *tdata = NULL;
2055 HANDLE hThread = NULL;
2056
2057 try {
2058
2059 try {
2060 tdata = new CryptThreadData;
2061 } catch (...) {
2062 }
2063
2064 if (!tdata) {
2065 mes = LocUtils::GetStringFromResources(IDS_FAILED_ALLOCATE_TDATA);
2066 throw(-1);
2067 }
2068
2069 if (opts.encryptkeysinmemory) {
2070 tdata->con.m_encryptKeysInMemory = true;
2071 tdata->con.m_cacheKeysInMemory = opts.cachekeysinmemory;
2072 tdata->con.GetConfig()->m_keybuf_manager.Activate();
2073 }
2074
2075 tdata->con.m_denyOtherSessions = opts.denyothersessions;
2076 tdata->con.m_denyServices = opts.denyservices;

Callers 1

MountMethod · 0.85

Calls 15

is_mountpoint_a_dirFunction · 0.85
is_suitable_mountpointFunction · 0.85
prepare_basedirFunction · 0.85
DbgPrintFunction · 0.85
findMethod · 0.80
ActivateMethod · 0.80
GetConfigMethod · 0.80
SetCaseSensitiveMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected