| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
MEMORY_MAPPED_FILE Class Reference

`#include <LibSymbolInfo.h>`

## Public Member Functions
| MEMORY_MAPPED_FILE (PSTR pszFileName)
| ~MEMORY_MAPPED_FILE (void)
PVOID | GetBase (void)
DWORD | GetFileSize (void)
BOOL | IsValid (void)
errMMF | GetErrorType ()

## Private Attributes
HANDLE | m_hFile
HANDLE | m_hFileMapping
PVOID | m_pMemoryMappedFileBase
DWORD | m_cbFile
errMMF | m_errCode

## Detailed Description

Definition at line 35 of file LibSymbolInfo.h.

## Constructor & Destructor Documentation

MEMORY_MAPPED_FILE::MEMORY_MAPPED_FILE | ( | PSTR | pszFileName | ) |

Definition at line 178 of file LibSymbolInfo.cpp.

179 {
180
181 //
182 // Given a filename, the constructor opens a file handle, creates a file
183 // mapping, and maps the entire file into memory.
184 //
185 m_hFile = INVALID_HANDLE_VALUE;
186 m_hFileMapping = 0;
187 m_pMemoryMappedFileBase = 0;
188 m_cbFile = 0;
189 m_errCode = errMMF_FileOpen; // Initial error code: not found
190 // First get a file handle
191 m_hFile =
192 CreateFile( pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0 );
193
194 if ( m_hFile == INVALID_HANDLE_VALUE ) {
195 m_errCode = errMMF_FileOpen;
196 return;
197 }
198 m_cbFile = ::GetFileSize( m_hFile, 0 );
199 // Now, create a file mapping
200 m_hFileMapping = CreateFileMapping( m_hFile, NULL, PAGE_READONLY, 0, 0, NULL );
201 if ( m_hFileMapping == 0 ) {
202 // Oops. Something went wrong. Clean up.
203 CloseHandle( m_hFile );
204 m_hFile = INVALID_HANDLE_VALUE;
205 m_errCode = errMMF_FileMapping;
206 return;
207 }
208 m_pMemoryMappedFileBase = (PCHAR)MapViewOfFile( m_hFileMapping, FILE_MAP_READ, 0, 0, 0 );
209 if ( m_pMemoryMappedFileBase == 0 ) {
210 // Oops. Something went wrong. Clean up.
211 CloseHandle( m_hFileMapping );
212 m_hFileMapping = 0;
213 CloseHandle( m_hFile );
214 m_hFile = INVALID_HANDLE_VALUE;
215 m_errCode = errMMF_MapView;
216 return;
217 }
218 m_errCode = errMMF_NoError;
219 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:33
errMMF_MapView
Definition: LibSymbolInfo.h:33
MEMORY_MAPPED_FILE::GetFileSize
DWORD GetFileSize(void)
Definition: LibSymbolInfo.h:42
errMMF_FileMapping
Definition: LibSymbolInfo.h:33
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:50
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:51
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:47
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:48
errMMF_NoError
Definition: LibSymbolInfo.h:33

MEMORY_MAPPED_FILE::~MEMORY_MAPPED_FILE | ( | void |  | ) |

Definition at line 221 of file LibSymbolInfo.cpp.

222 {
223 // Clean up everything that was created by the constructor
224 if ( m_pMemoryMappedFileBase ) UnmapViewOfFile( m_pMemoryMappedFileBase );
225
226 if ( m_hFileMapping ) CloseHandle( m_hFileMapping );
227
228 if ( m_hFile != INVALID_HANDLE_VALUE ) CloseHandle( m_hFile );
229
230 m_errCode = errMMF_FileOpen;
231 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:33
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:51
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:47
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:48

## Member Function Documentation

PVOID MEMORY_MAPPED_FILE::GetBase | ( | void |  | ) |
| inline

Definition at line 41 of file LibSymbolInfo.h.

41 { return m_pMemoryMappedFileBase; }
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:49

errMMF MEMORY_MAPPED_FILE::GetErrorType | ( |  | ) |
| inline

Definition at line 44 of file LibSymbolInfo.h.

44 { return m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:51

DWORD MEMORY_MAPPED_FILE::GetFileSize | ( | void |  | ) |
| inline

Definition at line 42 of file LibSymbolInfo.h.

42 { return m_cbFile; }
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:50

BOOL MEMORY_MAPPED_FILE::IsValid | ( | void |  | ) |
| inline

Definition at line 43 of file LibSymbolInfo.h.

43 { return errMMF_NoError == m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:51
errMMF_NoError
Definition: LibSymbolInfo.h:33

## Member Data Documentation

DWORD MEMORY_MAPPED_FILE::m_cbFile
| private

Definition at line 50 of file LibSymbolInfo.h.

errMMF MEMORY_MAPPED_FILE::m_errCode
| private

Definition at line 51 of file LibSymbolInfo.h.

HANDLE MEMORY_MAPPED_FILE::m_hFile
| private

Definition at line 47 of file LibSymbolInfo.h.

HANDLE MEMORY_MAPPED_FILE::m_hFileMapping
| private

Definition at line 48 of file LibSymbolInfo.h.

PVOID MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
| private

Definition at line 49 of file LibSymbolInfo.h.

The documentation for this class was generated from the following files:

- GaudiKernel/src/Util/LibSymbolInfo.h
- GaudiKernel/src/Util/LibSymbolInfo.cpp