| 128 | |
| 129 | |
| 130 | bool |
| 131 | closeMemoryMappedFile(MapFileHandle handle) |
| 132 | { |
| 133 | auto windowsHandle = reinterpret_cast<WindowsMapFileHandle *>(handle); |
| 134 | |
| 135 | if (windowsHandle->fileHandle) { |
| 136 | if (!CloseHandle(windowsHandle->fileHandle)) { |
| 137 | gLog->error("closeMemoryMappedFile({}) close file handle failed with error: {}", |
| 138 | handle, GetLastError()); |
| 139 | } |
| 140 | |
| 141 | windowsHandle->fileHandle = NULL; |
| 142 | } |
| 143 | |
| 144 | if (windowsHandle->mappingHandle) { |
| 145 | if (!CloseHandle(windowsHandle->mappingHandle)) { |
| 146 | gLog->error("closeMemoryMappedFile({}) close map handle failed with error: {}", |
| 147 | handle, GetLastError()); |
| 148 | return false; |
| 149 | } |
| 150 | |
| 151 | windowsHandle->mappingHandle = NULL; |
| 152 | } |
| 153 | |
| 154 | delete windowsHandle; |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | void * |
no test coverage detected