Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:46:23+00:00 2026-06-17T06:46:23+00:00

I was reading up on various things on CodeProject and I found this article:

  • 0

I was reading up on various things on CodeProject and I found this article: http://www.codeproject.com/Articles/29527/Reverse-Engineering-and-Function-Calling-by-Addres

So what I did was I created an injector and a DLL, and grabbed the sample executable file. It basically outputs this when you press F11:
https://i.stack.imgur.com/YIygV.jpg

So I followed the entire tutorial, but the thing is that the address used in the DLL is always changing. This one to be specific:

pFunctionAddress pMySecretFunction = (pFunctionAddress)(0x004113C0);

In his tutorial the address for the function is 0x004113C0. In mine it is something else, and I take the one I have and use it. It works perfectly, but when I close the executable and open it, it won’t work anymore, and OllyDbg shows that the address is a totally new one.

So I researched a bit and I started adding breakpoints with OllyDbg. I found out that the address is always going to be:

main + 4C

Where I guess “main” is the main module of these executable. How can I find this address to the function always? Because it changes all the time and I am clueless at this point. In this article I read it doesn’t go through what happens when the executable is re-opened, and I’ve spent 5 hours trying to find a solution.

Thanks in advance!

EDIT:

Huge thanks to everyone. Thanks to mfc especially, I have finally figured it out! What I ended up doing was whenever I hit DLL_PROCESS_ATTACH, I set a global HMODULE to the address of the executable, like this:

HMODULE g_hExeModule;
g_hExeModule = GetModuleHandle(L"TutExample.exe");

And after a few tests it seems like the function address is always the address of the executable + 0x11014, so in the call I just do:

pFunctionAddress pMySecretFunction = (pFunctionAddress)((DWORD)g_hExeModule + 0x11014);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:46:24+00:00Added an answer on June 17, 2026 at 6:46 am

    I cannot edit my post nor add any remark, so I have to post this as a new answer.

    Your result:

    Exe loaded at: 00000000 (wrong, probably: 00BE0000 and offset is: 00001005)
    Target function at: 00BE1005
    Exe loaded at: 00000000 (wrong, probably: 01230000 and offset is: 00001005)
    Target function at: 01231005
    Exe loaded at: 00000000 (wrong, probably: 012A0000 and offset is: 00001005)
    Target function at: 012A1005
    

    Please check the name of your compiled exe, is it “TutExample.exe” ? if not, change it to the exact name in the call to GetModuleHandle.

    The value of “00000000” indicates that the GetModuleHandle fails because the name “TutExample.exe” is not found in the current memory space.

    The address of target function seems ok. Just minus this address with the address of loaded exe and you will get the offset inside the exe memory layout.

    You can do this same math inside your injected dll to alway tracks the target function address correctly no matter how the os loads the exe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading all sorts of Stackoverflow postings and various documentation including some on http://code.google.com/p/google-api-java-client/
I spent all of yesterday reading various articles/tutorials on Hibernate and although I am
I see this referenced a lot: http://ajaxify.com/run/crossframe/ And I noticed now it's no longer
I've been reading through a couple of questions on here and various articles on
can anyone help? I have reading various blogs and it appears to include i18n
The Kindle has lit a personal interest in reading my various content on it,
after reading the cookbook and various Q&A here I am still a bit confused
Reading manual about Sling http://sling.apache.org/site/46-line-blog.html added folder blog and blog.html to destination: \launchpad\content\src\main\resources\content\ but
Reading the Scala by Example book and there is this example when Martin explains
I've been reading things here and there for a while now about using an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.