I imagine that if there is no application program loader for 32 bit support with NE/LE formats in 32 bit windows, then they are not supported in that manner.

It is correct to say that PE is the native format for 32 bit windows and while NE and LE will run in the 16 bit subsystems, they will not do the same things.

Regards,

hutch@movsd.com
Posted on 2002-03-03 15:38:30 by hutch--

I imagine that if there is no application program loader for 32 bit support with
NE/LE formats in 32 bit windows, then they are not supported in that manner.

I didn't say they were.


It is correct to say that PE is the native format for 32 bit windows and while
NE and LE will run in the 16 bit subsystems, they will not do the same things.

I didn't say that win32 has support for LE files... win9x does, but only
as VXDs (and these can contain both 16 and 32bit code). What I reacted to
was:


do not have the capacity to handle 32 bit flat memory model code.

Which *is* wrong, as the 32bit dos extended LE files from watcom
indeed does run 32bit flat memory model. That's also the reason for
the dos extender name, dos4gw.exe ... 4g as in 4gb (flat) address
space, w as watcom.

Peace.
Posted on 2002-03-03 16:12:16 by f0dder
I think there is only one solution, send a letter to Bill Gates and Steve Ballmer saying,

"Hey guys, you have it all wrong again, I WANNA run 32 bit flat memory model LE and NE code in 32 bit windows and this @#*&%^ crapheap of an OS will not do it."

I guess that if all the complaints about windows were printed on paper and put in a pile, we would not need to send man to the moon, they could just climb the paper mountain. :tongue:

Regards,

hutch@movsd.com
Posted on 2002-03-03 16:21:02 by hutch--
I weren't complaining, just stating the LE in fact does have the
capacity to contain 32bit flat code. PE is a fine format for win32
anyway.

Oh and btw if I want to, I can run 32bit flat LEs under win32...
writing a loader for the format is not too bad.
Posted on 2002-03-03 16:26:09 by f0dder

With the ms linker you can use /MERGE to collapse all the sections.
Don't forget using /SECTION:<whatever>,rwe to make your section
read/write/execute.


Thx f0dder, that was helpful. Now I got it 1024 bytes.. do you think I can make it smaller, maybe tweaking directly the PE headers? (I know it will be >512 bytes anyway).

Greets,
Maverick
Posted on 2002-03-03 16:42:27 by Maverick
Maverick,

Unless you need to have writable data in a test piece like this, avoiding the .DATA section will help to keep the size down. You can write read only string data to the code section easily and if you want to write to it, use the linker options that f0dder mentioned.

f0dder,

======
peace
======

Sure but a "piece on the side" is more fun, especially when its a redhead. :tongue:

Regards,

hutch@movsd.com
Posted on 2002-03-03 20:04:29 by hutch--
Here is a small WinXP EXE - 932 bytes by upi/throb
The source of the code is the Hugi Disk Mag 24
Posted on 2002-03-03 20:12:53 by bitRAKE
RAKEY: Thx pal, that's just what I needed.

Hutch: I sure already knew that, thanks anyway.

Greets,
Maverick
Posted on 2002-03-04 03:56:37 by Maverick
Fodder,
If you can simply write a loader to use LE file under win32, then you could just as easily whip up a custom minimalist file format, write a converter and a loader, and the entire hoopla over the minimun executable size would be all that much more wasted keystrokes. Heck, while we're at it, I demand we all adopt a win32 .com file format (no...not COMponent...) :)
Posted on 2002-03-04 04:19:19 by Canite
Maverick,

============
Hutch: I sure already knew that, thanks anyway.
============

Which idea, avoiding the .DATA section or the virtue of redheads ? :tongue:

Regards,

hutch@movsd.com
Posted on 2002-03-04 04:55:32 by hutch--
The former ;)

Greets,
Maverick
Posted on 2002-03-04 05:19:54 by Maverick

If you can simply write a loader to use LE file under win32, then you could just as easily
whip up a custom minimalist file format, write a converter and a loader, and the entire
hoopla over the minimun executable size would be all that much more wasted keystrokes.

Sure, but why bother? PE files can be smaller than 4k, which is the usual minimum cluster
size. PE files usually have filealign of 512 or 4096, so again there wont be wasted space
this way. It's also a pretty flexible format... so while it's quite possible to write your
own file format, and not too hard, I haven't got a reason to do so :).


Heck, while we're at it, I demand we all adopt a win32 .com file format (no...not COMponent...)

What would the use of this be? How would you handle things like DLLs? I suppose it could
be useful for very quickly testing out "stuff", but... it's not like it's a lot of work
to use a .asm template instead ;)
Posted on 2002-03-04 10:25:27 by f0dder
Hi All,

From examining some PE EXE files, I got the impression that when an EXE is loaded in Windows, also the Dos stub gets loaded. Is this true?

I thought so because when you stub a big Dos EXE then all the RVA's, code entry point, etc.. of the PE will be incremented/translated of the same amount of the Dos EXE size.

Can anybody confirm on this, please?

Greets,
Maverick
Posted on 2002-03-05 04:15:39 by Maverick
Maverick,

PE is a bit sloppy here, it loads the dos MZ header, PE header and the section data, even though it only gets used once. You can actually write data to the address specified in hInstance and overwrite it if you like.

Regards,

hutch@movsd.com
Posted on 2002-03-05 04:20:45 by hutch--
Hi Hutch,
But other than the Dos MZ header, does it "load" also the Dos code itself?

Greets,
Mav
Posted on 2002-03-05 04:23:19 by Maverick
Maverick, the PE loader works via File Mapping. While the entire
exe is mapped, only the used parts will be loaded. Yeah, the entire
MZ ought to be available in memory space.
Posted on 2002-03-05 06:10:28 by f0dder