Skip to content

Commit

Permalink
Updated x64 configuration, removed win32
Browse files Browse the repository at this point in the history
Updated x64 configuration, removed win32
  • Loading branch information
leo4048111 committed Oct 29, 2023
1 parent 99a4b66 commit a933bad
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 85 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*.lai
*.la
*.a
!BlackBone.lib
!BlackBone-d.lib

# Executables
*.exe
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 21 additions & 1 deletion dependency/blackbone/3rd_party/VersionApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ enum eBuildThreshold
Build_19H1 = 18362,
Build_19H2 = 18363,
Build_20H1 = 19041,
Build_21H2 = 22000,
Build_22H2 = 22621,
Build_RS_MAX = 99999,
};

Expand All @@ -48,6 +50,8 @@ enum eVerShort
Win10_19H1, // Windows 10 May 2019 update
Win10_19H2, // Windows 10 November 2019 update
Win10_20H1, // Windows 10 April 2020 update
Win11_21H2, // Windows 11
Win11_22H2 // Windows 11 September 2022 update
};

struct WinVersion
Expand Down Expand Up @@ -109,7 +113,11 @@ BLACKBONE_API inline void InitVersion()
switch (fullver)
{
case _WIN32_WINNT_WIN10:
if (g_WinVer.native.dwBuildNumber >= Build_20H1)
if (g_WinVer.native.dwBuildNumber >= Build_22H2)
g_WinVer.ver = Win11_22H2;
else if (g_WinVer.native.dwBuildNumber >= Build_21H2)
g_WinVer.ver = Win11_21H2;
else if (g_WinVer.native.dwBuildNumber >= Build_20H1)
g_WinVer.ver = Win10_20H1;
else if (g_WinVer.native.dwBuildNumber >= Build_19H2)
g_WinVer.ver = Win10_19H2;
Expand Down Expand Up @@ -303,6 +311,18 @@ IsWindows1020H1OrGreater()
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN10 ), LOBYTE( _WIN32_WINNT_WIN10 ), 0, Build_20H1 );
}

VERSIONHELPERAPI
IsWindows1121H2OrGreater()
{
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN10 ), LOBYTE( _WIN32_WINNT_WIN10 ), 0, Build_21H2);
}

VERSIONHELPERAPI
IsWindows1122H2OrGreater()
{
return IsWindowsVersionOrGreater( HIBYTE( _WIN32_WINNT_WIN10 ), LOBYTE( _WIN32_WINNT_WIN10 ), 0, Build_22H2 );
}

VERSIONHELPERAPI
IsWindowsServer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ NTSTATUS DriverControl::Reload( std::wstring path /*= L"" */ )
NULL, OPEN_EXISTING, 0, NULL
);

if (!_hDriver)
if (_hDriver == INVALID_HANDLE_VALUE)
{
_loadStatus = LastNtStatus();
BLACKBONE_TRACE( L"Failed to open driver handle. Status 0x%X", _loadStatus );
Expand Down
3 changes: 3 additions & 0 deletions dependency/blackbone/BlackBone/Patterns/PatternSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ bool PatternSearch::SearchWithHandler(
ptr_t value_offset /*= 0*/
) const
{
if (scanSize == 0)
return false;

size_t bad_char_skip[UCHAR_MAX + 1];

const uint8_t* haystack = reinterpret_cast<const uint8_t*>(scanStart);
Expand Down
10 changes: 10 additions & 0 deletions dependency/blackbone/BlackBone/Process/RPC/RemoteExec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ NTSTATUS RemoteExec::PrepareCallAssembly(
}

a.GenPrologue();
if (_process.core().isWow64())
{
a->pusha();
a->pushf();
}
a.GenCall( pfn, args, cc );

// Retrieve result from XMM0 or ST0
Expand All @@ -571,6 +576,11 @@ NTSTATUS RemoteExec::PrepareCallAssembly(
}

AddReturnWithEvent( a, mt_default, retType );
if (_process.core().isWow64())
{
a->popf();
a->popa();
}
a.GenEpilogue();

return STATUS_SUCCESS;
Expand Down
36 changes: 35 additions & 1 deletion dependency/blackbone/BlackBone/Symbols/PatternLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,41 @@ void FindPattern( const ScanParams& scan32, const ScanParams& scan64, const Offs
/// <param name="result">Result</param>
void OSFillPatterns( std::unordered_map<ptr_t*, OffsetData>& patterns, SymbolData& result )
{
if (IsWindows10RS3OrGreater())
if (IsWindows1121H2OrGreater())
{
// LdrpHandleTlsData64
// 41 55 41 56 41 57 48 81 EC F0 00 00
patterns.emplace(&result.LdrpHandleTlsData64, OffsetData{ "\x41\x55\x41\x56\x41\x57\x48\x81\xEC\xF0\x00\x00", true, 0xf });

// RtlInsertInvertedFunctionTable64
// 48 89 5C 24 08 57 48 83 EC 30 8B DA
patterns.emplace(&result.RtlInsertInvertedFunctionTable64, OffsetData{ "\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x30\x8B\xDA", true, 0 });

// RtlpInsertInvertedFunctionTableEntry64
// 49 8B E8 48 8B FA 0F 84
patterns.emplace(&result.LdrpInvertedFunctionTable64, OffsetData{ "\x49\x8b\xe8\x48\x8b\xfa\x0f\x84", true, -1, -0xF, 2, 6 });

// RtlInsertInvertedFunctionTable32
// 53 56 57 8D 45 F8 8B FA
patterns.emplace(&result.RtlInsertInvertedFunctionTable32, OffsetData{ "\x53\x56\x57\x8d\x45\xf8\x8b\xfa", false, 0x8 });

// RtlpInsertInvertedFunctionTableEntry32
// 33 F6 46 3B C6
patterns.emplace(&result.LdrpInvertedFunctionTable32, OffsetData{ "\x33\xF6\x46\x3B\xC6", false, -1, -0x1B });

// LdrpHandleTlsData32
// 33 f6 85 c0 79 03
auto offset = 0x2c;
if (IsWindows1122H2OrGreater())
offset = 0x42;

patterns.emplace(&result.LdrpHandleTlsData32, OffsetData{ "\x33\xf6\x85\xc0\x79\x03", false, offset });

// LdrProtectMrdata
// 75 20 85 f6 75 35
patterns.emplace(&result.LdrProtectMrdata, OffsetData{ "\x75\x20\x85\xf6\x75\x35", false, 0x1d });
}
else if (IsWindows10RS3OrGreater())
{
// LdrpHandleTlsData
// 74 33 44 8D 43 09
Expand Down
Binary file added dependency/blackbone/Lib/BlackBone-d.lib
Binary file not shown.
Binary file added dependency/blackbone/Lib/BlackBone.lib
Binary file not shown.
11 changes: 5 additions & 6 deletions potatoInjector.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "potatoInjector", "potatoInj
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Debug|x86.ActiveCfg = Debug|Win32
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Debug|x86.Build.0 = Debug|Win32
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Release|x86.ActiveCfg = Release|Win32
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Release|x86.Build.0 = Release|Win32
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Debug|x64.ActiveCfg = Debug|x64
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Release|x64.ActiveCfg = Release|x64
{A59A807A-36D3-4603-ACCA-71799937A1E6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
87 changes: 12 additions & 75 deletions potatoInjector.vcxproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
Expand All @@ -26,19 +18,6 @@
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
Expand All @@ -57,83 +36,37 @@
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\dependency\blackbone;$(DXSDK_DIR)\Include</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(ProjectDir)\dependency\blackbone\Lib;$(DXSDK_DIR)\Lib\x86</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\dependency\blackbone;$(DXSDK_DIR)\Include</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(ProjectDir)\dependency\blackbone\Lib;$(DXSDK_DIR)\Lib\x86</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\dependency\blackbone;$(DXSDK_DIR)\Include</IncludePath>
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)\dependency\blackbone\Lib;$(DXSDK_DIR)\Lib\x64</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\dependency\blackbone;$(DXSDK_DIR)\Include</IncludePath>
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)\dependency\blackbone\Lib;$(DXSDK_DIR)\Lib\x64</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>BlackBone-d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>BlackBone.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>BlackBone-d.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -144,12 +77,16 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>BlackBone.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion vars/vars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace vars
{
inline std::wstring_view str_steam_process_name{ L"steam.exe" };
inline std::wstring_view str_game_process_name{ L"csgo.exe" };
inline std::wstring_view str_game_process_name{ L"cs2.exe" };
inline std::wstring_view str_dll_name{ L"cheat.dll" };
inline std::wstring_view str_steam_mod_name{ L"tier0_s.dll" };
inline std::wstring_view str_game_mod_name{ L"serverbrowser.dll" };
Expand Down

0 comments on commit a933bad

Please sign in to comment.