Add support for -jobId parameter on 2012 player

This commit is contained in:
pizzaboxer 2022-01-26 22:24:01 +00:00
parent f49d58cdd7
commit 783cf16b88
7 changed files with 100 additions and 35 deletions

View File

@ -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

View File

@ -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<std::string, std::string> 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)

View File

@ -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);

View File

@ -28,4 +28,29 @@ const std::vector<std::string> Util::allowedEmbeddedSchemes
"javascript",
"jscript",
"res"
};
};
std::map<std::string, std::string> Util::parseArgs(std::string args)
{
std::map<std::string, std::string> 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;
}

View File

@ -8,4 +8,6 @@ public:
static const std::vector<std::string> allowedHosts;
static const std::vector<std::string> allowedSchemes;
static const std::vector<std::string> allowedEmbeddedSchemes;
static std::vector<std::string> split(std::string s, std::string delimiter);
static std::map<std::string, std::string> parseArgs(std::string args);
};

View File

@ -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)

View File

@ -6,6 +6,6 @@
#include <fstream>
#include <sstream>
#include <string>
#include <format>
#include <vector>
#include <map>
#include <stdexcept>