Line | |
---|
1 | /* $Id: mmap.h,v 1.5 1999-08-24 12:23:54 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Memory mapped class
|
---|
5 | *
|
---|
6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #ifndef __MMAP_H__
|
---|
13 | #define __MMAP_H__
|
---|
14 |
|
---|
15 | #include <vmutex.h>
|
---|
16 |
|
---|
17 | #ifndef PAGE_SIZE
|
---|
18 | #define PAGE_SIZE 4096
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | class Win32MemMap
|
---|
22 | {
|
---|
23 | public:
|
---|
24 | Win32MemMap(HFILE hfile, ULONG size, ULONG fdwProtect, LPSTR lpszName);
|
---|
25 | ~Win32MemMap();
|
---|
26 |
|
---|
27 | HANDLE Init();
|
---|
28 | BOOL flushView(LPVOID lpvBase, ULONG cbFlush);
|
---|
29 | LPVOID mapFileView(ULONG size, ULONG offset, ULONG fdwAccess);
|
---|
30 | BOOL unmapFileView();
|
---|
31 |
|
---|
32 | HFILE getMapHandle() { return hMemMap; };
|
---|
33 | LPSTR getMemName() { return lpszMapName; };
|
---|
34 |
|
---|
35 | static Win32MemMap *findMap(LPSTR lpszName);
|
---|
36 | static Win32MemMap *findMap(ULONG address);
|
---|
37 |
|
---|
38 | protected:
|
---|
39 | HFILE hMemMap, hMemFile;
|
---|
40 | ULONG mSize;
|
---|
41 | ULONG mProtFlags;
|
---|
42 | ULONG mMapAccess;
|
---|
43 | LPSTR lpszMapName;
|
---|
44 | void *pMapping;
|
---|
45 | BOOL fMapped;
|
---|
46 |
|
---|
47 | VMutex mapMutex;
|
---|
48 |
|
---|
49 | private:
|
---|
50 | static Win32MemMap *memmaps;
|
---|
51 | Win32MemMap *next;
|
---|
52 | };
|
---|
53 |
|
---|
54 | #endif //__MMAP_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.