Valhalla Legends Archive

Programming => General Programming => Topic started by: warz on December 17, 2002, 01:48 PM

Title: Calling functions found in IDA
Post by: warz on December 17, 2002, 01:48 PM
Howdy,

I've been poking around in a few files, file.exe for reference sake, with IDA, and have found a useful function (usefulfunc()). I need to force file.exe to call usefulfunc() whenever I want. It must be called from within file.exe, not outside its memory. Any ideas ?
Title: Re: Calling functions found in IDA
Post by: Noodlez on December 17, 2002, 08:07 PM
hmm.. just
jmp <address> ?
Title: Re: Calling functions found in IDA
Post by: warz on December 17, 2002, 08:19 PM
What about arguments?  :P
Title: Re: Calling functions found in IDA
Post by: n00blar on December 18, 2002, 02:32 AM
push arg
push arg
push arg
call funcaddr
Title: Re: Calling functions found in IDA
Post by: Skywing on December 18, 2002, 08:52 AM
You'll probably want to do this by loading a DLL into the target process.  As for how you'd call the function, that depends on it's calling convention and prototypes.  If you're using the same compiler as the program in question was compiled with, then you'll usually be able to call the function directly from within the language (assuming C/C++) instead of resorting to a inline assembly to make the transition to the foreign code.