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

Method CreateCryptfs

cppcryptfs/ui/CreatePropertyPage.cpp:97–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void CCreatePropertyPage::CreateCryptfs()
98{
99 //Moved to both methods, otherwise the array will be loaded before we determine the GUI language at program startup.
100 static const CString sPlainText = LocUtils::GetStringFromResources(IDS_PLAIN_TEXT).c_str();
101 static const WCHAR* filename_encryption_types[] = { L"AES256-EME", sPlainText };
102 const int NUM_FN_ENC_TYPES = sizeof(filename_encryption_types) / sizeof(filename_encryption_types[0]);
103
104 CWnd *pWnd = GetDlgItem(IDC_PATH);
105 if (!pWnd)
106 return;
107
108 LockZeroBuffer<WCHAR> password(MAX_PASSWORD_LEN + 1, false);
109 LockZeroBuffer<WCHAR> password2(MAX_PASSWORD_LEN + 1, false);
110
111 if (!password.IsLocked() || !password2.IsLocked()) {
112 MessageBox(LocUtils::GetStringFromResources(IDS_COULD_NOT_LOCK_BUFFER).c_str(), L"cppcryptefs", MB_OK | MB_ICONERROR);
113 return;
114 }
115
116 CSecureEdit *pPass = &m_password;
117
118 if (wcscpy_s(password.m_buf, MAX_PASSWORD_LEN + 1, pPass->m_strRealText))
119 return;
120
121 if (wcslen(password.m_buf) < 1) {
122 MessageBox(LocUtils::GetStringFromResources(IDS_PASSWORD_EMPTY).c_str(), L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
123 return;
124 }
125
126 CSecureEdit *pPass2 = &m_password2;
127
128 if (wcscpy_s(password2.m_buf, MAX_PASSWORD_LEN + 1, pPass2->m_strRealText))
129 return;
130
131 if (wcslen(password2.m_buf) < 1) {
132 MessageBox(LocUtils::GetStringFromResources(IDS_PASSWORD_REPEAT_EMPTY).c_str(), L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
133 return;
134 }
135
136 if (wcscmp(password.m_buf, password2.m_buf)) {
137 MessageBox(LocUtils::GetStringFromResources(IDS_PASSWORD_DO_NOT_MATCH).c_str(), L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
138 return;
139 }
140
141 pPass->SetRealText(L"");
142 pPass2->SetRealText(L"");
143
144 CString cpath;
145
146 pWnd->GetWindowTextW(cpath);
147
148 if (cpath.GetLength() < 1) {
149 MessageBox(LocUtils::GetStringFromResources(IDS_PATH_EMPTY).c_str(), L"cppcryptfs", MB_OK | MB_ICONEXCLAMATION);
150 return;
151 }
152
153 if (!PathFileExists(cpath)) {
154 CString mes;

Callers

nothing calls this directly

Calls 7

GetPathHashFunction · 0.85
IsLockedMethod · 0.80
SetRealTextMethod · 0.80
createMethod · 0.80
WriteProfileIntMethod · 0.80
AddMethod · 0.80
WriteProfileStringMethod · 0.80

Tested by

no test coverage detected