Advertisement
Guest User

[C++] Check MD5 files from source

a guest
Jan 21st, 2017
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.00 KB | None | 0 0
  1. /*
  2. *   Go in folder Svn/Client/UserInterface/ and add this file:
  3. *   Download:
  4.         https://mega.nz/#!vBw1UITR!8rJ1RbFVa47eIVHXm3HTtfRkY_iTFg_eaXgdIzMdI2A
  5.  
  6. *   If you want to obtaining md5 from files, you need only to drag file on box, and will show you "Current file MD5 checksum value".
  7.     Download:
  8.         http://www.winmd5.com/download/winmd5free.zip
  9. */
  10.  
  11. //@Svn/Client/UserInterface/Locale_inc.h
  12. //Add where you want:
  13. #define ENABLE_CHECK_FILES_MD5
  14.  
  15. //@Svn/Client/UserInterface/UserInterface.cpp
  16. //1.) Search for:
  17. #include "Version.h"
  18. //2.) Add bellow:
  19. #ifdef ENABLE_CHECK_FILES_MD5
  20.     #include "md5.h"
  21.     #include <windows.h>
  22. #endif
  23.  
  24. //1.) Search for:
  25. static const char * sc_apszPythonLibraryFilenames[] =
  26. {
  27.     [........]
  28. };
  29. //2.) Add after:
  30. #ifdef ENABLE_CHECK_FILES_MD5
  31.     #define MAX_ROWS_MD5 21
  32.     static char * ar_szMD5FileNames[MAX_ROWS_MD5][2] =
  33.     {
  34.         // Example of list:
  35.         { "lib/__future__.pyc", "d2505c6e64dc44a1745dda0905f4e787" },
  36.         { "lib/copy_reg.pyc",   "5e996d35b598676b253dd25fa3809ef2" },
  37.         { "lib/linecache.pyc",  "c4c28529b05b4093f629fb7b23603cd2" },
  38.         { "lib/ntpath.pyc",     "966048f390a65bebf60f912845441110" },
  39.         { "lib/os.pyc",         "9e1e72faaafcde16dfd0e643a31f0b74" },
  40.         { "lib/site.pyc",       "8336371539a459e72d7110f0cb1ed84f" },
  41.         { "lib/stat.pyc",       "3dc2d3d11ba4c668a0097fbd631c7be6" },
  42.         { "lib/string.pyc",     "39c29074226b2196e7f13ce93560d3d0" },
  43.         { "lib/traceback.pyc",  "009e6647dfac211b6e69c6b3f1ed5600" },
  44.         { "lib/types.pyc",      "2bff75340aa1d94b88bfc7915a291564" },
  45.         { "lib/UserDict.pyc",   "aabdd94dfe3a1b0092f0a414a935c091" },
  46.  
  47.         { "miles/mssdsp.flt",   "cb71b1791009eca618e9b1ad4baa4fa9" },
  48.         { "miles/msssoft.m3d",  "bdc9ad58ade17dbd939522eee447416f" },
  49.         { "miles/mssa3d.m3d",   "e089ce52b0617a6530069f22e0bdba2a" },
  50.         { "miles/mss32.dll",    "6400e224b8b44ece59a992e6d8233719" },
  51.  
  52.         { "pack/Index",         "8823ca827dfc980798856e97f3568cef" },
  53.         { "pack/root.eix",      "ce13b7c96f725b7d7c39cbe1ae2f8b4d" },
  54.         { "pack/ETC.eix",       "7c0b756d079a9c76a220a724b9594eeb" },
  55.         { "pack/locale_en.eix", "5b1aea18b89330481e16eca94673951c" },
  56.         { "pack/uiscript.eix""d211c0a83ff2c771946d73554916bd9a" },
  57.  
  58.         { "python27.dll",       "d219c0a8aff2c771946d73554916bd9a" }
  59.         /*
  60.             Unlimited files
  61.         */
  62.     };
  63. #endif
  64.  
  65. //1.) Search for:
  66. bool __IsLocaleVersion(LPSTR lpCmdLine)
  67. {
  68.     return (strcmp(lpCmdLine, "--perforce-revision") == 0);
  69. }
  70. //2.) Add bellow:
  71. #ifdef ENABLE_CHECK_FILES_MD5
  72.     void CheckMD5Filenames()
  73.     {
  74.         MD5 md5;
  75.         for (int it = 0; it < _countof(ar_szMD5FileNames); it++)
  76.         {
  77.             if (strcmp(md5.digestFile(ar_szMD5FileNames[it][0]), ar_szMD5FileNames[it][1]))
  78.             {
  79.                 char szBuf[512 + 1];
  80.                 snprintf(szBuf, sizeof(szBuf), "A file %s has been modified, please update autopatcher.", ar_szMD5FileNames[it][0]);
  81.                 MessageBoxA(NULL, szBuf, "#Metin2", NULL);
  82.                 exit(0);
  83.             }
  84.         }
  85.     }
  86. #endif
  87.  
  88. //1.) Search for:
  89.     if (strstr(lpCmdLine, "--hackshield") != 0)
  90.         return 0;
  91. //2.) Add after:
  92. #ifdef ENABLE_CHECK_FILES_MD5
  93.     CheckMD5Filenames();
  94. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement