Skip to content

Instantly share code, notes, and snippets.

@p0shkatz
Created July 18, 2022 18:48
Show Gist options
  • Save p0shkatz/778cdefa7184300cd0d60c284eb44d44 to your computer and use it in GitHub Desktop.
Save p0shkatz/778cdefa7184300cd0d60c284eb44d44 to your computer and use it in GitHub Desktop.
Proxy DLL uses exports from target DLL
#include "pch.h"
#include <windows.h>
#include <string>
#include <iostream>
#pragma comment(linker, "/export:FunctionName1=C:\\\\path\\\\to\\\\legitDLL.FunctionName1")
#pragma comment(linker, "/export:FunctionName2=C:\\\\path\\\\to\\\\legitDLL.FunctionName2")
#pragma comment(linker, "/export:FunctionName3=C:\\\\path\\\\to\\\\legitDLL.FunctionName3")
#pragma comment(linker, "/export:FunctionName4=C:\\\\path\\\\to\\\\legitDLL.FunctionName4")
#pragma comment(linker, "/export:FunctionName5=C:\\\\path\\\\to\\\\legitDLL.FunctionName5")
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// do stuff
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment