Code Monkey home page Code Monkey logo

quickdllproxy's Introduction

QuickDllProxy

A header-only DLL proxy stub generation library built with C++20. No more copy-pasting 100s of DLL exports. No more guessing function parameters.

For a somewhat detailed breakdown please read DllProxy.h's header comments or check out the implementation.

Configuration

#define DLL_PROXY_EXPORT_LISTING_FILE "ExportListing.inc"
// Required setting to define the list of proxied exports for this library.

#define DLL_PROXY_TLS_CALLBACK_AUTOINIT
// Optional setting to create a TLS callback that runs DllProxy::Initialize.

#define DLL_PROXY_CHECK_MISSING_EXPORTS
// Optional setting to enforce all real exports are found during DllProxy::Initialize. If disabled, unresolved
// export errors will be deferred until proxy functions are invoked.

#define DLL_PROXY_LIBRARY_RESOLVER_CALLBACK MyExampleLibraryResolver
// Optional setting to define a custom function that resolves a DLL's HMODULE. Signature identical to
// DllProxy::DefaultLibraryResolverCallback.

#define DLL_PROXY_EXPORT_RESOLVER_CALLBACK MyExampleExportResolver
// Optional setting to define a custom function that resolves a DLL's exported function. Signature identical to 
// DllProxy::DefaultExportResolverCallback.

#define DLL_PROXY_EXCEPTION_CALLBACK MyExampleExceptionCallback
// Optional setting to define a custom function that's called on error. Signature identical to
// DllProxy::DefaultExceptionCallback.

Example Usage

// MySpecialDllFile.cpp
#define DLL_PROXY_EXPORT_LISTING_FILE "ExportListing.inc"   // List of exported functions
#define DLL_PROXY_TLS_CALLBACK_AUTOINIT                     // Enable automatic initialization TLS callback
#define DLL_PROXY_DECLARE_IMPLEMENTATION                    // Define the whole implementation
#include <QuickDllProxy/DllProxy.h>
// ExportListing.inc
DECLARE_PROXIED_LIBRARY("winhttp.dll")
DECLARE_PROXIED_API_ORDINAL("WinHttpAddRequestHeaders", 6)
DECLARE_PROXIED_API_ORDINAL("WinHttpSetSecureLegacyServersAppCompat", 1)
DECLARE_PROXIED_API("TestFunction_1110")

Demo Projects

Known Limitations

  • Exported global variables aren't supported.
  • Original exports are resolved at runtime within a TLS callback or DllMain(). In rare cases this is too late to be useful.
  • Control flow guard targets aren't valid until after original export resolution.

License

quickdllproxy's People

Contributors

nukem9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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