Available Stack Memory
I present here an undocumented method for approximately (i.e, playing on the safe side) determining how much stack memory is available.
Undocumented, means it should not be used for production software even when, as is the case, it has been consistent for all Windows releases since NT.
Here is the 32-bit version, the 64-bit is in the downloadable .ZIP.
.386 ; Compile with ; uasm64 -c -coff deallocationStack32.asm ; or ; ml /c /coff deallocationStack32.asm .MODEL FLAT, C option casemap:none RESERVED_SPACE equ 4096 * 16 ; safe-side estimate .code availableStackSpace proc public lea eax, [esp] assume fs:nothing mov edx, fs:[0e0ch] ; DeallocationStack in TEB assume fs:error sub eax, edx sub eax, RESERVED_SPACE ret availableStackSpace endp end