-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileMapping.h
56 lines (46 loc) · 1.5 KB
/
FileMapping.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#pragma once
#include "File.h"
class CFileMapping : public CFile
{
public:
CFileMapping();
virtual ~CFileMapping();
BOOL CreateFile(_In_ PCWSTR pFileName, DWORD desiredAccess, DWORD creationDisposition, DWORD sharedMode = 0,
_Inout_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes = nullptr, DWORD flagsAndAttributes = 0,
_Inout_opt_ HANDLE templateFileHandle = nullptr)
{
return CFile::CreateFile(pFileName, desiredAccess, creationDisposition, sharedMode, lpSecurityAttributes,
flagsAndAttributes, templateFileHandle);
}
BOOL IsEndOfFile()
{
return CFile::IsEndOfFile();
}
VOID NextLine()
{
CFile::NextLine();
}
const WCHAR *GetReadBufferPointer()
{
return CFile::GetReadBufferPointer();
}
DWORD_PTR GetFileSize()
{
return CFile::GetFileSize();
}
LPCWSTR GetFileName()
{
return CFile::GetFileName();
}
protected:
BOOL SetupReadBuffer();
private:
HANDLE _fileMappingHandle; // file handle for CreateFileMapping
const VOID *_pMapBuffer; // read buffer memory.
};