<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to check whether the Pointer is allocated in Stack or Heap in Debug?</title>
	<atom:link href="http://weseetips.com/2008/12/14/how-to-check-whether-the-pointer-is-allocated-in-stack-or-heap-in-debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com/2008/12/14/how-to-check-whether-the-pointer-is-allocated-in-stack-or-heap-in-debug/</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:07:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jijo.Raj</title>
		<link>http://weseetips.com/2008/12/14/how-to-check-whether-the-pointer-is-allocated-in-stack-or-heap-in-debug/comment-page-1/#comment-235</link>
		<dc:creator>Jijo.Raj</dc:creator>
		<pubDate>Mon, 15 Dec 2008 07:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=702#comment-235</guid>
		<description>Wow! Thats Superb! Thanks a lot leochou, for sharing this tip. May be I&#039;ll update this to the tip with your name. ;) Well, Thanks once again and keep watching.

Regards,
Jijo.</description>
		<content:encoded><![CDATA[<p>Wow! Thats Superb! Thanks a lot leochou, for sharing this tip. May be I&#8217;ll update this to the tip with your name. <img src='http://weseetips.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Well, Thanks once again and keep watching.</p>
<p>Regards,<br />
Jijo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leochou</title>
		<link>http://weseetips.com/2008/12/14/how-to-check-whether-the-pointer-is-allocated-in-stack-or-heap-in-debug/comment-page-1/#comment-234</link>
		<dc:creator>leochou</dc:creator>
		<pubDate>Mon, 15 Dec 2008 05:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://weseetips.com/?p=702#comment-234</guid>
		<description>great work!
BTW, we can check whether a pointer points to stack or heap with the help of Thread Information Block in release version.

bool IsMemoryOnStack( LPVOID pVoid )
{
LPVOID dwStackTop = 0;
LPVOID dwStackLowCurrent = 0;
__asm
{
mov EAX, FS:[4]
mov dwStackTop, eax
mov EAX, FS:[8]
mov dwStackLowCurrent, eax
}
if( pVoid = dwStackLowCurrent )
{
// The memory lie between the stack top and stack commited.
return true;
}
// Pointer dosen&#039;t point to the stack
return false;
}

void main()
{
int OnStack;
bool bOnStack = IsMemoryOnStack( &amp;OnStack );// Returns true
int *pOnHeap = new int;
bOnStack = IsMemoryOnStack( pOnHeap );// Returns false
}

hope this be useful!</description>
		<content:encoded><![CDATA[<p>great work!<br />
BTW, we can check whether a pointer points to stack or heap with the help of Thread Information Block in release version.</p>
<p>bool IsMemoryOnStack( LPVOID pVoid )<br />
{<br />
LPVOID dwStackTop = 0;<br />
LPVOID dwStackLowCurrent = 0;<br />
__asm<br />
{<br />
mov EAX, FS:[4]<br />
mov dwStackTop, eax<br />
mov EAX, FS:[8]<br />
mov dwStackLowCurrent, eax<br />
}<br />
if( pVoid = dwStackLowCurrent )<br />
{<br />
// The memory lie between the stack top and stack commited.<br />
return true;<br />
}<br />
// Pointer dosen&#8217;t point to the stack<br />
return false;<br />
}</p>
<p>void main()<br />
{<br />
int OnStack;<br />
bool bOnStack = IsMemoryOnStack( &amp;OnStack );// Returns true<br />
int *pOnHeap = new int;<br />
bOnStack = IsMemoryOnStack( pOnHeap );// Returns false<br />
}</p>
<p>hope this be useful!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
