Jump to content
Tuts 4 You

Redirecting Calls In Another Exe to Custom DLL Function


Patrickssj6

Recommended Posts

Patrickssj6

Since my topic got locked on the MASM forums because this might be a malicious attempt..I'll try it here:

I hope the title says it all: I want to detour a function in another process after injecting my dll and then detour that function to a function inside my dll. The detours library do it for C++ but how do I it in MASM?

I don't see anything logic at first sight when looking at the pcode bytes...I took this from the detours lib can this be used (after translating to MASM of course) to redirect the call?

inline PBYTE DetourGenCall(PBYTE pbCode, PBYTE pbJmpDst, PBYTE pbJmpSrc = 0)
{
if (pbJmpSrc == 0) {
pbJmpSrc = pbCode;
}
*pbCode++ = 0xE8;
*((INT32*&)pbCode)++ = pbJmpDst - (pbJmpSrc + 5);
return pbCode;
}

Thanks :D

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...