diff --git a/.gitignore b/.gitignore index dfcfd56..d1ea7a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,350 +1,14 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +cmake-build-debug +cmake-release-debug +.idea \ No newline at end of file diff --git a/AutoSprint.sln b/AutoSprint.sln deleted file mode 100644 index d3cd3d6..0000000 --- a/AutoSprint.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30621.155 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoSprint", "AutoSprint\AutoSprint.vcxproj", "{E9333B08-B224-4849-AE9D-E9845DA5C3E6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Debug|x64.ActiveCfg = Debug|x64 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Debug|x64.Build.0 = Debug|x64 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Debug|x86.ActiveCfg = Debug|Win32 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Debug|x86.Build.0 = Debug|Win32 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Release|x64.ActiveCfg = Release|x64 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Release|x64.Build.0 = Release|x64 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Release|x86.ActiveCfg = Release|Win32 - {E9333B08-B224-4849-AE9D-E9845DA5C3E6}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1B18EEA6-E00B-4D44-9CEE-BB7FA3EF671B} - EndGlobalSection -EndGlobal diff --git a/AutoSprint/AutoSprint.vcxproj b/AutoSprint/AutoSprint.vcxproj deleted file mode 100644 index 015660c..0000000 --- a/AutoSprint/AutoSprint.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {e9333b08-b224-4849-ae9d-e9845da5c3e6} - AutoSprint - 10.0 - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - - Level3 - true - WIN32;_DEBUG;AUTOSPRINT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - lib - - - - - Level3 - true - true - true - WIN32;NDEBUG;AUTOSPRINT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - true - true - false - lib - - - - - Level3 - true - _DEBUG;AUTOSPRINT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - stdcpp20 - - - Windows - true - false - lib - MinHook.x64.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;AUTOSPRINT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - stdcpp20 - - - Windows - true - true - true - false - lib - MinHook.x64.lib;%(AdditionalDependencies) - - - - - - - - - - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/AutoSprint/framework.h b/AutoSprint/framework.h deleted file mode 100644 index 68e5802..0000000 --- a/AutoSprint/framework.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN - -#include diff --git a/AutoSprint/pch.cpp b/AutoSprint/pch.cpp deleted file mode 100644 index 9e6b2e0..0000000 --- a/AutoSprint/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/AutoSprint/pch.h b/AutoSprint/pch.h deleted file mode 100644 index 428d6ca..0000000 --- a/AutoSprint/pch.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef PCH_H -#define PCH_H - -#include "framework.h" - -#endif //PCH_H diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a671366 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.24) + +project(AutoSprint) + +set(CMAKE_CXX_STANDARD 20) + +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-Wno-dynamic-class-memaccess -Wno-microsoft-goto -Wno-delete-incomplete /EHsc /Ob0) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_options(/MP /Ob1) +endif() + +# Add definitions +add_compile_definitions(WIN32_LEAN_AND_MEAN) +add_compile_definitions(NOMINMAX) + +# Include header files +include_directories(include) + +# Link the libraries +link_directories(libs) + +add_library(AutoSprint SHARED dllmain.cpp) \ No newline at end of file diff --git a/AutoSprint/dllmain.cpp b/dllmain.cpp similarity index 69% rename from AutoSprint/dllmain.cpp rename to dllmain.cpp index 0ac97bf..59253de 100644 --- a/AutoSprint/dllmain.cpp +++ b/dllmain.cpp @@ -1,173 +1,166 @@ -#include "pch.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma warning(disable : 4996) - -#include "lib/MinHook.h" - -std::wstring acFolderPath; -std::wofstream modLog; - -#define INRANGE(x,a,b) (x >= a && x <= b) -#define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1])) -#define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0)) - -uintptr_t findSig(const char* szSignature) { - const char* pattern = szSignature; - uintptr_t firstMatch = 0; - - static const uintptr_t rangeStart = (uintptr_t)GetModuleHandleA("Minecraft.Windows.exe"); - static MODULEINFO miModInfo; - static bool init = false; - - if (!init) { - init = true; - GetModuleInformation(GetCurrentProcess(), (HMODULE)rangeStart, &miModInfo, sizeof(MODULEINFO)); - } - - static const uintptr_t rangeEnd = rangeStart + miModInfo.SizeOfImage; - - BYTE patByte = GET_BYTE(pattern); - const char* oldPat = pattern; - - for (uintptr_t pCur = rangeStart; pCur < rangeEnd; pCur++) { - if (!*pattern) - return firstMatch; - - while (*(PBYTE)pattern == ' ') - pattern++; - - if (!*pattern) - return firstMatch; - - if (oldPat != pattern) { - oldPat = pattern; - if (*(PBYTE)pattern != '\?') - patByte = GET_BYTE(pattern); - } - - if (*(PBYTE)pattern == '\?' || *(BYTE*)pCur == patByte) { - if (!firstMatch) - firstMatch = pCur; - - if (!pattern[2] || !pattern[1]) - return firstMatch; - - pattern += 2; - } - else { - pattern = szSignature; - firstMatch = 0; - } - } -} - -struct Vec3 { - union { - struct { - float x, y, z; - }; - float arr[3]; - }; - - Vec3() { x = y = z = 0; } - Vec3(float x, float y, float z) { - this->x = x, this->y = y, this->z = z; - } - - float magnitudexz() { - return sqrtf(x * x + z * z); - } -}; - -class Player { -public: - Vec3 position() { - return *(Vec3*)((uintptr_t)(this) + 0x7BC); - } - - void setSprinting(bool value) { - using setSprinting = void(*)(void*, bool); - static uintptr_t setSprintingAddr = NULL; - - if (setSprintingAddr == NULL) { - setSprintingAddr = findSig("48 89 74 24 20 57 48 83 EC 30 48 8B 01 0F B6 F2 BA 03 00 00 00"); - return; - } - - ((setSprinting)setSprintingAddr)(this, value); - } -}; - -class GameMode { -public: - Player* player; - -private: - virtual ~GameMode(); -}; - -void** getVtable(void* obj) { - return *((void***)obj); -} - -void(*oGameMode_tick)(GameMode*); -void hGameMode_tick(GameMode* gm) { - if (gm->player != nullptr) { - if (gm->player->position().magnitudexz() > 0.05f) { - gm->player->setSprinting(true); - } - } - - oGameMode_tick(gm); -} - -void Inject(HINSTANCE hModule) { - MH_Initialize(); - - PWSTR pAppDataPath; - SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pAppDataPath); - acFolderPath = pAppDataPath; - CoTaskMemFree(pAppDataPath); - - modLog.open(acFolderPath + L"\\AutoSprint.txt"); - - uintptr_t sigAddr = findSig("48 8D ? ? ? ? ? 48 8B D9 48 89 01 48 8B 89 B0 00 00 00 48 85 C9 74 11 48 8B 01 BA 01 00 00 00 48 8B 00 FF 15 ? ? ? ? 48 8B 8B A8 00 00 00 48 85 C9 74 17 48 8B 01 BA 01 00 00 00 48 8B 00 48 83 C4 20 5B 48 FF 25 ? ? ? ? 48 83 C4 20 5B C3 CC CC CC CC CC CC CC 48 89 5C 24 10 48 89 74 24 18 48 89 7C 24 20 55 41 56 41 57 48 8D 6C 24 A0 48 81 EC 60 01 00 00 48 8B ? ? ? ? ? 48 33 C4 48 89 45 50"); - - if (!sigAddr) - return; - - int offset = *(int*)(sigAddr + 3); - uintptr_t** vtable = (uintptr_t**)(sigAddr + offset + 7); - - if (MH_CreateHook((void*)vtable[8], &hGameMode_tick, (LPVOID*)&oGameMode_tick) == MH_OK) { - MH_EnableHook((void*)vtable[8]); - } -} - -BOOL APIENTRY DllMain(HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved -) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Inject, hModule, NULL, NULL); - - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} +#include +#include +#include +#include +#include +#include +#include + +#include + +#pragma comment(lib, "MinHook.x64.lib") +#pragma warning(disable : 4996) + +std::wstring acFolderPath; +std::wofstream modLog; + +#define INRANGE(x,a,b) (x >= a && x <= b) +#define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1])) +#define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0)) + +auto findSig(const char* szSignature) -> uintptr_t { + const char* pattern = szSignature; + uintptr_t firstMatch = 0; + + static const auto rangeStart = (uintptr_t)GetModuleHandleA("Minecraft.Windows.exe"); + static MODULEINFO miModInfo; + static bool init = false; + + if (!init) { + init = true; + GetModuleInformation(GetCurrentProcess(), (HMODULE)rangeStart, &miModInfo, sizeof(MODULEINFO)); + } + + static const uintptr_t rangeEnd = rangeStart + miModInfo.SizeOfImage; + + BYTE patByte = GET_BYTE(pattern); + const char* oldPat = pattern; + + for (uintptr_t pCur = rangeStart; pCur < rangeEnd; pCur++) { + if (!*pattern) + return firstMatch; + + while (*(PBYTE)pattern == ' ') + pattern++; + + if (!*pattern) + return firstMatch; + + if (oldPat != pattern) { + oldPat = pattern; + if (*(PBYTE)pattern != '\?') + patByte = GET_BYTE(pattern); + } + + if (*(PBYTE)pattern == '\?' || *(BYTE*)pCur == patByte) { + if (!firstMatch) + firstMatch = pCur; + + if (!pattern[2] || !pattern[1]) + return firstMatch; + + pattern += 2; + } + else { + pattern = szSignature; + firstMatch = 0; + } + } + + return 0; +} + +struct Vec3 { + union { + struct { + float x, y, z; + }; + float arr[3]{}; + }; + + Vec3() { x = y = z = 0; } + + [[maybe_unused]] Vec3(float x, float y, float z) { + this->x = x, this->y = y, this->z = z; + } + + [[nodiscard]] auto magnitude() const -> float { + return sqrtf(x * x + z * z); + } +}; + +class Player { +public: + auto position() -> Vec3 { + return *(Vec3*)((uintptr_t)(this) + 0x7BC); + } + + void setSprinting(bool value) { + using setSprinting = void(*)(void*, bool); + static uintptr_t setSprintingAddr = NULL; + + if (setSprintingAddr == NULL) { + setSprintingAddr = findSig("48 89 74 24 20 57 48 83 EC 30 48 8B 01 0F B6 F2 BA 03 00 00 00"); + return; + } + + ((setSprinting)setSprintingAddr)(this, value); + } +}; + +class GameMode { +public: + Player* player{}; + +public: + virtual ~GameMode() = delete; +}; + +auto getVtable(void* obj) -> void** { + return *((void***)obj); +} + +void(*oGameMode_tick)(GameMode*); +auto hGameMode_tick(GameMode* gm) -> void { + if (gm->player != nullptr) { + if (gm->player->position().magnitude() > 0.05f) { + gm->player->setSprinting(true); + } + } + + oGameMode_tick(gm); +} + +auto Inject(HINSTANCE hModule) -> void { + MH_Initialize(); + + PWSTR pAppDataPath; + SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pAppDataPath); + acFolderPath = pAppDataPath; + CoTaskMemFree(pAppDataPath); + + modLog.open(acFolderPath + L"\\AutoSprint.txt"); + + uintptr_t sigAddr = findSig("48 8D ? ? ? ? ? 48 8B D9 48 89 01 48 8B 89 B0 00 00 00 48 85 C9 74 11 48 8B 01 BA 01 00 00 00 48 8B 00 FF 15 ? ? ? ? 48 8B 8B A8 00 00 00 48 85 C9 74 17 48 8B 01 BA 01 00 00 00 48 8B 00 48 83 C4 20 5B 48 FF 25 ? ? ? ? 48 83 C4 20 5B C3 CC CC CC CC CC CC CC 48 89 5C 24 10 48 89 74 24 18 48 89 7C 24 20 55 41 56 41 57 48 8D 6C 24 A0 48 81 EC 60 01 00 00 48 8B ? ? ? ? ? 48 33 C4 48 89 45 50"); + + if (!sigAddr) + return; + + int offset = *(int*)(sigAddr + 3); + auto** vtable = (uintptr_t**)(sigAddr + offset + 7); + + if (MH_CreateHook((void*)vtable[8], (LPVOID**)&hGameMode_tick, (LPVOID*)&oGameMode_tick) == MH_OK) { + MH_EnableHook((void*)vtable[8]); + } +} + +auto APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -> BOOL { + if (ul_reason_for_call == DLL_PROCESS_ATTACH) { + CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)Inject, hModule, NULL, nullptr); + } else if (ul_reason_for_call == DLL_PROCESS_DETACH) { + MH_DisableHook(MH_ALL_HOOKS); + MH_Uninitialize(); + } + + return TRUE; +} diff --git a/AutoSprint/lib/MinHook.h b/include/MinHook.h similarity index 99% rename from AutoSprint/lib/MinHook.h rename to include/MinHook.h index 2e9baa8..2b8f67d 100644 --- a/AutoSprint/lib/MinHook.h +++ b/include/MinHook.h @@ -32,7 +32,7 @@ #error MinHook supports only x86 and x64 systems. #endif -#include +#include // MinHook Error Codes. typedef enum MH_STATUS diff --git a/AutoSprint/lib/MinHook.x64.lib b/libs/MinHook.x64.lib similarity index 100% rename from AutoSprint/lib/MinHook.x64.lib rename to libs/MinHook.x64.lib