Is it possible to detect if a variable is in stack or heap based on its address?

Bruno Jesus 00cpxxx at
Thu Feb 19 19:53:14 CST 2015

Hi all, the subject explains my needs. I would like to understand if
printing %p of a pointer can help me check if it's in the stack or was
allocated with some memory management functions. Something like:

void test()
  char stack[10], *heap = HeapAlloc(1234);
  printf("%p %p", stack, heap);

Can I be sure the first printed value is from stack and the second from heap?

A plus question would be: Is it possible to know if an address is a
const string?

These questions are related to debugging wine functions based on trace debugs.

Thanks in advance and best wishes,

More information about the wine-devel mailing list