Results 1 to 4 of 4
  1. #1
    ninjakinja's Avatar
    Join Date
    Apr 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    Question Calling functions externally

    I understand what I'm asking is much easier done with DLL injection, however I wanted to try something new.

    Okay, so I'm trying to call functions externally (hence the thread title). If I understand correctly, I can accomplish this with CreateRemoteThread. However I don't know how to exactly do this.

    Here's what i'm thinking:

    • In our host process, we create a function that we will inject into the target process
    • Inside that function will contain our instructions that declare and assign to where the function we want to call now that we are inside the target address space.


    Does anyone have an example code that does something similar to this?

  2. #2
    Alainx277's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    60
    Reputation
    10
    Thanks
    10
    My Mood
    Happy
    1. find the function you want to call (address)
    2. createremotethread with that address
    3. ???
    4. profit!
    Remember, if I helped you, leave a thanks.

    I'm 14, if I can do it, you can!

  3. #3
    Nimboso's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    554
    Reputation
    21
    Thanks
    2,635
    Quote Originally Posted by Alainx277 View Post
    1. find the function you want to call (address)
    2. createremotethread with that address
    3. ???
    4. profit!
    You can't add multiple parameters using CreateRemoteThread thread.
    You can define a structure, allocate with VirtualAllocEx and then write the parameters with WriteProcessMemory, then at CreateRemoteThread you pass the address of the structure. This means you have to do code injection, which is just a bit more complicated than DLL injection. Better, DLL injection it's a quicker solution of Code Injection.
    just coppied from a relevant thread on rohitab
    Last edited by Nimboso; 02-20-2017 at 12:38 AM.

  4. #4
    Alainx277's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    60
    Reputation
    10
    Thanks
    10
    My Mood
    Happy
    Quote Originally Posted by Nimboso View Post
    You can't add multiple parameters using CreateRemoteThread thread.

    just coppied from a relevant thread on rohitab
    Yeah, sorry. I forgot that you can only pass one argument. And your solution is also correct, I would recommend a DLL injection over code injection. If you want to know how to do a code injection I recommend this video:
    Remember, if I helped you, leave a thanks.

    I'm 14, if I can do it, you can!

Similar Threads

  1. [C/C++ Tutorial] Calling function pointers without definitions
    By TrollerCoaster in forum Programming Tutorials
    Replies: 4
    Last Post: 05-27-2021, 09:48 PM
  2. [Help] calling function from loaded swf
    By hamid1655 in forum Visual Basic Programming
    Replies: 0
    Last Post: 11-21-2012, 01:06 PM
  3. [Solved] Calling Functions With In Classes From Address
    By hwfhwhfwf in forum C++/C Programming
    Replies: 14
    Last Post: 02-14-2012, 11:28 AM
  4. Calling functions?
    By Void in forum C++/C Programming
    Replies: 6
    Last Post: 11-29-2009, 09:34 AM
  5. [Tutorial(C++)]How to call functions within another process
    By radnomguywfq3 in forum Programming Tutorials
    Replies: 4
    Last Post: 07-08-2008, 07:33 PM