Files
DepotDownloaderMod/NetHook/clientapp.cpp
Ryan Stecker eef3bdd852 --HG--
extra : convert_revision : svn%3A946a0da7-ebce-4904-9acb-2f1e67aed693%4011
2010-08-10 03:10:34 +00:00

77 lines
1.3 KiB
C++

#include <winsock2.h>
#include <windows.h>
#include "clientapp.h"
#include "logger.h"
#include "udpconnection.h"
#include "wshooks.h"
#include "crypto.h"
#include "msgmanager.h"
// define our clientapp entry point
CLIENTAPP( main );
CLogger *g_Logger = NULL;
CUDPConnection *g_udpConnection = NULL;
CMsgManager *g_MsgManager = NULL;
int main( int argc, char **argv )
{
AllocConsole();
g_Logger = new CLogger( argv[ 0 ] );
g_MsgManager = new CMsgManager();
g_udpConnection = new CUDPConnection();
Detour_WSAStartup->Attach();
// load the real client app
HMODULE steamUI = LoadLibrary( "SteamUI.dll" );
if ( !steamUI )
{
MessageBox( HWND_DESKTOP, "Unable to load SteamUI.", "Oops!", MB_OK );
return -1;
}
SteamDllMainFn realSteamMain = ( SteamDllMainFn )GetProcAddress( steamUI, "SteamDllMain" );
if ( !realSteamMain )
{
MessageBox( HWND_DESKTOP, "Unable to find Steam entrypoint.", "Oops!", MB_OK );
return -1;
}
int ret = realSteamMain( argc, argv );
FreeLibrary( steamUI );
// udp
Detour_recvfrom->Detach();
Detour_WSASendTo->Detach();
// tcp
Detour_WSARecv->Detach();
Detour_WSASend->Detach();
Detour_WSAStartup->Detach();
delete g_Crypto; // cleanup crypto hooks
delete g_udpConnection;
delete g_Logger;
return ret;
}