bool __GetExeCRC(DWORD & r_dwProcCRC, DWORD & r_dwFileCRC) { std::string exeFileName; LPCVOID c_pvBaseAddress; GetExcutedFileName(exeFileName); if (GetProcessInformation(exeFileName, &c_pvBaseAddress)) r_dwProcCRC = GetProcessMemoryCRC(c_pvBaseAddress); else r_dwProcCRC = 0; r_dwFileCRC = GetFileCRC32(exeFileName.c_str()); return true; }
bool CGuildMarkUploader::__LoadSymbol(const char* c_szFileName, UINT* peError) { // For Check Image ILuint uImg; ilGenImages(1, &uImg); ilBindImage(uImg); ilEnable(IL_ORIGIN_SET); ilOriginFunc(IL_ORIGIN_UPPER_LEFT); if (!ilLoad(IL_TYPE_UNKNOWN, (const ILstring)c_szFileName)) { *peError=ERROR_LOAD; return false; } if (ilGetInteger(IL_IMAGE_WIDTH) != 64) { *peError=ERROR_WIDTH; return false; } if (ilGetInteger(IL_IMAGE_HEIGHT) != 128) { *peError=ERROR_HEIGHT; return false; } ilDeleteImages(1, &uImg); ilShutDown(); ///// FILE * file = fopen(c_szFileName, "rb"); if (!file) { *peError=ERROR_LOAD; } fseek(file, 0, SEEK_END); m_dwSymbolBufSize = ftell(file); fseek(file, 0, SEEK_SET); m_pbySymbolBuf = new BYTE [m_dwSymbolBufSize]; fread(m_pbySymbolBuf, m_dwSymbolBufSize, 1, file); fclose(file); ///// m_dwSymbolCRC32 = GetFileCRC32(c_szFileName); return true; }
// 데이타 파일 CRC32 값 검사하기 bool CheckFileCRC32( LPCSTR szFileName, DWORD dwCRC32 ) { char szMessage[256]; if (_access( szFileName, 4 ) != 0) { _snprintf(szMessage, sizeof(szMessage)/sizeof(szMessage[0])-1, ApplicationStringTable_GetStringz(IDS_ERR_CANNOT_READ_FILE, "ERR_CANNOT_READ_FILE"), szFileName); ApplicationSetErrorString(szMessage); return false; } DWORD dwLocalCRC32 = GetFileCRC32(szFileName); if (dwCRC32 != dwLocalCRC32) { _snprintf(szMessage, sizeof(szMessage)/sizeof(szMessage[0])-1, ApplicationStringTable_GetStringz(IDS_ERR_NOT_LATEST_FILE, "ERR_NOT_LATEST_FILE"), szFileName); ApplicationSetErrorString(szMessage); return false; } return true; }