⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsfile.h

📁 This is a little console mode utility program which is able to (de-)compress single files with a s
💻 H
字号:
/*****************************************************************************

  clsFILE
  -------

  Revisions: 002

  This is a class for handling files and memory maps of them.

  by yoda

  WWW:      y0da.cjb.net
  E-mail:   LordPE@gmx.net

  You are allowed to use this source code in your own projects if you mention
  my name.

*****************************************************************************/

#ifndef __File_h__
#define __File_h__

#include <windows.h>

//
// constants
//
// modes for GetFileHandle
#define F_OPENEXISTING_R     0
#define F_OPENEXISTING_RW    1
#define F_CREATENEW          2
#define F_TRUNCATE           3

//
// class clsFILE
//
class clsFILE
{
public:
	//
	// some properties for uncomplex use (Microsoft specific stuff!)
	//
	__declspec( property( get=GetHandle ) )   DWORD  m_hFile;
	__declspec( property( get=GetFSize ) )    DWORD  m_dwFileSize;
	__declspec( property( get=GetMapPtr ) )   void*  m_pMap;
	__declspec( property( get=GetMapSize ) )  DWORD  m_cbMappedSize;

	clsFILE();
	~clsFILE();
	BOOL          GetFileHandle(char *szFilePath, DWORD dwMode);
	BOOL          GetFileHandleWithMaxAccess(char* szFilePath);
	BOOL          Destroy();
	void          InitVars();
	HANDLE        GetHandle();
	BOOL          IsFileReadOnly();
	BOOL          MapFile();
	void*         GetMapPtr();
	BOOL          UnmapFile();
	BOOL          ReMapFile(DWORD dwNewSize);
	DWORD         GetMapSize();
	BOOL          IsMapped();
	DWORD         GetFSize();
	BOOL          FlushFileMap();
	static BOOL   FileExits(char* szFilePath);
	char*         GetFilePath();
	BOOL          Write(void* pBuff, DWORD dwc);
	BOOL          Read(void* pBuff, DWORD dwc);
	BOOL          SetFPointer(DWORD dwOff);
	BOOL          Truncate();
	void          SetMapPtrSize(void* ptr, DWORD dwSize);

private:
	DWORD         dwMapSize;
	void          *pMap;
	BOOL          bReadOnly;
	HANDLE        hFile;
	char          cFilePath[MAX_PATH];
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -