Temporary - ExecUrlScript debugging

This commit is contained in:
pizzaboxer 2022-01-22 15:48:57 +00:00
parent c7c5d913c4
commit 0c8e1c786f
4 changed files with 52 additions and 23 deletions

View File

@ -11,7 +11,7 @@ class CWorkspace;
// 0x47E010: CWorkspace->DoExecScript()
// 0x47EC10: CWorkspace->ExecUrlScript()
const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))ADDRESS_CWORKSPACE__EXECURLSCRIPT;
// const auto CWorkspace__ExecUrlScript = (HRESULT(__stdcall*)(CWorkspace * workspace, LPCWSTR, VARIANTARG, VARIANTARG, VARIANTARG, VARIANTARG, LPVOID))ADDRESS_CWORKSPACE__EXECURLSCRIPT;
struct CRobloxDoc
{
@ -21,10 +21,12 @@ struct CRobloxDoc
// padding1[4] = offset of 0x10
// padding1[40] = offset of 0xA0
// possible options
// padding1[46] = offset of 0xB8
// padding1[84] = offset of 0x150
struct CApp;
// const auto CApp__CreateGame = (CWorkspace * (__thiscall*)(CApp * _this, LPCWSTR, LPCWSTR))ADDRESS_CAPP__CREATEGAME;
// const auto CApp__CreateGame = (CWorkspace * (__thiscall*)(CApp * _this, void*, int, LPCWSTR))ADDRESS_CAPP__CREATEGAME;
const auto CApp__RobloxAuthenticate = (void * (__thiscall*)(CApp * _this, void*, LPCWSTR, LPCWSTR))ADDRESS_CAPP__ROBLOXAUTHENTICATE;
struct CRobloxApp;
@ -34,7 +36,7 @@ struct CRobloxApp;
// 0x44F6F0: CRobloxApp->ExitInstance()
// 0x452900: CRobloxApp->InitInstance()
const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
// const auto CRobloxApp__CreateDocument = (CRobloxDoc * (__thiscall*)(CRobloxApp * _this))ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
struct CCommandLineInfo
{

View File

@ -26,7 +26,9 @@ StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARD
// Network__RakNetAddressToString_t Network__RakNetAddressToString = (Network__RakNetAddressToString_t)ADDRESS_NETWORK__RAKNETADDRESSTOSTRING;
#endif
#if defined(MFC2010) || defined(MFC2011)
CApp__CreateGame_t CApp__CreateGame = (CApp__CreateGame_t)ADDRESS_CAPP__CREATEGAME;
// CApp__CreateGame_t CApp__CreateGame = (CApp__CreateGame_t)ADDRESS_CAPP__CREATEGAME;
CWorkspace__ExecUrlScript_t CWorkspace__ExecUrlScript = (CWorkspace__ExecUrlScript_t)ADDRESS_CWORKSPACE__EXECURLSCRIPT;
CRobloxApp__CreateDocument_t CRobloxApp__CreateDocument = (CRobloxApp__CreateDocument_t)ADDRESS_CROBLOXAPP__CREATEDOCUMENT;
CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE;
CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM;
#endif
@ -141,13 +143,28 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
#endif
#if defined(MFC2010) || defined(MFC2011)
INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int a2, int* a3)
/* INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int a2, LPCWSTR a3)
{
printf("\n");
printf("Pointer location of CApp: %p\n", &_this);
printf("Pointer value of CApp: %p\n", _this);
// CApp__RobloxAuthenticate(_this, NULL, L"http://polygondev.pizzaboxer.xyz/login/negotiate.ashx", L"0");
return CApp__CreateGame(_this, a2, a3);
} */
void __fastcall CWorkspace__ExecUrlScript_hook(CWorkspace* workspace, void*, LPCWSTR url, VARIANTARG arg1, VARIANTARG arg2, VARIANTARG arg3, VARIANTARG arg4, LPVOID voidptr)
{
printf("CWorkspace::ExecUrlScript called\n");
CWorkspace__ExecUrlScript(workspace, url, arg1, arg2, arg3, arg4, voidptr);
printf("Pointer location of CWorkspace: %p\n", &workspace);
printf("Pointer value of CWorkspace: %p\n", workspace);
printf("\n");
}
CRobloxDoc* __fastcall CRobloxApp__CreateDocument_hook(CRobloxApp* _this)
{
printf("CRobloxApp::CreateDocument called\n");
CRobloxDoc* document = CRobloxApp__CreateDocument(_this);
printf("Pointer location of CRobloxDoc: %p\n", &document);
printf("Pointer value of CRobloxDoc: %p\n", document);
printf("\n");
return document;
}
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
@ -162,21 +179,23 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this)
CApp__RobloxAuthenticate(app, NULL, authenticationUrl.c_str(), authenticationTicket.c_str());
}
// printf("Pointer location of CRobloxApp: %p\n", &_this);
// printf("Pointer value of CRobloxApp: %p\n", _this);
// printf("Pointer location of CRobloxDoc: %p\n", document);
// printf("Pointer location of CWorkspace: %p\n", &document->workspace);
// printf("Pointer location of CApp: %p\n", &app);
// printf("Pointer value of CApp: %p\n", app);
if (hasJoinArg && !joinScriptUrl.empty())
{
try
{
// TODO: use CApp__CreateGame instead
CRobloxDoc* document = CRobloxApp__CreateDocument(_this);
CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
CRobloxDoc* document = CRobloxApp__CreateDocument_hook(_this);
CWorkspace* workspace = document->workspace;
// CWorkspace__ExecUrlScript(document->workspace, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
CWorkspace__ExecUrlScript_hook(workspace, nullptr, joinScriptUrl.c_str(), VARIANTARG(), VARIANTARG(), VARIANTARG(), VARIANTARG(), nullptr);
printf("InitInstance - Pointer location of CRobloxDoc: %p\n", &document);
printf("InitInstance - Pointer value of CRobloxDoc: %p\n", document);
printf("\n");
printf("InitInstance - Pointer location of CWorkspace: %p\n", &workspace);
printf("InitInstance - Pointer value of CWorkspace: %p\n", workspace);
printf("\n");
}
catch (std::runtime_error& exception)
{

View File

@ -14,7 +14,9 @@ typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string*
// typedef void(__thiscall* Network__RakNetAddressToString_t)(int raknetAddress, bool writePort, char portDelineator);
#endif
#if defined(MFC2010) || defined(MFC2011)
typedef INT(__thiscall* CApp__CreateGame_t)(CApp* _this, int a2, int *a3);
// typedef INT(__thiscall* CApp__CreateGame_t)(CApp* _this, int a2, LPCWSTR a3);
typedef void(__thiscall* CWorkspace__ExecUrlScript_t)(CWorkspace* workspace, LPCWSTR url, VARIANTARG arg1, VARIANTARG arg2, VARIANTARG arg3, VARIANTARG arg4, LPVOID voidptr);
typedef CRobloxDoc*(__thiscall* CRobloxApp__CreateDocument_t)(CRobloxApp* _this);
typedef BOOL(__thiscall* CRobloxApp__InitInstance_t)(CRobloxApp* _this);
typedef void(__thiscall* CRobloxCommandLineInfo__ParseParam_t)(CRobloxCommandLineInfo* _this, const char* pszParam, BOOL bFlag, BOOL bLast);
#endif
@ -29,7 +31,9 @@ extern StandardOut__print_t StandardOut__print;
// extern Network__RakNetAddressToString_t Network__RakNetAddressToString;
#endif
#if defined(MFC2010) || defined(MFC2011)
extern CApp__CreateGame_t CApp__CreateGame;
// extern CApp__CreateGame_t CApp__CreateGame;
extern CWorkspace__ExecUrlScript_t CWorkspace__ExecUrlScript;
extern CRobloxApp__CreateDocument_t CRobloxApp__CreateDocument;
extern CRobloxApp__InitInstance_t CRobloxApp__InitInstance;
extern CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam;
#endif
@ -44,7 +48,9 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
// std::string __fastcall Network__RakNetAddressToString_hook(int raknetAddress, bool writePort, char portDelineator);
#endif
#if defined(MFC2010) || defined(MFC2011)
INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int a2, int *a3);
// INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int a2, LPCWSTR a3);
void __fastcall CWorkspace__ExecUrlScript_hook(CWorkspace* _this, void*, LPCWSTR url, VARIANTARG arg1, VARIANTARG arg2, VARIANTARG arg3, VARIANTARG arg4, LPVOID voidptr);
CRobloxDoc* __fastcall CRobloxApp__CreateDocument_hook(CRobloxApp* _this);
BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this);
void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast);
#endif

View File

@ -13,6 +13,8 @@ ADD_PATCH(StandardOut__print, StandardOut__print_hook)
#endif
#if defined(MFC2010) || defined(MFC2011)
// ADD_PATCH(CApp__CreateGame, CApp__CreateGame_hook)
ADD_PATCH(CRobloxApp__CreateDocument, CRobloxApp__CreateDocument_hook)
ADD_PATCH(CWorkspace__ExecUrlScript, CWorkspace__ExecUrlScript_hook)
ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook)
ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook)
#endif