FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

force the eip() function to never be inlined under x64 in order to av… · a10ncoder/ReflectiveDLLInjection@3cadc42 · GitHub

Repository navigation

Commit 3cadc42

Browse files
committed
force the eip() function to never be inlined under x64 in order to avoid an error being introduced when some unexpected compiler flags are being used. Now the compiler flags used (/O1, /O2, ...) shouldnt pose any problem
1 parent b79bb55 commit 3cadc42

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎dll/src/ReflectiveLoader.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ HINSTANCE hAppInstance = NULL;
3232
//===============================================================================================//
3333
#ifdef _WIN64
3434
#pragma intrinsic( _ReturnAddress )
35-
UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
35+
// This function can not be inlined by the compiler or we will not get the address we expect. Ideally
36+
// this code will be compiled with the /O2 and /Ob1 switches. Bonus points if we could take advantage of
37+
// RIP relative addressing in this instance but I dont believe we can do so with the compiler intrinsics
38+
// available (and no inline asm available under x64).
39+
__declspec(noinline) UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
3640
#endif
3741
//===============================================================================================//
3842

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL