#ifndef __ENCRYPTION #define __ENCRYPTION #include "FileListLoader.h" #include "FileEncoder.h" #include "FileDecoder.h" #include "StructInPacket.h" __declspec(align(8)) struct SFiles { BYTE byValue; BOOL bLoad; CHAR pFileName[256]; SFiles() : byValue( 0), bLoad( FALSE) { ZeroMemory( pFileName, 256); } }; struct SFileInfo { DWORD dwLineCount; SFiles* pList; SFileInfo() : dwLineCount( 0), pList( 0) { } }; struct FileHandleInfo { HANDLE hFILE; DWORD dwFileSize; CHAR* pSTREAM; FileHandleInfo() : hFILE( NULL), dwFileSize( 0), pSTREAM( 0) { } }; class Encryption { class EnterSect { public: explicit EnterSect( CRITICAL_SECTION& section ) : m_Section( section) { EnterCriticalSection( &m_Section); } ~EnterSect() { LeaveCriticalSection( &m_Section); } private: EnterSect(const EnterSect& rhs); EnterSect& operator=(const EnterSect& rhs); private: CRITICAL_SECTION& m_Section; }; public: Encryption( CONVERT_RESULT_TOTAL_INFO* pResult, const TCHAR* pPath, BOOL encrypt = FALSE) : m_pResult( pResult), m_FolderPath( pPath), m_bEncrytion( encrypt) { InitializeCriticalSection( &m_hSection); } ~Encryption() { DeleteCriticalSection( &m_hSection); } VOID LoadScriptList(); VOID TestUnit_FileList_EnDecode(BOOL bDecrypt = FALSE); BOOL OpenNrewrite(FileHandleInfo* p_FHI, SFiles* pListT, CHAR* pSrcBuffer, DWORD dwSize); BOOL OpenNread( FileHandleInfo* p_FHI, SFiles* pListT); private: VOID _MessageOut(SFiles* pListT, eRC_CONVERT error, BOOL bError = FALSE) const; HANDLE _OpenFile(const TCHAR *FullPath, DWORD mode) const; private: CONVERT_RESULT_TOTAL_INFO* const m_pResult; const TCHAR* const m_FolderPath; SFileInfo m_FileInfo; BOOL m_bEncrytion; // FALSE : ÀÎÄÚµå, TRUE : µðÄÚµå CRITICAL_SECTION m_hSection; Encryption( const Encryption& rhs ); Encryption& operator = ( const Encryption& rhs ); }; #endif //__ENCRYPTION