1. //################################################################################
  2. //# Purpose: Skip the Langtype checks inside UILoginWnd::OnCreate and always #
  3. //# makes the registration page open inside UILoginWnd::SendMsg. #
  4. //# Also modifies the CModeMgr::Quit CALL to actually close the client. #
  5. //################################################################################
  6. function ShowRegisterButton() {
  7. //Step 1a - Find the alternate URL string
  8. var offset = exe.findString("http://ro.hangame.com/login/loginstep.asp?prevURL=/NHNCommon/NHN/Memberjoin.asp", RVA);
  9. if (offset === -1)
  10. return "Failed in Step 1 - String missing";
  11. //Step 1b - Find its reference inside UILoginWnd::SendMsg
  12. offset = exe.findCode("68" + offset.packToHex(4), PTYPE_HEX, false);
  13. if (offset === -1)
  14. return "Failed in Step 1 - String reference missing";
  15. //Step 2a - Get the LangType
  16. var LANGTYPE = GetLangType();//Langtype value overrides Service settings hence they use the same variable - g_serviceType
  17. if (LANGTYPE.length === 1)
  18. return "Failed in Step 2 - " + LANGTYPE[0];
  19. //Step 2b - Look for the LangType comparison before the URL reference
  20. var code =
  21. " 83 3D" + LANGTYPE + " 00" //CMP DWORD PTR DS:[g_serviceType], 0
  22. + " 75 AB" //JNE SHORT addr
  23. ;
  24. var codeSuffix =
  25. " 83 3D AB AB AB 00 01" //CMP DWORD PTR DS:[g_isGravityID], 1
  26. + " 75" //JNE SHORT addr
  27. ;
  28. var type = 1;
  29. var offset2 = exe.find(code + codeSuffix, PTYPE_HEX, true, "\xAB", offset - 0x30, offset);
  30. if (offset2 === -1) {
  31. if (offset2 === -1)
  32. {
  33. codeSuffix = codeSuffix.replace(" 83 3D AB AB AB 00 01", " 83 3D AB AB AB 01 01");
  34. offset2 = exe.find(code + codeSuffix, PTYPE_HEX, true, "\xAB", offset - 0x30, offset);
  35. }
  36. if (offset2 === -1)
  37. {
  38. code =
  39. " A1" + LANGTYPE //MOV EAX, DWORD PTR DS:[g_serviceType]
  40. + " 85 C0" //TEST EAX, EAX
  41. + " 0F 85 AB 00 00 00" //JNE addr
  42. ;
  43. type = 2;
  44. offset2 = exe.find(code + codeSuffix, PTYPE_HEX, true, "\xAB", offset - 0x30, offset);
  45. codeSuffix = codeSuffix.replace(" 83 3D AB AB AB 01 01", " 83 3D AB AB AB 00 01");
  46. offset2 = exe.find(code + codeSuffix, PTYPE_HEX, true, "\xAB", offset - 0x30, offset);
  47. }
  48. }
  49. if (offset2 === -1)
  50. return "Failed in Step 2 - Langtype comparison missing";
  51. offset2 += code.hexlength();
  52. //Step 2c - Change the first JNE (LangType JNE) to JMP and goto the Jumped address
  53. if (type == 1) {
  54. exe.replace(offset2 - 2, "EB", PTYPE_HEX);
  55. offset2 += exe.fetchByte(offset2 - 1);
  56. }
  57. else {
  58. exe.replace(offset2 - 6, "90 E9", PTYPE_HEX);
  59. offset2 += exe.fetchDWord(offset2 - 4);
  60. }
  61. //Step 3a - Add 10 to Skip over MOV ECX, OFFSET g_modeMgr and CALL CModeMgr::Quit
  62. offset2 += 10;
  63. //Step 3b - Prep new code (original CModeMgr::Quit will get overwritten by RestoreLoginWindow so create a new function with the essentials)
  64. code =
  65. " 8B 41 04" //MOV EAX,DWORD PTR DS:[ECX+4]
  66. + " C7 40 14 00 00 00 00" //MOV DWORD PTR DS:[EAX+14], 0
  67. + " C7 01 00 00 00 00" //MOV DWORD PTR DS:[ECX],0
  68. + " C3" //RETN
  69. //Step 3c - Allocate space for the code
  70. var free = exe.findZeros(code.hexlength());
  71. if (free === -1)
  72. return "Failed in Step 3 - Not enough free space";
  73. //Step 3d - Insert it
  74. exe.insert(free, code.hexlength(), code, PTYPE_HEX);
  75. //Step 3e - Change the CModeMgr::Quit CALL with a CALL to our function
  76. exe.replaceDWord(offset2 - 4, exe.Raw2Rva(free) - exe.Raw2Rva(offset2));
  77. //Step 4a - Find the prefix string for the button (pressed state)
  78. offset = exe.findString("btn_request_b", RVA);
  79. if (offset === -1)
  80. return "Failed in Step 4 - Button prefix missing";
  81. //Step 4b - Find its reference
  82. offset = exe.findCode(offset.packToHex(4) + " C7", PTYPE_HEX, false);
  83. if (offset === -1)
  84. return "Failed in Step 4 - Prefix reference missing";
  85. //Step 4c - Look for the LangType comparison after the reference
  86. code =
  87. " 83 AB 03" //CMP reg32, 03 ; 03 is for register button
  88. + " 75 25" //JNE SHORT addr
  89. + " A1" + LANGTYPE //MOV EAX, DWORD PTR DS:[g_serviceType]
  90. ;
  91. offset2 = exe.find(code, PTYPE_HEX, true, "\xAB", offset + 0xA0, offset + 0x100);
  92. if (offset2 === -1)
  93. return "Failed in Step 4 - Langtype comparison missing";
  94. //Step 4d - Change the JNE to JMP. This way no langtype check occurs for any buttons
  95. exe.replace(offset2 + 3, "EB", PTYPE_HEX);
  96. return true;
  97. }

ShowRegisterButton.qs