The best thing you can do is to keep it to 4KB in the PE, and then handle it dynamically with your own code. Remember, though, to set FS:4 and FS:8 to the correct value (or set it to the $00000000..$7FFFFFFF extremes and forget) otherwise your ESP will be checked in most Win32 functions and your thread will be terminated by the OS (should it lay outside the FS:4..FS:8 boundaries).
For my programming style, I tend to use the stack a lot, and the heap as little as possible. Allocating memory on the stack, when you use the technique above, is just using [ESP-xxxxx] straight. Superfast allocation, and no need to free anything. Also, you don't have to probe for stack pages, etc.. like the usual stack Win32 programming style.
|