If you have a procedure that requires a large stack space for local data storage you may get access violation exceptions generated at runtime. The stack is dynamically grown in a downward direction by the OS with the use of guard pages. However if the stack pointer is adjusted by a procedure entry with "sub esp,somevalue" the mechanism can fail when the stack pointer "jumps over" the guard page to unmapped memory and creates havoc with memory exceptions.
So here is my susgestion. Just a simple addition of 3 lines to the PROC32.INC and PROC64.INC files:
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
;add the next three lines
repeat localbytes shr 12
mov byte[esp-%*4096],0
end repeat
;------------------------
sub esp,localbytes
end if
end if
irps reg, reglist \{ push reg \} }
For PROC64.INC the registers become RBP and RSP but still the same idea.
I think in the majority of cases this is efficient and adequate. The "repeat" will only generate the minimum required extra instructions, zero instructions in most cases. Even for moderately large stack adjustments only a few instructions are needed. If you are generating very large local stack areas, and thus the "repeat" loop iterates many times, then perhaps it would be better to use a more appropriate memory allocation function (VirtualAlloc or LocalAlloc) for your purpose but the code will still work if you want to use the stack.