Page 1 of 1

How to run a process from an other probgram.

Posted: Sat Apr 23, 2005 1:13 am
by Holdlang
How can i run a process from an other program? I have the memory adress where the process is starting, but when i try to CallFuntionFast($adress) it, i get an acces vioalation error.

i try this:

Code: Select all

Procedure VirtualProtectExMY(hwnd, adress, size.l)
  CallFunction (#PROCESS32LIB, "VirtualProtectEx", hwnd, adress, size.l, 128, @OrigMode)

EndProcedure

pHandle = OpenProcess_(#PROCESS_ALL_ACCESS, #False, pid)
ReadProcessMemory_(pHandle, $40107D,lives,1,0)
PrintN("lives:" + Hex(Asc(lives))) ;It works i get the firs byte of the process (push....)
VirtualProtectExMY(pHandle, $40107D, 24) ;I try to set read,write,exec access to the process in the other program
CallFunctionFast($40107D) ;and here is where it dies....

any idea pls? :(

Holdláng

Posted: Sat Apr 23, 2005 5:31 am
by El_Choni
Maybe the other process function needs some parameters in the stack?

Code: Select all

CallFunctionFast($40107D, arg1, arg2...)
Also, make sure that you only need those 24 bytes (or a memory page) of the other process' memory.

BTW, how do you know the other process' function always resides at $40107D?

Posted: Sat Apr 23, 2005 7:41 am
by Holdlang
El_Choni wrote:Maybe the other process function needs some parameters in the stack?

Code: Select all

CallFunctionFast($40107D, arg1, arg2...)
Also, make sure that you only need those 24 bytes (or a memory page) of the other process' memory.
It don't need. I call this process from test.exe, which already running:

Code: Select all

Procedure test()
   PrintN("Test ok!")
EndProccedure
The other program which is use the CallFunctionFast is named to fastcall.exe.
BTW, how do you know the other process' function always resides at $40107D?
Yes this is the problem. I searched the addres with tsearch but the problem is i think that it is in an other program(now in 1.exe), and fastcall can only call from the program which call it.
Like some process in the same source: CallFunctionFast(@test)

So i'm now wery upsett. Any idea how to access and run a process from an other program?

I need something like this:
FastCall(procid,_function_,[param1,param2,...])

Holdláng