In the Optional Header of any PE executables there is:

68 DWORD SizeOfHeapReserve;
6C DWORD SizeOfHeapCommit;

To what specific heap does this refer, exactly?

---

Also, I'd like to add an icon to my hand-written PE executable.
I ~know I've to add a icon resource section.

Could anybody go more in detail, please?
Posted on 2002-05-29 05:57:49 by Maverick
The heap settings are, I believe, for the process-default heap.
As for icons... eeek, I really dislike the PE resource section :).
Posted on 2002-05-29 06:04:08 by f0dder

Also, I'd like to add an icon to my hand-written PE executable.
I ~know I've to add a icon resource section.

Could anybody go more in detail, please?


you can try to compile the same program with and
without icon and see the differences ...

or check fasm macros from resource.inc
http://fasm.metro-nt.pl

btw, are you trying to make smaller programs
by hand-written PEs ?

TBD
Posted on 2002-05-29 06:23:00 by TBD
According to msdn :
SizeOfHeapReserve
The number of bytes to reserve for the local heap.
SizeOfHeapCommit
The number of bytes to commit for the local heap.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/imagehlp_5euq.asp
Posted on 2002-05-29 06:24:03 by JCP
as for the resources you have to add the VA of your
res section in the datadirectory (3rd entry) at first.
resources are the hardest part of a pe i think, i
simply hate it... if you managed to do it, it would be
very cool to see your results :) ah, i attached some
pe-resource reference...
Posted on 2002-05-29 06:33:09 by mob
Thank you all.

So, if I got it correctly, I can set those two heap members to 0.. since the only Win32 heap functions that I use are VirtualXXX() anyway.
Right?

TBD: As a side effect yes, but the mother reason is because I've got my own compiler.

Readiosys: Thanks for the link.. I always forget that MSDN exists. :rolleyes:

Many thanks to f0dder, mob and bomb01 too.
Posted on 2002-05-29 06:43:30 by Maverick
Microsoft's official document on this subject

Win32 Binary Resource Formats
Author: Floyd Rogers
Posted on 2002-05-29 06:44:28 by C.Z.
Maverick,

No you should not set them to zero, because:

The core functions in Windows 2000 perform all of their operations using Unicode characters and strings. If you call an ANSI version of a Windows function, this ANSI version must convert the ANSI strings to Unicode strings and then call the Unicode version of the same function(too bad your code has to be compatible with win2k). To convert the strings, the ANSI function needs to allocate a block of memory to hold the Unicode version of the string. This block of memory is allocated from your process's default heap. Lots of other Windows functions also require the use of temporary memory blocks which are allocated from the process's default heap.


Even if you don't call any API, the exe-loader may want to (but I'm not sure). So I very much doubt on decreasing the values of these two dwords.
Posted on 2002-05-29 07:08:53 by C.Z.