diff --git a/Tadah.DLL/Discord.cpp b/Tadah.DLL/Discord.cpp index 0094241..97a8008 100644 --- a/Tadah.DLL/Discord.cpp +++ b/Tadah.DLL/Discord.cpp @@ -8,7 +8,7 @@ bool isRunning = false; std::string username; int placeId; -void InitializeDiscord() +void Discord::Initialize(std::string joinScriptUrl) { // Check if Discord should be enabled by checking if the binary is the client as well as if the binary's containing folder contains a ".nodiscord" file std::string path = Helpers::getModulePath(); @@ -23,8 +23,32 @@ void InitializeDiscord() return; } + std::pair> parsed = Helpers::parseURL(joinScriptUrl); + + if (!parsed.first) + { + return; + } + + if (parsed.second["query"].empty()) + { + return; + } + + std::map query = Helpers::parseQueryString(parsed.second["query"]); + + if (query.find("ticket") == query.end()) + { + return; + } + + if (query["ticket"].empty()) + { + return; + } + // Get the username and placeId - std::pair response = Helpers::httpGet(BASE_URL + std::string("/api/places/information?ticket=") + ticket); + std::pair response = Helpers::httpGet(BASE_URL + std::string("/api/places/information?ticket=" + query["ticket"])); if (!response.first) { return; @@ -41,14 +65,14 @@ void InitializeDiscord() username = document["username"].GetString(); placeId = document["placeId"].GetInt(); - UpdatePresence(); + Discord::Update(); // Run the updater - std::thread updater(UpdatePresence); + std::thread updater(Discord::Update); updater.join(); } -void UpdatePresence() +void Discord::Update() { isRunning = true; @@ -61,7 +85,7 @@ void UpdatePresence() int max = 0; // Get title, size, and max - std::pair response = Helpers::httpGet(BASE_URL + std::string("/api/places/information?id=") + std::to_string(placeId)); + std::pair response = Helpers::httpGet(BASE_URL + std::string("/api/places/information?id=" + placeId)); if (!response.first) { return; @@ -94,7 +118,7 @@ void UpdatePresence() } } -void CleanupDiscord() +void Discord::Cleanup() { isRunning = false; Discord_Shutdown(); diff --git a/Tadah.DLL/Hooks/CRoblox.cpp b/Tadah.DLL/Hooks/CRoblox.cpp index b9a658a..f0101aa 100644 --- a/Tadah.DLL/Hooks/CRoblox.cpp +++ b/Tadah.DLL/Hooks/CRoblox.cpp @@ -2,15 +2,19 @@ #include "Hooks/CRoblox.h" -std::string ticket = ""; +#ifdef SERVER +#include "Server.h" +#endif -static bool hasAuthUrlArg = false; -static bool hasAuthTicketArg = false; -static bool hasJoinArg = false; +bool hasAuthUrlArg = false; +bool hasAuthTicketArg = false; +bool hasJoinArg = false; +bool hasJobIdArg = false; -static std::wstring authenticationUrl; -static std::wstring authenticationTicket; -static std::wstring joinScriptUrl; +std::wstring authenticationUrl; +std::wstring authenticationTicket; +std::wstring joinScriptUrl; +std::wstring jobId; CRobloxApp__InitInstance_t CRobloxApp__InitInstance = (CRobloxApp__InitInstance_t)ADDRESS_CROBLOXAPP__INITINSTANCE; CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobloxCommandLineInfo__ParseParam_t)ADDRESS_CROBLOXCOMMANDLINEINFO__PARSEPARAM; @@ -18,16 +22,19 @@ CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobl BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this) { if (!CRobloxApp__InitInstance(_this)) + { return FALSE; + } CApp* app = reinterpret_cast(CLASSLOCATION_CAPP); +#ifndef SERVER if (hasAuthUrlArg && hasAuthTicketArg && !authenticationUrl.empty() && !authenticationTicket.empty()) { CApp__RobloxAuthenticate(app, nullptr, authenticationUrl.c_str(), authenticationTicket.c_str()); } +#endif -#ifndef SERVER if (hasJoinArg && !joinScriptUrl.empty()) { try @@ -40,14 +47,12 @@ BOOL __fastcall CRobloxApp__InitInstance_hook(CRobloxApp* _this) return FALSE; } } -#endif return TRUE; } void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this, void*, const char* pszParam, BOOL bFlag, BOOL bLast) { -#ifndef SERVER if (hasJoinArg && joinScriptUrl.empty()) { int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0); @@ -57,29 +62,13 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* _this->m_bRunAutomated = TRUE; CCommandLineInfo__ParseLast(_this, bLast); - - // Parse the joinScriptUrl for it's placeId here - std::pair> result = Helpers::parseURL(Helpers::ws2s(joinScriptUrl)); - if (!result.first) - { - ExitProcess(EXIT_FAILURE); - } - std::map parameters = result.second; - if (parameters.find("ticket") != parameters.end()) - { - ticket = parameters["ticket"]; - } - - if (ticket.empty()) - { - ExitProcess(EXIT_FAILURE); - } - - return; - } +#ifndef SERVER + Discord::Initialize(Helpers::ws2s(joinScriptUrl)); #endif + } +#ifndef SERVER if (hasAuthUrlArg && authenticationUrl.empty()) { int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0); @@ -99,7 +88,21 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* CCommandLineInfo__ParseLast(_this, bLast); return; } +#endif +#ifdef SERVER + if (hasJobIdArg && jobId.empty()) + { + int size = MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), nullptr, 0); + jobId.resize(size); + MultiByteToWideChar(CP_ACP, 0, pszParam, strlen(pszParam), &jobId[0], size); + + CCommandLineInfo__ParseLast(_this, bLast); + return; + } +#endif + +#ifndef SERVER if (bFlag && _stricmp(pszParam, "a") == 0) { hasAuthUrlArg = true; @@ -113,14 +116,25 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* CCommandLineInfo__ParseLast(_this, bLast); return; } +#endif -#ifndef SERVER if (bFlag && _stricmp(pszParam, "j") == 0) { hasJoinArg = true; CCommandLineInfo__ParseLast(_this, bLast); return; } + +#ifdef SERVER + if (bFlag && _stricmp(pszParam, "jobId") == 0) + { + hasJobIdArg = true; + CCommandLineInfo__ParseLast(_this, bLast); + + Server::Initialize(jobId); + + return; + } #endif CRobloxCommandLineInfo__ParseParam(_this, pszParam, bFlag, bLast); diff --git a/Tadah.DLL/Hooks/DataModel.cpp b/Tadah.DLL/Hooks/DataModel.cpp new file mode 100644 index 0000000..1442777 --- /dev/null +++ b/Tadah.DLL/Hooks/DataModel.cpp @@ -0,0 +1,22 @@ +#include "pch.h" + +#include "Hooks/DataModel.h" + +#ifdef SERVER + +bool setJobId = false; + +DataModel__getJobId_t DataModel__getJobId = (DataModel__getJobId_t)ADDRESS_DATAMODEL__GETJOBID; + +int __fastcall DataModel__getJobId_hook(DataModel* _this, void*, int a2) +{ + if (!setJobId && hasJobIdArg && !jobId.empty()) + { + _this->jobId = Helpers::ws2s(jobId); + setJobId = true; + } + + return DataModel__getJobId(_this, a2); +} + +#endif diff --git a/Tadah.DLL/Hooks/Http.cpp b/Tadah.DLL/Hooks/Http.cpp index 20d5d83..63e6731 100644 --- a/Tadah.DLL/Hooks/Http.cpp +++ b/Tadah.DLL/Hooks/Http.cpp @@ -90,9 +90,10 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i } #ifdef SERVER - httpLog.open(httpLogPath, std::ios::out); - httpLog << "[" << Helpers::getISOTimestamp << "] [" << (isPost ? "POST" : "GET") << "] '" << _this->url << "'" << std::endl; - httpLog.close(); + if (Server::Handle) + { + Server::Log::Http((RequestType)isPost, _this->url); + } #endif Http__httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6); diff --git a/Tadah.DLL/Hooks/ServerReplicator.cpp b/Tadah.DLL/Hooks/ServerReplicator.cpp index cda8115..78db52f 100644 --- a/Tadah.DLL/Hooks/ServerReplicator.cpp +++ b/Tadah.DLL/Hooks/ServerReplicator.cpp @@ -2,7 +2,7 @@ #include "Hooks/ServerReplicator.h" -#if defined(SERVER) +#ifdef SERVER static std::map rakPeers; diff --git a/Tadah.DLL/Hooks/StandardOut.cpp b/Tadah.DLL/Hooks/StandardOut.cpp index 9fcfddc..8fd5515 100644 --- a/Tadah.DLL/Hooks/StandardOut.cpp +++ b/Tadah.DLL/Hooks/StandardOut.cpp @@ -4,86 +4,23 @@ #ifdef SERVER -HANDLE outputHandle; - -std::string httpLogPath; -std::string stdoutLogPath; - -std::ofstream httpLog; -std::ofstream stdoutLog; - -void InitializeOutput() -{ - AllocConsole(); - freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); - outputHandle = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - SetStdHandle(STD_OUTPUT_HANDLE, outputHandle); - - printf("Tadah.DLL v1.0.0\n"); - -#ifdef _DEBUG - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN); - printf("Compiled as Debug\n\n"); -#endif - - // Initialize file logging - fs::create_directory(fs::path(Helpers::getModulePath()).parent_path() / "logs"); - - std::string time = Helpers::getISOTimestamp(); - - stdoutLogPath = (fs::path(Helpers::getModulePath()).parent_path() / "logs" / (time + "-StandardOut.log")).string(); - httpLogPath = (fs::path(Helpers::getModulePath()).parent_path() / "logs" / (time + "-Http.log")).string(); - - stdoutLog.open(stdoutLogPath, std::ios::out); - httpLog.open(stdoutLogPath, std::ios::out); - - stdoutLog << "Tadah.DLL v1.0.0 - StandardOut" << std::endl << std::endl; - httpLog << "Tadah.DLL v1.0.0 - Http" << std::endl << std::endl; - - stdoutLog.close(); - httpLog.close(); -} - StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARDOUT__PRINT; void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message) { StandardOut__print(_this, type, message); +#ifdef SERVER + if (Server::Handle) + { #ifndef _DEBUG - // Message pointer is offset 4 bytes when the DLL is compiled as release - message = reinterpret_cast((int)message + 4); + // Message pointer is offset 4 bytes when the DLL is compiled as release + message = reinterpret_cast((int)message + 4); #endif - std::string stringifiedType; - std::string time = Helpers::getISOTimestamp(); - - switch (type) - { - case RBX__MESSAGE_OUTPUT: - SetConsoleTextAttribute(outputHandle, FOREGROUND_BLUE | FOREGROUND_INTENSITY); - stringifiedType = "out"; - break; - case RBX__MESSAGE_INFO: - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); - stringifiedType = "info"; - break; - case RBX__MESSAGE_WARNING: - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN); - stringifiedType = "warn"; - break; - case RBX__MESSAGE_ERROR: - stringifiedType = "err"; - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_INTENSITY); - break; + Server::Log::Output((LogSeverity)type, message->c_str()); } - - printf("%s\n", message->c_str()); - SetConsoleTextAttribute(outputHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); - - stdoutLog.open(stdoutLogPath, std::ios::out); - stdoutLog << "[" << time << "] [" << stringifiedType << "] " << message << std::endl; - stdoutLog.close(); +#endif } #endif \ No newline at end of file diff --git a/Tadah.DLL/Include/Configuration.h b/Tadah.DLL/Include/Configuration.h index 4d400c2..bfc14c2 100644 --- a/Tadah.DLL/Include/Configuration.h +++ b/Tadah.DLL/Include/Configuration.h @@ -1,5 +1,6 @@ #pragma once +//#define SERVER #define BASE_URL "https://tadah.rocks" #define DISCORD_APP_ID 923705431543668736 @@ -16,16 +17,16 @@ #define CLASSPADDING_DATAMODEL__JOBID 739 -#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0 -#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0 -#define ADDRESS_SERVERREPLICATOR__SENDTOP 0x00513E80 -#define ADDRESS_SERVERREPLICATOR__PROCESSTICKET 0x00514B60 -#define ADDRESS_SERVERREPLICATOR__PROCESSPACKET 0x0 -#define ADDRESS_GAME__CONSTRUCT 0x0 #define ADDRESS_HTTP__HTTPGETPOSTWININET 0x0 #define ADDRESS_HTTP__TRUSTCHECK 0x005B7050 +#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0 #define ADDRESS_CONTEXT__REQUIREPERMISSION 0x0 #define ADDRESS_CONTEXT__ISINROLE 0x0 +#define ADDRESS_DATAMODEL__GETJOBID 0x005E70C0 +#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0 +#define ADDRESS_SERVERREPLICATOR__SENDTOP 0x00513E80 +#define ADDRESS_SERVERREPLICATOR__PROCESSTICKET 0x00514B60 +#define ADDRESS_SERVERREPLICATOR__PROCESSPACKET 0x00514B60 #define CLASSLOCATION_CROBLOXAPP 0x00CBA8A0 #define CLASSLOCATION_CAPP 0x00406D80 @@ -44,4 +45,9 @@ #define PADDING_STRUCT 1 #else #define PADDING_STRUCT 0 -#endif \ No newline at end of file +#endif + +#define RBX__MESSAGE_INFO 0 +#define RBX__MESSAGE_OUTPUT 1 +#define RBX__MESSAGE_WARNING 2 +#define RBX__MESSAGE_ERROR 3 \ No newline at end of file diff --git a/Tadah.DLL/Include/Discord.h b/Tadah.DLL/Include/Discord.h index 636dcea..f80ad30 100644 --- a/Tadah.DLL/Include/Discord.h +++ b/Tadah.DLL/Include/Discord.h @@ -10,8 +10,12 @@ #ifndef SERVER -void InitializeDiscord(); -void UpdatePresence(); -void CleanupDiscord(); +class Discord { +public: + static void Initialize(std::string joinScriptUrl); + static void Cleanup(); +private: + static void Update(); +}; #endif \ No newline at end of file diff --git a/Tadah.DLL/Include/Hooks/CRoblox.h b/Tadah.DLL/Include/Hooks/CRoblox.h index 6b4eabf..7967f06 100644 --- a/Tadah.DLL/Include/Hooks/CRoblox.h +++ b/Tadah.DLL/Include/Hooks/CRoblox.h @@ -4,6 +4,7 @@ #include "Configuration.h" #include "Helpers.h" +#include "Discord.h" class CWorkspace; @@ -42,4 +43,5 @@ void __fastcall CRobloxCommandLineInfo__ParseParam_hook(CRobloxCommandLineInfo* extern CRobloxApp__InitInstance_t CRobloxApp__InitInstance; extern CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam; -extern std::string ticket; \ No newline at end of file +extern std::wstring jobId; +extern bool hasJobIdArg; \ No newline at end of file diff --git a/Tadah.DLL/Include/Hooks/DataModel.h b/Tadah.DLL/Include/Hooks/DataModel.h new file mode 100644 index 0000000..208d347 --- /dev/null +++ b/Tadah.DLL/Include/Hooks/DataModel.h @@ -0,0 +1,20 @@ +#pragma once + +#include "Helpers.h" +#include "Configuration.h" + +#include "Hooks/CRoblox.h" + +#ifdef SERVER + +struct DataModel +{ + void* padding1[CLASSPADDING_DATAMODEL__JOBID]; + std::string jobId; +}; + +typedef INT(__thiscall* DataModel__getJobId_t)(DataModel* _this, int a2); +int __fastcall DataModel__getJobId_hook(DataModel* _this, void*, int a2); +extern DataModel__getJobId_t DataModel__getJobId; + +#endif \ No newline at end of file diff --git a/Tadah.DLL/Include/Hooks/ServerReplicator.h b/Tadah.DLL/Include/Hooks/ServerReplicator.h index cdd9ca9..ab15b3c 100644 --- a/Tadah.DLL/Include/Hooks/ServerReplicator.h +++ b/Tadah.DLL/Include/Hooks/ServerReplicator.h @@ -12,7 +12,6 @@ struct Packet unsigned char* data; }; -struct ConcurrentRakPeer {}; struct RakPeerInterface {}; struct ServerReplicator diff --git a/Tadah.DLL/Include/Hooks/StandardOut.h b/Tadah.DLL/Include/Hooks/StandardOut.h index 8990b17..7f7a2ef 100644 --- a/Tadah.DLL/Include/Hooks/StandardOut.h +++ b/Tadah.DLL/Include/Hooks/StandardOut.h @@ -3,24 +3,12 @@ #include "Configuration.h" #include "Patches.h" #include "Helpers.h" +#include "Server.h" #ifdef SERVER -void InitializeOutput(); - typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string* message); void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message); extern StandardOut__print_t StandardOut__print; -extern std::string httpLogPath; -extern std::string stdoutLogPath; - -extern std::ofstream httpLog; -extern std::ofstream stdoutLog; - -#define RBX__MESSAGE_INFO 0 -#define RBX__MESSAGE_OUTPUT 1 -#define RBX__MESSAGE_WARNING 2 -#define RBX__MESSAGE_ERROR 3 - #endif \ No newline at end of file diff --git a/Tadah.DLL/Include/Server.h b/Tadah.DLL/Include/Server.h new file mode 100644 index 0000000..3f01545 --- /dev/null +++ b/Tadah.DLL/Include/Server.h @@ -0,0 +1,42 @@ +#pragma once + +#include "Configuration.h" +#include "Helpers.h" + +#include "Hooks/StandardOut.h" + +#ifdef SERVER + +enum class RequestType { + POST, + GET +}; + +enum class LogSeverity { + Information = RBX__MESSAGE_INFO, + Output = RBX__MESSAGE_OUTPUT, + Warning = RBX__MESSAGE_WARNING, + Error = RBX__MESSAGE_ERROR +}; + +class Server { +public: + static HANDLE Handle; + + static void Initialize(const std::wstring jobId); + static void Cleanup(); + + struct Log + { + static void Http(const RequestType type, const std::string message); + static void Output(const LogSeverity severity, const std::string message); + }; +private: + static std::string HttpLogPath; + static std::string OutputLogPath; + + static std::ofstream HttpLog; + static std::ofstream OutputLog; +}; + +#endif \ No newline at end of file diff --git a/Tadah.DLL/Server.cpp b/Tadah.DLL/Server.cpp new file mode 100644 index 0000000..34e312c --- /dev/null +++ b/Tadah.DLL/Server.cpp @@ -0,0 +1,99 @@ +#include "pch.h" + +#include "Server.h" + +#ifdef SERVER + +HANDLE Server::Handle; + +std::ofstream Server::OutputLog; +std::ofstream Server::HttpLog; + +std::string Server::OutputLogPath; +std::string Server::HttpLogPath; + +void Server::Initialize(const std::wstring jobId) +{ + std::string _jobId = Helpers::ws2s(jobId); + std::string signature = "Tadah.DLL v1.0.0"; + +#ifdef _DEBUG + signature += " (compiled as Debug)"; +#endif + + AllocConsole(); + freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); + Server::Handle = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + SetStdHandle(STD_OUTPUT_HANDLE, Server::Handle); + + printf((signature + "\n\n").c_str()); + + // Initialize file logging + fs::create_directory(fs::path(Helpers::getModulePath()).parent_path() / "logs"); + + OutputLogPath = (fs::path(Helpers::getModulePath()).parent_path() / "logs" / (_jobId + "-Output.log")).string(); + HttpLogPath = (fs::path(Helpers::getModulePath()).parent_path() / "logs" / (_jobId + "-Http.log")).string(); + + OutputLog.open(OutputLogPath, std::ios::out); + HttpLog.open(HttpLogPath, std::ios::out); + + OutputLog << signature << " - StandardOut" << std::endl << std::endl; + HttpLog << signature << " - Http" << std::endl << std::endl; + + OutputLog.close(); + HttpLog.close(); +} + +void Server::Log::Output(const LogSeverity severity, const std::string message) +{ + std::string type; + std::string time = Helpers::getISOTimestamp(); + + switch (severity) + { + case LogSeverity::Output: + SetConsoleTextAttribute(Server::Handle, FOREGROUND_BLUE | FOREGROUND_INTENSITY); + type = "out"; + break; + case LogSeverity::Information: + SetConsoleTextAttribute(Server::Handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + type = "info"; + break; + case LogSeverity::Warning: + SetConsoleTextAttribute(Server::Handle, FOREGROUND_RED | FOREGROUND_GREEN); + type = "warn"; + break; + case LogSeverity::Error: + type = "err"; + SetConsoleTextAttribute(Server::Handle, FOREGROUND_RED | FOREGROUND_INTENSITY); + break; + } + + printf("%s\n", message.c_str()); + SetConsoleTextAttribute(Server::Handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + + OutputLog.open(OutputLogPath, std::ios::out); + OutputLog << "[" << time << "] [" << type << "] " << message << std::endl; + OutputLog.close(); +} + +void Server::Log::Http(const RequestType request, const std::string url) +{ + std::string type; + std::string time = Helpers::getISOTimestamp(); + + type = (request == RequestType::GET ? "GET" : "POST"); + + HttpLog.open(HttpLogPath, std::ios::out); + HttpLog << "[" << time << "] [" << type << "] " << "'" << url << "'" << std::endl; + HttpLog.close(); +} + +void Server::Cleanup() +{ + CloseHandle(Server::Handle); + OutputLog.close(); + HttpLog.close(); +} + +#endif \ No newline at end of file diff --git a/Tadah.DLL/Tadah.DLL.vcxproj b/Tadah.DLL/Tadah.DLL.vcxproj index 80ad13a..4b38334 100644 --- a/Tadah.DLL/Tadah.DLL.vcxproj +++ b/Tadah.DLL/Tadah.DLL.vcxproj @@ -127,9 +127,11 @@ + + @@ -141,6 +143,8 @@ + + Create diff --git a/Tadah.DLL/Tadah.DLL.vcxproj.filters b/Tadah.DLL/Tadah.DLL.vcxproj.filters index 664b20d..addb0fb 100644 --- a/Tadah.DLL/Tadah.DLL.vcxproj.filters +++ b/Tadah.DLL/Tadah.DLL.vcxproj.filters @@ -27,9 +27,6 @@ Header Files - - Header Files - Header Files @@ -57,6 +54,15 @@ Header Files + + Header Files + + + Header Files\Hooks + + + Header Files + @@ -92,6 +98,12 @@ Source Files + + Source Files + + + Source Files\Hooks + diff --git a/Tadah.DLL/dllmain.cpp b/Tadah.DLL/dllmain.cpp index 1e7ed04..956bc44 100644 --- a/Tadah.DLL/dllmain.cpp +++ b/Tadah.DLL/dllmain.cpp @@ -1,4 +1,5 @@ #include "pch.h" + #include "Configuration.h" #include "Patches.h" @@ -6,20 +7,24 @@ #include "Discord.h" #endif +#ifdef SERVER +#include "Server.h" +#endif + #include "Hooks/Http.h" #include "Hooks/Crypt.h" +#include "Hooks/CRoblox.h" #ifdef _DEBUG #include "Hooks/Context.h" #endif #ifdef SERVER +#include "Hooks/DataModel.h" #include "Hooks/StandardOut.h" #include "Hooks/ServerReplicator.h" #endif -#include "Hooks/CRoblox.h" - START_PATCH_LIST() ADD_PATCH(Http__httpGetPostWinInet, Http__httpGetPostWinInet_hook) @@ -27,28 +32,22 @@ ADD_PATCH(Http__trustCheck, Http__trustCheck_hook) ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook) +ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook) +ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook) + #ifdef _DEBUG ADD_PATCH(Context__requirePermission, Context__requirePermission_hook) #endif #ifdef SERVER -ADD_PATCH(StandardOut__print, StandardOut__print_hook) -#endif +ADD_PATCH(DataModel__getJobId, DataModel__getJobId_hook) + +ADD_PATCH(StandardOut__print, StandardOut__print_hook) -#if defined(SERVER) && defined(MFC2011) ADD_PATCH(ServerReplicator__sendTop, ServerReplicator__sendTop_hook) ADD_PATCH(ServerReplicator__processTicket, ServerReplicator__processTicket_hook) #endif -#if defined(SERVER) && defined(PLAYER2012) -ADD_PATCH(Application__ParseArguments, Application__ParseArguments_hook) -#endif - -#if defined(MFC2010) || defined(MFC2011) -ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook) -ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook) -#endif - END_PATCH_LIST() void __declspec(dllexport) import() {} @@ -57,10 +56,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { -#ifdef SERVER - InitializeOutput(); -#endif - LONG patchesError = Patches::Apply(); if (patchesError != NO_ERROR) { @@ -82,10 +77,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv ExitProcess(EXIT_FAILURE); } - -#ifndef SERVER - InitializeDiscord(); -#endif } if (ul_reason_for_call == DLL_PROCESS_DETACH) @@ -93,7 +84,14 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv curl_global_cleanup(); #ifndef SERVER - CleanupDiscord(); + Discord::Cleanup(); +#endif + +#ifdef SERVER + if (Server::Handle) + { + Server::Cleanup(); + } #endif }