News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

execute another application from program

Started by white scorpion, January 28, 2005, 11:56:47 PM

Previous topic - Next topic

Vortex

Hi joe,

Welcome to the forum.

Here is a very nice example from Chetnik, it loads a test PE to the memory, fixes the import table and executes the image loaded to the memory.

[attachment deleted by admin]

joe


Vortex

Hi joe,

I modified my extractor demo to use Chetnik's pe-mem technique. This time, the main executable PEmem.exe "extracts" the demo file dialog.exe to the memory and then this demo app is executed.

[attachment deleted by admin]

Mark Jones

Sweet! Now that's only a step away from having LZMA compression. :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Vortex

Hi Mark,

Thanks for the compression idea :U

This time, the embedded application is decompressed to memory and then the main application executes it using Chetnik's technique.

Thanks to Jeremy Collake for his JCALG1 compression library :U

[attachment deleted by admin]

joe

This is unreal. I understand only 1/2 of this, but it's OK. I did know many new thinks from this.
There are still some problem:
1. it's fuctional only for relocable exe (I know, this isn't problem move main routine to the high memory & load new process at the adress 400000h)
2. new process isn't independent to the loader & loader can't to be end after new start

Vortex

Hi joe,

As you said, creating a new process from the embedded application might be another technical problem.

Peterpan

Quote from: joe on May 29, 2005, 08:23:04 AM
There are still some problem:
1. it's fuctional only for relocable exe (I know, this isn't problem move main routine to the high memory & load new process at the adress 400000h)

Hi all,

I don't get on how to do that  :dazzled:
I played around with an exe file that has a Relocations Stripped. the code from Vortex (Chetnik) always crashed.

Anyone have any idea or hints ?
Thanks

Vortex

Hi Peterpan,

Did you build your child application with the linker option/FIXED:NO ?


link /SUBSYSTEM:WINDOWS /FIXED:NO objfile.obj

Peterpan

Hi Vortex,

Thanks for replying :)

I built using the included batch file (makec.bat, makecf.bat, makef.bat). All crashed. The test exe is just a small program showing only a blank window, built from HLL (such as VB). It always crashed on do_relocation proc.

I have also tried to skip relocation. Same results


Update:
Sorry, I think I missed something. Did you mean the code cannot be use for a child exe that is built from another language ?

Vortex

Hi Peterpan,

QuoteSorry, I think I missed something. Did you mean the code cannot be use for a child exe that is built from another language ?

Compared to asm and C/C++ ,The structure of VB executables are different. If I remember well, they are named as p-code.

Peterpan

Quote from: Vortex on May 30, 2005, 07:28:31 PM
Compared to asm and C/C++ ,The structure of VB executables are different. If I remember well, they are named as p-code.

Vortex,

Yes. I'm aware of that. But VB can also compile to Native-Code. This is what I used. The only different is the exe doesn't have a relocation table (Relocations Stripped). Anyway, do you have any idea/hints/links how can we change the code to run the this kind of exe ?

Vortex

Hi Peterpan,

Sorry, I don't know how to do that. Maybe a VB expert can help you about that topic.

Peterpan

Quote from: Vortex on May 30, 2005, 08:33:15 PM
Maybe a VB expert can help you about that topic.

Hi Vortex,

I think you got me wrong. What I meant was I'm not trying to change the VB.exe, but changing the code you posted so it can run the exe from another languange. Maybe I'm asking too much  :green  :red

Well, thanks for posting the code anyway  :U

Vortex

Hi Peterpan,

OK, now if I understood you correctly, you would like to run an embedded application from your VB executable, is that right? Maybe, you need to do some inline asm trick in VB, you need to search the board about this topic.

Please feel free to post all your questions, I am glad if I am able to help you.