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

  • Home
  • SEARCH
  • 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 8736935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:24:32+00:00 2026-06-13T10:24:32+00:00

I have a memory address, its the memory address of a function in another

  • 0

I have a memory address, its the memory address of a function in another program (one of its dlls). I am already loaded into the program via DLL injection. I already have the bass address, and the actual location of the function each time the program loads. So, this is not an issue.

I want to just simply hook that location, and grab the variables. I know the function’s pseudocode. So this is not an issue. OR another approach that would be great is doing a break point at that memory location and grab the debug registers.

I can not find any clear-cut examples of this. I also do not have the “name” of the function, I just have the memory address. Is there any way to work with just a memory address? Most, if not all the examples have you use the name of the function, which I do not have.

If anyone could point me into the right direction so I can accomplish this task, I would greatly appreciate it. It also might help a lot of other people who may have the same question.

Edit: I should also mention that Id rather not overload my program with someone else code, I really just want the barebones, much like a basic car with roll-up windows. No luxury packages for me please.

  • 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-13T10:24:33+00:00Added an answer on June 13, 2026 at 10:24 am

    You missed the most important part, is this for 32 or 64 bit code? In any case, the code project has a good run-down and lib here that covers both.

    If you want to do this “old-school”, then it can be done quite simply:

    firstly, you need to find the virtual address of the function you want to hook (due to ASLR, you should never rely on it being in the same place), this is generally done with RVA + module base load address for function that are not exported, for exported functions, you can use GetProcAddress.

    From there, the type hook depends on what you want to accomplish, in your case, there are two methods:

    1. patch a jump/call out to your function in the target function’ prologue
    2. patch all call sites to the function you want to hook, redirecting to your function

    the first is simpler, but messy as it generally involves some inline assembly (unless you are hooking a /HOTPATCH binary or you just want to stub it), the second is much cleaner, but requires a bit of work with a debugger.

    The function you’ll jump out to should have the same parameters and calling convention (ABI) as the function you are hooking, this function is where you can capture the passed parameters, manipulate them, filter calls or whatever you are after.

    for both, you need a way to write some assembly to do the patching, under windows, WriteProcessMemory is your first port of call (note: you require RWX permissions to do this, hence the calls to VirtualProtect), this is a little utility function that creates a 32bit relative call or jump (depending on the opcode passed as eType)

    #pragma pack(1)
    struct patch_t
    {
        BYTE nPatchType;
        DWORD dwAddress;
    };
    #pragma pack()
    
    BOOL ApplyPatch(BYTE eType, DWORD dwAddress, const void* pTarget)
    {
        DWORD dwOldValue, dwTemp;
        patch_t pWrite =
        {
            eType,
            (DWORD)pTarget - (dwAddress + sizeof(DWORD) + sizeof(BYTE))
        };
    
        VirtualProtect((LPVOID)dwAddress,sizeof(DWORD),PAGE_EXECUTE_READWRITE,&dwOldValue);
        BOOL bSuccess = WriteProcessMemory(GetCurrentProcess(),(LPVOID)dwAddress,&pWrite,sizeof(pWrite),NULL);
        VirtualProtect((LPVOID)dwAddress,sizeof(DWORD),dwOldValue,&dwTemp);
        return bSuccess;
    }
    

    This function works great for method 2, but for method 1, you’ll need to jump to an intermediary assembly trampoline to restore any code that the patch overwrote before returning to the original function, this gets very tedious, which is why its better to just use an existing and tested library.

    From the sounds of it, using method 1 and patching a jump over the prologue of your target function will do what you need, as it seems you don’t care about executing the function you patched.

    (there is a third method using HW breakpoints, but this is very brittle, and can become problematic, as you are limited to 4 HW breakpoints).

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

Sidebar

Related Questions

I have written my own my_malloc() function that manages its own physical memory. In
i have the memory address of certain register(the address LCDCW1 is C000). c codes:
I have a memory leak on one of the part of my node.js application.
I have a memory block that is divided into a series of location that
I have a program that call a function with undefined arguments, like this: #include
I have an issue where i call a function on an object in one
I have to program in Assembly (MIPS) a function to return the max value
Two Windows processes have memory mapped the same shared file. If the file consists
Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I
I am trying to load an image in memory but might have memory issues

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.