| 193 | #endif // _WIN32 |
| 194 | |
| 195 | bool |
| 196 | get_dir_iv(CryptContext *con, const WCHAR *path, unsigned char *diriv) |
| 197 | { |
| 198 | |
| 199 | if (con && !con->GetConfig()->DirIV()) { |
| 200 | memset(diriv, 0, DIR_IV_LEN); |
| 201 | return true; |
| 202 | } |
| 203 | |
| 204 | bool bret = true; |
| 205 | |
| 206 | try { |
| 207 | |
| 208 | if (con && con->GetConfig()->m_reverse) { |
| 209 | throw(wstring(L"\tcalled for reverse fs")); |
| 210 | } |
| 211 | |
| 212 | if (!con->m_dir_iv_cache.lookup(path, diriv)) { |
| 213 | FILETIME LastWritten; |
| 214 | if (!read_dir_iv(path, diriv, LastWritten)) |
| 215 | throw(wstring(L"read_dir_iv failed for") + path); |
| 216 | if (!con->m_dir_iv_cache.store(path, diriv, LastWritten)) { |
| 217 | throw(wstring(L"store_diriv failed for ") + path); |
| 218 | } |
| 219 | } |
| 220 | } catch (const wstring& mes) { |
| 221 | DbgPrint(L"\tget_diriv %s\n", mes.c_str()); |
| 222 | bret = false; |
| 223 | } catch (...) { |
| 224 | bret = false; |
| 225 | } |
| 226 | |
| 227 | return bret; |
| 228 | } |
| 229 | |
| 230 | static bool |
| 231 | convert_fdata(CryptContext *con, BOOL isRoot, const BYTE *dir_iv, const WCHAR *path, WIN32_FIND_DATAW& fdata, string *actual_encrypted, wstring& storage) |
no test coverage detected