Add address configs for multiple client versions

This commit is contained in:
pizzaboxer 2022-01-20 21:07:56 +00:00
parent 744ca5fb92
commit f3eb2893c6
5 changed files with 102 additions and 8 deletions

View File

@ -0,0 +1,28 @@
#pragma once
#define MFC2011
#define ARBITERBUILD
// RobloxApp (2010)
#ifdef MFC2010
#define ADDRESS_STANDARDOUT__PRINT 0x0059F340
#define ADDRESS_CAPP__CREATEGAME 0x00405D20
#define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x00408060
#define ADDRESS_CROBLOXAPP__INITINSTANCE 0x00452900
#define ADDRESS_CROBLOXAPP__CREATEDOCUMENT 0x0044F6E0
#define ADDRESS_CWORKSPACE__EXECURLSCRIPT 0x0047EC10
#define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x00450AC0
#define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x007A80A0
#endif
// RobloxApp (2011)
#ifdef MFC2011
#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0
#define ADDRESS_CAPP__CREATEGAME 0x0
#define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x0
#define ADDRESS_CROBLOXAPP__INITINSTANCE 0x004613C0
#define ADDRESS_CROBLOXAPP__CREATEDOCUMENT 0x0045D030
#define ADDRESS_CWORKSPACE__EXECURLSCRIPT 0x0049FC90
#define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x0045EE50
#define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x0081354A
#endif

View File

@ -157,6 +157,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Config.h" />
<ClInclude Include="Patches.h" /> <ClInclude Include="Patches.h" />
<ClInclude Include="pch.h" /> <ClInclude Include="pch.h" />
<ClInclude Include="RobloxMFCClasses.h" /> <ClInclude Include="RobloxMFCClasses.h" />

View File

@ -27,6 +27,9 @@
<ClInclude Include="Patches.h"> <ClInclude Include="Patches.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Config.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="dllmain.cpp"> <ClCompile Include="dllmain.cpp">

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "Config.h"
#include <oaidl.h> #include <oaidl.h>
// CWorkspace // CWorkspace
@ -8,7 +9,7 @@
class CWorkspace; class CWorkspace;
const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))0x0047EC10; const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))ADDRESS_CWORKSPACE__EXECURLSCRIPT;
// CRobloxDoc // CRobloxDoc
@ -20,14 +21,26 @@ public:
CWorkspace* workspace; CWorkspace* workspace;
}; };
// CApp
class CApp;
const auto CApp__CreateGame = (CWorkspace * (__thiscall*)(CApp * _this, LPCWSTR, LPCWSTR))ADDRESS_CAPP__CREATEGAME;
const auto CApp__RobloxAuthenticate = (void * (__thiscall*)(CApp * _this, LPCWSTR, LPCWSTR))ADDRESS_CAPP__ROBLOXAUTHENTICATE;
// CRobloxApp // CRobloxApp
// 2010: 0x0044F6E0 // 2010: 0x0044F6E0
// 2011: 0x0045D030 // 2011: 0x0045D030
class CRobloxApp; class CRobloxApp
{
private:
void* padding1[124];
public:
CApp* app;
};
const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))0x0044F6E0; const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
// const auto CRobloxApp__CreateGame = (CWorkspace * (__thiscall*)(CRobloxApp * _this, LPCWSTR))0x00405D20; // is CApp the same thing as CRobloxApp??
// CRobloxCommandLineInfo // CRobloxCommandLineInfo
// 2010: 0x007A80A0 // 2010: 0x007A80A0
@ -43,4 +56,4 @@ public:
class CRobloxCommandLineInfo : public CCommandLineInfo {}; class CRobloxCommandLineInfo : public CCommandLineInfo {};
const auto CCommandLineInfo__ParseLast = (void(__thiscall*)(CCommandLineInfo * _this, BOOL bLast))0x007A80A0; const auto CCommandLineInfo__ParseLast = (void(__thiscall*)(CCommandLineInfo * _this, BOOL bLast))ADDRESS_CCOMMANDLINEINFO__PARSELAST;

View File

@ -1,31 +1,46 @@
#include "pch.h" #include "pch.h"
#include "Config.h"
#include "RobloxMFCHooks.h" #include "RobloxMFCHooks.h"
static HANDLE handle; static HANDLE handle;
static std::ofstream jobLog; static std::ofstream jobLog;
static bool hasAuthUrlArg = false;
static bool hasAuthTicketArg = false;
static bool hasJoinArg = false; static bool hasJoinArg = false;
static bool hasJobId = false; static bool hasJobId = false;
static std::wstring authenticationUrl;
static std::wstring authenticationTicket;
static std::wstring joinScriptUrl; static std::wstring joinScriptUrl;
static std::string jobId; static std::string jobId;
// 2010: 0x00452900; // 2010: 0x00452900;
// 2011: 0x004613C0; // 2011: 0x004613C0;
CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)0x00452900; CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE;
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this) BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
{ {
if (!CRobloxApp__InitInstance(_this)) if (!CRobloxApp__InitInstance(_this))
return FALSE; return FALSE;
if (hasAuthUrlArg && hasAuthTicketArg && !authenticationUrl.empty() && !authenticationTicket.empty())
{
// TODO: implement this
}
if (hasJoinArg && !joinScriptUrl.empty()) if (hasJoinArg && !joinScriptUrl.empty())
{ {
try try
{ {
// TODO: use CApp__CreateGame instead
CRobloxDoc* document = CRobloxApp__CreateDocument(_this); CRobloxDoc* document = CRobloxApp__CreateDocument(_this);
CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr); CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
// CApp__CreateGame(NULL, L"", L"44340105256");
// CApp__RobloxAuthenticate(_this->app, L"http://polygondev.pizzaboxer.xyz/", L"test");
// CRobloxApp__CreateDocument(_this);
} }
catch (std::runtime_error& exception) catch (std::runtime_error& exception)
{ {
@ -40,7 +55,7 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
// 2010: 0x00450AC0; // 2010: 0x00450AC0;
// 2011: 0x0045EE50; // 2011: 0x0045EE50;
CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)0x00450AC0; CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM;
void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast) void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast)
{ {
@ -56,6 +71,26 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return; return;
} }
if (hasAuthUrlArg && authenticationUrl.empty())
{
int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0);
authenticationUrl.resize(size);
MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), &authenticationUrl[0], size);
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
if (hasAuthTicketArg && authenticationTicket.empty())
{
int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0);
authenticationTicket.resize(size);
MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), &authenticationTicket[0], size);
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
if (hasJobId && jobId.empty()) if (hasJobId && jobId.empty())
{ {
jobId = std::string(pszParam); jobId = std::string(pszParam);
@ -70,6 +105,20 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
return; return;
} }
if (bFlag && _stricmp(pszParam, "a") == 0)
{
hasAuthUrlArg = true;
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
if (bFlag && _stricmp(pszParam, "t") == 0)
{
hasAuthTicketArg = true;
CCommandLineInfo__ParseLast(_this, bLast);
return;
}
if (bFlag && _stricmp(pszParam, "j") == 0) if (bFlag && _stricmp(pszParam, "j") == 0)
{ {
hasJoinArg = true; hasJoinArg = true;
@ -90,7 +139,7 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo*
// 2010: 0x0059F340; // 2010: 0x0059F340;
// 2011: 0x005B25E0; // 2011: 0x005B25E0;
StandardOut__print_t StandardOut__print = (StandardOut__print_t)0x0059F340; StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARDOUT__PRINT;
void __fastcall StandardOut__print_hook(void* _this, void*, int type, const std::string& message) void __fastcall StandardOut__print_hook(void* _this, void*, int type, const std::string& message)
{ {