<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>InsaneDevelopers &#187; debug</title>
	<atom:link href="http://insanedevelopers.net/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://insanedevelopers.net</link>
	<description>My personal trash bin</description>
	<lastBuildDate>Sun, 06 May 2012 13:40:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Dynamically altering another program&#8217;s flow</title>
		<link>http://insanedevelopers.net/2012/04/04/dynamically-altering-another-programs-flow/</link>
		<comments>http://insanedevelopers.net/2012/04/04/dynamically-altering-another-programs-flow/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 20:19:01 +0000</pubDate>
		<dc:creator>Alessandro</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[attach]]></category>
		<category><![CDATA[attaching]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debug api]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[debugging api]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[hooking]]></category>

		<guid isPermaLink="false">http://insanedevelopers.net/?p=690</guid>
		<description><![CDATA[I&#8217;ve been asked by a friend of mine for sample code on debugging APIs. The code starts and debugs the Minesweeper game that comes with Windows 7, using breakpoints and single steps. When the user clicks a bomb, the instruction &#8230; <a href="http://insanedevelopers.net/2012/04/04/dynamically-altering-another-programs-flow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked by a friend of mine for sample code on debugging APIs. The code starts and debugs the Minesweeper game that comes with Windows 7, using breakpoints and single steps. When the user clicks a bomb, the instruction pointer is moved so that it doesn&#8217;t explode.</p>
<p style="text-align: center;"><strong>Updates</strong><br />
14/04/2012: fixed a bug</p>
<p style="text-align: center;"><strong>Downloads</strong><br />
<a title="Bomb Technician sample code" href="http://www.insanedevelopers.net/downloads/Sources/BombTechnician.zip">Source code (x86 and x64 compatible)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://insanedevelopers.net/2012/04/04/dynamically-altering-another-programs-flow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Application monitoring</title>
		<link>http://insanedevelopers.net/2009/03/13/application-monitoring/</link>
		<comments>http://insanedevelopers.net/2009/03/13/application-monitoring/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 23:49:02 +0000</pubDate>
		<dc:creator>Alessandro</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debug api]]></category>

		<guid isPermaLink="false">http://insanedevelopers.net/?p=5</guid>
		<description><![CDATA[I&#8217;ve been asked if there&#8217;s a way to programmatically determine if an application crashed in order to restart it; the answer is, of course, yes. To accomplish this task, you have to create the process with a launcher that acts &#8230; <a href="http://insanedevelopers.net/2009/03/13/application-monitoring/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked if there&#8217;s a way to programmatically determine if an application crashed in order to restart it; the answer is, of course, yes. To accomplish this task, you have to create the process with a launcher that acts like a debugger; your application only needs to check the exit code of the process whenever it receives an EXIT_PROCESS_DEBUG_EVENT event (you can also check for unrecoverable exceptions).</p>
<p>Here&#8217;s the pseudo-code:</p>
<pre>DEBUG_EVENT deDebugEvent;
...
WaitForDebugEvent(..);
...
// Check the event type
switch(deDebugEvent.dwDebugEventCode)
{
	...
	case EXIT_PROCESS_DEBUG_EVENT:
	{
		// We assume that if the program exited with a nonzero code, it crashed
		if (deDebugEvent.u.ExitProcess.dwExitCode)
		{
			// The program crashed
			DebugActiveProcessStop(...);
			CreateProcess(...);
			...
		}

		// Clean exit
		ExitProcess(0);
	}
	...
}</pre>
<p>Source code: <a href="http://www.insanedevelopers.net/downloads/Sources/ApplicationMonitor.zip">http://www.insanedevelopers.net/downloads/Sources/ApplicationMonitor.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://insanedevelopers.net/2009/03/13/application-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

