Guest User

Untitled

a guest
Dec 6th, 2018
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.78 KB | None | 0 0
  1. #include "StdAfx.h"
  2. #include "Locale.h"
  3. #include "PythonApplication.h"
  4. #include "resource.h"
  5. #include "../eterBase/CRC32.h"
  6. #include "../eterpack/EterPackManager.h"
  7. #include "../eterLocale/Japanese.h"
  8. #include <windowsx.h>
  9. #include <windows.h>
  10. #include <assert.h>
  11. #include <tlhelp32.h>
  12. #include <imagehlp.h>
  13. #include <psapi.h>
  14. #include <process.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <commdlg.h>
  19. #include <iostream>
  20. #include <sstream>
  21. #include <string>
  22. #include <vector>
  23. #pragma comment(lib, "psapi.lib")
  24. #pragma comment(lib, "imagehlp.lib")
  25. #pragma comment(lib, "comdlg32.lib")
  26. #define JUMP_TO_OFFSET(_BaseOffset, _TargetOffset) ((LONG)(_TargetOffset) - (LONG)(_BaseOffset) - 5)
  27. #define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
  28. #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
  29. #define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)
  30. #define SystemHandleInformation 16
  31. #define APP_TITLE "Metin2 (C) Actiune orientala MMORPG" //CHANGE THIS WITH THE TITLE THAT YOU WANT (REMEMBER TO CHANGE IT IN Locale.cpp)
  32. #define ARGUMENT "--metin2"
  33.  
  34. bool LogMode = false;
  35. bool LibCheck = false;
  36. bool YmirWorkFolderCheck = true;
  37. bool ArgumentEnable = false;
  38.  
  39. std::string AppTitle = APP_TITLE;
  40.  
  41. std::string FromHex(const std::string& in) {
  42. std::string output;
  43. if ((in.length() % 2) != 0) {
  44. FILE *f=fopen("HackShield.Config.Error.txt", "w");
  45. fputs("[HackShield] Error while decrypting this text: ", f);
  46. fputs(in.c_str(), f);
  47. fputs("\n", f);
  48. fclose(f);
  49. exit(-1);
  50. return "";
  51. }
  52. size_t cnt = in.length() / 2;
  53. for (size_t i = 0; cnt > i; ++i) {
  54. unsigned long int s = 0;
  55. std::stringstream ss;
  56. ss << std::hex << in.substr(i * 2, 2);
  57. ss >> s;
  58. output.push_back(static_cast<unsigned char>(s));
  59. }
  60. return output;
  61. }
  62.  
  63. std::string UltimateCipher(std::string Str) {
  64. char Key[3] = { 'A', 'B', 'C' };
  65. std::string Encrypted = Str;
  66. for (unsigned int i = 0; i<Str.size(); i++) Encrypted[i] = Str[i] ^ Key[i % (sizeof(Key) / sizeof(char))];
  67. return Encrypted;
  68. }
  69.  
  70. std::string UltimateDecrypt(std::string MyString) {
  71. return UltimateCipher(FromHex(MyString));
  72. }
  73.  
  74. std::string WhiteList[] = {
  75. AppTitle,
  76. UltimateDecrypt("022d2e312337162b2d252d34"),
  77. UltimateDecrypt("0d0d04"),
  78. UltimateDecrypt("0c010a61212c2c2f222f266329232d252e2a2f2563362b2d252d34"),
  79. UltimateDecrypt("0923202a112b28272f25626e610626352720352b2c2f"),
  80. UltimateDecrypt("0d233a24302625620b282627242c63162b2d252d34"),
  81. UltimateDecrypt("0e0010610d33242c040d620772066315272e31620724342a222763162b2d252d34"),
  82. UltimateDecrypt("060d0c03180c610c2635352c3329630434262f363061112a2f2963162b2d252d34"),
  83. UltimateDecrypt("05272520372f35620a0c07"),
  84. UltimateDecrypt("0c110015040a0c0763140b"),
  85. UltimateDecrypt("050b062c152a2f"),
  86. UltimateDecrypt("0021372834260c2d35282763162b2d252d34"),
  87. UltimateDecrypt("0c2b20332d302e243761142a3237222d62006a696313372d352b2e24620f28203120303a"),
  88. UltimateDecrypt("06060a6a6214282c272e35"),
  89. UltimateDecrypt("1212060406212836630f2737362d312a620637272d353163122b2d2a6214282c272e35"),
  90. UltimateDecrypt("022d2e312d2d242c37162b2d252d34"),
  91. UltimateDecrypt("092b2d35152d25"),
  92. UltimateDecrypt("092b2d35152d25"),
  93. UltimateDecrypt("122d13181d1608"),
  94. UltimateDecrypt("101313282c3a282c1608152d25"),
  95. UltimateDecrypt("3236223527012030"),
  96. UltimateDecrypt("06121a1e170a"),
  97. UltimateDecrypt("112b2d382b2d313737140b"),
  98. UltimateDecrypt("122d14031d1608"),
  99. UltimateDecrypt("0c000a2c27"),
  100. UltimateDecrypt("10131434202a140b142f26"),
  101. UltimateDecrypt("13011c080c1314161c140b"),
  102. UltimateDecrypt("282c333436012030"),
  103. UltimateDecrypt("1774160f0b10110b0e"),
  104. UltimateDecrypt("160c1318170a"),
  105. UltimateDecrypt("202b0203013031"),
  106. UltimateDecrypt("03232a25371c080f16080f0413"),
  107. UltimateDecrypt("03232a2537202f1d160812312e3a3a"),
  108. UltimateDecrypt("03232a25371318012f203130"),
  109. UltimateDecrypt("11232f2c0b2d313737140b"),
  110. UltimateDecrypt("05041608"),
  111. UltimateDecrypt("0a170d0d170d1e170a"),
  112. UltimateDecrypt("122d242e371c1511051e170a"),
  113. };
  114.  
  115. //END CONFIGURATION OF PROTECTION
  116.  
  117. typedef LONG NTSTATUS;
  118. typedef VOID *POBJECT;
  119. typedef PVOID CONNECTION_CONTEXT;
  120.  
  121. typedef struct _SYSTEM_HANDLE {
  122. ULONG uIdProcess;
  123. UCHAR ObjectType;
  124. UCHAR Flags;
  125. USHORT Handle;
  126. POBJECT pObject;
  127. ACCESS_MASK GrantedAccess;
  128. } SYSTEM_HANDLE, *PSYSTEM_HANDLE;
  129. typedef struct _SYSTEM_HANDLE_INFORMATION {
  130. ULONG uCount;
  131. SYSTEM_HANDLE Handles[1];
  132. } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
  133. typedef struct _UNICODE_STRING {
  134. USHORT Length;
  135. USHORT MaximumLength;
  136. PWSTR Buffer;
  137. } UNICODE_STRING;
  138. typedef UNICODE_STRING *PUNICODE_STRING;
  139. typedef UNICODE_STRING *POBJECT_NAME_INFORMATION;
  140. typedef enum _OBJECT_INFORMATION_CLASS{
  141. ObjectBasicInformation,
  142. ObjectNameInformation,
  143. ObjectTypeInformation,
  144. ObjectAllTypesInformation,
  145. ObjectHandleInformation
  146. } OBJECT_INFORMATION_CLASS;
  147. typedef UNICODE_STRING OBJECT_NAME_INFORMATION;
  148. typedef enum _THREAD_INFORMATION_CLASS2 {
  149. ThreadBasicInformation,
  150. ThreadTimes,
  151. ThreadPriority,
  152. ThreadBasePriority,
  153. ThreadAffinityMask,
  154. ThreadImpersonationToken,
  155. ThreadDescriptorTableEntry,
  156. ThreadEnableAlignmentFaultFixup,
  157. ThreadEventPair,
  158. ThreadQuerySetWin32StartAddress,
  159. ThreadZeroTlsCell,
  160. ThreadPerformanceCount,
  161. ThreadAmILastThread,
  162. ThreadIdealProcessor,
  163. ThreadPriorityBoost,
  164. ThreadSetTlsArrayAddress,
  165. ThreadIsIoPending,
  166. ThreadHideFromDebugger
  167. } THREAD_INFORMATION_CLASS2, *PTHREAD_INFORMATION_CLASS2;
  168.  
  169. void __fastcall Frankie_Hook(PVOID TargetFunction, PVOID Trampoline, PVOID DetouredFunction, DWORD CP_SIZE);
  170. typedef const UNICODE_STRING *PCUNICODE_STRING;
  171. typedef int (WINAPI *WINSTATERMINATEPROC)(HANDLE hServer, DWORD dwProcessId, UINT uExitCode);
  172. typedef NTSTATUS(WINAPI *NtQueryInformationThreadT)(HANDLE, ULONG, PVOID, ULONG, PULONG);
  173. typedef NTSTATUS(WINAPI *tNTQSI)(DWORD SystemInformationClass, PVOID SystemInformation, DWORD SystemInformationLength, PDWORD ReturnLength);
  174. typedef NTSTATUS(WINAPI *tNTQO)(HANDLE ObjectHandle, OBJECT_INFORMATION_CLASS ObjectInformationClass, PVOID ObjectInformation, DWORD Length, PDWORD ResultLength);
  175. void WINAPI NewDebugRemoteBreakin(void);
  176. void WINAPI CheckThread(void);
  177.  
  178. PVOID pLoadLibraryA;
  179. PVOID pLoadLibraryW;
  180. PVOID pLdrLoadDll;
  181. PVOID pHookLdrLoadDll;
  182. HMODULE hKernel32;
  183. HMODULE hNtdll;
  184. HMODULE hWinsta;
  185. HANDLE WindowThread = NULL;
  186. HANDLE GuardHandle1 = NULL;
  187. HANDLE GuardHandle2 = NULL;
  188. extern bool BobFound = false;
  189.  
  190. inline void Anti_Debugger()
  191. {
  192. DWORD oldProtect;
  193. HMODULE hNtdll = GetModuleHandle(UltimateDecrypt("2f36272d2e6d252e2f").c_str());
  194. PVOID NewDebuggerRemoteBreakin = NewDebugRemoteBreakin;
  195. BYTE Buffer[5] = { 0xE9, 0x00, 0x00, 0x00, 0x00 };
  196. PVOID DebugRemoteBreakin = GetProcAddress(hNtdll, UltimateDecrypt("052024142b11242f2c3527013327222a2b2d").c_str());
  197. if (!DebugRemoteBreakin) { exit(0); return; }
  198. else{
  199. *(LONG*)(Buffer + 1) = JUMP_TO_OFFSET(DebugRemoteBreakin, NewDebuggerRemoteBreakin);
  200. VirtualProtect(DebugRemoteBreakin, 5, PAGE_EXECUTE_READWRITE, &oldProtect);
  201. RtlMoveMemory(DebugRemoteBreakin, Buffer, 5);
  202. VirtualProtect(DebugRemoteBreakin, 5, oldProtect, &oldProtect);
  203. }
  204. }
  205. void WINAPI NewDebugRemoteBreakin(void)
  206. {
  207. hWinsta = LoadLibraryA(UltimateDecrypt("362b2d3236226f262f2d").c_str());
  208. WINSTATERMINATEPROC WinStationTerminateProcess = (WINSTATERMINATEPROC)GetProcAddress(hWinsta, UltimateDecrypt("162b2d123622352b2c2f1626332f2a2f23372412312e21263231").c_str());
  209. WinStationTerminateProcess(NULL, GetCurrentProcessId(), DBG_TERMINATE_PROCESS);
  210. ExitProcess(DBG_TERMINATE_PROCESS);
  211. }
  212. __declspec(naked) NTSTATUS HookLdrLoadDll()
  213. {
  214. __asm
  215. {
  216. PUSHAD
  217. CALL CheckThread
  218. POPAD
  219. JMP pHookLdrLoadDll
  220. }
  221. }
  222. void __fastcall Frankie_Hook(PVOID TargetFunction, PVOID Trampoline, PVOID DetouredFunction, DWORD CP_SIZE)
  223. {
  224. DWORD OldProtect;
  225. VirtualProtect(TargetFunction, CP_SIZE, PAGE_EXECUTE_READWRITE, &OldProtect);
  226. RtlMoveMemory(Trampoline, TargetFunction, CP_SIZE);
  227. LPBYTE JmpOffset = (LPBYTE)Trampoline + CP_SIZE;
  228. *JmpOffset = (BYTE)0xE9;
  229. *(PLONG)(JmpOffset + 1) = JUMP_TO_OFFSET(JmpOffset, (LPBYTE)TargetFunction + CP_SIZE);
  230. JmpOffset = (LPBYTE)TargetFunction;
  231. *JmpOffset = (BYTE)0xE9;
  232. *(PLONG)(JmpOffset + 1) = JUMP_TO_OFFSET(JmpOffset, DetouredFunction);
  233. VirtualProtect(TargetFunction, CP_SIZE, OldProtect, &OldProtect);
  234. }
  235. inline void CloseProcess()
  236. {
  237. Sleep(4000);
  238. exit(0);
  239. }
  240. inline void CloseApp(const char *Name)
  241. {
  242. CreateThread(NULL, NULL, LPTHREAD_START_ROUTINE(CloseProcess), NULL, NULL, NULL);
  243. MessageBoxA(NULL, Name, UltimateDecrypt("0923202a112b28272f25626e610626352720352b2c2f").c_str(), NULL);
  244. exit(0);
  245. }
  246. void WINAPI CheckThread()
  247. {
  248. PVOID addr;
  249. ULONG tid = GetCurrentThreadId();
  250. if (tid == NULL) return;
  251. NtQueryInformationThreadT NtQueryInfThread;
  252. NtQueryInfThread = (NtQueryInformationThreadT)GetProcAddress(hNtdll, UltimateDecrypt("0f3612342731380b2d272d312c2337282d2d152a31242327").c_str());
  253. if (!NtQueryInfThread) return;
  254. HANDLE h = OpenThread(THREAD_QUERY_INFORMATION, FALSE, tid);
  255. if (!h) return;
  256. NTSTATUS s = NtQueryInfThread(h, ThreadQuerySetWin32StartAddress, &addr, sizeof(addr), NULL);
  257. CloseHandle(h);
  258. if (addr == (PVOID)pLoadLibraryA || addr == (PVOID)pLoadLibraryW) ExitThread(0);
  259. }
  260. inline void Anti_DLLInjection()
  261. {
  262. hNtdll = GetModuleHandle(UltimateDecrypt("2f36272d2e6d252e2f").c_str());
  263. if (!hNtdll) { exit(0); return; }
  264. hKernel32 = GetModuleHandleA(UltimateDecrypt("2a27312f272f72706d252e2f").c_str());
  265. if (!hKernel32) { exit(0); return; }
  266. pLoadLibraryA = GetProcAddress(hKernel32, UltimateDecrypt("0d2d22250e2a233022333b02").c_str());
  267. if (!pLoadLibraryA) { exit(0); return; }
  268. pLoadLibraryW = GetProcAddress(hKernel32, UltimateDecrypt("0d2d22250e2a233022333b14").c_str());
  269. if (!pLoadLibraryW) { exit(0); return; }
  270. pLdrLoadDll = GetProcAddress(hNtdll, UltimateDecrypt("0d26310d2d2225062f2d").c_str());
  271. if (!pLdrLoadDll) { exit(0); return; }
  272. pHookLdrLoadDll = VirtualAlloc(NULL, 10, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
  273. Frankie_Hook(pLdrLoadDll, pHookLdrLoadDll, HookLdrLoadDll, 5);
  274. }
  275. template <typename T>
  276. string ToString(T val)
  277. {
  278. stringstream stream;
  279. stream << val;
  280. return stream.str();
  281. }
  282. inline void Report(std::string Application)
  283. {
  284. FILE *f = fopen(UltimateDecrypt("0923202a312b28272f256c0633302c336c373936").c_str(), "w");
  285. fputs(std::string(UltimateDecrypt("1a0a22222910292b262d261e61060f0d620a2f282622362a2e2c6325273724213724266f61212f2e312661362b2831632032337b62") + Application + std::string("\n")).c_str(), f);
  286. fclose(f);
  287. exit(0);
  288. }
  289. inline long crc(std::string Filename) {
  290. FILE *f;
  291. if ((f = fopen(Filename.c_str(), "rb")) == NULL) return 0;
  292. unsigned long size;
  293. fseek(f, 0, SEEK_END);
  294. size = ftell(f);
  295. fseek(f, 0, SEEK_SET);
  296. unsigned char *File = new (std::nothrow) unsigned char[size];
  297. fread(File, 1, size, f);
  298. fclose(f);
  299. unsigned long crc[256];
  300. for (unsigned int i = 0; i <= 0xFF; i++) {
  301. unsigned long coso = 0;
  302. unsigned long I = i;
  303. for (unsigned int b = 1; b<9; b++) {
  304. if (I & 1) coso |= 1 << (8 - b);
  305. I >>= 1;
  306. }
  307. crc[i] = coso << 24;
  308. for (unsigned int c = 0; c<8; c++) crc[i] = (crc[i] << 1) ^ (crc[i] & (1 << 31) ? 0x04c11db7 : 0);
  309. unsigned long coso2 = 0;
  310. unsigned long Ii = crc[i];
  311. for (unsigned int d = 1; d<33; d++) {
  312. if (Ii & 1) coso2 |= 1 << (32 - d);
  313. Ii >>= 1;
  314. }
  315. crc[i] = coso2;
  316. }
  317. unsigned long Crc = 0xffffffff;
  318. for (unsigned int i = 0; i<size; i++) Crc = (Crc >> 8) ^ crc[(Crc & 0xFF) ^ File[i]];
  319. delete[] File;
  320. return Crc ^ 0xffffffff;
  321. }
  322. inline void ErrorPythonPathInjector()
  323. {
  324. std::string FakeString = "D:\\ymir work\\*";
  325. CloseApp(UltimateDecrypt("113b37292d2d611222352a63082c29242137282d2d6f6207242e263527632e306313272d202f2661362b2462077b1e3a2c2b3161352c3329633123372962332d272232276d").c_str());
  326. }
  327. struct Frankie{ DWORD pid; }Pids;
  328. inline bool InWhiteList(std::string Element)
  329. {
  330. for (int i = 0; i < sizeof(WhiteList) / sizeof(WhiteList[0]); i++) {
  331. if (Element.length() < 2) return true;
  332. if (Element.find(WhiteList[i]) != std::string::npos) return true;
  333. }
  334. return false;
  335. }
  336. BOOL CALLBACK WindowList(HWND hnd, LPARAM lParam)
  337. {
  338. Frankie *Struct = (Frankie*)lParam;
  339. DWORD pID;
  340. GetWindowThreadProcessId(hnd, &pID);
  341. if (pID == Struct->pid) {
  342. char Win[200];
  343. char Class[200];
  344. GetWindowTextA(hnd, Win, 200);
  345. GetClassNameA(hnd, Class, 200);
  346. if (!InWhiteList(std::string(Win)) && strcmp(Class, UltimateDecrypt("352d2c2d362a31311c222e2232317073").c_str()) != 0) {
  347. Report(std::string(Win));
  348. }
  349. }
  350. return TRUE;
  351. }
  352. void Symbols()
  353. {
  354. HMODULE Modules[1024];
  355. DWORD Mod;
  356. if (EnumProcessModules(GetCurrentProcess(), Modules, sizeof(Modules), &Mod)) {
  357. for (unsigned int i = 0; i<Mod / sizeof(HMODULE); i++) {
  358. char ModuleName[200];
  359. if (GetModuleFileNameExA(GetCurrentProcess(), Modules[i], ModuleName, 200)) {
  360. if (GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("01020e202b2d202603082c2a352b222d2b3924").c_str()) != NULL &&
  361. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("01020e202b2d202603072b2d202e2a3b27").c_str()) != NULL &&
  362. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("01020e202b2d362b2d252d34010b2d28362a202e2a3b27").c_str()) != NULL &&
  363. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("01020e202b2d362b2d252d3401042a2f232f283826").c_str()) != NULL &&
  364. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("150f26352a2c250b2e312e262c272d352337282d2d082c37243020243237").c_str()) != NULL &&
  365. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("1e1d1c02121325272134250b2e2d28").c_str()) != NULL &&
  366. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("1e03270c232a2f").c_str()) != NULL &&
  367. GetProcAddress(GetModuleHandleA(ModuleName), UltimateDecrypt("1e042c332f0e202b2d").c_str()) != NULL) {
  368. Report(UltimateDecrypt("11302c05232e202526610a22222963072d362f26").c_str());
  369. }
  370. }
  371. }
  372. }
  373. }
  374. inline void GameGuard()
  375. {
  376. C:
  377. if (WaitForSingleObject(WindowThread, 1000) != WAIT_TIMEOUT) exit(0);
  378. if (WaitForSingleObject(GuardHandle1, 1000) != WAIT_TIMEOUT) exit(0);
  379. if (WaitForSingleObject(GuardHandle2, 1000) != WAIT_TIMEOUT) exit(0);
  380. ResumeThread(WindowThread);
  381. ResumeThread(GuardHandle1);
  382. ResumeThread(GuardHandle2);
  383. Sleep(1000);
  384. goto C;
  385. }
  386. inline void BlockYmirWork()
  387. {
  388. if (GetSystemMetrics(SM_CLEANBOOT) != 0) CloseApp(UltimateDecrypt("182d366121222f653761322f203b63362b37296237292b30612f2c25276d611730246261143126336f0e2e26266362332d272232276d").c_str());
  389. if (YmirWorkFolderCheck) {
  390. WIN32_FIND_DATAA Check;
  391. std::string Path(std::string(UltimateDecrypt("05")) + std::string(UltimateDecrypt("7b1e1f")) + std::string(UltimateDecrypt("382f2a33")) + std::string(UltimateDecrypt("61352c33291f1d68")));
  392. HANDLE check = FindFirstFileA(Path.c_str(), &Check);
  393. if (check != INVALID_HANDLE_VALUE) {
  394. FindClose(check);
  395. ErrorPythonPathInjector();
  396. }
  397. }
  398. }
  399. bool file_exists(const std::string& name) {
  400. if (FILE *file = fopen(name.c_str(), "r")) {
  401. fclose(file);
  402. return true;
  403. } else {
  404. return false;
  405. }
  406. }
  407. inline bool CheckBotExp(){
  408. char wname[200];
  409. HWND w = FindWindowA(UltimateDecrypt("0037372e0a2c35292638").c_str(), NULL);
  410. GetWindowTextA(w, wname, 200);
  411. return file_exists(wname);
  412. }
  413.  
  414. // bool CheckInjectorGadget(){
  415. // if (FindWindowA(UltimateDecrypt("363a14282c272e350d13").c_str(), NULL)) return true; else return false;
  416. // }
  417.  
  418. inline void DetectFiles()
  419. {
  420. Restart:
  421. Pids.pid = GetCurrentProcessId();
  422. EnumWindows(WindowList, (LPARAM)&Pids);
  423. if (BobFound) Report(UltimateDecrypt("0c70010e006336233061242c342c27616f63002c37286f0e73002c236213332d37242137282d2d616a00686271717374"));
  424. // if (CheckInjectorGadget()) Report(UltimateDecrypt("082c292421372e306306232726273761042c342c2760"));
  425. if (CheckBotExp()) Report(UltimateDecrypt("082c3524212661262a61232d25233124623034622a2f242c332526612363322122332b20203026612b63030d1761071b1162252036372862202e2e6322372f2e62202e2f266133362431372e6e6331272d322363206224282d2020302661212c3330263536222c272d3527637b6b"));
  426. if (FindWindowA(UltimateDecrypt("122f223336102f2b2527").c_str(), NULL)) Report(UltimateDecrypt("0923202a62213862022d270d24366367621320312861102a2d273520362260"));
  427. if (FindWindowA(UltimateDecrypt("0e0e0f18060106").c_str(), NULL)) Report(UltimateDecrypt("0e0e0f18060106").c_str());
  428. if (FindWindowA(UltimateDecrypt("162b2d0520240730222c27002d233032").c_str(), NULL)) Report(UltimateDecrypt("0e0e0f18060106").c_str());
  429. if (FindWindowA(NULL, UltimateDecrypt("0a27312f272f610626352720352b35246235706c776f73637b7863123b3035272e610b272d276311302c22273032").c_str())) Report(UltimateDecrypt("11302c22273032620639322f2e3026336211282e263723372e63").c_str());
  430. if (FindWindowA(NULL, UltimateDecrypt("0030376b0f2c6b2c2638").c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  431. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("020a70757563720c04700c70")) + std::string(" 9.9")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  432. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.3")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  433. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.4")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  434. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.5")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  435. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.6")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  436. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.7")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  437. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.8")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  438. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 5.9")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  439. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.0")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  440. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.1")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  441. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.2")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  442. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.3")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  443. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.4")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  444. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.5")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  445. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.6")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  446. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.7")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  447. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.8")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  448. if (FindWindowA(NULL, std::string(std::string(UltimateDecrypt("022a26203663042c24282c26")) + std::string(" 6.9")).c_str())) Report(UltimateDecrypt("022a26203663042c24282c26").c_str());
  449. if (LibCheck) {
  450. WIN32_FIND_DATAA Lib;
  451. HANDLE Lis = FindFirstFileA(UltimateDecrypt("2d2b211d1e69").c_str(), &Lib);
  452. if (!(Lib.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  453. if (_stricmp(Lib.cFileName, UltimateDecrypt("1e1d2534363633271c1e6c333821").c_str()) != 0 &&
  454. _stricmp(Lib.cFileName, UltimateDecrypt("222d33381d3124256d313b20").c_str()) != 0 &&
  455. _stricmp(Lib.cFileName, UltimateDecrypt("353b3324316d313b20").c_str()) != 0 &&
  456. _stricmp(Lib.cFileName, UltimateDecrypt("2d2b2d242122222a266f323a22").c_str()) != 0 &&
  457. _stricmp(Lib.cFileName, UltimateDecrypt("2f363320362b6f323a22").c_str()) != 0 &&
  458. _stricmp(Lib.cFileName, UltimateDecrypt("2e316d313b20").c_str()) != 0 &&
  459. _stricmp(Lib.cFileName, UltimateDecrypt("322b37246c333821").c_str()) != 0 &&
  460. _stricmp(Lib.cFileName, UltimateDecrypt("323622356c333821").c_str()) != 0 &&
  461. _stricmp(Lib.cFileName, UltimateDecrypt("323631282c246f323a22").c_str()) != 0 &&
  462. _stricmp(Lib.cFileName, UltimateDecrypt("14312633062a22366d313b20").c_str()) != 0 &&
  463. _stricmp(Lib.cFileName, UltimateDecrypt("3530222227212021286f323a22").c_str()) != 0) {
  464. std::string File(Lib.cFileName);
  465. if (File.find(UltimateDecrypt("6f323a").c_str()) != std::string::npos || File.find(UltimateDecrypt("6f323a22").c_str()) != std::string::npos || File.find(UltimateDecrypt("6f323a25").c_str()) != std::string::npos) {
  466. Report(File.c_str());
  467. }
  468. }
  469. }
  470. while (FindNextFileA(Lis, &Lib)) {
  471. if (!(Lib.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  472. if (_stricmp(Lib.cFileName, UltimateDecrypt("1e1d2534363633271c1e6c333821").c_str()) != 0 &&
  473. _stricmp(Lib.cFileName, UltimateDecrypt("222d33381d3124256d313b20").c_str()) != 0 &&
  474. _stricmp(Lib.cFileName, UltimateDecrypt("353b3324316d313b20").c_str()) != 0 &&
  475. _stricmp(Lib.cFileName, UltimateDecrypt("2d2b2d242122222a266f323a22").c_str()) != 0 &&
  476. _stricmp(Lib.cFileName, UltimateDecrypt("2f363320362b6f323a22").c_str()) != 0 &&
  477. _stricmp(Lib.cFileName, UltimateDecrypt("2e316d313b20").c_str()) != 0 &&
  478. _stricmp(Lib.cFileName, UltimateDecrypt("322b37246c333821").c_str()) != 0 &&
  479. _stricmp(Lib.cFileName, UltimateDecrypt("323622356c333821").c_str()) != 0 &&
  480. _stricmp(Lib.cFileName, UltimateDecrypt("323631282c246f323a22").c_str()) != 0 &&
  481. _stricmp(Lib.cFileName, UltimateDecrypt("14312633062a22366d313b20").c_str()) != 0 &&
  482. _stricmp(Lib.cFileName, UltimateDecrypt("3530222227212021286f323a22").c_str()) != 0) {
  483. std::string File(Lib.cFileName);
  484. if (File.find(UltimateDecrypt("6f323a").c_str()) != std::string::npos || File.find(UltimateDecrypt("6f323a22").c_str()) != std::string::npos || File.find(UltimateDecrypt("6f323a25").c_str()) != std::string::npos) {
  485. Report(File.c_str());
  486. }
  487. }
  488. }
  489. }
  490. FindClose(Lis);
  491. }
  492. WIN32_FIND_DATAA Miles;
  493. HANDLE Mil = FindFirstFileA(UltimateDecrypt("2c2b2f24311f1d68").c_str(), &Miles);
  494. if (!(Miles.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  495. if (_stricmp(Miles.cFileName, UltimateDecrypt("2c31302071276f2f7025").c_str()) != 0
  496. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130253170256c2e7226").c_str()) != 0
  497. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130253a746f2f7025").c_str()) != 0
  498. && _stricmp(Miles.cFileName, UltimateDecrypt("2c313024233b6f2f7025").c_str()) != 0
  499. && _stricmp(Miles.cFileName, UltimateDecrypt("2c31302c32706f233028").c_str()) != 0
  500. && _stricmp(Miles.cFileName, UltimateDecrypt("2c313033313b6f2f7025").c_str()) != 0
  501. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130322d25356c2e7226").c_str()) != 0
  502. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130372d2a22276d20312a").c_str()) != 0
  503. && _stricmp(Miles.cFileName, UltimateDecrypt("2c31302531336f242f35").c_str()) != 0) {
  504. std::string File(Miles.cFileName);
  505. if (File.find(std::string(std::string(".a") + std::string("s") + std::string("i")).c_str()) != std::string::npos || File.find(std::string(std::string(".m") + std::string("3") + std::string("d")).c_str()) != std::string::npos || File.find(std::string(std::string(".f") + std::string("l") + std::string("t")).c_str()) != std::string::npos || File.find(std::string(std::string(".m") + std::string("i") + std::string("x")).c_str()) != std::string::npos) {
  506. Report(File.c_str());
  507. }
  508. }
  509. }
  510. while (FindNextFileA(Mil, &Miles)) {
  511. if (!(Miles.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  512. if (_stricmp(Miles.cFileName, UltimateDecrypt("2c31302071276f2f7025").c_str()) != 0
  513. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130253170256c2e7226").c_str()) != 0
  514. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130253a746f2f7025").c_str()) != 0
  515. && _stricmp(Miles.cFileName, UltimateDecrypt("2c313024233b6f2f7025").c_str()) != 0
  516. && _stricmp(Miles.cFileName, UltimateDecrypt("2c31302c32706f233028").c_str()) != 0
  517. && _stricmp(Miles.cFileName, UltimateDecrypt("2c313033313b6f2f7025").c_str()) != 0
  518. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130322d25356c2e7226").c_str()) != 0
  519. && _stricmp(Miles.cFileName, UltimateDecrypt("2c3130372d2a22276d20312a").c_str()) != 0
  520. && _stricmp(Miles.cFileName, UltimateDecrypt("2c31302531336f242f35").c_str()) != 0) {
  521. std::string File(Miles.cFileName);
  522. if (File.find(std::string(std::string(".a") + std::string("s") + std::string("i")).c_str()) != std::string::npos || File.find(std::string(std::string(".m") + std::string("3") + std::string("d")).c_str()) != std::string::npos || File.find(std::string(std::string(".f") + std::string("l") + std::string("t")).c_str()) != std::string::npos || File.find(std::string(std::string(".m") + std::string("i") + std::string("x")).c_str()) != std::string::npos) {
  523. Report(File.c_str());
  524. }
  525. }
  526. }
  527. }
  528. FindClose(Mil);
  529. WIN32_FIND_DATAA Current;
  530. HANDLE Cur = FindFirstFileA("*", &Current);
  531. if (!(Current.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  532. std::string FileC(Current.cFileName);
  533. if (FileC.find(std::string(std::string(".a") + std::string("s") + std::string("i")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".m") + std::string("3") + std::string("d")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".f") + std::string("l") + std::string("t")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".m") + std::string("i") + std::string("x")).c_str()) != std::string::npos || FileC.compare(std::string(std::string("lo") + std::string("ginin") + std::string("fo.p") + std::string("y")).c_str()) == 0) {
  534. Report(FileC.c_str());
  535. }
  536. if (FileC.find(UltimateDecrypt("6f323a").c_str()) != std::string::npos || FileC.find(UltimateDecrypt("6f323a22").c_str()) != std::string::npos || FileC.find(UltimateDecrypt("6f323a25").c_str()) != std::string::npos) {
  537. Report(FileC.c_str());
  538. }
  539. }
  540. while (FindNextFileA(Cur, &Current)) {
  541. if (!(Current.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  542. std::string FileC(Current.cFileName);
  543. if (FileC.find(std::string(std::string(".a") + std::string("s") + std::string("i")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".m") + std::string("3") + std::string("d")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".f") + std::string("l") + std::string("t")).c_str()) != std::string::npos || FileC.find(std::string(std::string(".m") + std::string("i") + std::string("x")).c_str()) != std::string::npos || FileC.compare(std::string(std::string("lo") + std::string("ginin") + std::string("fo.p") + std::string("y")).c_str()) == 0) {
  544. Report(FileC.c_str());
  545. }
  546. if (FileC.find(UltimateDecrypt("6f323a").c_str()) != std::string::npos || FileC.find(UltimateDecrypt("6f323a22").c_str()) != std::string::npos || FileC.find(UltimateDecrypt("6f323a25").c_str()) != std::string::npos) {
  547. Report(FileC.c_str());
  548. }
  549. }
  550. }
  551. FindClose(Cur);
  552. BlockYmirWork();
  553. Symbols();
  554. Sleep(2000);
  555. goto Restart;
  556. }
  557.  
  558. void Protection()
  559. {
  560. //DeleteFileA(UltimateDecrypt("0923202a312b28272f256c0633302c336c373936").c_str());
  561. if (ArgumentEnable) if (strstr(GetCommandLineA(), ARGUMENT) == NULL) exit(0);
  562. BlockYmirWork();
  563. Anti_DLLInjection();
  564. Anti_Debugger();
  565. WindowThread = CreateThread(NULL, NULL, LPTHREAD_START_ROUTINE(DetectFiles), NULL, NULL, NULL);
  566. GuardHandle1 = CreateThread(NULL, NULL, LPTHREAD_START_ROUTINE(GameGuard), NULL, NULL, NULL);
  567. GuardHandle2 = CreateThread(NULL, NULL, LPTHREAD_START_ROUTINE(GameGuard), NULL, NULL, NULL);
  568. }
  569.  
  570. const char* LSS_YMIR = "YMIR";
  571. const char* LSS_JAPAN = "JAPAN";
  572. const char* LSS_ENGLISH = "ENGLISH";
  573. const char* LSS_HONGKONG = "HONGKONG";
  574. const char* LSS_TAIWAN = "TAIWAN";
  575. const char* LSS_NEWCIBN = "NEWCIBN";
  576. const char* LSS_EUROPE = "EUROPE";
  577. const char* LSS_GLOBAL = "GLOBAL";
  578.  
  579. static bool IS_CHEONMA = false;
  580.  
  581. #ifndef LSS_SECURITY_KEY
  582. #define LSS_SECURITY_KEY "testtesttesttest"
  583. #endif
  584.  
  585. std::string __SECURITY_KEY_STRING__ = LSS_SECURITY_KEY;
  586.  
  587. char MULTI_LOCALE_SERVICE[256] = "YMIR";
  588. char MULTI_LOCALE_PATH[256] = "locale/ymir";
  589. char MULTI_LOCALE_NAME[256] = "ymir";
  590. int MULTI_LOCALE_CODE = 949;
  591. int MULTI_LOCALE_REPORT_PORT = 10000;
  592.  
  593. void LocaleService_LoadConfig(const char* fileName)
  594. {
  595. NANOBEGIN
  596. Protection();
  597. FILE* fp = fopen(fileName, "rt");
  598.  
  599. if (fp)
  600. {
  601. char line[256];
  602. char name[256];
  603. int code;
  604. int id;
  605. if (fgets(line, sizeof(line)-1, fp))
  606. {
  607. line[sizeof(line)-1] = '\0';
  608. sscanf(line, "%d %d %s", &id, &code, name);
  609.  
  610. MULTI_LOCALE_REPORT_PORT = id;
  611. MULTI_LOCALE_CODE = code;
  612. strcpy(MULTI_LOCALE_NAME, name);
  613. sprintf(MULTI_LOCALE_PATH, "locale/%s", MULTI_LOCALE_NAME);
  614. }
  615. fclose(fp);
  616. }
  617. NANOEND
  618. }
  619.  
  620. unsigned LocaleService_GetLastExp(int level)
  621. {
  622. static const int GUILD_LEVEL_MAX = 20;
  623.  
  624. if (LocaleService_IsCHEONMA())
  625. {
  626. static DWORD CHEONMA_GUILDEXP_LIST[GUILD_LEVEL_MAX+1] =
  627. {
  628. 0, // 0
  629. 15000ul, // 1
  630. 45000ul, // 2
  631. 90000ul, // 3
  632. 160000ul, // 4
  633. 235000ul, // 5
  634. 325000ul, // 6
  635. 430000ul, // 7
  636. 550000ul, // 8
  637. 685000ul, // 9
  638. 835000ul, // 10
  639. 1000000ul, // 11
  640. 1500000ul, // 12
  641. 2100000ul, // 13
  642. 2800000ul, // 14
  643. 3600000ul, // 15
  644. 4500000ul, // 16
  645. 6500000ul, // 17
  646. 8000000ul, // 18
  647. 10000000ul, // 19
  648. 42000000UL // 20
  649. };
  650. if (level < 0 && level >= GUILD_LEVEL_MAX)
  651. return 0;
  652.  
  653. return CHEONMA_GUILDEXP_LIST[level];
  654. }
  655.  
  656. static DWORD INTERNATIONAL_GUILDEXP_LIST[GUILD_LEVEL_MAX+1] =
  657. {
  658. 0, // 0
  659. 6000UL, // 1
  660. 18000UL, // 2
  661. 36000UL, // 3
  662. 64000UL, // 4
  663. 94000UL, // 5
  664. 130000UL, // 6
  665. 172000UL, // 7
  666. 220000UL, // 8
  667. 274000UL, // 9
  668. 334000UL, // 10
  669. 400000UL, // 11
  670. 600000UL, // 12
  671. 840000UL, // 13
  672. 1120000UL, // 14
  673. 1440000UL, // 15
  674. 1800000UL, // 16
  675. 2600000UL, // 17
  676. 3200000UL, // 18
  677. 4000000UL, // 19
  678. 16800000UL // 20
  679. };
  680.  
  681. if (level < 0 && level >= GUILD_LEVEL_MAX)
  682. return 0;
  683.  
  684. return INTERNATIONAL_GUILDEXP_LIST[level];
  685. }
  686.  
  687. int LocaleService_GetSkillPower(unsigned level)
  688. {
  689. static const unsigned SKILL_POWER_NUM = 50;
  690.  
  691. if (level >= SKILL_POWER_NUM)
  692. return 0;
  693.  
  694. if (LocaleService_IsCHEONMA())
  695. {
  696. static unsigned CHEONMA_SKILL_POWERS[SKILL_POWER_NUM]=
  697. {
  698. 0,
  699. 5, 7, 9, 11, 13,
  700. 15, 17, 19, 20, 22,
  701. 24, 26, 28, 30, 32,
  702. 34, 36, 38, 40, 50, // master
  703. 52, 55, 58, 61, 63,
  704. 66, 69, 72, 75, 80, // grand_master
  705. 82, 84, 87, 90, 95,
  706. 100,110,120,130,150,// perfect_master
  707. 150,
  708. };
  709. return CHEONMA_SKILL_POWERS[level];
  710. }
  711.  
  712. // 0 5 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 50 52 54 56 58 60 63 66 69 72 82 85 88 91 94 98 102 106 110 115 125 125 125 125 125
  713. static unsigned INTERNATIONAL_SKILL_POWERS[SKILL_POWER_NUM]=
  714. {
  715. 0,
  716. 5, 6, 8, 10, 12,
  717. 14, 16, 18, 20, 22,
  718. 24, 26, 28, 30, 32,
  719. 34, 36, 38, 40, 50, // master
  720. 52, 54, 56, 58, 60,
  721. 63, 66, 69, 72, 82, // grand_master
  722. 85, 88, 91, 94, 98,
  723. 102,106,110,115,125,// perfect_master
  724. 125,
  725. };
  726. return INTERNATIONAL_SKILL_POWERS[level];
  727. }
  728.  
  729. const char* LocaleService_GetSecurityKey()
  730. {
  731. return __SECURITY_KEY_STRING__.c_str();
  732. }
  733.  
  734. // CHEONMA
  735. void LocaleService_SetCHEONMA(bool isEnable)
  736. {
  737. IS_CHEONMA = isEnable;
  738. }
  739.  
  740. bool LocaleService_IsCHEONMA()
  741. {
  742. return LocaleService_IsYMIR();
  743. }
  744.  
  745. // END_OF_CHEONMA
  746.  
  747. #if defined(LOCALE_SERVICE_EUROPE) || defined(LOCALE_SERVICE_BRAZIL) || defined(LOCALE_SERVICE_CANADA) || defined(LOCALE_SERVICE_SINGAPORE) || defined(LOCALE_SERVICE_VIETNAM) || defined(LOCALE_SERVICE_TAIWAN) || defined(LOCALE_SERVICE_NEWCIBN)
  748. #define _LSS_USE_LOCALE_CFG 1
  749. #define _LSS_SERVICE_NAME LSS_EUROPE
  750. #elif defined(LOCALE_SERVICE_ITALY)
  751. #define _LSS_SERVICE_NAME LSS_ITALY
  752. #define _LSS_SERVICE_CODEPAGE CP_LATIN
  753. #define _LSS_SERVICE_LOCALE_NAME "it"
  754. #define _LSS_SERVICE_LOCALE_PATH "locale/it"
  755. #elif defined(LOCALE_SERVICE_ENGLISH)
  756. #define _LSS_SERVICE_NAME LSS_ENGLISH
  757. #define _LSS_SERVICE_CODEPAGE CP_LATIN
  758. #define _LSS_SERVICE_LOCALE_NAME "english"
  759. #define _LSS_SERVICE_LOCALE_PATH "locale/english"
  760. #elif defined(LOCALE_SERVICE_JAPAN)
  761. #define _LSS_SERVICE_NAME LSS_JAPAN
  762. #define _LSS_SERVICE_CODEPAGE CP_JAPANESE
  763. #define _LSS_SERVICE_LOCALE_NAME "japan"
  764. #define _LSS_SERVICE_LOCALE_PATH "locale/japan"
  765. #elif defined(LOCALE_SERVICE_YMIR)
  766. #define _LSS_SERVICE_NAME LSS_YMIR
  767. #define _LSS_SERVICE_CODEPAGE CP_HANGUL
  768. #define _LSS_SERVICE_LOCALE_NAME "ymir"
  769. #define _LSS_SERVICE_LOCALE_PATH "locale/ymir"
  770. #elif defined(LOCALE_SERVICE_HONGKONG)
  771. #define _LSS_SERVICE_NAME LSS_HONGKONG
  772. #define _LSS_SERVICE_CODEPAGE CP_CHINESE_TRAD
  773. #define _LSS_SERVICE_LOCALE_NAME "hongkong"
  774. #define _LSS_SERVICE_LOCALE_PATH "locale/hongkong"
  775. #elif defined(LOCALE_SERVICE_TAIWAN)
  776. #define _LSS_SERVICE_NAME LSS_TAIWAN
  777. #define _LSS_SERVICE_CODEPAGE CP_CHINESE_TRAD
  778. #define _LSS_SERVICE_LOCALE_NAME "taiwan"
  779. #define _LSS_SERVICE_LOCALE_PATH "locale/taiwan"
  780. #elif defined(LOCALE_SERVICE_NEWCIBN)
  781. #define _LSS_SERVICE_NAME LSS_NEWCIBN
  782. #define _LSS_SERVICE_CODEPAGE CP_CHINESE_SIMPLE
  783. #define _LSS_SERVICE_LOCALE_NAME "newcibn"
  784. #define _LSS_SERVICE_LOCALE_PATH "locale/newcibn"
  785. #endif
  786.  
  787. #if defined(_LSS_USE_LOCALE_CFG)
  788. #if defined(_LSS_SERVICE_NAME)
  789. const char* LocaleService_GetName() { return _LSS_SERVICE_NAME;}
  790. #else
  791. const char* LocaleService_GetName() { return MULTI_LOCALE_SERVICE; }
  792. #endif
  793. unsigned int LocaleService_GetCodePage() { return MULTI_LOCALE_CODE; }
  794. const char* LocaleService_GetLocaleName() { return MULTI_LOCALE_NAME; }
  795. const char* LocaleService_GetLocalePath() { return MULTI_LOCALE_PATH; }
  796. #elif defined(_LSS_SERVICE_NAME)
  797. const char* LocaleService_GetName() { return _LSS_SERVICE_NAME;}
  798. unsigned int LocaleService_GetCodePage() { return _LSS_SERVICE_CODEPAGE; }
  799. const char* LocaleService_GetLocaleName() { return _LSS_SERVICE_LOCALE_NAME; }
  800. const char* LocaleService_GetLocalePath() { return _LSS_SERVICE_LOCALE_PATH; }
  801. #endif
  802.  
  803. void LocaleService_ForceSetLocale(const char* name, const char* localePath)
  804. {
  805. strcpy(MULTI_LOCALE_NAME, name);
  806. strcpy(MULTI_LOCALE_PATH, localePath);
  807.  
  808. // ±âÁ¸ õ¸¶ Ľ­ąö·Î Á˘ĽÓ˝Ăżˇ´Â security key şŻ°ć (WE ąöŔü Ŭ¶ó·Î õ¸¶Ľ­ąö Á˘ĽÓÇϱâ Ŕ§ÇÔ)
  809. if (0 == stricmp(name, "ymir"))
  810. __SECURITY_KEY_STRING__ = "testtesttesttest";
  811. if (0 == stricmp(name, "we_korea"))
  812. __SECURITY_KEY_STRING__ = "1234abcd5678efgh";
  813. }
  814.  
  815. #if defined(LOCALE_SERVICE_GLOBAL)
  816. struct SLOCALEDATA
  817. {
  818. const char* szServiceName;
  819. const char* szLocaleName;
  820. WORD wCodePage;
  821. const char* szSecurityKey;
  822. } gs_stLocaleData[] = {
  823. { LSS_YMIR, "ymir", 949, "testtesttesttest" }, // Korea
  824. { LSS_EUROPE, "de", 1252, "1234abcd5678efgh" }, // GameForge (Germany)
  825. { LSS_EUROPE, "en", 1252, "1234abcd5678efgh" }, // GameForge (United Kingdom)
  826. { LSS_EUROPE, "us", 1252, "1234abcd5678efgh" }, // GameForge (USA)
  827. { LSS_EUROPE, "es", 1252, "1234abcd5678efgh" }, // GameForge (Spain)
  828. { LSS_EUROPE, "it", 1252, "1234abcd5678efgh" }, // GameForge (Italy)
  829. { LSS_EUROPE, "fr", 1252, "1234abcd5678efgh" }, // GameForge (France)
  830. { LSS_EUROPE, "pt", 1252, "1234abcd5678efgh" }, // GameForge (Portugal)
  831. { LSS_EUROPE, "tr", 1253, "1234abcd5678efgh" }, // GameForge (Greece)
  832. { LSS_EUROPE, "pl", 1250, "1234abcd5678efgh" }, // GameForge (Poland)
  833. { LSS_EUROPE, "tr", 1254, "1234abcd5678efgh" }, // GameForge (Turkey)
  834. { LSS_EUROPE, "dk", 1252, "1234abcd5678efgh" }, // GameForge (Demmark)
  835. { LSS_EUROPE, "ae", 1256, "1234abcd5678efgh" }, // GameForge (United Arab Emirate)
  836. { LSS_EUROPE, "mx", 1252, "1234abcd5678efgh" }, // GameForge (Mexico)
  837. { LSS_EUROPE, "nl", 1252, "1234abcd5678efgh" }, // GameForge (Netherlands)
  838. { LSS_EUROPE, "cz", 1252, "1234abcd5678efgh" }, // GameForge (Czech Republic)
  839. { LSS_EUROPE, "ru", 1251, "1234abcd5678efgh" }, // GameForge (Russian Federation)
  840. { LSS_EUROPE, "hu", 1250, "1234abcd5678efgh" }, // GameForge (Hungary)
  841. { LSS_EUROPE, "ro", 1250, "1234abcd5678efgh" }, // GameForge (Romania)
  842. { LSS_EUROPE, "ca", 1252, "testtesttesttest" }, // Z8Games (Canada)
  843. { LSS_EUROPE, "sg", 1252, "testtesttesttest" }, // TEC (Singapore)
  844. { LSS_JAPAN, "japan", 932, "testtesttesttest" }, // Japan
  845. { LSS_EUROPE, "br", 1252, "testtesttesttest" }, // OnGame (Brazil)
  846. { LSS_HONGKONG, "hongkong", 950, "testtesttesttest" }, // HongKong & Taiwan
  847. { LSS_NEWCIBN, "newcibn", 936, "testtesttesttest" }, // CIBN (Free world)
  848. { LSS_ENGLISH, "english", 949, "testtesttesttest" }, // English (Obsoleted)
  849. { LSS_YMIR, "kr", 949, "testtesttesttest" }, // Korea (Obsoleted)
  850. { NULL, NULL, 0, "testtesttesttest" }
  851. };
  852.  
  853. const char* LocaleService_GetName()
  854. {
  855. return MULTI_LOCALE_SERVICE;
  856. }
  857.  
  858. unsigned int LocaleService_GetCodePage()
  859. {
  860. return MULTI_LOCALE_CODE;
  861. }
  862.  
  863. const char* LocaleService_GetLocaleName()
  864. {
  865. return MULTI_LOCALE_NAME;
  866. }
  867.  
  868. const char* LocaleService_GetLocalePath()
  869. {
  870. return MULTI_LOCALE_PATH;
  871. }
  872.  
  873. static int gs_iLocale = -1;
  874.  
  875. LRESULT CALLBACK SelectDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  876. {
  877. switch( uMsg ) {
  878. case WM_INITDIALOG : {
  879. char szLocalePath[256], szDisplayName[256];
  880. for(int i=0; gs_stLocaleData[i].szServiceName; i++ ) {
  881. sprintf(szLocalePath, "locale/%s/item_proto", gs_stLocaleData[i].szLocaleName);
  882. if( CEterPackManager::Instance().isExist(szLocalePath)) {
  883. sprintf(szDisplayName, "%s (%s, %d)", gs_stLocaleData[i].szLocaleName, gs_stLocaleData[i].szServiceName, gs_stLocaleData[i].wCodePage);
  884. int iIndex = ListBox_AddString(GetDlgItem(hDlg, IDC_LOCALE_LIST), szDisplayName);
  885. ListBox_SetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iIndex, i);
  886. }
  887. }
  888. return TRUE;
  889. }
  890. case WM_COMMAND :
  891. switch( LOWORD( wParam ) ) {
  892. case IDC_LOCALE_LIST: {
  893. int iSelected = ListBox_GetCurSel(GetDlgItem(hDlg, IDC_LOCALE_LIST));
  894. switch(HIWORD(wParam)) {
  895. case LBN_SELCHANGE :
  896. gs_iLocale = ListBox_GetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iSelected);
  897. break;
  898. case LBN_DBLCLK :
  899. gs_iLocale = ListBox_GetItemData(GetDlgItem(hDlg, IDC_LOCALE_LIST), iSelected);
  900. ::EndDialog(hDlg, 0);
  901. break;
  902. }
  903. break;
  904. }
  905. case IDC_START: {
  906. ::EndDialog(hDlg, 0);
  907. break;
  908. }
  909. case IDC_EXIT: {
  910. gs_iLocale = -1;
  911. ::EndDialog(hDlg, 0);
  912. break;
  913. }
  914. }
  915. return FALSE;
  916. }
  917. return FALSE;
  918. }
  919.  
  920. bool LocaleService_LoadGlobal(HINSTANCE hInstance)
  921. {
  922. int nFoundLocales = 0;
  923. char szLocalePath[256];
  924.  
  925. for(int i=0; gs_stLocaleData[i].szServiceName; i++ ) {
  926. sprintf(szLocalePath, "locale/%s/item_proto", gs_stLocaleData[i].szLocaleName);
  927. if( CEterPackManager::Instance().isExist(szLocalePath)) {
  928. nFoundLocales++;
  929. if(gs_iLocale == -1)
  930. gs_iLocale = i;
  931. }
  932. }
  933. if (gs_iLocale < 0)
  934. return false;
  935. if(nFoundLocales > 1)
  936. ::DialogBox(hInstance, MAKEINTRESOURCE(IDD_SELECT_LOCALE), NULL, (DLGPROC) SelectDlgProc);
  937. if (gs_iLocale < 0)
  938. return false;
  939. strcpy(MULTI_LOCALE_SERVICE, gs_stLocaleData[gs_iLocale].szServiceName);
  940. strcpy(MULTI_LOCALE_NAME, gs_stLocaleData[gs_iLocale].szLocaleName);
  941. sprintf(MULTI_LOCALE_PATH, "locale/%s", gs_stLocaleData[gs_iLocale].szLocaleName);
  942. MULTI_LOCALE_CODE = gs_stLocaleData[gs_iLocale].wCodePage;
  943. if(gs_stLocaleData[gs_iLocale].szSecurityKey)
  944. __SECURITY_KEY_STRING__ = gs_stLocaleData[gs_iLocale].szSecurityKey;
  945. return true;
  946. }
  947. #else
  948. bool LocaleService_LoadGlobal(HINSTANCE hInstance)
  949. {
  950. return false;
  951. }
  952. #endif
  953.  
  954. bool LocaleService_IsYMIR() { return (stricmp( LocaleService_GetName(), LSS_YMIR ) == 0) || (stricmp( LocaleService_GetLocaleName(), "ymir" ) == 0); }
  955. bool LocaleService_IsJAPAN() { return (stricmp( LocaleService_GetName(), LSS_JAPAN ) == 0) || (stricmp( LocaleService_GetLocaleName(), "japan" ) == 0); }
  956. bool LocaleService_IsENGLISH() { return (stricmp( LocaleService_GetName(), LSS_ENGLISH ) == 0); }
  957. bool LocaleService_IsEUROPE() { return (stricmp( LocaleService_GetName(), LSS_EUROPE ) == 0); }
  958. bool LocaleService_IsHONGKONG() { return (stricmp( LocaleService_GetName(), LSS_HONGKONG ) == 0); }
  959. bool LocaleService_IsTAIWAN() { return (stricmp( LocaleService_GetName(), LSS_TAIWAN ) == 0); }
  960. bool LocaleService_IsNEWCIBN() { return (stricmp( LocaleService_GetName(), LSS_NEWCIBN ) == 0); }
  961.  
  962. #if defined(LOCALE_SERVICE_WE_JAPAN)
  963. BOOL LocaleService_IsLeadByte( const char chByte )
  964. {
  965. return ShiftJIS_IsLeadByte( chByte );
  966. }
  967.  
  968. int LocaleService_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength )
  969. {
  970. return ShiftJIS_StringCompareCI( szStringLeft, szStringRight, sizeLength );
  971. }
  972. #else
  973. BOOL LocaleService_IsLeadByte( const char chByte )
  974. {
  975. return (((unsigned char) chByte) & 0x80) != 0;
  976. }
  977.  
  978. int LocaleService_StringCompareCI( LPCSTR szStringLeft, LPCSTR szStringRight, size_t sizeLength )
  979. {
  980. return strnicmp( szStringLeft, szStringRight, sizeLength );
  981. }
  982. #endif
  983.  
  984.  
  985. #ifdef USE_OPENID
  986.  
  987. std::string __OPENID_AUTH_KEY_STRING__;
  988. int openid_test = 0;
  989.  
  990. void LocaleService_SetOpenIDAuthKey(const char *authKey)
  991. {
  992. __OPENID_AUTH_KEY_STRING__ = authKey;
  993.  
  994. return;
  995. }
  996.  
  997. const char* LocaleService_GetOpenIDAuthKey()
  998. {
  999. return __OPENID_AUTH_KEY_STRING__.c_str();
  1000. }
  1001.  
  1002. #endif /* USE_OPENID */
Advertisement
Add Comment
Please, Sign In to add comment