source: trunk/src/kernel32/mmap.h@ 664

Last change on this file since 664 was 664, checked in by sandervl, 26 years ago

Memory mapped file changes

File size: 1.3 KB
Line 
1/* $Id: mmap.h,v 1.6 1999-08-24 18:46:40 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
21class Win32MemMap
22{
23public:
24 Win32MemMap(HFILE hfile, ULONG size, ULONG fdwProtect, LPSTR lpszName);
25 ~Win32MemMap();
26
27 BOOL Init(HANDLE hMemMap);
28 BOOL flushView(LPVOID lpvBase, ULONG cbFlush);
29 LPVOID mapViewOfFile(ULONG size, ULONG offset, ULONG fdwAccess);
30 BOOL unmapViewOfFile();
31
32 HFILE getMapHandle() { return hMemMap; };
33 LPSTR getMemName() { return lpszMapName; };
34 DWORD getProtFlags() { return mProtFlags; };
35
36 void AddRef() { ++referenced; };
37 void Release() { if(--referenced == 0) delete this; };
38
39static Win32MemMap *findMap(LPSTR lpszName);
40static Win32MemMap *findMap(ULONG address);
41
42protected:
43 HFILE hMemMap, hMemFile;
44 ULONG mSize;
45 ULONG mProtFlags;
46 ULONG mMapAccess;
47 LPSTR lpszMapName;
48 void *pMapping;
49 BOOL fMapped;
50
51 ULONG referenced;
52
53 VMutex mapMutex;
54
55private:
56 static Win32MemMap *memmaps;
57 Win32MemMap *next;
58};
59
60#endif //__MMAP_H__
Note: See TracBrowser for help on using the repository browser.