Git Product home page Git Product logo

reloadlibrary's Introduction

ReloadLibrary

ReloadLibrary is a quick-and-dirty anti-hook library. Given the name of a .dll, it will make a temporary copy of the .dll on disk, load the copy, and overwrite the import address table with corresponding function addresses in the cloned library. Examples:

// reload kernel32.dll and replace imports in the main module
ReloadLibrary("kernel32.dll");

// reload ntdll and replace imports in kernel32.dll
ReloadLibrary("ntdll.dll", GetModuleHandleA("kernel32.dll"));

A call to ReloadLibrary() will return 0 on failure, otherwise returning the number of function pointers replaced in the import address table. On success, you're done! Since the code replaces function pointers in the import address table, everything will happen transparently; just code as normal.

Development

The code is C++ with project files for Visual Studio 2017. This is a quick and dirty PoC and I do not intend to maintain or improve it. It is simple to use, you can import the library or simply copy the code from ReloadLibrary.cpp into your project.

I have done basically no testing beyond making sure the concept works, and there are likely various edge-cases which can be handled.

A known issue is that clone libraries will be left in temp, since they cannot be deleted until the process dies. There are various ways to fix this; I would recommend using the RunOnce registry key to set up a call to del the file upon the next login.

reloadlibrary's People

Contributors

nickcano 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.