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

Function check_dokany_version

cppcryptfs/dokan/cryptdokan.cpp:2758–2807  ·  view source on GitHub ↗

return false if won't work, returns true with no message if all ok, returns true with message if there will maybe be a problem

Source from the content-addressed store, hash-verified

2756// return false if won't work, returns true with no message if all ok,
2757// returns true with message if there will maybe be a problem
2758bool check_dokany_version(wstring& mes)
2759{
2760 constexpr int required_major = 2;
2761 constexpr int required_middle = 3;
2762 const wstring required_ver = to_wstring(required_major) + L"." + to_wstring(required_middle) + L".x.x";
2763
2764 mes = L"";
2765
2766 wstring ver;
2767
2768 vector<int> v;
2769 if (!get_dokany_version(ver, v)) {
2770 mes = LocUtils::GetStringFromResources(IDS_UNABLE_GET_DOKANY_VERSION);
2771 return false;
2772 }
2773
2774 if (v.size() < 2) {
2775 return false;
2776 }
2777
2778 const int major = v[0];
2779 const int middle = v[1];
2780
2781 if (major == required_major && middle == required_middle) {
2782 return true;
2783 }
2784
2785 if (major != required_major) {
2786 CString strMsg;
2787 strMsg.Format(LocUtils::GetStringFromResources(IDS_DOKANY_VER_NOT_COMPATIBLE).c_str(), ver, required_ver);
2788 mes = strMsg;
2789 return false; // error
2790 }
2791
2792 if (major == required_major && middle < required_middle) {
2793 CString strMsg;
2794 strMsg.Format(LocUtils::GetStringFromResources(IDS_DOKANY_VER_NOT_COMPATIBLE).c_str(), ver, required_ver);
2795 mes = strMsg;
2796 return false; // error
2797 }
2798
2799 if (major == required_major && middle > required_middle) {
2800 CString strMsg;
2801 strMsg.Format(LocUtils::GetStringFromResources(IDS_DOKANY_VER_NOT_TESTED).c_str(), ver, required_ver);
2802 mes = strMsg;
2803 return true; // warning
2804 }
2805
2806 return false;
2807}
2808
2809bool get_fs_info(const wchar_t *mountpoint, FsInfo& info)
2810{

Callers 1

InitInstanceMethod · 0.85

Calls 2

get_dokany_versionFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected