Coder Social home page Coder Social logo

btmemory-memory-patch-library-'s Introduction

BTMemory

x86-x64 Memory library ( patches, NOPs, hooks )

uintptr_t FindSignature(const char* moduleName, const void* signatureString, const char* mask);
uintptr_t FindDMAAddy(uintptr_t baseAddress, std::vector<unsigned int> offsets);
void UnpatchAll();

BTMemory::Patcher

CPatch* BTMemory::Patcher::Patch(uintptr_t destination, const void* patchBytes, size_t patchSize, bool isSimple = false);
CPatch* BTMemory::Patcher::Nop(uintptr_t destination, size_t patchSize, bool isSimple = false);
void BTMemory::Patcher::CPatch::ApplyPatch();
void BTMemory::Patcher::CPatch::RestorePatch();
void BTMemory::Patcher::CPatch::DestroyPatch();

BTMemory::VMTHooker

BTMemory::VMTHooker::CVMTHook* BTMemory::VMTHooker::Hook(void *pVMT, int iMethodIndex, void *fnHook);
void *BTMemory::VMTHooker::CVMTHook::ApplyHook();
void *BTMemory::VMTHooker::CVMTHook::DestroyHook();

BTMemory::Hooker

CHook* BTMemory::Hooker::Hook(void* fnToHook, void* fnHookCallback, HookType hookType, size_t hookSize = 5);
void* BTMemory::Hooker::CHook::ApplyHook();
void BTMemory::Hooker::CHook::DestroyHook();

Example:

#include "BTMemory.h"


// Assault Cube no recoil
DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
	switch (dwReason) {
	case DLL_PROCESS_ATTACH:
		static auto* noRecoilNop = BTMemory::Patcher::Nop((DWORD)GetModuleHandle(NULL) + 0x63786, 10); // nop the function call
		// or
		//static BTMemory::CPatch* noRecoilPatch = BTMemory::Patch((DWORD)GetModuleHandle(NULL) + 0x62020, "\xC2\x80\x00", 3); // "ret 08" to prevent execution of function
		noRecoilNop->ApplyPatch();

	
		break;
	case DLL_PROCESS_DETACH:
		BTMemory::UnpatchAll(); // restore original bytes and deletes allocated memory for them
		break;
	}
	return TRUE;
}

Other examples at main.cpp

btmemory-memory-patch-library-'s People

Contributors

bottomtext228 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.