mirror of
https://github.com/360NENZ/Taiga74164-Akebi-GC.git
synced 2025-09-19 04:06:12 +08:00
minor changes
`cheat-base` add x32 build `manual map` and `load library` injection moved to `cheat-base` removed unnecessary packet sniffer functionality fixed several type conversionals `cheat-library` now is startup by default little changes in `Logger`, `PatternScanner`, `ProtoTransfer` updated detours
This commit is contained in:
@ -1,14 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_WS|Win32">
|
||||
<Configuration>Release_WS</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_WS|x64">
|
||||
<Configuration>Release_WS</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@ -43,6 +55,24 @@
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
@ -60,18 +90,30 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
@ -81,8 +123,9 @@
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
@ -94,26 +137,28 @@
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
</Lib>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
@ -127,26 +172,28 @@
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
</Lib>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
@ -160,10 +207,63 @@
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
</Lib>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||
<ClCompile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@ -196,6 +296,8 @@
|
||||
<ClInclude Include="src\cheat-base\events\joins\eventjoinwrapper.hpp" />
|
||||
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.h" />
|
||||
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.hpp" />
|
||||
<ClInclude Include="src\cheat-base\inject\load-library.h" />
|
||||
<ClInclude Include="src\cheat-base\inject\manual-map.h" />
|
||||
<ClInclude Include="src\cheat-base\ResourceLoader.h" />
|
||||
<ClInclude Include="src\cheat-base\Hotkey.h" />
|
||||
<ClInclude Include="src\cheat-base\render\ImageLoader.h" />
|
||||
@ -208,6 +310,8 @@
|
||||
<ClInclude Include="src\cheat-base\render\renderer.h" />
|
||||
<ClInclude Include="src\cheat-base\HookManager.h" />
|
||||
<ClInclude Include="src\cheat-base\Patch.h" />
|
||||
<ClInclude Include="src\cheat-base\singleton\Singleton.h" />
|
||||
<ClInclude Include="src\cheat-base\singleton\SingletonManager.h" />
|
||||
<ClInclude Include="src\cheat-base\thread-safe.h" />
|
||||
<ClInclude Include="src\cheat-base\util.h" />
|
||||
<ClInclude Include="src\cheat-base\Logger.h" />
|
||||
@ -247,12 +351,20 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cheat-base\events\joins\eventjoinwrapper.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cheat-base\inject\load-library.cpp" />
|
||||
<ClCompile Include="src\cheat-base\inject\manual-map.cpp" />
|
||||
<ClCompile Include="src\cheat-base\ResourceLoader.cpp" />
|
||||
<ClCompile Include="src\cheat-base\Hotkey.cpp" />
|
||||
<ClCompile Include="src\cheat-base\render\ImageLoader.cpp" />
|
||||
@ -269,57 +381,90 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cheat-base\PipeTransfer.cpp" />
|
||||
<ClCompile Include="vendor\fmt\src\format.cc">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\fmt\src\os.cc">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_dx11.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\imgui.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\imgui_demo.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\imgui_draw.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\imgui_tables.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\imgui_widgets.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vendor\imgui\misc\cpp\imgui_stdlib.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
@ -231,6 +231,18 @@
|
||||
<ClInclude Include="vendor\imgui\backends\imgui_impl_win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cheat-base\singleton\Singleton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cheat-base\singleton\SingletonManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cheat-base\inject\manual-map.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cheat-base\inject\load-library.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\cheat-base\util.cpp">
|
||||
@ -317,5 +329,11 @@
|
||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cheat-base\inject\manual-map.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cheat-base\inject\load-library.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -17,6 +17,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <queue>
|
||||
|
@ -88,11 +88,6 @@ Prefix GetLevelPrefix(Logger::Level level)
|
||||
|
||||
void Logger::Log(Logger::Level logLevel, const char* filepath, int line, const char* fmt, ...)
|
||||
{
|
||||
if (Logger::s_ConsoleLogLevel == Logger::Level::None && Logger::s_FileLogLevel == Logger::Level::None)
|
||||
return;
|
||||
|
||||
auto filename = std::filesystem::path(filepath).filename().string();
|
||||
auto prefix = GetLevelPrefix(logLevel);
|
||||
char buffer[1024];
|
||||
|
||||
va_list args;
|
||||
@ -100,6 +95,13 @@ void Logger::Log(Logger::Level logLevel, const char* filepath, int line, const c
|
||||
vsprintf_s(buffer, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
LogEvent(logLevel, filepath, line, buffer);
|
||||
if (Logger::s_ConsoleLogLevel == Logger::Level::None && Logger::s_FileLogLevel == Logger::Level::None)
|
||||
return;
|
||||
|
||||
auto filename = std::filesystem::path(filepath).filename().string();
|
||||
auto prefix = GetLevelPrefix(logLevel);
|
||||
|
||||
if (Logger::s_ConsoleLogLevel != Logger::Level::None && Logger::s_ConsoleLogLevel >= logLevel)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(_mutex);
|
||||
@ -140,4 +142,4 @@ void Logger::PrepareFileLogging(std::string directory)
|
||||
|
||||
Logger::logfilepath = util::string_format("%s\\log_%04d-%02d-%02d_%02d-%02d.txt", directory.c_str(),
|
||||
1900 + gmtm.tm_year, gmtm.tm_mon, gmtm.tm_mday, gmtm.tm_hour, gmtm.tm_min);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <cheat-base/events/event.hpp>
|
||||
|
||||
#define EXTLOG(level, fmt, ...) Logger::Log(level, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
||||
#define LOG_CRIT(fmt, ...) EXTLOG(Logger::Level::Critical, fmt, __VA_ARGS__)
|
||||
#define LOG_ERROR(fmt, ...) EXTLOG(Logger::Level::Error, fmt, __VA_ARGS__)
|
||||
@ -37,6 +39,8 @@ public:
|
||||
|
||||
static void PrepareFileLogging(std::string directory);
|
||||
|
||||
static inline TEvent<Logger::Level, const char*, int, const char*> LogEvent;
|
||||
|
||||
private:
|
||||
static Level s_FileLogLevel;
|
||||
static Level s_ConsoleLogLevel;
|
||||
|
@ -33,6 +33,9 @@ public:
|
||||
|
||||
int64_t GetModuleTimestamp(const std::string& moduleName);
|
||||
int64_t GetModuleTimestamp(HMODULE hModule);
|
||||
|
||||
uintptr_t SearchInModule(const std::string& moduleName, const std::string& pattern);
|
||||
uintptr_t SearchInModule(HMODULE hModule, const std::string& pattern);
|
||||
|
||||
protected:
|
||||
|
||||
@ -97,9 +100,6 @@ protected:
|
||||
|
||||
uintptr_t SearchXref(const std::string& moduleName, const OffsetSignature& xrefPattern);
|
||||
uintptr_t SearchXref(HMODULE hModule, const OffsetSignature& xrefPattern);
|
||||
|
||||
uintptr_t SearchInModule(const std::string& moduleName, const std::string& pattern);
|
||||
uintptr_t SearchInModule(HMODULE hModule, const std::string& pattern);
|
||||
|
||||
uintptr_t GetOffsetInt(const nlohmann::json& value);
|
||||
std::string GetOffsetStr(uintptr_t offset);
|
||||
|
@ -45,7 +45,7 @@ bool PipeTransfer::Connect()
|
||||
|
||||
bool PipeTransfer::WaitForConnection()
|
||||
{
|
||||
return ConnectNamedPipe(m_Pipe, nullptr);
|
||||
return ConnectNamedPipe(m_Pipe, nullptr) || GetLastError() == ERROR_PIPE_CONNECTED;
|
||||
}
|
||||
|
||||
void PipeTransfer::ReadBytes(void* buffer, size_t size)
|
||||
|
55
cheat-base/src/cheat-base/inject/load-library.cpp
Normal file
55
cheat-base/src/cheat-base/inject/load-library.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include <pch.h>
|
||||
#include "load-library.h"
|
||||
#include <cheat-base/util.h>
|
||||
|
||||
#if defined(DISABLE_OUTPUT)
|
||||
#define ILog(data, ...)
|
||||
#define IPrintError(text, ...)
|
||||
#else
|
||||
#define ILog(text, ...) printf(text, __VA_ARGS__)
|
||||
#define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl
|
||||
#endif
|
||||
|
||||
bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath)
|
||||
{
|
||||
HMODULE hKernel = GetModuleHandle("kernel32.dll");
|
||||
if (hKernel == NULL)
|
||||
{
|
||||
ILogError("[DLL Injection] Failed to get kernel32.dll module address.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
LPVOID pLoadLibrary = (LPVOID)GetProcAddress(hKernel, "LoadLibraryA");
|
||||
if (pLoadLibrary == NULL) {
|
||||
ILogError("[DLL Injection] Failed to get LoadLibraryA address.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
LPVOID pDLLPath = VirtualAllocEx(hProc, NULL, strlen(dllpath.c_str()) + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
if (pDLLPath == NULL) {
|
||||
ILogError("[DLL Injection] Failed to allocate memory for DLLPath in target process.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write the string name of our DLL in the memory allocated
|
||||
BOOL writeResult = WriteProcessMemory(hProc, pDLLPath, dllpath.c_str(), strlen(dllpath.c_str()), NULL);
|
||||
if (writeResult == FALSE) {
|
||||
ILogError("[DLL Injection] Failed to write remote process memory.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load our DLL by calling loadlibrary in the other process and passing our dll name
|
||||
HANDLE hThread = CreateRemoteThread(hProc, NULL, NULL, (LPTHREAD_START_ROUTINE)pLoadLibrary, (LPVOID)pDLLPath, NULL, NULL);
|
||||
if (hThread == NULL) {
|
||||
ILogError("[DLL Injection] Failed to create remote thread.\n");
|
||||
VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
CloseHandle(hThread);
|
||||
|
||||
// TODO: Add waiting for thread end and release unneccessary data.
|
||||
// VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
||||
|
||||
ILog("[DLL Injection] Successfully LoadLibraryA injection.\n");
|
||||
return true;
|
||||
}
|
3
cheat-base/src/cheat-base/inject/load-library.h
Normal file
3
cheat-base/src/cheat-base/inject/load-library.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath);
|
385
cheat-base/src/cheat-base/inject/manual-map.cpp
Normal file
385
cheat-base/src/cheat-base/inject/manual-map.cpp
Normal file
@ -0,0 +1,385 @@
|
||||
#include <pch.h>
|
||||
#include "manual-map.h"
|
||||
#include <cheat-base/util.h>
|
||||
|
||||
#if defined(DISABLE_OUTPUT)
|
||||
#define ILog(data, ...)
|
||||
#define IPrintError(text, ...)
|
||||
#else
|
||||
#define ILog(text, ...) printf(text, __VA_ARGS__)
|
||||
#define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#define CURRENT_ARCH IMAGE_FILE_MACHINE_AMD64
|
||||
#else
|
||||
#define CURRENT_ARCH IMAGE_FILE_MACHINE_I386
|
||||
#endif
|
||||
|
||||
using f_LoadLibraryA = HINSTANCE(WINAPI*)(const char* lpLibFilename);
|
||||
using f_GetProcAddress = FARPROC(WINAPI*)(HMODULE hModule, LPCSTR lpProcName);
|
||||
using f_DLL_ENTRY_POINT = BOOL(WINAPI*)(void* hDll, DWORD dwReason, void* pReserved);
|
||||
|
||||
#ifdef _WIN64
|
||||
using f_RtlAddFunctionTable = BOOL(WINAPIV*)(PRUNTIME_FUNCTION FunctionTable, DWORD EntryCount, DWORD64 BaseAddress);
|
||||
#endif
|
||||
|
||||
struct MANUAL_MAPPING_DATA
|
||||
{
|
||||
f_LoadLibraryA pLoadLibraryA;
|
||||
f_GetProcAddress pGetProcAddress;
|
||||
#ifdef _WIN64
|
||||
f_RtlAddFunctionTable pRtlAddFunctionTable;
|
||||
#endif
|
||||
BYTE* pbase;
|
||||
HINSTANCE hMod;
|
||||
DWORD fdwReasonParam;
|
||||
LPVOID reservedParam;
|
||||
BOOL SEHSupport;
|
||||
};
|
||||
|
||||
|
||||
bool ManualMapDLL(HANDLE hProc, const std::string& filepath)
|
||||
{
|
||||
std::ifstream file(filepath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||
if (!file.is_open())
|
||||
{
|
||||
std::cout << "Error while reading DLL file!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::streampos size = file.tellg();
|
||||
auto memblock = new char[size];
|
||||
file.seekg(0, std::ios::beg);
|
||||
file.read(memblock, size);
|
||||
file.close();
|
||||
|
||||
BYTE* fileContent = (BYTE*)memblock;
|
||||
|
||||
// Manual map injection will help us to be like a assasin
|
||||
bool result = ManualMapDLL(hProc, fileContent, size);
|
||||
|
||||
delete[] memblock;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData);
|
||||
|
||||
bool ManualMapDLL(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader, bool ClearNonNeededSections, bool AdjustProtections, bool SEHExceptionSupport, DWORD fdwReason) {
|
||||
IMAGE_NT_HEADERS* pOldNtHeader = nullptr;
|
||||
IMAGE_OPTIONAL_HEADER* pOldOptHeader = nullptr;
|
||||
IMAGE_FILE_HEADER* pOldFileHeader = nullptr;
|
||||
BYTE* pTargetBase = nullptr;
|
||||
|
||||
if (reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_magic != 0x5A4D) { //"MZ"
|
||||
ILog("[DLL injection] Invalid file\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
pOldNtHeader = reinterpret_cast<IMAGE_NT_HEADERS*>(pSrcData + reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_lfanew);
|
||||
pOldOptHeader = &pOldNtHeader->OptionalHeader;
|
||||
pOldFileHeader = &pOldNtHeader->FileHeader;
|
||||
|
||||
if (pOldFileHeader->Machine != CURRENT_ARCH) {
|
||||
ILog("[DLL injection] Invalid platform.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ILog("[DLL injection] File ok\n");
|
||||
|
||||
pTargetBase = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, pOldOptHeader->SizeOfImage, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||
if (!pTargetBase) {
|
||||
ILogError("[DLL injection] Target process memory allocation failed (ex)\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD oldp = 0;
|
||||
VirtualProtectEx(hProc, pTargetBase, pOldOptHeader->SizeOfImage, PAGE_EXECUTE_READWRITE, &oldp);
|
||||
|
||||
MANUAL_MAPPING_DATA data{ 0 };
|
||||
data.pLoadLibraryA = LoadLibraryA;
|
||||
data.pGetProcAddress = GetProcAddress;
|
||||
#ifdef _WIN64
|
||||
data.pRtlAddFunctionTable = (f_RtlAddFunctionTable)RtlAddFunctionTable;
|
||||
#else
|
||||
SEHExceptionSupport = false;
|
||||
#endif
|
||||
data.pbase = pTargetBase;
|
||||
data.fdwReasonParam = fdwReason;
|
||||
data.SEHSupport = SEHExceptionSupport;
|
||||
|
||||
//File header
|
||||
if (!WriteProcessMemory(hProc, pTargetBase, pSrcData, 0x1000, nullptr)) { //only first 0x1000 bytes for the header
|
||||
ILogError("[DLL injection] Can't write file header.\n");
|
||||
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
IMAGE_SECTION_HEADER* pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||
if (pSectionHeader->SizeOfRawData) {
|
||||
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSrcData + pSectionHeader->PointerToRawData, pSectionHeader->SizeOfRawData, nullptr)) {
|
||||
ILogError("[DLL injection] Can't map sections.\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mapping params
|
||||
BYTE* MappingDataAlloc = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, sizeof(MANUAL_MAPPING_DATA), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||
if (!MappingDataAlloc) {
|
||||
ILogError("[DLL injection] Target process mapping allocation failed (ex).\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!WriteProcessMemory(hProc, MappingDataAlloc, &data, sizeof(MANUAL_MAPPING_DATA), nullptr)) {
|
||||
ILogError("[DLL injection] Can't write mapping.\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Shell code
|
||||
void* pShellcode = VirtualAllocEx(hProc, nullptr, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
if (!pShellcode) {
|
||||
ILogError("[DLL injection] Memory shellcode allocation failed (ex).\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!WriteProcessMemory(hProc, pShellcode, Shellcode, 0x1000, nullptr)) {
|
||||
ILogError("[DLL injection] Can't write shellcode.\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
|
||||
ILog("[DLL injection] Mapped DLL at %p\n", pTargetBase);
|
||||
ILog("[DLL injection] Mapping info at %p\n", MappingDataAlloc);
|
||||
ILog("[DLL injection] Shell code at %p\n", pShellcode);
|
||||
|
||||
ILog("[DLL injection] Data allocated\n");
|
||||
|
||||
#ifdef _DEBUG
|
||||
ILog("[DLL injection] My shellcode pointer %p\n", Shellcode);
|
||||
ILog("[DLL injection] Target point %p\n", pShellcode);
|
||||
#endif
|
||||
|
||||
HANDLE hThread = CreateRemoteThread(hProc, nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(pShellcode), MappingDataAlloc, 0, nullptr);
|
||||
if (!hThread) {
|
||||
ILogError("[DLL injection] Thread creation failed.\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
CloseHandle(hThread);
|
||||
|
||||
ILog("[DLL injection] Thread created at: %p, waiting for return...\n", pShellcode);
|
||||
|
||||
HINSTANCE hCheck = NULL;
|
||||
while (!hCheck) {
|
||||
DWORD exitcode = 0;
|
||||
GetExitCodeProcess(hProc, &exitcode);
|
||||
if (exitcode != STILL_ACTIVE) {
|
||||
ILog("[DLL injection] Process crashed, exit code: 0x%x\n", exitcode);
|
||||
return false;
|
||||
}
|
||||
|
||||
MANUAL_MAPPING_DATA data_checked{ 0 };
|
||||
ReadProcessMemory(hProc, MappingDataAlloc, &data_checked, sizeof(data_checked), nullptr);
|
||||
hCheck = data_checked.hMod;
|
||||
|
||||
if (hCheck == (HINSTANCE)0x404040) {
|
||||
ILog("[DLL injection] Wrong mapping ptr.\n");
|
||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||
return false;
|
||||
}
|
||||
else if (hCheck == (HINSTANCE)0x505050) {
|
||||
ILog("[DLL injection] WARNING: Exception support failed!\n");
|
||||
}
|
||||
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
BYTE* emptyBuffer = (BYTE*)malloc(1024 * 1024 * 20);
|
||||
if (emptyBuffer == nullptr) {
|
||||
ILog("[DLL injection] Unable to allocate memory\n");
|
||||
return false;
|
||||
}
|
||||
memset(emptyBuffer, 0, 1024 * 1024 * 20);
|
||||
|
||||
//CLEAR PE HEAD
|
||||
if (ClearHeader) {
|
||||
if (!WriteProcessMemory(hProc, pTargetBase, emptyBuffer, 0x1000, nullptr)) {
|
||||
ILogError("[DLL injection] WARNING!: Can't clear HEADER\n");
|
||||
}
|
||||
}
|
||||
//END CLEAR PE HEAD
|
||||
|
||||
|
||||
if (ClearNonNeededSections) {
|
||||
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||
if (pSectionHeader->Misc.VirtualSize) {
|
||||
if ((SEHExceptionSupport ? 0 : strcmp((char*)pSectionHeader->Name, ".pdata") == 0) ||
|
||||
strcmp((char*)pSectionHeader->Name, ".rsrc") == 0 ||
|
||||
strcmp((char*)pSectionHeader->Name, ".reloc") == 0) {
|
||||
ILog("[DLL injection] Processing %s removal\n", pSectionHeader->Name);
|
||||
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, emptyBuffer, pSectionHeader->Misc.VirtualSize, nullptr)) {
|
||||
ILogError("[DLL injection] Can't clear section %s.\n", pSectionHeader->Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AdjustProtections) {
|
||||
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||
if (pSectionHeader->Misc.VirtualSize) {
|
||||
DWORD old = 0;
|
||||
DWORD newP = PAGE_READONLY;
|
||||
|
||||
if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_WRITE) > 0) {
|
||||
newP = PAGE_READWRITE;
|
||||
}
|
||||
else if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_EXECUTE) > 0) {
|
||||
newP = PAGE_EXECUTE_READ;
|
||||
}
|
||||
if (VirtualProtectEx(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSectionHeader->Misc.VirtualSize, newP, &old)) {
|
||||
ILog("[DLL injection] Section %s set as %lX\n", (char*)pSectionHeader->Name, newP);
|
||||
}
|
||||
else {
|
||||
ILog("[DLL injection] FAIL: section %s not set as %lX\n", (char*)pSectionHeader->Name, newP);
|
||||
}
|
||||
}
|
||||
}
|
||||
DWORD old = 0;
|
||||
VirtualProtectEx(hProc, pTargetBase, IMAGE_FIRST_SECTION(pOldNtHeader)->VirtualAddress, PAGE_READONLY, &old);
|
||||
}
|
||||
|
||||
if (!WriteProcessMemory(hProc, pShellcode, emptyBuffer, 0x1000, nullptr)) {
|
||||
ILog("[DLL injection] WARNING: Can't clear shellcode\n");
|
||||
}
|
||||
if (!VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE)) {
|
||||
ILog("[DLL injection] WARNING: can't release shell code memory\n");
|
||||
}
|
||||
if (!VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE)) {
|
||||
ILog("[DLL injection] WARNING: can't release mapping data memory\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define RELOC_FLAG32(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_HIGHLOW)
|
||||
#define RELOC_FLAG64(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_DIR64)
|
||||
|
||||
#ifdef _WIN64
|
||||
#define RELOC_FLAG RELOC_FLAG64
|
||||
#else
|
||||
#define RELOC_FLAG RELOC_FLAG32
|
||||
#endif
|
||||
|
||||
#pragma runtime_checks( "", off )
|
||||
#pragma optimize( "", off )
|
||||
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData) {
|
||||
if (!pData) {
|
||||
pData->hMod = (HINSTANCE)0x404040;
|
||||
return;
|
||||
}
|
||||
|
||||
BYTE* pBase = pData->pbase;
|
||||
auto* pOpt = &reinterpret_cast<IMAGE_NT_HEADERS*>(pBase + reinterpret_cast<IMAGE_DOS_HEADER*>((uintptr_t)pBase)->e_lfanew)->OptionalHeader;
|
||||
|
||||
auto _LoadLibraryA = pData->pLoadLibraryA;
|
||||
auto _GetProcAddress = pData->pGetProcAddress;
|
||||
#ifdef _WIN64
|
||||
auto _RtlAddFunctionTable = pData->pRtlAddFunctionTable;
|
||||
#endif
|
||||
auto _DllMain = reinterpret_cast<f_DLL_ENTRY_POINT>(pBase + pOpt->AddressOfEntryPoint);
|
||||
|
||||
BYTE* LocationDelta = pBase - pOpt->ImageBase;
|
||||
if (LocationDelta) {
|
||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size) {
|
||||
auto* pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
|
||||
const auto* pRelocEnd = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<uintptr_t>(pRelocData) + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size);
|
||||
while (pRelocData < pRelocEnd && pRelocData->SizeOfBlock) {
|
||||
UINT AmountOfEntries = (pRelocData->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
|
||||
WORD* pRelativeInfo = reinterpret_cast<WORD*>(pRelocData + 1);
|
||||
|
||||
for (UINT i = 0; i != AmountOfEntries; ++i, ++pRelativeInfo) {
|
||||
if (RELOC_FLAG(*pRelativeInfo)) {
|
||||
UINT_PTR* pPatch = reinterpret_cast<UINT_PTR*>(pBase + pRelocData->VirtualAddress + ((*pRelativeInfo) & 0xFFF));
|
||||
*pPatch += reinterpret_cast<UINT_PTR>(LocationDelta);
|
||||
}
|
||||
}
|
||||
pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<BYTE*>(pRelocData) + pRelocData->SizeOfBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size) {
|
||||
auto* pImportDescr = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
|
||||
while (pImportDescr->Name) {
|
||||
char* szMod = reinterpret_cast<char*>(pBase + pImportDescr->Name);
|
||||
HINSTANCE hDll = _LoadLibraryA(szMod);
|
||||
|
||||
ULONG_PTR* pThunkRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->OriginalFirstThunk);
|
||||
ULONG_PTR* pFuncRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->FirstThunk);
|
||||
|
||||
if (!pThunkRef)
|
||||
pThunkRef = pFuncRef;
|
||||
|
||||
for (; *pThunkRef; ++pThunkRef, ++pFuncRef) {
|
||||
if (IMAGE_SNAP_BY_ORDINAL(*pThunkRef)) {
|
||||
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, reinterpret_cast<char*>(*pThunkRef & 0xFFFF));
|
||||
}
|
||||
else {
|
||||
auto* pImport = reinterpret_cast<IMAGE_IMPORT_BY_NAME*>(pBase + (*pThunkRef));
|
||||
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, pImport->Name);
|
||||
}
|
||||
}
|
||||
++pImportDescr;
|
||||
}
|
||||
}
|
||||
|
||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size) {
|
||||
auto* pTLS = reinterpret_cast<IMAGE_TLS_DIRECTORY*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress);
|
||||
auto* pCallback = reinterpret_cast<PIMAGE_TLS_CALLBACK*>(pTLS->AddressOfCallBacks);
|
||||
for (; pCallback && *pCallback; ++pCallback)
|
||||
(*pCallback)(pBase, DLL_PROCESS_ATTACH, nullptr);
|
||||
}
|
||||
|
||||
bool ExceptionSupportFailed = false;
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
if (pData->SEHSupport) {
|
||||
auto excep = pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION];
|
||||
if (excep.Size) {
|
||||
if (!_RtlAddFunctionTable(
|
||||
reinterpret_cast<IMAGE_RUNTIME_FUNCTION_ENTRY*>(pBase + excep.VirtualAddress),
|
||||
excep.Size / sizeof(IMAGE_RUNTIME_FUNCTION_ENTRY), (DWORD64)pBase)) {
|
||||
ExceptionSupportFailed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_DllMain(pBase, pData->fdwReasonParam, nullptr);
|
||||
|
||||
if (ExceptionSupportFailed)
|
||||
pData->hMod = reinterpret_cast<HINSTANCE>(0x505050);
|
||||
else
|
||||
pData->hMod = reinterpret_cast<HINSTANCE>(pBase);
|
||||
}
|
4
cheat-base/src/cheat-base/inject/manual-map.h
Normal file
4
cheat-base/src/cheat-base/inject/manual-map.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
bool ManualMapDLL(HANDLE hProc, const std::string& filepath);
|
||||
bool ManualMapDLL(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader = false, bool ClearNonNeededSections = false, bool AdjustProtections = true, bool SEHExceptionSupport = false, DWORD fdwReason = DLL_PROCESS_ATTACH);
|
BIN
cheat-base/vendor/detours/detours-x64.lib
vendored
BIN
cheat-base/vendor/detours/detours-x64.lib
vendored
Binary file not shown.
BIN
cheat-base/vendor/detours/detours-x86.lib
vendored
Normal file
BIN
cheat-base/vendor/detours/detours-x86.lib
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user