| 55 | } |
| 56 | |
| 57 | bool CryptOpenFiles::CloseFile(LPCWSTR path, HANDLE h) |
| 58 | { |
| 59 | wstring ucpath; |
| 60 | |
| 61 | if (!touppercase(path, ucpath)) { |
| 62 | assert(false); |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | lock_guard<mutex> lock(m_mutex); |
| 67 | |
| 68 | auto it = m_openfiles.find(ucpath); |
| 69 | |
| 70 | if (it == m_openfiles.end()) { |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | auto result = it->second->Close(h); |
| 75 | if (!result) { |
| 76 | DbgPrint(L"openfiles cannot close handle %llx\n", h); |
| 77 | } |
| 78 | |
| 79 | if (it->second->Empty()) |
| 80 | m_openfiles.erase(it); |
| 81 | |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | shared_ptr<CryptOpenFile> CryptOpenFiles::GetOpenFile(LPCWSTR path) |
| 86 | { |
no test coverage detected