How to run a process from an other probgram.

Just starting out? Need help? Post your questions and find answers here.
Holdlang
New User
New User
Posts: 4
Joined: Wed Mar 30, 2005 4:44 pm

How to run a process from an other probgram.

Post 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
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post 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?
El_Choni
Holdlang
New User
New User
Posts: 4
Joined: Wed Mar 30, 2005 4:44 pm

Post 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
Post Reply