The question may look like duplicate but I guess its not.
Mainly I want to determine if a pointer resides in Stack or Heap using C++ or C without using any debugging library. I've searched in stack overflow but could not find any solution / way around of that for windows system.
I've seen one python library (pydbg) which can determine whether any address belongs to stack or heap region. The exact link of the function is given below.
https://github.com/OpenRCE/pydbg/blob/master/pydbg.py#L3147
And I think windbg's "!address 0xaddress" command does some similar stuff. The usage tells us if its in heap or stack.
0:000> !address 00aada58
00a80000 : 00a80000 - 0004b000
Type 00020000 MEM_PRIVATE
Protect 00000004 PAGE_READWRITE
State 00001000 MEM_COMMIT
Usage RegionUsageHeap
Handle 00970000
So can we do the same without using any debugging library ??
Thanks in Adv.