diff options
Diffstat (limited to 'storage/connect/maputil.cpp')
-rw-r--r-- | storage/connect/maputil.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp index b7032f10d2b..7104259ebad 100644 --- a/storage/connect/maputil.cpp +++ b/storage/connect/maputil.cpp @@ -80,7 +80,16 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR filename, } // endif hFileMap access = (mode == MODE_READ) ? FILE_MAP_READ : FILE_MAP_WRITE; - mm->memory = MapViewOfFile(hFileMap, access, 0, 0, 0); + + if (!(mm->memory = MapViewOfFile(hFileMap, access, 0, 0, 0))) { + DWORD ler = GetLastError(); + + sprintf(g->Message, "Error %ld in MapViewOfFile %s", + ler, filename); + CloseHandle(hFile); + return INVALID_HANDLE_VALUE; + } // endif memory + // lenH is the high-order word of the file size mm->lenL = GetFileSize(hFile, &mm->lenH); CloseHandle(hFileMap); // Not used anymore |