Log in

View Full Version : Reading in another process


Seveley
Apr 22, 2009, 03:44 AM
Hi,

I am currently working on a scripting engine and I remembered that when I was young a program exist that could read the object inside any program and modify its content. For example I was able to enable or disable a button in the other application.

I would need this particular hability so my scripting engine can read the application status prior to take an automated action.

So if anyone know anything about pooling information from objects in a given process, I'll be glad to hear about it.

Thank you all in advance

Seveley

P.S. program is in VB .net 2008

Perito
Apr 22, 2009, 09:17 AM
Are you wanting to read the state of a button inside another program and act on that? Are you the one writing the program with the button in it?

Seveley
Apr 22, 2009, 09:27 AM
Are you wanting to read the state of a button inside another program and act on that? Are you the one writing the program with the button in it?

Yes actually the goal is to probe in a windows to read the information inside the other application to take decision before acting on the probed application to fully automate some process. It would be a interpreter that execute a script that tell what to probe and take decision on that info and then act on object on the other app.

Seveley
Apr 22, 2009, 09:29 AM
Sorry forgot to say I'm not the one who wrote the application I want to control.

Perito
Apr 22, 2009, 11:24 AM
Windows tries very hard to isolate one program from another -- it's very different from what happened in Windows 3.1 or earlier. If your program somehow owns the program you want to access, then you can probably accomplish your goal. However, unless that program has already exposed some API to let you see what's going on inside it, I doubt you will be able to do that.

Seveley
Apr 22, 2009, 05:02 PM
OK I get what you mean...

If I do the assumption that lunching the target program from my application creates ownership relation between my application and the target process, am I wrong ?

Perito
Apr 22, 2009, 07:41 PM
Sometimes there is some kind of ownership relation that is generated. I fooled with it once, but it's been a long time and I don't quite remember all of the ins and outs. When you call "CreateProcess" (from the Windows API) to launch the program, you can probably set it up to give you privileges. Then, you might be able to get into the program -- depending on what type it is. If it were a .NET program, you could use reflection to get into it.

Seveley
Apr 23, 2009, 04:29 AM
I read about Reflection it sounds interesting but for portability I don't want to be limited to .NET program. So is there a way to read generic hwnd structure and properties that don't depend on the technology used to create the application ?

Also read about CreateProcess and some forum argue that the System.Diagnostics.Process is equivalent. I already used this class but never saw any privilege parameter. So I'm continuing to look for CreateProcess syntax to get privilege.

Perito
Apr 23, 2009, 05:23 AM
I'm still not sure that CreateProcess will do what you want, but it's where I would start looking. There are some security structures in there, and maybe it will let you have access to the program, though I still don't know how you'll get the information you need.