├── LoLAdvanced ├── StdAfx.cpp ├── ObjectManager.cpp ├── NetApp.cpp ├── Detours.hpp ├── Detours.cpp ├── Automate.hpp ├── StdAfx.hpp ├── Entry.cpp ├── Core.hpp ├── ObjectManager.hpp ├── Unit.cpp ├── NetApp.hpp ├── Memory.hpp ├── Core.cpp ├── LoLPtrs.hpp ├── Unit.hpp ├── Automate.cpp ├── LoLAdvanced.vcxproj └── Memory.cpp ├── LoLAdvanced.sln └── LoL!Loader ├── Entry.cpp └── LoL!Loader.vcxproj /LoLAdvanced/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" -------------------------------------------------------------------------------- /LoLAdvanced/ObjectManager.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" -------------------------------------------------------------------------------- /LoLAdvanced/NetApp.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | #include "NetApp.hpp" -------------------------------------------------------------------------------- /LoLAdvanced/Detours.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern void __fastcall New_Game_Loop( void ); 4 | -------------------------------------------------------------------------------- /LoLAdvanced/Detours.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | 3 | void __fastcall New_Game_Loop( void ) 4 | { 5 | CCore::s_lpcCore->GameLoop( ); 6 | Game_Loop( ); 7 | return; 8 | } -------------------------------------------------------------------------------- /LoLAdvanced/Automate.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class CAutomate 7 | { 8 | public: 9 | CAutomate( void ); 10 | ~CAutomate( void ); 11 | 12 | void OnGameLoop( void ); 13 | 14 | private: 15 | DWORD m_dwLastBestTick; 16 | DWORD m_dwLastCheck; 17 | bool m_bInUse; 18 | std::map> m_cUnitHealth; 19 | }; -------------------------------------------------------------------------------- /LoLAdvanced/StdAfx.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define _CRT_NON_CONFORMING_SWPRINTFS 5 | #define _CRT_SECURE_NO_WARNINGS 6 | #include 7 | #include 8 | #include 9 | 10 | #define DPRINT __noop 11 | 12 | #include "Memory.hpp" 13 | #include "Automate.hpp" 14 | #include "Core.hpp" 15 | #include "LoLPtrs.hpp" 16 | #include "Detours.hpp" -------------------------------------------------------------------------------- /LoLAdvanced/Entry.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | 3 | DWORD WINAPI DllMain( HMODULE hModule, DWORD dwReason, void* lpReserved ) 4 | { 5 | if( dwReason == DLL_PROCESS_ATTACH ) 6 | { 7 | CCore::s_lpcCore = new CCore( hModule ); 8 | return !!CCore::s_lpcCore->Initialize( ); 9 | } 10 | else if( dwReason == DLL_PROCESS_DETACH ) 11 | { 12 | delete CCore::s_lpcCore; 13 | } 14 | return TRUE; 15 | } -------------------------------------------------------------------------------- /LoLAdvanced/Core.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CCore 6 | { 7 | public: 8 | CCore( HMODULE hModule ); 9 | ~CCore( void ); 10 | 11 | bool Initialize( void ); 12 | void GameLoop( void ); 13 | void Print( std::string szOutput ); 14 | 15 | static CCore* s_lpcCore; 16 | 17 | CAutomate m_cAutomate; 18 | 19 | private: 20 | HMODULE m_hModule; 21 | HWND m_hWnd; 22 | CMemory m_cMemory; 23 | 24 | bool m_bFirstLoop; 25 | 26 | friend class CAutomate; 27 | }; -------------------------------------------------------------------------------- /LoLAdvanced/ObjectManager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Unit; 4 | 5 | class ObjectManager 6 | { 7 | public: 8 | inline Unit** GetFirst( void ) { return m_lpcUnits; } 9 | inline DWORD GetMaxObjects( void ) { return m_dwMaxObjects; } 10 | inline DWORD GetObjects( void ) { return m_dwObjects; } 11 | inline Unit** GetEnd( void ) { return m_lpcUnits + m_dwEnd; } 12 | 13 | private: 14 | /* 0x00 */ Unit** m_lpcUnits; 15 | /* 0x04 */ DWORD m_dwMaxObjects; 16 | /* 0x08 */ DWORD m_dwObjects; 17 | /* 0x0C */ DWORD m_dwEnd; 18 | }; -------------------------------------------------------------------------------- /LoLAdvanced/Unit.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | #include "Unit.hpp" 3 | 4 | float 5 | Unit::CalcDistance( Unit* lpcUnitA, Unit* lpcUnitB ) 6 | { 7 | float* lpfPosA = lpcUnitA->GetPos( ); 8 | float* lpfPosB = lpcUnitB->GetPos( ); 9 | 10 | return sqrt( pow( lpfPosA[ 0 ] - lpfPosB[ 0 ], 2 ) + pow( lpfPosA[ 1 ] - lpfPosB[ 1 ], 2 ) ); 11 | } 12 | 13 | Unit* 14 | Unit::GetUnitByNetworkId( DWORD dwNetworkId ) 15 | { 16 | return Unit_GetUnitByNetworkId( dwNetworkId ); 17 | } 18 | 19 | Unit* 20 | Unit::GetPlayerToon( void ) 21 | { 22 | return *g_lpcLocalPlayer; 23 | } -------------------------------------------------------------------------------- /LoLAdvanced/NetApp.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace NetApp 4 | { 5 | class ClientFacade 6 | { 7 | public: 8 | virtual void Function0( void ) = 0; // +00 9 | virtual void Function1( void ) = 0; // +04 10 | virtual void Function2( void ) = 0; // +08 11 | virtual void Function3( void ) = 0; // +0C 12 | virtual void Function4( void ) = 0; // +10 13 | virtual void Function5( void ) = 0; // +14 14 | virtual void Function6( void ) = 0; // +18 15 | virtual void Function7( void ) = 0; // +1C 16 | virtual void Function8( void ) = 0; // +20 17 | virtual void Function9( void ) = 0; // +24 18 | virtual void Function10( void ) = 0; // +28 19 | virtual void Function11( void ) = 0; // +2C 20 | virtual void SendPacket( DWORD dwArg0, BYTE* lpyPacket, DWORD dwArg1, DWORD dwArg2 ) = 0; // +30 21 | 22 | private: 23 | }; 24 | }; -------------------------------------------------------------------------------- /LoLAdvanced/Memory.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CMemory 4 | { 5 | public: 6 | CMemory( void ); 7 | ~CMemory( void ); 8 | 9 | enum EPatchType 10 | { 11 | Jump, 12 | Call, 13 | VMT, 14 | Inline, 15 | }; 16 | 17 | template T Patch( EPatchType eType, DWORD dwAddress, DWORD dwDetour, DWORD dwLength = 0 ) 18 | { 19 | return (T) _Patch( eType, dwAddress, dwDetour, dwLength ); 20 | } 21 | DWORD ComputeLength( DWORD dwAddress ); 22 | 23 | private: 24 | static DWORD __cdecl _mlde32( DWORD dwAddress ); 25 | DWORD _Patch( EPatchType eType, DWORD dwAddress, DWORD dwDetour, DWORD dwLength ); 26 | 27 | struct SPatch 28 | { 29 | SPatch* lpsPrev; 30 | SPatch* lpsNext; 31 | EPatchType eType; 32 | DWORD dwAddress; 33 | DWORD dwLength; 34 | BYTE yBackup[ 64 ]; 35 | DWORD dwTrampolin; 36 | }; 37 | 38 | enum EOpCodes : BYTE 39 | { 40 | OpNop = 0x90, 41 | OpJmp = 0xE9, 42 | OpCall = 0xE8, 43 | }; 44 | 45 | SPatch* m_lpsFirstPatch; 46 | SPatch* m_lpsLastPatch; 47 | }; -------------------------------------------------------------------------------- /LoLAdvanced/Core.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | 3 | CCore* CCore::s_lpcCore; 4 | 5 | CCore::CCore( HMODULE hModule ) 6 | : m_hModule( hModule ), m_bFirstLoop( true ) 7 | { 8 | } 9 | 10 | CCore::~CCore( void ) 11 | { 12 | } 13 | 14 | bool 15 | CCore::Initialize( void ) 16 | { 17 | m_hWnd = FindWindow( NULL, L"League of Legends (TM) Client" ); 18 | 19 | Game_Loop = m_cMemory.Patch( CMemory::Call, (DWORD) Game_Loop, (DWORD) New_Game_Loop ); 20 | 21 | // DebugCircleManager::GetSingleton( )->AddDebugCircle( Unit::GetPlayerToon( ), 10.0f, 0xAAAAAAAA ); 22 | 23 | return true; 24 | } 25 | 26 | void 27 | CCore::GameLoop( void ) 28 | { 29 | if( m_bFirstLoop == true && (* reinterpret_cast( g_dwPrintArgument) ) != NULL ) 30 | { 31 | // This should probably be moved into a header somewhere that is tapped like ass every build 32 | Print("LoL!Advanced 20110412 loaded"); 33 | m_bFirstLoop = false; 34 | } 35 | 36 | m_cAutomate.OnGameLoop( ); 37 | } 38 | 39 | void 40 | CCore::Print( std::string szOutput ) { 41 | Print_Console( const_cast< char* >( szOutput.c_str( ) ), g_dwPrintArgument, false, false ); 42 | } -------------------------------------------------------------------------------- /LoLAdvanced/LoLPtrs.hpp: -------------------------------------------------------------------------------- 1 | #include "ObjectManager.hpp" 2 | #include "Unit.hpp" 3 | #include "NetApp.hpp" 4 | 5 | #if defined( _DEFINE_PTRS ) 6 | 7 | #define MakeVar( x, y, z ) x y = (x) z; 8 | #define MakeFnc( ret, call, param, name, offset ) \ 9 | name##_t name = (##name##_t) offset; 10 | #define MakeAsm( x, y ) DWORD x = (DWORD) y; 11 | 12 | #else 13 | 14 | #define MakeVar( x, y, z ) extern x y; 15 | #define MakeFnc( ret, call, param, name, offset ) \ 16 | typedef ret##(##call##*##name##_t)##param##; \ 17 | extern name##_t name; 18 | #define MakeAsm( x, y ) extern DWORD x; 19 | 20 | #endif 21 | 22 | // Variables 23 | MakeVar( ObjectManager*, g_lpcUnitManager, 0x2B2C11C ) 24 | MakeVar( Unit**, g_lpcLocalPlayer, 0x009F73EC ) 25 | MakeVar( DWORD, g_dwPrintArgument, 0x2AA5288 ) 26 | 27 | // Function Pointers 28 | MakeFnc( void, __fastcall, ( void ), Game_Loop, 0x0075390E ) 29 | MakeFnc( void, __thiscall, ( Unit* _this, DWORD dwActionType, float* lpfPos, Unit* lpcTarget, DWORD dwArg4, DWORD dwArg5, bool bUnk ), Unit_IssueOrder, 0x006EBC80 ) 30 | MakeFnc( Unit*, __cdecl, ( DWORD dwNetworkId ), Unit_GetUnitByNetworkId, 0x81ACF0 ) 31 | MakeFnc( int, __fastcall, ( char* szText, DWORD dwArgument, bool bUnk1, bool bUnk2 ), Print_Console, 0x7A1950 ) 32 | 33 | #undef MakeFnc 34 | #undef MakeVar 35 | #undef MakeAsm 36 | -------------------------------------------------------------------------------- /LoLAdvanced.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoLAdvanced", "LoLAdvanced\LoLAdvanced.vcxproj", "{AAFE4B78-477F-41B1-8421-CC26DB70015C}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoL!Loader", "LoL!Loader\LoL!Loader.vcxproj", "{728C1D88-9BDE-41B2-8D4A-2EE697B69C69}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {AAFE4B78-477F-41B1-8421-CC26DB70015C}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {AAFE4B78-477F-41B1-8421-CC26DB70015C}.Debug|Win32.Build.0 = Debug|Win32 16 | {AAFE4B78-477F-41B1-8421-CC26DB70015C}.Release|Win32.ActiveCfg = Release|Win32 17 | {AAFE4B78-477F-41B1-8421-CC26DB70015C}.Release|Win32.Build.0 = Release|Win32 18 | {728C1D88-9BDE-41B2-8D4A-2EE697B69C69}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {728C1D88-9BDE-41B2-8D4A-2EE697B69C69}.Debug|Win32.Build.0 = Debug|Win32 20 | {728C1D88-9BDE-41B2-8D4A-2EE697B69C69}.Release|Win32.ActiveCfg = Release|Win32 21 | {728C1D88-9BDE-41B2-8D4A-2EE697B69C69}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /LoL!Loader/Entry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) 4 | { 5 | HWND hWnd = FindWindow( NULL, L"League of Legends (TM) Client" ); 6 | DWORD dwPid; 7 | HANDLE hHandle; 8 | void* lpRemoteString; 9 | 10 | wchar_t szPath[ MAX_PATH ]; 11 | 12 | if( hWnd == NULL ) 13 | { 14 | MessageBox( NULL, L"Couldn't find League of Legends window!", NULL, MB_OK ); 15 | return 1; 16 | } 17 | 18 | GetWindowThreadProcessId( hWnd, &dwPid ); 19 | hHandle = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dwPid ); 20 | 21 | lpRemoteString = VirtualAllocEx( hHandle, NULL, MAX_PATH, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE ); 22 | GetCurrentDirectory( sizeof( szPath ), szPath ); 23 | wcscat_s( szPath, L"\\LoLAdvanced.dll" ); 24 | 25 | WriteProcessMemory( hHandle, lpRemoteString, (void*)szPath, sizeof( szPath ) * 2, NULL ); 26 | 27 | MessageBox( NULL, szPath, L"Press OK to inject", MB_OK ); 28 | 29 | HANDLE hThread = CreateRemoteThread( hHandle, NULL, 0, (LPTHREAD_START_ROUTINE) LoadLibraryW, lpRemoteString, 0, NULL ); 30 | 31 | WaitForSingleObject( hThread, INFINITE ); 32 | 33 | DWORD dwModule; 34 | GetExitCodeThread( hThread, &dwModule ); 35 | 36 | CloseHandle( hThread); 37 | 38 | VirtualFreeEx( hHandle, lpRemoteString, 0, MEM_FREE ); 39 | 40 | MessageBox( NULL, szPath, L"Press OK to unload!", MB_OK ); 41 | 42 | hThread = CreateRemoteThread( hHandle, NULL, 0, (LPTHREAD_START_ROUTINE) FreeLibrary, (void*) dwModule, 0, NULL ); 43 | WaitForSingleObject( hThread, INFINITE ); 44 | CloseHandle( hThread); 45 | 46 | CloseHandle( hHandle ); 47 | 48 | return 0; 49 | } -------------------------------------------------------------------------------- /LoLAdvanced/Unit.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Unit 4 | { 5 | public: 6 | inline bool IsDead( void ) { return m_yDead == 1; } 7 | inline DWORD GetTeam( void ) { return m_dwTeam; } 8 | inline char* GetName( void ) { return m_lpszName; } 9 | inline float* GetPos( void ) { return m_fPos; } 10 | inline float GetMissChance( void ) { return m_fMissChance; } 11 | inline DWORD GetNetworkId( void ) { return m_dwNetworkId; } 12 | inline float GetHealth( void ) { return m_fHealth; } 13 | inline float GetMana( void ) { return m_fMana; } 14 | inline float GetRange( void ) { return m_fRange; } 15 | inline float GetBaseDamage( void ) { return m_fBaseDamage; } 16 | inline float GetAdditionDamage( void ) { return m_fAddedDamage; } 17 | inline float GetTotalDamage( void ) { return m_fBaseDamage + m_fAddedDamage; } 18 | 19 | static float CalcDistance( Unit* lpcUnitA, Unit* lpcUnitB ); 20 | static Unit* GetUnitByNetworkId( DWORD dwNetworkId ); 21 | static Unit* GetPlayerToon( void ); 22 | 23 | private: 24 | /* 0x0000 */ BYTE _00[ 0x12 ]; 25 | /* 0x0012 */ BYTE m_yDead; 26 | /* 0x0013 */ BYTE _13[ 0x09 ]; 27 | /* 0x001C */ DWORD m_dwTeam; 28 | /* 0x0020 */ BYTE _20[ 0x08 ]; 29 | /* 0x0028 */ char* m_lpszName; 30 | /* 0x002C */ BYTE _2C[ 0x30 ]; 31 | /* 0x005C */ float m_fPos[ 3 ]; 32 | /* 0x0068 */ BYTE _68[ 0x88 ]; 33 | /* 0x00F0 */ float m_fMissChance; 34 | /* 0x00F4 */ BYTE _F4[ 0x04 ]; 35 | /* 0x00F8 */ DWORD m_dwNetworkId; 36 | /* 0x00FC */ BYTE _FC[ 0x20 ]; 37 | /* 0x011C */ float m_fHealth; 38 | /* 0x0120 */ BYTE _120[ 0x44 ]; 39 | /* 0x0164 */ float m_fMana; 40 | /* 0x0168 */ BYTE _168[ 0x8D8 ]; 41 | /* 0x0A40 */ float m_fAddedDamage; 42 | /* 0x0A44 */ BYTE _A44[ 0x60 ]; 43 | /* 0x0AA4 */ float m_fBaseDamage; 44 | /* 0x0AA8 */ BYTE _AA8[ 0x40 ]; 45 | /* 0x0AE8 */ float m_fRange; 46 | }; -------------------------------------------------------------------------------- /LoL!Loader/LoL!Loader.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {728C1D88-9BDE-41B2-8D4A-2EE697B69C69} 15 | Win32Proj 16 | LoLLoader 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 53 | 54 | 55 | Windows 56 | true 57 | 58 | 59 | 60 | 61 | Level3 62 | 63 | 64 | MaxSpeed 65 | true 66 | true 67 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 68 | MultiThreaded 69 | 70 | 71 | Windows 72 | false 73 | true 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /LoLAdvanced/Automate.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | 3 | CAutomate::CAutomate( void ) 4 | { 5 | m_dwLastBestTick = 0; 6 | m_dwLastCheck = 0; 7 | m_bInUse = false; 8 | m_cUnitHealth.clear( ); 9 | } 10 | 11 | CAutomate::~CAutomate( void ) 12 | { 13 | } 14 | 15 | void 16 | CAutomate::OnGameLoop( void ) 17 | { 18 | DWORD dwCurrentTickCount = GetTickCount( ); 19 | 20 | if( dwCurrentTickCount - m_dwLastCheck >= 100 ) 21 | { 22 | if( GetAsyncKeyState( VK_MENU ) & 0x8000 && dwCurrentTickCount - m_dwLastBestTick >= 450 && GetForegroundWindow( ) == CCore::s_lpcCore->m_hWnd ) 23 | { 24 | Unit* lpcPlayer = *g_lpcLocalPlayer; 25 | 26 | 27 | if( m_bInUse == false ) 28 | { 29 | #ifdef _DEBUG 30 | OutputDebugStringA("Toggled On\n"); 31 | #endif//_DEBUG 32 | CCore::s_lpcCore->Print("Last Hit Bot is now Activated"); 33 | m_bInUse = true; 34 | } 35 | 36 | 37 | Unit* lpcBestUnit = NULL; 38 | 39 | for( Unit** lpcIterator = (*g_lpcUnitManager).GetFirst( ); lpcIterator != (*g_lpcUnitManager).GetEnd( ); lpcIterator++ ) 40 | { 41 | if( (*lpcIterator) == NULL || lpcPlayer == NULL ) 42 | { 43 | continue; 44 | } 45 | 46 | if( (*lpcIterator)->GetTeam( ) == lpcPlayer->GetTeam( ) ) 47 | { 48 | continue; 49 | } 50 | 51 | if( (*lpcIterator)->IsDead( ) == true ) 52 | { 53 | continue; 54 | } 55 | 56 | if( memcmp( (*lpcIterator)->GetName( ), "Minion_", 7 ) ) 57 | { 58 | continue; 59 | } 60 | 61 | if( Unit::CalcDistance( lpcPlayer, *lpcIterator ) > lpcPlayer->GetRange( ) ) 62 | { 63 | continue; 64 | } 65 | 66 | if( m_cUnitHealth.find( (*lpcIterator)->GetNetworkId( ) ) != m_cUnitHealth.end( ) ) 67 | { 68 | float fDmgDealt = m_cUnitHealth[ (*lpcIterator)->GetNetworkId( ) ].front() - m_cUnitHealth[ (*lpcIterator)->GetNetworkId( ) ].back(); 69 | 70 | if( (*lpcIterator)->GetHealth( ) - ( fDmgDealt / 1.5f + lpcPlayer->GetTotalDamage( ) ) <= 5.0f ) 71 | { 72 | lpcBestUnit = *lpcIterator; 73 | break; 74 | } 75 | } 76 | else if( lpcPlayer->GetTotalDamage( ) * 2.0f >= (*lpcIterator)->GetHealth( ) ) 77 | { 78 | lpcBestUnit = *lpcIterator; 79 | break; 80 | } 81 | } 82 | 83 | if( lpcBestUnit != NULL ) 84 | { 85 | m_dwLastBestTick = dwCurrentTickCount; 86 | #ifdef _DEBUG 87 | char szBuffer[128]; 88 | sprintf(szBuffer, "%d Issuing Last Hit | Minion Current Health: %04.02f | Health in 750ms: %04.02f\n",dwCurrentTickCount,lpcBestUnit->GetHealth( ),lpcBestUnit->GetHealth( ) - ( ( m_cUnitHealth[ lpcBestUnit->GetNetworkId( ) ].front( ) - m_cUnitHealth[ lpcBestUnit->GetNetworkId( ) ].back( ) ) / 1.5f ) ); 89 | OutputDebugStringA(szBuffer); 90 | #endif//_DEBUG 91 | 92 | // Attempt to animation cancel 93 | float fZero[ ] = { 0.0f, 0.0f, 0.0f }; 94 | Unit_IssueOrder( lpcPlayer, 37, fZero , 0, 0, 0, true ); 95 | Unit_IssueOrder( lpcPlayer, 3, lpcBestUnit->GetPos( ), lpcBestUnit, 0, 0, true ); 96 | } 97 | } 98 | 99 | for( Unit** lpcIterator = (*g_lpcUnitManager).GetFirst( ); lpcIterator != (*g_lpcUnitManager).GetEnd( ); lpcIterator++ ) 100 | { 101 | if( (*lpcIterator) == NULL || (*g_lpcLocalPlayer) == NULL ) 102 | { 103 | continue; 104 | } 105 | 106 | if( (*lpcIterator)->GetTeam( ) == (*g_lpcLocalPlayer)->GetTeam( ) ) 107 | { 108 | continue; 109 | } 110 | 111 | if( (*lpcIterator)->IsDead( ) == true ) 112 | { 113 | continue; 114 | } 115 | 116 | if( memcmp( (*lpcIterator)->GetName( ), "Minion_", 7 ) ) 117 | { 118 | continue; 119 | } 120 | 121 | m_cUnitHealth[ (*lpcIterator)->GetNetworkId( ) ].push_back((*lpcIterator)->GetHealth( )); 122 | if( m_cUnitHealth[ (*lpcIterator)->GetNetworkId( ) ].size( ) > 10 ) 123 | { 124 | m_cUnitHealth[ (*lpcIterator)->GetNetworkId( ) ].pop_front( ); 125 | } 126 | 127 | } 128 | 129 | m_dwLastCheck = dwCurrentTickCount; 130 | } 131 | 132 | if( ! (GetAsyncKeyState( VK_MENU ) & 0x8000) ) 133 | { 134 | if( m_bInUse == true ) 135 | { 136 | #ifdef _DEBUG 137 | OutputDebugStringA("Toggled Off\n"); 138 | #endif//DEBUG 139 | CCore::s_lpcCore->Print("Last Hit Bot is now Deactivated"); 140 | m_bInUse = false; 141 | } 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /LoLAdvanced/LoLAdvanced.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {AAFE4B78-477F-41B1-8421-CC26DB70015C} 15 | Win32Proj 16 | LoLAdvanced 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | Unicode 23 | 24 | 25 | DynamicLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_WINDOWS;_USRDLL;LOLADVANCED_EXPORTS;%(PreprocessorDefinitions) 53 | 54 | 55 | Windows 56 | true 57 | 58 | 59 | 60 | 61 | Level3 62 | Use 63 | MaxSpeed 64 | true 65 | true 66 | WIN32;NDEBUG;_WINDOWS;_USRDLL;LOLADVANCED_EXPORTS;%(PreprocessorDefinitions) 67 | MultiThreaded 68 | 1Byte 69 | false 70 | StdAfx.hpp 71 | Speed 72 | 73 | 74 | Windows 75 | true 76 | true 77 | true 78 | %(AdditionalDependencies) 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Create 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /LoLAdvanced/Memory.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.hpp" 2 | #define _DEFINE_PTRS 3 | #include "LoLPtrs.hpp" 4 | 5 | CMemory::CMemory( void ) 6 | { 7 | m_lpsFirstPatch = NULL; 8 | m_lpsLastPatch = NULL; 9 | } 10 | 11 | CMemory::~CMemory( void ) 12 | { 13 | DWORD dwOldProtect; 14 | 15 | for( SPatch* lpsPatch = m_lpsFirstPatch; lpsPatch != NULL; lpsPatch = lpsPatch->lpsNext ) 16 | { 17 | if( lpsPatch->lpsPrev != NULL ) 18 | { 19 | delete lpsPatch->lpsPrev; 20 | } 21 | 22 | VirtualProtect( (void*) lpsPatch->dwAddress, lpsPatch->dwLength, PAGE_EXECUTE_READWRITE, &dwOldProtect ); 23 | memcpy( (void*) lpsPatch->dwAddress, lpsPatch->yBackup, lpsPatch->dwLength ); 24 | VirtualProtect( (void*) lpsPatch->dwAddress, lpsPatch->dwLength, dwOldProtect, &dwOldProtect ); 25 | 26 | if( lpsPatch->eType == Inline ) 27 | { 28 | VirtualFree( (void*) lpsPatch->dwTrampolin, 0, MEM_RELEASE ); 29 | } 30 | } 31 | 32 | delete m_lpsLastPatch; 33 | 34 | m_lpsFirstPatch = NULL; 35 | m_lpsLastPatch = NULL; 36 | } 37 | 38 | DWORD CMemory::_Patch( EPatchType eType, DWORD dwAddress, DWORD dwDetour, DWORD dwLength ) 39 | { 40 | DWORD dwProtect = 0; 41 | SPatch* lpsPatch = new SPatch; 42 | 43 | ZeroMemory( lpsPatch, sizeof( SPatch ) ); 44 | 45 | lpsPatch->eType = eType; 46 | lpsPatch->dwAddress = dwAddress; 47 | lpsPatch->dwLength = dwLength; 48 | 49 | switch( eType ) 50 | { 51 | case Call: // Oldschool Call/Jump Detours.. 52 | case Jump: 53 | { 54 | BYTE yCave[ 64 ]; 55 | 56 | // Compute Length if no Length paramter was given. 57 | if( dwLength == 0 ) 58 | { 59 | for( ; dwLength < 5; dwLength += ComputeLength( dwAddress + dwLength ) ); 60 | lpsPatch->dwLength = dwLength; 61 | } 62 | 63 | // Prepare the new assembler code. 64 | memset( yCave, 0x90, dwLength ); 65 | 66 | yCave[ 0 ] = eType == Call ? OpCall : OpJmp; 67 | *(DWORD*)&yCave[ 1 ] = dwDetour - dwAddress - 5; 68 | 69 | // Calculate Trampoline Jump/Call if the Opcode is either 0xE8 or 0xE9. 70 | if( *(BYTE*) dwAddress == OpCall || *(BYTE*) dwAddress == OpJmp ) 71 | { 72 | lpsPatch->dwTrampolin = *(DWORD*)( dwAddress + 1 ) + dwAddress + 5; 73 | } 74 | 75 | // Change Page Protection, backup old code and write the detour. 76 | VirtualProtect( (void*) dwAddress, dwLength, PAGE_EXECUTE_READWRITE, &dwProtect ); 77 | 78 | memcpy( lpsPatch->yBackup, (void*) dwAddress, dwLength ); 79 | memcpy( (void*)dwAddress, yCave, dwLength ); 80 | 81 | VirtualProtect( (void*) dwAddress, dwLength, dwProtect, &dwProtect ); 82 | } 83 | break; 84 | case VMT: 85 | // A bit newer, VMT hooks! Easy to make, easy to manage! 86 | { // Length Parameter is in this case the index of the method in the virtual method table. 87 | 88 | dwAddress = *(DWORD*) dwAddress; 89 | dwAddress += dwLength * sizeof( DWORD ); 90 | 91 | lpsPatch->dwAddress = dwAddress; 92 | lpsPatch->dwTrampolin = *(DWORD*) dwAddress; 93 | lpsPatch->dwLength = sizeof( DWORD ); 94 | 95 | // Backup old address, and patch it. 96 | VirtualProtect( (void*) dwAddress, sizeof( DWORD ), PAGE_EXECUTE_READWRITE, &dwProtect ); 97 | memcpy( lpsPatch->yBackup, (void*) dwAddress, sizeof( DWORD ) ); 98 | *(DWORD*)&dwAddress = dwDetour; 99 | VirtualProtect( (void*) dwAddress, sizeof( DWORD ), dwProtect, &dwProtect ); 100 | } 101 | break; 102 | case Inline: 103 | // Very comfortable, Inline Hooks! 104 | { 105 | BYTE yCave[ 64 ]; 106 | 107 | // Compute the length 108 | if( dwLength == 0 ) 109 | { 110 | for( ; dwLength < 5; dwLength += ComputeLength( dwAddress + dwLength ) ); 111 | lpsPatch->dwLength = dwLength; 112 | } 113 | 114 | // Prepare the new assembler code. 115 | memset( yCave, OpNop, dwLength ); 116 | yCave[ 0 ] = OpJmp; 117 | *(DWORD*)&yCave[ 1 ] = dwDetour - dwAddress - 5; 118 | 119 | // Backup the old code 120 | VirtualProtect( (void*) dwAddress, dwLength, PAGE_EXECUTE_READWRITE, &dwProtect ); 121 | memcpy( lpsPatch->yBackup, (void*) dwAddress, dwLength ); 122 | 123 | // Allocate some memory on which the back up'd code gets copied onto. 124 | lpsPatch->dwTrampolin = (DWORD) VirtualAlloc( NULL, dwLength, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); 125 | memcpy( (void*) lpsPatch->dwTrampolin, (void*) lpsPatch->yBackup, dwLength ); 126 | 127 | // Write the jmp opcode to the rest of the original code 128 | *(BYTE*)(lpsPatch->dwTrampolin + dwLength ) = OpJmp; 129 | *(DWORD*)(lpsPatch->dwTrampolin + dwLength + 1 ) = ( dwAddress + dwLength ) - ( lpsPatch->dwTrampolin + dwLength ) - 5; 130 | 131 | // now patch it 132 | memcpy( (void*)dwAddress, yCave, dwLength ); 133 | 134 | VirtualProtect( (void*) dwAddress, dwLength, dwProtect, &dwProtect ); 135 | } 136 | break; 137 | default: 138 | delete lpsPatch; 139 | return NULL; 140 | } 141 | 142 | if( m_lpsFirstPatch == NULL ) 143 | { 144 | m_lpsFirstPatch = lpsPatch; 145 | } 146 | 147 | if( m_lpsLastPatch != NULL ) 148 | { 149 | m_lpsLastPatch->lpsNext = lpsPatch; 150 | } 151 | 152 | lpsPatch->lpsPrev = m_lpsLastPatch; 153 | m_lpsLastPatch = lpsPatch; 154 | 155 | return lpsPatch->dwTrampolin; 156 | } 157 | 158 | DWORD 159 | CMemory::ComputeLength( DWORD dwAddress ) 160 | { 161 | return _mlde32( dwAddress ); 162 | } 163 | 164 | __declspec(naked) DWORD 165 | CMemory::_mlde32( DWORD dwAddress ) 166 | { 167 | enum 168 | { 169 | O_UNIQUE = 0, 170 | O_PREFIX = 1, 171 | O_IMM8 = 2, 172 | O_IMM16 = 3, 173 | O_IMM24 = 4, 174 | O_IMM32 = 5, 175 | O_IMM48 = 6, 176 | O_MODRM = 7, 177 | O_MODRM8 = 8, 178 | O_MODRM32 = 9, 179 | O_EXTENDED = 10, 180 | O_WEIRD = 11, 181 | O_ERROR = 12, 182 | }; 183 | __asm 184 | { 185 | pushad 186 | cld 187 | xor edx, edx 188 | 189 | mov esi, [esp+(8*4)+4] 190 | mov ebp, esp 191 | 192 | // 256 bytes, index-compressed opcode type table 193 | push 01097F71Ch 194 | push 0F71C6780h 195 | push 017389718h 196 | push 0101CB718h 197 | push 017302C17h 198 | push 018173017h 199 | push 0F715F547h 200 | push 04C103748h 201 | push 0272CE7F7h 202 | push 0F7AC6087h 203 | push 01C121C52h 204 | push 07C10871Ch 205 | push 0201C701Ch 206 | push 04767602Bh 207 | push 020211011h 208 | push 040121625h 209 | push 082872022h 210 | push 047201220h 211 | push 013101419h 212 | push 018271013h 213 | push 028858260h 214 | push 015124045h 215 | push 05016A0C7h 216 | push 028191812h 217 | push 0F2401812h 218 | push 019154127h 219 | push 050F0F011h 220 | mov ecx, 015124710h 221 | push ecx 222 | push 011151247h 223 | push 010111512h 224 | push 047101115h 225 | mov eax, 012472015h 226 | push eax 227 | push eax 228 | push 012471A10h 229 | add cl, 10h 230 | push ecx 231 | sub cl, 20h 232 | push ecx 233 | 234 | xor ecx, ecx 235 | dec ecx 236 | 237 | ; code starts 238 | _ps: inc ecx 239 | mov edi, esp 240 | _go: lodsb 241 | mov bh, al 242 | _ft: mov ah, [edi] 243 | inc edi 244 | shr ah, 4 245 | sub al, ah 246 | jnc _ft 247 | 248 | mov al, [edi-1] 249 | and al, 0Fh 250 | 251 | cmp al, O_ERROR 252 | jnz _i7 253 | 254 | pop edx 255 | not edx 256 | 257 | _i7: inc edx 258 | cmp al, O_UNIQUE 259 | jz _t_exit 260 | 261 | cmp al, O_PREFIX 262 | jz _ps 263 | 264 | add edi, 51h //(__ettbl - __ttbl) 265 | 266 | cmp al, O_EXTENDED 267 | jz _go 268 | 269 | mov edi, [ebp+(8*4)+4] 270 | 271 | inc edx 272 | cmp al, O_IMM8 273 | jz _t_exit 274 | cmp al, O_MODRM 275 | jz _t_modrm 276 | cmp al, O_WEIRD 277 | jz _t_weird 278 | 279 | _i5: inc edx 280 | cmp al, O_IMM16 281 | jz _t_exit 282 | cmp al, O_MODRM8 283 | jz _t_modrm 284 | 285 | inc edx 286 | cmp al, O_IMM24 287 | jz _t_exit 288 | 289 | inc edx 290 | inc edx 291 | 292 | pushad 293 | mov al, 66h 294 | repnz scasb 295 | popad 296 | jnz _c32 297 | 298 | _d2: dec edx 299 | dec edx 300 | 301 | _c32: cmp al, O_MODRM32 302 | jz _t_modrm 303 | sub al, O_IMM32 304 | jz _t_imm32 305 | 306 | _i1: inc edx 307 | 308 | _t_exit: 309 | mov esp, ebp 310 | mov [esp+(7*4)], edx 311 | popad 312 | ret 313 | 314 | /********************************* 315 | ;* PROCESS THE MOD/RM BYTE * 316 | ;* * 317 | ;* 7 6 5 3 2 0 * 318 | ;* | MOD | Reg/Opcode | R/M | * 319 | ;* * 320 | ;*********************************/ 321 | _t_modrm: 322 | lodsb 323 | mov ah, al 324 | shr al, 7 325 | jb _prmk 326 | jz _prm 327 | 328 | add dl, 4 329 | 330 | pushad 331 | mov al, 67h 332 | repnz scasb 333 | popad 334 | jnz _prm 335 | 336 | sub dl, 3 337 | 338 | dec al 339 | _prmk:jnz _t_exit 340 | inc edx 341 | inc eax 342 | _prm: 343 | and ah, 00000111b 344 | 345 | pushad 346 | mov al, 67h 347 | repnz scasb 348 | popad 349 | jz _prm67chk 350 | 351 | cmp ah, 04h 352 | jz _prmsib 353 | 354 | cmp ah, 05h 355 | jnz _t_exit 356 | 357 | dec al 358 | jz _t_exit 359 | _i42: add dl, 4 360 | jmp _t_exit 361 | 362 | _prm67chk: 363 | cmp ax, 0600h 364 | jnz _t_exit 365 | inc edx 366 | jmp _i1 367 | 368 | _prmsib: 369 | cmp al, 00h 370 | jnz _i1 371 | lodsb 372 | and al, 00000111b 373 | sub al, 05h 374 | jnz _i1 375 | inc edx 376 | jmp _i42 377 | 378 | /**************************** 379 | ;* PROCESS WEIRD OPCODES * 380 | ;* * 381 | ;* Fucking test (F6h/F7h) * 382 | ;* * 383 | ;***************************/ 384 | _t_weird: 385 | test byte ptr [esi], 00111000b 386 | jnz _t_modrm 387 | 388 | mov al, O_MODRM8 389 | 390 | shr bh, 1 391 | adc al, 0 392 | jmp _i5 393 | 394 | /********************************* 395 | ;* PROCESS SOME OTHER SHIT * 396 | ;* * 397 | ;* Fucking mov (A0h/A1h/A2h/A3h) * 398 | ;* * 399 | ;********************************/ 400 | _t_imm32: 401 | sub bh, 0A0h 402 | 403 | cmp bh, 04h 404 | jae _d2 405 | 406 | pushad 407 | mov al, 67h 408 | repnz scasb 409 | popad 410 | jnz _chk66t 411 | 412 | dec edx 413 | dec edx 414 | 415 | _chk66t: 416 | pushad 417 | mov al, 66h 418 | repnz scasb 419 | popad 420 | jz _i1 421 | jnz _d2 422 | } 423 | } --------------------------------------------------------------------------------