-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't clear password when logging in, don't login through std::async,…
… connect CSO2MsgHandler in tierextra
- Loading branch information
Ochii
committed
Feb 23, 2019
1 parent
a9ba0e6
commit 3fce187
Showing
6 changed files
with
60 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,41 @@ | ||
#include "stdafx.hpp" | ||
#include <future> | ||
|
||
#include "hooks.hpp" | ||
|
||
#include "engine/cso2/icso2msgmanager.h" | ||
#include "tier0/ICommandLine.h" | ||
|
||
static std::unique_ptr<PLH::x86Detour> g_pInitUIHook; | ||
static uint64_t g_InitUIOrig = NULL; | ||
|
||
class ICSO2LoginManager | ||
{ | ||
public: | ||
virtual void sub_1028465() = 0; | ||
virtual void sub_10286160() = 0; | ||
virtual bool Login(const char *UserName, const char *Password, const char *a4, const char *a5, const char *a6) = 0; | ||
}; | ||
|
||
extern ICSO2LoginManager *g_pCSO2LoginManager; | ||
|
||
NOINLINE bool __fastcall hkCSO2UIManager_InitMainUI(void* ecx, void* edx) | ||
NOINLINE bool __fastcall hkCSO2UIManager_InitMainUI( void* ecx, void* edx ) | ||
{ | ||
std::async(std::launch::async, []() { | ||
// Delay 1s after ui loaded to avoid crash | ||
std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
|
||
const char* szUsername = CommandLine()->ParmValue("-username"); | ||
const char* szPassword = CommandLine()->ParmValue("-password"); | ||
|
||
if (szUsername && szPassword) | ||
{ | ||
std::string Username(szUsername); | ||
std::string Password(szPassword); | ||
|
||
while (Username.size() > 16) | ||
Username.pop_back(); | ||
|
||
while (Password.size() > 4) | ||
Password.pop_back(); | ||
const char* szUsername = CommandLine()->ParmValue( "-username" ); | ||
const char* szPassword = CommandLine()->ParmValue( "-password" ); | ||
|
||
g_pCSO2LoginManager->Login(strdup(Username.c_str()), strdup(Password.c_str()), "", "", ""); | ||
} | ||
}); | ||
if ( szUsername && szPassword ) | ||
{ | ||
g_pCSO2MsgHandler->Login( szUsername, szPassword, szUsername ); | ||
} | ||
|
||
return PLH::FnCast(g_InitUIOrig, &hkCSO2UIManager_InitMainUI)(ecx, edx); | ||
return PLH::FnCast( g_InitUIOrig, &hkCSO2UIManager_InitMainUI )( ecx, edx ); | ||
} | ||
|
||
void OnClientLoaded(const uintptr_t dwClientBase) | ||
void OnClientLoaded( const uintptr_t dwClientBase ) | ||
{ | ||
static bool bHasLoaded = false; | ||
static bool bHasLoaded = false; | ||
|
||
if (bHasLoaded) | ||
{ | ||
return; | ||
} | ||
if ( bHasLoaded ) | ||
{ | ||
return; | ||
} | ||
|
||
bHasLoaded = true; | ||
bHasLoaded = true; | ||
|
||
PLH::CapstoneDisassembler dis(PLH::Mode::x86); | ||
PLH::CapstoneDisassembler dis( PLH::Mode::x86 ); | ||
|
||
g_pInitUIHook = SetupDetourHook( | ||
dwClientBase + 0xAE4610, &hkCSO2UIManager_InitMainUI, &g_InitUIOrig, dis); | ||
g_pInitUIHook->hook(); | ||
g_pInitUIHook = | ||
SetupDetourHook( dwClientBase + 0xAE4610, &hkCSO2UIManager_InitMainUI, | ||
&g_InitUIOrig, dis ); | ||
g_pInitUIHook->hook(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3.2 | ||
0.4.0 |