| OLD | NEW |
| (Empty) |
| 1 // Windows/FileMapping.h | |
| 2 | |
| 3 #ifndef __WINDOWS_FILEMAPPING_H | |
| 4 #define __WINDOWS_FILEMAPPING_H | |
| 5 | |
| 6 #include "Windows/Handle.h" | |
| 7 #include "Windows/Defs.h" | |
| 8 | |
| 9 namespace NWindows { | |
| 10 // namespace NFile { | |
| 11 // namespace NMapping { | |
| 12 | |
| 13 class CFileMapping: public CHandle | |
| 14 { | |
| 15 public: | |
| 16 bool Create(HANDLE file, LPSECURITY_ATTRIBUTES attributes, | |
| 17 DWORD protect, UINT64 maximumSize, LPCTSTR name) | |
| 18 { | |
| 19 _handle = ::CreateFileMapping(file, attributes, | |
| 20 protect, DWORD(maximumSize >> 32), DWORD(maximumSize), name); | |
| 21 return (_handle != NULL); | |
| 22 } | |
| 23 | |
| 24 bool Open(DWORD desiredAccess, bool inheritHandle, LPCTSTR name) | |
| 25 { | |
| 26 _handle = ::OpenFileMapping(desiredAccess, BoolToBOOL(inheritHandle), name); | |
| 27 return (_handle != NULL); | |
| 28 } | |
| 29 | |
| 30 LPVOID MapViewOfFile(DWORD desiredAccess, UINT64 fileOffset, | |
| 31 SIZE_T numberOfBytesToMap) | |
| 32 { | |
| 33 return ::MapViewOfFile(_handle, desiredAccess, | |
| 34 DWORD(fileOffset >> 32), DWORD(fileOffset), numberOfBytesToMap); | |
| 35 } | |
| 36 | |
| 37 LPVOID MapViewOfFileEx(DWORD desiredAccess, UINT64 fileOffset, | |
| 38 SIZE_T numberOfBytesToMap, LPVOID baseAddress) | |
| 39 { | |
| 40 return ::MapViewOfFileEx(_handle, desiredAccess, | |
| 41 DWORD(fileOffset >> 32), DWORD(fileOffset), | |
| 42 numberOfBytesToMap, baseAddress); | |
| 43 } | |
| 44 | |
| 45 | |
| 46 }; | |
| 47 | |
| 48 } | |
| 49 | |
| 50 #endif | |
| OLD | NEW |