I'm reverse engineering some windows application. I came accross with this function that IDA recognized:

call __alloca_probe_16

I'm unable to find any documentation/reference on this function except here. The poster suggests that __alloca_probe is a support routine for the API _alloca() without providing any reference.

I'm just wondering if anyone knows what this function does and where I can find reference to undocumented/internal(?) APIs like this in the future.

up vote 5 down vote accepted

This funcion enures that an alloca() call returns a pointer aligned to 16 bytes boundary. You can see the comments in alloca16.asm in Visual C++' CRT sources:

; _alloca_probe_16, _alloca_probe_8 - align allocation to 16/8 byte boundary
;       Adjust allocation size so the ESP returned from chkstk will be aligned
;       to 16/8 bit boundary. Call chkstk to do the real allocation.
;       EAX = size of local frame
;       Adjusted EAX.
;       EAX

NB: this comment seems to be stale; the current implementation tail-calls _chkstk, so the allocation (ESP adjustment) happens immediately.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.