Thread: How to override a function in binary from outside?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    6

    Question How to override a function in binary from outside?

    Hi all,

    I am working on a problem that goes as follows:

    GIVEN:
    I have the executable file ready with me. I know the source code has a function named f(). I know the entire signature of the function. However, I do not have the source code available with me. I donot have any other header file etc with me either.

    PROBLEM:
    Now, I need to override this function f() with my own function f(). How can I achieve that?

    Also, main function exists in the existing executable. So, I do not intend to use this executable as a library and then call all the functions in the new code.

    Any pointers on this would be welcome.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    No idea - this one's closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM

Tags for this Thread