static
HANDLE CacheHandle;
+static
+VOID * ViewOfFile;
+
static
SYSTEM_INFO sysInfo;
#endif /* !DJGPP */
}
return CM_ERROR_INVAL;
}
- data = MapViewOfFile(hm,
- FILE_MAP_ALL_ACCESS,
- 0, 0,
- buf_nbuffers * buf_bufferSize);
- if (data == NULL) {
+ ViewOfFile = MapViewOfFile(hm,
+ FILE_MAP_ALL_ACCESS,
+ 0, 0,
+ buf_nbuffers * buf_bufferSize);
+ if (ViewOfFile == NULL) {
afsi_log("Error mapping view of file: 0x%X", GetLastError());
if (hf != INVALID_HANDLE_VALUE)
CloseHandle(hf);
return CM_ERROR_INVAL;
}
CloseHandle(hm);
+
+ data = ViewOfFile;
#else
/* djgpp doesn't support memory mapped files */
data = malloc(buf_nbuffers * buf_bufferSize);
return 0;
}
+void
+buf_Shutdown(void)
+{
+ UnmapViewOfFile(ViewOfFile);
+ CloseHandle(CacheHandle);
+}
+
/* add nbuffers to the buffer pool, if possible.
* Called with no locks held.
*/