Hi all,
I remember having found on the net a long time ago something quite funny. It was a true Win32 app in COM file structure. Not talking about the modern COM stuff but the old DOS Com file. Not talking either about what has been used in the demo scene to pack PE files into COM files. Plain old Com file running in Windows! ;)

I wanted to have a look again at the source but unfortunately can't find it anymore. Had a search on Google and here but didn't manage to find it again.

Has anybody in here still a copy of that source? Would be very kind of you, I you have it, to post it here.

Thank you very much.

Why do I need it? Well, I'm very curious and I think it's nice to think about a old Com file able to "host" a modern Win32 app ;)

Posted on 2003-02-20 18:02:59 by KaSt

A COM file is a pure memory image that has no header at all and is loaded by the system loader at 100 hex with a DOS PSP in front of it written by the operating system.

A PE 32 bit file for Windows must have the basic section information required to load it so what you are after is simply not possible.

What both DOS COM files and 32 bit PE files have in common is that they are loaded into a single segment, a DOS COM file can only fit into a DOS 16 bit segment where a PE file can theoretically be any size up to the limit of a 32 bit segment even though in practice, it is restricted to 2 gig in size.


Posted on 2003-02-20 23:27:14 by hutch--
I tried to rename windows program calc.exe to calc.com -> works also :) (at least with Win95)
Posted on 2003-02-21 03:08:55 by beaster
It works for all PE files.:stupid:
Posted on 2003-02-21 06:42:06 by roticv
That worked with old MZ exes as well. I think COMMAND.COM of Win9x is such an EXE file.
Posted on 2003-02-21 06:46:11 by japheth
Thanks Hutch for your comments but believe me the source I had found made it possible.
Not sure if I remember well but the Header part had been manually put inside the source code, has once assembled & linked, it would have been wrote on disk the way PE files are structured.
I'm learning Win32asm (and plain Asm as well) now, so my explanation can contain lot of mistakes but the example I had found worked.

It used a trick, for sure, as COM and PE files have completely different structure. The COM file produced was actually a plain PE file but the source was in COM style.

If I manage to put manually the required PE header at the beginning of my source, once compiled should give the same result as if I had compiled my Win32Asm proggy in EXE style, right?

At least this is what the COM file example I had found was doing and this is what I'm looking to find again.

Thanks for your help,

Posted on 2003-02-21 06:49:53 by KaSt
Sounds like something Sven Schreiber did way back when. It's been a while since I looked at his WALK package, so I may be misremembering it.
Posted on 2003-02-22 00:28:35 by tenkey

If you could post an example of Win32 COM file? :)
Posted on 2003-02-22 06:19:27 by Vortex
I've seen COM files that magically gets transformed into Win32 PE:s at runtime but you can't make a PE file look like a COM file. The PE files must follow the rules for the PE format (ie at least 512 byte per section etc.)
Posted on 2003-02-23 12:27:29 by gliptic
I agree with you that what I'm talking about seems impossible but I remember having seen it, had the source code on my screen. Only prob, can't find it back. :(

Hoped someone in here had it in his "code museum"

Thanks for your help,

Posted on 2003-02-24 18:28:07 by KaSt