Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.85 KB | None | 0 0
  1. userinterface/userinterface.cpp
  2.  
  3. int APIENTRY WinMain
  4.  
  5. sub
  6. #ifdef XTRAP_CLIENT_ENABLE sau
  7. #ifdef USE_AHNLAB_HACKSHIELD sau
  8. #ifdef USE_NPROTECT_GAMEGUARD sau
  9. #if defined(CHECK_LATEST_DATA_FILES)
  10.  
  11. adauga
  12.  
  13. static DWORD s_nextFileCheckTime = ELTimer_GetMSec();
  14. DWORD curTime = ELTimer_GetMSec();
  15.  
  16. if (s_nextFileCheckTime <= curTime)
  17. {
  18. CPythonNetworkStream::Instance().FileCheckRoutine();
  19. CPythonNetworkStream::Instance().FileCheckPack();
  20. CPythonNetworkStream::Instance().FileChecks();
  21. s_nextFileCheckTime = curTime + 800;
  22. }
  23.  
  24. PythonNetworkStream.h sub bool SendItemPickUpPacket(DWORD vid);
  25.  
  26. void FileCheckRoutine();
  27. void FileCheckPack();
  28. void FileChecks();
  29.  
  30. PythonNetworkStreamPhaseGame.cpp
  31. sub
  32. BOOL gs_bEmpireLanuageEnable = TRUE;
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. static std::vector <std::string> vWhiteList =
  40. {
  41. "artpclnt.dll",
  42. "bgm",
  43. "channel.inf",
  44. "config.exe",
  45. "devil.dll",
  46. "DSETUP.dll",
  47. "ErrorLog.txt",
  48. "granny2.dll",
  49. "ijl15.dll",
  50. "ilu.dll",
  51. "lib",
  52. "locale.cfg",
  53. "Mac.dll",
  54. "mark",
  55. "Memetin2.exe",
  56. "metin2.cfg",
  57. "miles",
  58. "mouse.cfg",
  59. "mscoree.dll",
  60. "MSS32.DLL",
  61. "msvcp60.dll",
  62. "MSVCRTD.DLL",
  63. "pack",
  64. "Patcher.exe",
  65. "python27.dll",
  66. "screenshot",
  67. "SpeedTreeRT.dll",
  68. "syserr.txt",
  69. "temp",
  70. "unicows.dll",
  71. "upload"
  72. };
  73.  
  74. static std::vector <std::string> vWhiteListPack =
  75. {
  76. "bgm.eix",
  77. "bgm.epk",
  78. "effect.eix",
  79. "effect.epk",
  80. "etc.eix",
  81. "etc.epk",
  82. "gildenkrieg.eix",
  83. "gildenkrieg.epk",
  84. "guild.eix",
  85. "guild.epk",
  86. "icon.eix",
  87. "icon.epk",
  88. "Index",
  89. "item.eix",
  90. "item.epk",
  91. "locale_de.eix",
  92. "locale_de.epk",
  93. "map1.eix",
  94. "map1.epk",
  95. "map2.eix",
  96. "map2.epk",
  97. "maps.eix",
  98. "maps.epk",
  99. "maps2.eix",
  100. "maps2.epk",
  101. "monster.eix",
  102. "monster.epk",
  103. "npc.eix",
  104. "npc.epk",
  105. "pc.eix",
  106. "pc.epk",
  107. "pc2.eix",
  108. "pc2.epk",
  109. "property.eix",
  110. "property.epk",
  111. "reichsschlacht.eix",
  112. "reichsschlacht.epk",
  113. "root.eix",
  114. "root.epk",
  115. "season.eix",
  116. "season.epk",
  117. "season1.eix",
  118. "season1.epk",
  119. "sound.eix",
  120. "sound.epk",
  121. "terrain.eix",
  122. "terrain.epk",
  123. "textureset.eix",
  124. "textureset.epk",
  125. "tree.eix",
  126. "tree.epk",
  127. "uiscript.eix",
  128. "uiscript.epk",
  129. "zone.eix",
  130. "zone.epk"
  131. };
  132.  
  133. static std::vector <std::string> vWhiteListlib =
  134. {
  135. "abc.pyc",
  136. "aifc.pyc",
  137. "antigravity.pyc",
  138. "anydbm.pyc",
  139. "argparse.pyc",
  140. "ast.pyc",
  141. "asynchat.pyc",
  142. "asyncore.pyc",
  143. "atexit.pyc",
  144. "audiodev.pyc",
  145. "base64.pyc",
  146. "BaseHTTPServer.pyc",
  147. "Bastion.pyc",
  148. "bdb.pyc",
  149. "binhex.pyc",
  150. "bisect.pyc",
  151. "calendar.pyc",
  152. "cgi.pyc",
  153. "CGIHTTPServer.pyc",
  154. "cgitb.pyc",
  155. "chunk.pyc",
  156. "cmd.pyc",
  157. "code.pyc",
  158. "codecs.pyc",
  159. "codeop.pyc",
  160. "collections.pyc",
  161. "colorsys.pyc",
  162. "commands.pyc",
  163. "compileall.pyc",
  164. "ConfigParser.pyc",
  165. "contextlib.pyc",
  166. "Cookie.pyc",
  167. "cookielib.pyc",
  168. "copy.pyc",
  169. "copy_reg.pyc",
  170. "cProfile.pyc",
  171. "csv.pyc",
  172. "dbhash.pyc",
  173. "decimal.pyc",
  174. "difflib.pyc",
  175. "dircache.pyc",
  176. "dis.pyc",
  177. "doctest.pyc",
  178. "DocXMLRPCServer.pyc",
  179. "dumbdbm.pyc",
  180. "dummy_thread.pyc",
  181. "dummy_threading.pyc",
  182. "encodings",
  183. "FastEquipPage1.pyc",
  184. "filecmp.pyc",
  185. "fileinput.pyc",
  186. "fnmatch.pyc",
  187. "formatter.pyc",
  188. "fpformat.pyc",
  189. "fractions.pyc",
  190. "ftplib.pyc",
  191. "functools.pyc",
  192. "genericpath.pyc",
  193. "getopt.pyc",
  194. "getpass.pyc",
  195. "gettext.pyc",
  196. "glob.pyc",
  197. "gzip.pyc",
  198. "hashlib.pyc",
  199. "heapq.pyc",
  200. "hmac.pyc",
  201. "htmlentitydefs.pyc",
  202. "htmllib.pyc",
  203. "HTMLParser.pyc",
  204. "httplib.pyc",
  205. "ihooks.pyc",
  206. "imaplib.pyc",
  207. "imghdr.pyc",
  208. "imputil.pyc",
  209. "inspect.pyc",
  210. "io.pyc",
  211. "itemlist.txt",
  212. "keyword.pyc",
  213. "linecache.pyc",
  214. "locale.pyc",
  215. "macpath.pyc",
  216. "macurl2path.pyc",
  217. "mailbox.pyc",
  218. "mailcap.pyc",
  219. "markupbase.pyc",
  220. "md5.pyc",
  221. "mhlib.pyc",
  222. "mimetools.pyc",
  223. "mimetypes.pyc",
  224. "MimeWriter.pyc",
  225. "mimify.pyc",
  226. "modulefinder.pyc",
  227. "multifile.pyc",
  228. "mutex.pyc",
  229. "netrc.pyc",
  230. "new.pyc",
  231. "nntplib.pyc",
  232. "ntpath.pyc",
  233. "nturl2path.pyc",
  234. "numbers.pyc",
  235. "opcode.pyc",
  236. "optparse.pyc",
  237. "os.pyc",
  238. "os2emxpath.pyc",
  239. "pdb.pyc",
  240. "pickle.pyc",
  241. "pickletools.pyc",
  242. "pipes.pyc",
  243. "pkgutil.pyc",
  244. "platform.pyc",
  245. "plistlib.pyc",
  246. "popen2.pyc",
  247. "poplib.pyc",
  248. "posixfile.pyc",
  249. "posixpath.pyc",
  250. "pprint.pyc",
  251. "profile.pyc",
  252. "pstats.pyc",
  253. "pty.pyc",
  254. "pyclbr.pyc",
  255. "pydoc.pyc",
  256. "pyexpat.pyd",
  257. "pyexpat_d.pdb",
  258. "pyexpat_d.pyd",
  259. "py_compile.pyc",
  260. "Queue.pyc",
  261. "quopri.pyc",
  262. "random.pyc",
  263. "re.pyc",
  264. "repr.pyc",
  265. "rexec.pyc",
  266. "rfc822.pyc",
  267. "rlcompleter.pyc",
  268. "robotparser.pyc",
  269. "runpy.pyc",
  270. "sched.pyc",
  271. "sets.pyc",
  272. "sgmllib.pyc",
  273. "sha.pyc",
  274. "shelve.pyc",
  275. "shlex.pyc",
  276. "shutil.pyc",
  277. "SimpleHTTPServer.pyc",
  278. "SimpleXMLRPCServer.pyc",
  279. "site.pyc",
  280. "smtpd.pyc",
  281. "smtplib.pyc",
  282. "sndhdr.pyc",
  283. "socket.pyc",
  284. "SocketServer.pyc",
  285. "sre.pyc",
  286. "sre_compile.pyc",
  287. "sre_constants.pyc",
  288. "sre_parse.pyc",
  289. "ssl.pyc",
  290. "stat.pyc",
  291. "statvfs.pyc",
  292. "string.pyc",
  293. "StringIO.pyc",
  294. "stringold.pyc",
  295. "stringprep.pyc",
  296. "struct.pyc",
  297. "subprocess.pyc",
  298. "sunau.pyc",
  299. "sunaudio.pyc",
  300. "symbol.pyc",
  301. "symtable.pyc",
  302. "sysconfig.pyc",
  303. "tabnanny.pyc",
  304. "tarfile.pyc",
  305. "telnetlib.pyc",
  306. "tempfile.pyc",
  307. "textwrap.pyc",
  308. "this.pyc",
  309. "threading.pyc",
  310. "timeit.pyc",
  311. "toaiff.pyc",
  312. "token.pyc",
  313. "tokenize.pyc",
  314. "trace.pyc",
  315. "traceback.pyc",
  316. "tty.pyc",
  317. "types.pyc",
  318. "urllib.pyc",
  319. "urllib2.pyc",
  320. "urlparse.pyc",
  321. "user.pyc",
  322. "UserDict.pyc",
  323. "UserList.pyc",
  324. "UserString.pyc",
  325. "uu.pyc",
  326. "uuid.pyc",
  327. "warnings.pyc",
  328. "wave.pyc",
  329. "weakref.pyc",
  330. "webbrowser.pyc",
  331. "whichdb.pyc",
  332. "xdrlib.pyc",
  333. "xml",
  334. "xml.rar",
  335. "xmllib.pyc",
  336. "xmlrpclib.pyc",
  337. "zipfile.pyc",
  338. "_abcoll.pyc",
  339. "_locale.pyc",
  340. "_LWPCookieJar.pyc",
  341. "_MozillaCookieJar.pyc",
  342. "_osx_support.pyc",
  343. "_pyio.pyc",
  344. "_socket.pyd",
  345. "_strptime.pyc",
  346. "_threading_local.pyc",
  347. "_weakrefset.pyc",
  348. "__future__.pyc",
  349. "__phello__.foo.pyc"
  350. };
  351.  
  352. static std::string GetRootPath()
  353. {
  354. char szBuffer[MAX_PATH];
  355. if (GetModuleFileNameA(NULL, szBuffer, MAX_PATH))
  356. {
  357. std::string szPath = std::string(szBuffer);
  358. size_t nPos = szPath.find_last_of("\\/");
  359. szPath = szPath.substr(0, nPos);
  360.  
  361. DWORD dwAttrib = GetFileAttributesA(szPath.c_str());
  362. if (szPath.empty() == false && dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))
  363. {
  364. return szPath;
  365. }
  366. }
  367. return std::string("");
  368. }
  369.  
  370. void CPythonNetworkStream::FileChecks()
  371. {
  372. std::string szRootPath = GetRootPath();
  373. if (szRootPath.empty())
  374. {
  375. // printf("Root path not found! Error: %u\n", GetLastError());
  376. return;
  377. }
  378. std::string szSearchPath = szRootPath + "/lib/*.*";
  379.  
  380. WIN32_FIND_DATAA w32fd;
  381. HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
  382. if (hFind != INVALID_HANDLE_VALUE)
  383. {
  384. do {
  385. std::string szCurrentItem = w32fd.cFileName;
  386. if (szCurrentItem != "." && szCurrentItem != "..")
  387. {
  388. // printf("\tCurrent %s\n", szCurrentItem.c_str());
  389.  
  390. if (std::find(vWhiteListlib.begin(), vWhiteListlib.end(), szCurrentItem) == vWhiteListlib.end()) // not whitelisted item
  391. {
  392. // printf("\tUnknown file: %s\n", szCurrentItem.c_str());
  393.  
  394. if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
  395. {
  396. std::string szWarn = "Unknown file detected: " + szCurrentItem + ", Delete this file.";
  397. MessageBoxA(0, szWarn.c_str(), 0, 0);
  398.  
  399. PostQuitMessage(0);
  400. }
  401. }
  402. }
  403. } while (FindNextFileA(hFind, &w32fd));
  404. FindClose(hFind);
  405. }
  406. }
  407.  
  408. void CPythonNetworkStream::FileCheckPack()
  409. {
  410. std::string szRootPath = GetRootPath();
  411. if (szRootPath.empty())
  412. {
  413. // printf("Root path not found! Error: %u\n", GetLastError());
  414. return;
  415. }
  416. std::string szSearchPath = szRootPath + "/pack/*.*";
  417.  
  418. WIN32_FIND_DATAA w32fd;
  419. HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
  420. if (hFind != INVALID_HANDLE_VALUE)
  421. {
  422. do {
  423. std::string szCurrentItem = w32fd.cFileName;
  424. if (szCurrentItem != "." && szCurrentItem != "..")
  425. {
  426. // printf("\tCurrent %s\n", szCurrentItem.c_str());
  427.  
  428. if (std::find(vWhiteListPack.begin(), vWhiteListPack.end(), szCurrentItem) == vWhiteListPack.end()) // not whitelisted item
  429. {
  430. // printf("\tUnknown file: %s\n", szCurrentItem.c_str());
  431.  
  432. if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
  433. {
  434. std::string szWarn = "Unknown file detected: " + szCurrentItem + ", Delete this file.";
  435. MessageBoxA(0, szWarn.c_str(), 0, 0);
  436.  
  437. PostQuitMessage(0);
  438. }
  439. }
  440. }
  441. } while (FindNextFileA(hFind, &w32fd));
  442. FindClose(hFind);
  443. }
  444. }
  445.  
  446. void CPythonNetworkStream::FileCheckRoutine()
  447. {
  448. std::string szRootPath = GetRootPath();
  449. if (szRootPath.empty())
  450. {
  451. // printf("Root path not found! Error: %u\n", GetLastError());
  452. return;
  453. }
  454. // printf("Root: %s\n", szRootPath.c_str());
  455. std::string szSearchPath = szRootPath + "/*.*";
  456.  
  457. WIN32_FIND_DATAA w32fd;
  458. HANDLE hFind = FindFirstFileA(szSearchPath.c_str(), &w32fd);
  459. if (hFind != INVALID_HANDLE_VALUE)
  460. {
  461. do {
  462. std::string szCurrentItem = w32fd.cFileName;
  463. if (szCurrentItem != "." && szCurrentItem != "..")
  464. {
  465. // printf("\tCurrent %s\n", szCurrentItem.c_str());
  466.  
  467. if (std::find(vWhiteList.begin(), vWhiteList.end(), szCurrentItem) == vWhiteList.end()) // not whitelisted item
  468. {
  469. // printf("\tUnknown file: %s\n", szCurrentItem.c_str());
  470.  
  471. if (DeleteFileA(szCurrentItem.c_str()) == FALSE /* can not removed */ || _access(szCurrentItem.c_str(), 0) == 0 /* removed but still exist */)
  472. {
  473. std::string szWarn = "Unknown file detected: " + szCurrentItem + ", Delete this file.";
  474. MessageBoxA(0, szWarn.c_str(), 0, 0);
  475.  
  476. PostQuitMessage(0);
  477. }
  478. }
  479. }
  480. } while (FindNextFileA(hFind, &w32fd));
  481. FindClose(hFind);
  482. }
  483. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement