diff --git a/Bo3-igorr.sln b/Bo3-igorr.sln new file mode 100644 index 0000000..ed8311c --- /dev/null +++ b/Bo3-igorr.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32602.291 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bo3-igorr", "Bo3-igorr.vcxproj", "{9161E319-BCE0-4071-ACAB-77DA96825BA1}" +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 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Debug|x64.ActiveCfg = Debug|x64 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Debug|x64.Build.0 = Debug|x64 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Debug|x86.ActiveCfg = Debug|Win32 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Debug|x86.Build.0 = Debug|Win32 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Release|x64.ActiveCfg = Release|x64 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Release|x64.Build.0 = Release|x64 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Release|x86.ActiveCfg = Release|Win32 + {9161E319-BCE0-4071-ACAB-77DA96825BA1}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1EF090D7-CDBE-4212-83FB-00450337B9A1} + EndGlobalSection +EndGlobal diff --git a/Bo3-igorr.vcxproj b/Bo3-igorr.vcxproj new file mode 100644 index 0000000..d0ee3ac --- /dev/null +++ b/Bo3-igorr.vcxproj @@ -0,0 +1,171 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {9161e319-bce0-4071-acab-77da96825ba1} + Bo3igorr + 10.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;BO3IGORR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;BO3IGORR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + Level3 + true + _DEBUG;BO3IGORR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;BO3IGORR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/Bo3-igorr.vcxproj.filters b/Bo3-igorr.vcxproj.filters new file mode 100644 index 0000000..dbe52d6 --- /dev/null +++ b/Bo3-igorr.vcxproj.filters @@ -0,0 +1,45 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {bde49f2f-a3fc-411d-88dd-d737a4d7ff5b} + + + {037782e3-24a2-4985-9919-228df7a14777} + + + + + Header Files + + + pch + + + mem + + + + + Source Files + + + pch + + + mem + + + \ No newline at end of file diff --git a/dllmain.cpp b/dllmain.cpp new file mode 100644 index 0000000..8109ac8 --- /dev/null +++ b/dllmain.cpp @@ -0,0 +1,72 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "pch.h" +#include "mem.h" + +DWORD WINAPI MainThread(HMODULE hModule) +{ + uintptr_t moduleBase = (uintptr_t)GetModuleHandle(L"blackops3.exe"); + + bool ejectDLL = false; + bool bAmmo = false, bHealth = false; + + while (!ejectDLL) + { + if (GetAsyncKeyState(VK_INSERT) & 1) + { + ejectDLL = true; + } + + // uintptr_t* zm_entList = (uintptr_t*)moduleBase + 0x0A5701B8; // 7FF7277C01B8 + + if (GetAsyncKeyState(VK_F1) & 1 || ejectDLL) + { + bAmmo = !bAmmo; + + if (bAmmo && !ejectDLL) // nop -> blackops3.exe+26E71EA - 45 89 18 - mov [r8],r11d (ammo dec) + { + mem::Nop((BYTE*)moduleBase + 0x26E71EA, 3); + } + else // Patch + { + mem::Patch((BYTE*)moduleBase + 0x26E71EA, (BYTE*)"\x45\x89\x18", 3); + } + } + + if (GetAsyncKeyState(VK_F2) & 1 || ejectDLL) + { + bHealth = !bHealth; + + if (bHealth && !ejectDLL) // nop -> blackops3.exe+18B9AC4 - 44 29 BE C8020000 - sub [rsi+000002C8],r15d (sub hp on hit) + { + mem::Nop((BYTE*)moduleBase + 0x18B9AC4, 7); + } + else // Patch + { + mem::Patch((BYTE*)moduleBase + 0x18B9AC4, (BYTE*)"\x44\x29\xBE\xC8\x02\x00\x00", 7); + } + } + } + + FreeLibraryAndExitThread(hModule, 0); + return 0; +} + +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)MainThread, NULL, NULL, NULL); + } + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/framework.h b/framework.h new file mode 100644 index 0000000..c10286c --- /dev/null +++ b/framework.h @@ -0,0 +1,7 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files +#include +#include +#include \ No newline at end of file diff --git a/mem.cpp b/mem.cpp new file mode 100644 index 0000000..d1b9736 --- /dev/null +++ b/mem.cpp @@ -0,0 +1,34 @@ +#include "pch.h" +#include "mem.h" + +void mem::Patch(BYTE* dst, BYTE* src, unsigned int size) +{ + DWORD oldProtect; + VirtualProtect(dst, size, PAGE_EXECUTE_READWRITE, &oldProtect); + memcpy(dst, src, size); + VirtualProtect(dst, size, oldProtect, &oldProtect); +} + +void mem::Nop(BYTE* dst, unsigned int size) +{ + DWORD oldProtect; + VirtualProtect(dst, size, PAGE_EXECUTE_READWRITE, &oldProtect); + memset(dst, 0x90, size); + VirtualProtect(dst, size, oldProtect, &oldProtect); +} + +uintptr_t mem::FindDMAAddy(uintptr_t addr, std::vector offsets) +{ + uintptr_t cAddr = addr; + for (unsigned int i = 0; i < offsets.size(); i++) + { + cAddr = *(uintptr_t*)cAddr; + + // Check if memory is writable (not ?? in cheatengine) + if (IsBadReadPtr((uintptr_t*)cAddr, sizeof(cAddr))) + return 0; + + cAddr += offsets[i]; + } + return cAddr; +} diff --git a/mem.h b/mem.h new file mode 100644 index 0000000..315ec4d --- /dev/null +++ b/mem.h @@ -0,0 +1,10 @@ +#pragma once + +namespace mem +{ + void Patch(BYTE* dst, BYTE* src, unsigned int size); + void Nop(BYTE* dst, unsigned int size); + + uintptr_t FindDMAAddy(uintptr_t ptr, std::vector offsets); +} + diff --git a/pch.cpp b/pch.cpp new file mode 100644 index 0000000..64b7eef --- /dev/null +++ b/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/pch.h b/pch.h new file mode 100644 index 0000000..885d5d6 --- /dev/null +++ b/pch.h @@ -0,0 +1,13 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here +#include "framework.h" + +#endif //PCH_H