Results 1 to 6 of 6
  1. #1
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh

    Fetching in a new function into program's memory and calling it

    Alright so I had this idea: I will allocate a space in the memory and will write into it a function, can I call that function later on using assembly?
    Like:
    Code:
    DWORD ptr = (DWORD)malloc( <size> );
    memcpy(&ptr, <function>, <size>);
    __asm{
        mov eax, ptr
        call eax
    };
    I'm a total noob on C++ (especially ASM), so is this possible?

  2. #2
    Knochove's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Location
    :(
    Posts
    48
    Reputation
    10
    Thanks
    11
    My Mood
    Tired
    and how are you going to calculate the size of a function? it's not something you can just do by doing

    Code:
    sizeof(&function);
    Also you can't just directly copy a function from one place to another using :

    Code:
    memcpy(&ptr, <function>, <size>);
    maybe a combination of malloc + function pointers could work, but I'm unsure.

    And judging from the fact that you said "I'm a total noob on C++ (especially ASM), so is this possible?" I'm not sure you'll be able to implement this as this allows deeper knowledge of how things work (eg. stack, what happens during function calls).
    Last edited by Knochove; 01-26-2015 at 04:28 PM.

  3. #3
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    1.) Fix memory access to allow +Execute ( [ malloc -> HeapAlloc ] only allows read/write access )
    2.) Fix RVAs in function and replace explicit addresses dynamically.

    That's how I did it.

  4. #4
    **_seals_**'s Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    1
    Quote Originally Posted by Hitokiri~ View Post
    1.) Fix memory access to allow +Execute ( [ malloc -> HeapAlloc ] only allows read/write access )
    2.) Fix RVAs in function and replace explicit addresses dynamically.

    That's how I did it.
    This looks cool, will try to work on something like this.

    - - - Updated - - -

    Quote Originally Posted by Knochove View Post
    and how are you going to calculate the size of a function? it's not something you can just do by doing

    Code:
    sizeof(&function);
    Also you can't just directly copy a function from one place to another using :

    Code:
    memcpy(&ptr, <function>, <size>);
    maybe a combination of malloc + function pointers could work, but I'm unsure.

    And judging from the fact that you said "I'm a total noob on C++ (especially ASM), so is this possible?" I'm not sure you'll be able to implement this as this allows deeper knowledge of how things work (eg. stack, what happens during function calls).
    By that I meant that I don't have enough experience with native languages and low level programming, but I of course know about stack and heap and what happens during a function call. Yes I do not have enough to perform this task all by myself but hey, we can all learn.

  5. The Following User Says Thank You to **_seals_** For This Useful Post:

    Knochove (02-09-2015)

  6. #5
    bloodx_'s Avatar
    Join Date
    Feb 2015
    Gender
    male
    Location
    Germany
    Posts
    92
    Reputation
    138
    Thanks
    1,432
    My Mood
    Tired
    why would you do this ?

    Dont get the sense of that..

  7. #6
    Hindi93's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    13
    Reputation
    10
    Thanks
    1
    What you are looking for is called "Function Hooking" or "Detouring", google that and you'll find it.

Similar Threads

  1. [Release] New Function PUB ([[WallClimb&MountainClimb or jus call it SPIDERMAN SH*T!]])
    By xflick13 in forum WarRock Hack Source Code
    Replies: 5
    Last Post: 01-26-2012, 12:15 PM
  2. New GT Modding Program
    By benl in forum XBOX Customizing & Modding
    Replies: 6
    Last Post: 07-03-2010, 02:57 AM
  3. [Release] Dawm Nomenu v1.5 Undetected 3-2-2010..add new function
    By maxpayne in forum WarRock - International Hacks
    Replies: 84
    Last Post: 03-06-2010, 11:59 AM
  4. [Release] Dawm NewNomenu hack undetected v1.2 25-2-2010 added new functions:)
    By maxpayne in forum WarRock - International Hacks
    Replies: 60
    Last Post: 02-25-2010, 01:49 PM
  5. [New] Going into 3rd Person without a mod
    By vomer in forum WarRock - International Hacks
    Replies: 16
    Last Post: 08-06-2006, 12:36 AM