forked from bailey27/cppcryptfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFsInfoDialog.cpp
More file actions
186 lines (149 loc) · 6.13 KB
/
Copy pathFsInfoDialog.cpp
File metadata and controls
186 lines (149 loc) · 6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
cppcryptfs : user-mode cryptographic virtual overlay filesystem.
Copyright (C) 2016-2026 Bailey Brown (github.com/bailey27/cppcryptfs)
cppcryptfs is based on the design of gocryptfs (github.com/rfjakob/gocryptfs)
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// FsInfoDialog.cpp : implementation file
//
#include "stdafx.h"
#include "cppcryptfs.h"
#include "FsInfoDialog.h"
#include "afxdialogex.h"
#include "locutils.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFsInfoDialog dialog
CFsInfoDialog::CFsInfoDialog(CWnd* pParent /*=NULL*/)
: CDialog(IDD_FSINFO /*CFsInfoDialog::IDD*/, pParent)
{
//{{AFX_DATA_INIT(CFsInfoDialog)
//}}AFX_DATA_INIT
}
void CFsInfoDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFsInfoDialog)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFsInfoDialog, CDialog)
//{{AFX_MSG_MAP(CFsInfoDialog)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK, &CFsInfoDialog::OnBnClickedOk)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFsInfoDialog message handlers
void CFsInfoDialog::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CDialog::OnOK();
}
BOOL CFsInfoDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CString strMsgYes, strMsgNo, strMsgNA, strMsgReverse, strMsgForward, strMsgKB, strMsgSec, strMsgInfinite, strMsgNone;
strMsgYes = LocUtils::GetStringFromResources(IDS_FSINFO_YES).c_str();
strMsgNo = LocUtils::GetStringFromResources(IDS_FSINFO_NO).c_str();
strMsgNA = LocUtils::GetStringFromResources(IDS_FSINFO_NA).c_str();
strMsgReverse = LocUtils::GetStringFromResources(IDS_FSINFO_REVERSE).c_str();
strMsgForward = LocUtils::GetStringFromResources(IDS_FSINFO_FORWARD).c_str();
strMsgInfinite = LocUtils::GetStringFromResources(IDS_FSINFO_INFINITE).c_str();
strMsgNone = LocUtils::GetStringFromResources(IDS_FSINFO_NAME_ENCRYPTION_NO).c_str();
LPCWSTR yes = strMsgYes;
LPCWSTR no = strMsgNo;
LPCWSTR na = strMsgNA;
LPCWSTR path = m_info.path.c_str();
if (!wcsncmp(path, L"\\\\?\\", wcslen(L"\\\\?\\"))) {
path += wcslen(L"\\\\?\\");
}
SetDlgItemText(IDC_PATH, m_info.path.c_str());
SetDlgItemText(IDC_MOUNT_POINT, m_mountPoint);
SetDlgItemText(IDC_CONFIG_PATH, m_info.configPath.c_str());
//To display localized text in the GUI
LPCWSTR none = strMsgNone;
if (m_info.fileNameEncryption == L"none") {
SetDlgItemText(IDC_FILE_NAME_ENCRYPTION, none);
}
else {
SetDlgItemText(IDC_FILE_NAME_ENCRYPTION, m_info.fileNameEncryption.c_str());
}
SetDlgItemText(IDC_DATA_ENCRYPTION, m_info.dataEncryption.c_str());
SetDlgItemText(IDC_READ_ONLY, m_info.readOnly ? yes : no);
SetDlgItemText(IDC_MODE, m_info.reverse ? strMsgReverse : strMsgForward);
SetDlgItemText(IDC_MOUNT_MANAGER, m_info.mountManager ? yes : no);
SetDlgItemText(IDC_CASE_INSENSITIVE, m_info.caseInsensitive ? yes : no);
SetDlgItemText(IDC_LONG_FILE_NAMES, m_info.longFileNames ? yes : no);
SetDlgItemText(IDC_ENCRYPT_KEYS_IN_MEM, m_info.encryptKeysInMemory ? yes : no);
SetDlgItemText(IDC_CACHE_KEYS_IN_MEM, m_info.encryptKeysInMemory ? (m_info.cacheKeysInMemory ? yes : no) : na);
SetDlgItemText(IDC_DENY_OTHER_SESSIONS_TXT, m_info.denyOtherSessions ? yes : no);
SetDlgItemText(IDC_DENY_SERVICES_TXT, m_info.denyServices ? yes : no);
SetDlgItemText(IDC_FLUSH_AFTER_WRITE_TXT, m_info.flushAfterWrite ? yes : no);
SetDlgItemText(IDC_DELETE_SPURRIOUS_FILES, m_info.deleteSpurriousFiles ? yes : no);
wstring txt;
txt = to_wstring(m_info.ioBufferSize);
strMsgKB.Format(LocUtils::GetStringFromResources(IDS_FSINFO_KB).c_str(), txt);
SetDlgItemText(IDC_IO_BUF_SIZE, strMsgKB);
txt = m_info.multhreaded ? yes : no;
SetDlgItemText(IDC_THREADS, txt.c_str());
if (m_info.cacheTTL > 0) {
txt = to_wstring(m_info.cacheTTL);
strMsgSec.Format(LocUtils::GetStringFromResources(IDS_FSINFO_SEC).c_str(), txt);
SetDlgItemText(IDC_CACHE_TTL, strMsgSec);
} else {
SetDlgItemText(IDC_CACHE_TTL, strMsgInfinite);
}
WCHAR buf[32];
*buf = '\0';
float r;
r = m_info.caseCacheHitRatio;
if (r < 0.0f) {
txt = na;
} else {
_snwprintf_s(buf, _TRUNCATE, L"%.2f", r*100.0f);
txt = buf;
txt += L"%";
}
SetDlgItemText(IDC_CASE_CACHE_HR, txt.c_str());
r = m_info.lfnCacheHitRatio;
if (r < 0.0f) {
txt = strMsgNA;
} else {
_snwprintf_s(buf, _TRUNCATE, L"%.2f", r*100.0f);
txt = buf;
txt += L"%";
}
SetDlgItemText(IDC_LFN_CACHE_HR, txt.c_str());
r = m_info.dirIvCacheHitRatio;
if (r < 0.0f) {
txt = strMsgNA;
} else {
_snwprintf_s(buf, _TRUNCATE, L"%.2f", r*100.0f);
txt = buf;
txt += L"%";
}
SetDlgItemText(IDC_DIRIV_CACHE_HR, txt.c_str());
SetDlgItemText(IDC_LONG_NAME_MAX, to_wstring(m_info.longNameMax).c_str());
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}