diff --git a/PolygonClientUtilities/Classes.h b/PolygonClientUtilities/Classes.h index 4f46b75..26e0d08 100644 --- a/PolygonClientUtilities/Classes.h +++ b/PolygonClientUtilities/Classes.h @@ -3,21 +3,30 @@ #include "Config.h" #include +struct Game +{ + void* padding1[26]; // 2010 has a class size of 104 +}; + +const auto Game__initializeConstruct = (void * (__thiscall*)(void* _this, int a2))0x455D40; + struct DataModel { - void* padding1[CLASSPADDING_DATAMODEL__JOBID]; + void* padding1[CLASSPADDING_DATAMODEL__JOBID + PADDING_STRUCT]; std::string jobId; }; struct Http { +#if PADDING_STRUCT != 0 void* padding1[1]; +#endif std::string alternateUrl; - void* padding2[4]; + void* padding2[3 + PADDING_STRUCT]; std::string url; }; -// const auto DataModel__createDataModel = (void * (__thiscall*)(int a1, char a2))ADDRESS_DATAMODEL__CREATEDATAMODEL; +// const auto DataModel__createDataModel = (std::shared_ptr(__thiscall*)(bool startHeartbeat))ADDRESS_DATAMODEL__CREATEDATAMODEL; struct Packet { diff --git a/PolygonClientUtilities/Config.h b/PolygonClientUtilities/Config.h index 4689372..8eeaa61 100644 --- a/PolygonClientUtilities/Config.h +++ b/PolygonClientUtilities/Config.h @@ -19,7 +19,7 @@ // RobloxApp (2010) #ifdef MFC2010 -#define CLASSPADDING_DATAMODEL__JOBID 729 // when compiled as debug, this must be 728 +#define CLASSPADDING_DATAMODEL__JOBID 728 #define ADDRESS_DATAMODEL__GETJOBID 0x005CACC0 #define ADDRESS_STANDARDOUT__PRINT 0x0059F340 @@ -60,7 +60,7 @@ // RobloxApp (2011) #ifdef MFC2011 -#define CLASSPADDING_DATAMODEL__JOBID 740 // when compiled as debug, this must be 739 +#define CLASSPADDING_DATAMODEL__JOBID 739 #define ADDRESS_DATAMODEL__GETJOBID 0x005E70C0 #define ADDRESS_DATAMODEL__DESTRUCT 0x006002A0 @@ -135,7 +135,7 @@ #define ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM 0x0 #define ADDRESS_CCOMMANDLINEINFO__PARSELAST 0x0 -#define CLASSPADDING_DATAMODEL__JOBID 763 // when compiled as debug, this must be 762 +#define CLASSPADDING_DATAMODEL__JOBID 762 #define ADDRESS_DATAMODEL__GETJOBID Patches::GetAddressByOffset(0x002079A0) #define ADDRESS_STANDARDOUT__PRINT Patches::GetAddressByOffset(0x0023A8C0) @@ -157,4 +157,10 @@ #define RR_STOP_PROCESSING_AND_DEALLOCATE 0 #define RR_CONTINUE_PROCESSING 1 -#define RR_STOP_PROCESSING 2 \ No newline at end of file +#define RR_STOP_PROCESSING 2 + +#ifdef NDEBUG +#define PADDING_STRUCT 1 +#else +#define PADDING_STRUCT 0 +#endif \ No newline at end of file diff --git a/PolygonClientUtilities/Debug/PolygonClientUtilities.ilk b/PolygonClientUtilities/Debug/PolygonClientUtilities.ilk index ede2fbd..bca18fe 100644 Binary files a/PolygonClientUtilities/Debug/PolygonClientUtilities.ilk and b/PolygonClientUtilities/Debug/PolygonClientUtilities.ilk differ diff --git a/PolygonClientUtilities/DebugDatamodel.cpp b/PolygonClientUtilities/DebugDatamodel.cpp deleted file mode 100644 index c03540a..0000000 --- a/PolygonClientUtilities/DebugDatamodel.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "pch.h" -#include "DebugDatamodel.h" - -DataModel__createDataModel_t DataModel__createDataModel = (DataModel__createDataModel_t)0; // ADDRESS_DATAMODEL__CREATEDATAMODEL; - -int __fastcall DataModel__createDataModel_hook(int, int, int, bool startHeartbeat) -{ - printf("DataModel::createDataModel called\n"); - - printf("Value of startHeartbeat: %#010x\n", startHeartbeat); - - return DataModel__createDataModel(startHeartbeat); -} - -/* DataModel__createDataModel_t DataModel__createDataModel = (DataModel__createDataModel_t)ADDRESS_GAME__CONSTRUCT; - -int __fastcall DataModel__createDataModel_hook(int _this) -{ - printf("Game::Game called\n"); - printf("Value of _this: %#010X\n", _this); - return DataModel__createDataModel(_this); -} */ \ No newline at end of file diff --git a/PolygonClientUtilities/DebugDatamodel.h b/PolygonClientUtilities/DebugDatamodel.h deleted file mode 100644 index 5ffe78e..0000000 --- a/PolygonClientUtilities/DebugDatamodel.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "Classes.h" - -typedef int (__thiscall* DataModel__createDataModel_t)(bool startHeartbeat); -int __fastcall DataModel__createDataModel_hook(int, int, int, bool startHeartbeat); -extern DataModel__createDataModel_t DataModel__createDataModel; - -// Game::Game -/* typedef int(__thiscall* DataModel__createDataModel_t)(int _this); -int __fastcall DataModel__createDataModel_hook(int _this); -extern DataModel__createDataModel_t DataModel__createDataModel; */ \ No newline at end of file diff --git a/PolygonClientUtilities/DebugGame.cpp b/PolygonClientUtilities/DebugGame.cpp new file mode 100644 index 0000000..0e05547 --- /dev/null +++ b/PolygonClientUtilities/DebugGame.cpp @@ -0,0 +1,11 @@ +#include "pch.h" +#include "DebugGame.h" + +Game__construct_t Game__construct = (Game__construct_t)0x47DBF0; + +int __fastcall Game__construct_hook(Game* _this) +{ + printf("Game::Game called\n"); + printf("Value of _this: %p\n", _this); + return Game__construct(_this); +} \ No newline at end of file diff --git a/PolygonClientUtilities/DebugGame.h b/PolygonClientUtilities/DebugGame.h new file mode 100644 index 0000000..9ea8346 --- /dev/null +++ b/PolygonClientUtilities/DebugGame.h @@ -0,0 +1,7 @@ +#pragma once + +#include "Classes.h" + +typedef int (__thiscall* Game__construct_t)(Game* _this); +int __fastcall Game__construct_hook(Game* _this); +extern Game__construct_t Game__construct; \ No newline at end of file diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj b/PolygonClientUtilities/PolygonClientUtilities.vcxproj index bf40e58..d102ffc 100644 --- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj +++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj @@ -72,9 +72,11 @@ true + true false + true true @@ -162,6 +164,7 @@ + @@ -178,6 +181,7 @@ + diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters index e9612bd..2d6f92e 100644 --- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters +++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters @@ -66,6 +66,9 @@ Header Files\Hooks + + Header Files\Hooks + @@ -110,5 +113,8 @@ Source Files\Hooks + + Source Files\Hooks + \ No newline at end of file diff --git a/PolygonClientUtilities/RCCOutput.cpp b/PolygonClientUtilities/RCCOutput.cpp index 33eb673..7a8c1b4 100644 --- a/PolygonClientUtilities/RCCOutput.cpp +++ b/PolygonClientUtilities/RCCOutput.cpp @@ -1,5 +1,6 @@ #include "pch.h" #include "RCCOutput.h" +#include "DebugGame.h" #include "Patches.h" HANDLE outputHandle; @@ -35,6 +36,25 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message = reinterpret_cast(messagePtr); #endif + /* if (message->compare("MakeDatamodel") == 0) + { + printf("Attempting to create DataModel...\n"); + DataModel__createDataModel(true); + } */ + + if (message->compare("NewGame") == 0) + { + printf("Attempting to create new Game...\n"); + int v2; + void* v3; + void* v4; + + // v3 = operator new(104u); + v3 = new Game(); + v4 = Game__initializeConstruct(v3, 0); + v2 = Game__construct_hook((Game*)v4); + } + switch (type) { case 1: // RBX::MESSAGE_OUTPUT: diff --git a/PolygonClientUtilities/TestHttpGetPost.cpp b/PolygonClientUtilities/TestHttpGetPost.cpp index ebcfa6c..5d13bf7 100644 --- a/PolygonClientUtilities/TestHttpGetPost.cpp +++ b/PolygonClientUtilities/TestHttpGetPost.cpp @@ -25,9 +25,7 @@ void __fastcall Http_httpGetPostWinInet_hook(Http* _this, void*, bool isPost, in printf("\n"); printf("Location of _this+40: %08X\n", (int)_this + 40); - printf("Location of _this->url: %p\n", &_this->url); - - printf("\n"); */ + printf("Location of _this->url: %p\n", &_this->url); */ printf("Requested url: %s\n", _this->url.c_str()); @@ -41,17 +39,11 @@ void __fastcall Http_httpGetPostWinInet_hook(Http* _this, void*, bool isPost, in std::string assetUrl = "https://assetdelivery.roblox.com/v1/asset/?" + parsedUrl.query_; printf("Should swap URL with: %s\n", assetUrl.c_str()); - // yep... same access violation i got in polygonutil.dll.......... - // yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayyyyyyyyyyyyyyyyyyyyyy - _this->url = assetUrl; + std::string test = assetUrl; + _this->url = test; } } - // printf("Host: %s\n", parsedUrl.host_.c_str()); - // printf("Path: %s\n", parsedUrl.path_.c_str()); - // printf("Query: %s\n", parsedUrl.query_.c_str()); - // printf("Fragment: %s\n", parsedUrl.fragment_.c_str()); - printf("\n"); Http_httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6); diff --git a/PolygonClientUtilities/dllmain.cpp b/PolygonClientUtilities/dllmain.cpp index 2292725..e128538 100644 --- a/PolygonClientUtilities/dllmain.cpp +++ b/PolygonClientUtilities/dllmain.cpp @@ -3,7 +3,7 @@ #include "Patches.h" //#include "RobloxMFCHooks.h" -// #include "DebugDatamodel.h" +#include "DebugGame.h" // #include "TestHttpGetPost.h" #include "TrustCheck.h" #include "VerifySignatureBase64.h" @@ -25,8 +25,8 @@ #endif START_PATCH_LIST() +ADD_PATCH(Game__construct, Game__construct_hook) // ADD_PATCH(Http_httpGetPostWinInet, Http_httpGetPostWinInet_hook) -// ADD_PATCH(DataModel__createDataModel, DataModel__createDataModel_hook) ADD_PATCH(Http__trustCheck, Http__trustCheck_hook) ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook)