#ifndef __INC_METIN_II_371GNFBQOCJ_LZO_H__ #define __INC_METIN_II_371GNFBQOCJ_LZO_H__ #include #include #include "Singleton.h" class CLZObject { public: #pragma pack(4) typedef struct SHeader { DWORD dwFourCC; DWORD dwEncryptSize; // ¾ÏȣȭµÈ Å©±â DWORD dwCompressedSize; // ¾ÐÃàµÈ µ¥ÀÌÅÍ Å©±â DWORD dwRealSize; // ½ÇÁ¦ µ¥ÀÌÅÍ Å©±â } THeader; #pragma pack() CLZObject(); ~CLZObject(); void Clear(); void BeginCompress(const void * pvIn, UINT uiInLen); void BeginCompressInBuffer(const void * pvIn, UINT uiInLen, void * pvOut); bool Compress(); bool BeginDecompress(const void * pvIn); bool Decompress(DWORD * pdwKey = NULL); bool Encrypt(DWORD * pdwKey); bool __Decrypt(DWORD * key, BYTE* data); const THeader & GetHeader() { return *m_pHeader; } BYTE * GetBuffer() { return m_pbBuffer; } DWORD GetSize(); void AllocBuffer(DWORD dwSize); DWORD GetBufferSize() { return m_dwBufferSize; } //void CopyBuffer(const char* pbSrc, DWORD dwSrcSize); private: void Initialize(); BYTE * m_pbBuffer; DWORD m_dwBufferSize; THeader * m_pHeader; const BYTE * m_pbIn; bool m_bCompressed; bool m_bInBuffer; public: static DWORD ms_dwFourCC; }; class CLZO : public CSingleton { public: CLZO(); virtual ~CLZO(); bool CompressMemory(CLZObject & rObj, const void * pIn, UINT uiInLen); bool CompressEncryptedMemory(CLZObject & rObj, const void * pIn, UINT uiInLen, DWORD * pdwKey); bool Decompress(CLZObject & rObj, const BYTE * pbBuf, DWORD * pdwKey = NULL); BYTE * GetWorkMemory(); private: BYTE * m_pWorkMem; }; #endif