forked from somma/_MyLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileIoHelper.h
38 lines (32 loc) · 1.17 KB
/
FileIoHelper.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
/*-----------------------------------------------------------------------------
* FileIoHelper.h
*-----------------------------------------------------------------------------
* 파일 사이즈가 4GB 가 넘는 경우 사용이 불가능
* 4GB 이상의 파일에 대한 IO 처리가 필요한 경우 FileIoHelperClass.h 모듈을
* 이용할 것
*-----------------------------------------------------------------------------
* All rights reserved by somma (fixbrain@gmail.com, unsorted@msn.com)
*-----------------------------------------------------------------------------
* - 01.09.2010 created
**---------------------------------------------------------------------------*/
#ifndef _fileio_helper_h_
#define _fileio_helper_h_
#include "Win32Utils.h"
typedef struct _FILE_CTX
{
HANDLE FileHandle;
DWORD FileSize;
HANDLE FileMap;
PCHAR FileView;
}FILE_CTX, *PFILE_CTX;
bool OpenFileContext(IN PCWSTR FilePath, IN bool ReadOnly, OUT PFILE_CTX& Ctx);
void CloseFileContext(IN PFILE_CTX& Ctx);
class SmrtFileCtx
{
public:
SmrtFileCtx(PFILE_CTX ctx) : mCtx(ctx) {}
~SmrtFileCtx(){ CloseFileContext(mCtx);}
private:
PFILE_CTX mCtx;
};
#endif//_dtagent_helper_h_