diff --git a/PolygonClientUtilities/Config.h b/PolygonClientUtilities/Config.h index 86fcf01..cfe352b 100644 --- a/PolygonClientUtilities/Config.h +++ b/PolygonClientUtilities/Config.h @@ -12,10 +12,6 @@ // RobloxApp (2010) #ifdef MFC2010 -#define CLASSLOCATION_CROBLOXAPP 0x00BFF898 -#define CLASSLOCATION_CAPP 0x00405D20 - -#define CLASSPADDING_CROBLOXDOC__WORKSPACE 40 #define CLASSPADDING_DATAMODEL__JOBID 729 // when compiled as debug, this must be 728 #define ADDRESS_DATAMODEL__GETJOBID 0x005CACC0 @@ -23,6 +19,13 @@ #define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x004FC1A0 #define ADDRESS_HTTP__TRUSTCHECK 0x005A2680 #define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x0079ECF0 + +// MFC specific definitions +#define CLASSLOCATION_CROBLOXAPP 0x00BFF898 +#define CLASSLOCATION_CAPP 0x00405D20 + +#define CLASSPADDING_CROBLOXDOC__WORKSPACE 40 + #define ADDRESS_CAPP__CREATEGAME 0x00405D20 #define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x00408060 #define ADDRESS_CROBLOXAPP__INITINSTANCE 0x00452900 @@ -34,10 +37,6 @@ // RobloxApp (2011) #ifdef MFC2011 -#define CLASSLOCATION_CROBLOXAPP 0x00CBA8A0 -#define CLASSLOCATION_CAPP 0x00406D80 - -#define CLASSPADDING_CROBLOXDOC__WORKSPACE 45 #define CLASSPADDING_DATAMODEL__JOBID 740 // when compiled as debug, this must be 739 #define ADDRESS_DATAMODEL__GETJOBID 0x005E70C0 @@ -45,6 +44,13 @@ #define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x0 #define ADDRESS_HTTP__TRUSTCHECK 0x005B7050 #define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0 + +// MFC specific definitions +#define CLASSLOCATION_CROBLOXAPP 0x00CBA8A0 +#define CLASSLOCATION_CAPP 0x00406D80 + +#define CLASSPADDING_CROBLOXDOC__WORKSPACE 45 + #define ADDRESS_CAPP__CREATEGAME 0x00406D80 #define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x00409050 #define ADDRESS_CROBLOXAPP__INITINSTANCE 0x004613C0 @@ -55,37 +61,29 @@ #endif #ifdef PLAYER2012 - // so 2012's a bit different - // VMProtect likes to offset the memory locations randomly on startup - // so defining the addresses here are a bit weird +// so 2012's a bit different +// VMProtect likes to offset the memory locations randomly on startup +// so defining the addresses here are a bit weird - // say the beginning of the program is located at 0x00BF1000 - // and you have a trust check hook that's, for example, located at 0x00DF20A0 +// say the beginning of the program is located at 0x00BF1000 +// and you have a trust check hook that's, for example, located at 0x00DF20A0 - // VMProtect is offsetting the memory location from 0x00000000 - 0x00FF0000 - // so the 0x00BF0000 in 0x00BF1000 is actually an offset +// VMProtect is offsetting the memory location from 0x00000000 - 0x00FF0000 +// so the 0x00BF0000 in 0x00BF1000 is actually an offset - // with that offset, the address you'd have to put for your trust check hook will be 0x00DF20A0 - 0x00BF0000 = 0x002020A0 - // and you just put that address into the function +// with that offset, the address you'd have to put for your trust check hook will be 0x00DF20A0 - 0x00BF0000 = 0x002020A0 +// and you just put that address into the function - #define CLASSLOCATION_CROBLOXAPP 0x00CBA8A0 - #define CLASSLOCATION_CAPP 0x00406D80 +#define CLASSPADDING_DATAMODEL__JOBID 763 // when compiled as debug, this must be 762 - #define CLASSPADDING_CROBLOXDOC__WORKSPACE 0 - #define CLASSPADDING_DATAMODEL__JOBID 763 // when compiled as debug, this must be 762 +#define ADDRESS_DATAMODEL__GETJOBID Patches::GetAddressByOffset(0x002079A0) +#define ADDRESS_STANDARDOUT__PRINT Patches::GetAddressByOffset(0x0023A8C0) +#define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x0 +#define ADDRESS_HTTP__TRUSTCHECK Patches::GetAddressByOffset(0x002020A0) +#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 Patches::GetAddressByOffset(0x00526330) - #define ADDRESS_DATAMODEL__GETJOBID Patches::GetAddressByOffset(0x002079A0) - #define ADDRESS_STANDARDOUT__PRINT Patches::GetAddressByOffset(0x0023A8C0) - #define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x0 - #define ADDRESS_HTTP__TRUSTCHECK Patches::GetAddressByOffset(0x002020A0) - #define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 Patches::GetAddressByOffset(0x00526330) - #define ADDRESS_CAPP__CREATEGAME 0x0 - #define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x0 - #define ADDRESS_CROBLOXAPP__INITINSTANCE 0x0 - #define ADDRESS_CROBLOXAPP__CREATEDOCUMENT 0x0 - #define ADDRESS_CWORKSPACE__EXECURLSCRIPT 0x0 - #define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x0 - #define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x0 +// Player specific definitions +#define ADDRESS_APPLICATION__PARSEARGUMENTS Patches::GetAddressByOffset(0x00004E60) #endif diff --git a/PolygonClientUtilities/RobloxMFCHooks.cpp b/PolygonClientUtilities/RobloxMFCHooks.cpp index f0e3941..fdd44f8 100644 --- a/PolygonClientUtilities/RobloxMFCHooks.cpp +++ b/PolygonClientUtilities/RobloxMFCHooks.cpp @@ -31,6 +31,9 @@ StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARD CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE; CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM; #endif +#ifdef PLAYER2012 +Application__ParseArguments_t Application__ParseArguments = (Application__ParseArguments_t)ADDRESS_APPLICATION__PARSEARGUMENTS; +#endif // Hook Definitions // @@ -131,6 +134,31 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* // { // return Network__RakNetAddressToString(raknetAddress, portDelineator); // } + +#ifdef PLAYER2012 +BOOL __fastcall Application__ParseArguments_hook(int _this, void*, int a2, const char* argv) +{ + std::map argslist = Util::parseArgs(argv); + + if (argslist.count("-jobId")) + { + hasJobId = true; + jobId = argslist["-jobId"]; + + // now we have to reconstruct the args to exclude the -jobId arg + std::stringstream argsrecon; + for (auto const& arg : argslist) + { + if (arg.first == "-jobId") continue; + argsrecon << arg.first << " " << arg.second << " "; + } + const std::string tmp = argsrecon.str(); + argv = tmp.c_str(); + } + + return Application__ParseArguments(_this, a2, argv); +} +#endif #endif #if defined(MFC2010) || defined(MFC2011) diff --git a/PolygonClientUtilities/RobloxMFCHooks.h b/PolygonClientUtilities/RobloxMFCHooks.h index 3e9528b..da5347c 100644 --- a/PolygonClientUtilities/RobloxMFCHooks.h +++ b/PolygonClientUtilities/RobloxMFCHooks.h @@ -10,6 +10,9 @@ typedef void(__thiscall* Crypt__verifySignatureBase64_t)(HCRYPTPROV* _this, char typedef INT(__thiscall* DataModel__getJobId_t)(DataModel* _this, int a2); typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string* message); // typedef std::string(__thiscall* Network__RakNetAddressToString_t)(const int raknetAddress, char portDelineator); +#ifdef PLAYER2012 +typedef BOOL(__thiscall* Application__ParseArguments_t)(int _this, int a2, const char* argv); +#endif #endif #if defined(MFC2010) || defined(MFC2011) // typedef INT(__thiscall* CApp__CreateGame_t)(CApp* _this, int *a2, LPCWSTR a3); @@ -25,6 +28,9 @@ extern Crypt__verifySignatureBase64_t Crypt__verifySignatureBase64; extern DataModel__getJobId_t DataModel__getJobId; extern StandardOut__print_t StandardOut__print; // extern Network__RakNetAddressToString_t Network__RakNetAddressToString; +#ifdef PLAYER2012 +extern Application__ParseArguments_t Application__ParseArguments; +#endif #endif #if defined(MFC2010) || defined(MFC2011) // extern CApp__CreateGame_t CApp__CreateGame; @@ -40,6 +46,9 @@ void __fastcall Crypt__verifySignatureBase64_hook(HCRYPTPROV* _this, void*, char INT __fastcall DataModel__getJobId_hook(DataModel* _this, void*, int a2); void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message); // std::string __fastcall Network__RakNetAddressToString_hook(const int raknetAddress, char portDelineator); +#ifdef PLAYER2012 +BOOL __fastcall Application__ParseArguments_hook(int _this, void*, int a2, const char* argv); +#endif #endif #if defined(MFC2010) || defined(MFC2011) // INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int *a2, LPCWSTR a3); diff --git a/PolygonClientUtilities/Util.cpp b/PolygonClientUtilities/Util.cpp index 966ec54..fd38915 100644 --- a/PolygonClientUtilities/Util.cpp +++ b/PolygonClientUtilities/Util.cpp @@ -28,4 +28,29 @@ const std::vector Util::allowedEmbeddedSchemes "javascript", "jscript", "res" -}; \ No newline at end of file +}; + +std::map Util::parseArgs(std::string args) +{ + std::map map; + + std::string::size_type key_pos = 0; + std::string::size_type key_end; + std::string::size_type val_pos; + std::string::size_type val_end; + + while ((key_end = args.find(' ', key_pos)) != std::string::npos) + { + if ((val_pos = args.find_first_not_of(" -", key_end)) == std::string::npos) + break; + + val_end = args.find(" -", val_pos); + map.emplace(args.substr(key_pos, key_end - key_pos), args.substr(val_pos, val_end - val_pos)); + + key_pos = val_end; + if (key_pos != std::string::npos) + ++key_pos; + } + + return map; +} \ No newline at end of file diff --git a/PolygonClientUtilities/Util.h b/PolygonClientUtilities/Util.h index ff252fa..6db06c3 100644 --- a/PolygonClientUtilities/Util.h +++ b/PolygonClientUtilities/Util.h @@ -8,4 +8,6 @@ public: static const std::vector allowedHosts; static const std::vector allowedSchemes; static const std::vector allowedEmbeddedSchemes; + static std::vector split(std::string s, std::string delimiter); + static std::map parseArgs(std::string args); }; \ No newline at end of file diff --git a/PolygonClientUtilities/dllmain.cpp b/PolygonClientUtilities/dllmain.cpp index a24f506..d1d09e4 100644 --- a/PolygonClientUtilities/dllmain.cpp +++ b/PolygonClientUtilities/dllmain.cpp @@ -11,6 +11,9 @@ ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook) ADD_PATCH(DataModel__getJobId, DataModel__getJobId_hook) ADD_PATCH(StandardOut__print, StandardOut__print_hook) // ADD_PATCH(Network__RakNetAddressToString, Network__RakNetAddressToString_hook) +#ifdef PLAYER2012 +ADD_PATCH(Application__ParseArguments, Application__ParseArguments_hook) +#endif #endif #if defined(MFC2010) || defined(MFC2011) // ADD_PATCH(CApp__CreateGame, CApp__CreateGame_hook) diff --git a/PolygonClientUtilities/pch.h b/PolygonClientUtilities/pch.h index 17d5a71..e3540a6 100644 --- a/PolygonClientUtilities/pch.h +++ b/PolygonClientUtilities/pch.h @@ -6,6 +6,6 @@ #include #include #include -#include #include +#include #include \ No newline at end of file