Old fashion design for PC-104
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: MemoryFile.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of MemoryFile.cpp
//----------------------------------------------------------------------------
// MapFile.cpp: implementation of the CMemoryFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MemoryFile.h"
#include "..\..\LgLib\Version.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMemoryFile::CMemoryFile(){ m_hMap = NULL; m_pMemory = NULL;
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CMemoryFile::CMemoryFile") );}
CMemoryFile::~CMemoryFile(){ Unmap();
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CMemoryFile::~CMemoryFile") );}
BOOL CMemoryFile::Map( DWORD dwSize, LPCTSTR pName ){ Unmap();
m_hMap = ::CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, dwSize, pName );
if( m_hMap ) { m_pMemory = ::MapViewOfFileEx( m_hMap, FILE_MAP_ALL_ACCESS, 0UL, 0UL, 0UL, NULL );
if( m_pMemory ) return TRUE; }
return FALSE;}
void CMemoryFile::Unmap(){ if( m_pMemory ) { ::UnmapViewOfFile( m_pMemory ); m_pMemory = NULL; }
if( m_hMap ) { ::CloseHandle( m_hMap ); m_hMap = NULL; }}
|