<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Daniel Pearson [MSFT]</title><link>http://blogs.msdn.com/danpear/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Off to Perth</title><link>http://blogs.msdn.com/danpear/archive/2007/08/06/4252952.aspx</link><pubDate>Mon, 06 Aug 2007 10:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4252952</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/4252952.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=4252952</wfw:commentRss><description>&lt;P&gt;I'll be in Perth&amp;nbsp;shortly after &lt;A class="" title="Link to Microsoft Australia's Tech Ed site" href="http://www.microsoft.com/australia/teched" mce_href="http://www.microsoft.com/australia/teched"&gt;Tech Ed&lt;/A&gt;&amp;nbsp;presenting to the &lt;A class="" title="Link to Perth Infrastructure Group site" href="http://www.aususergroups.org/pig" mce_href="http://www.aususergroups.org/pig"&gt;Perth Infrastructure Group&lt;/A&gt;, oink, oink! I'll be delivering the Windows Debugging Demystified session that I've presented previously in Sydney, Brisbane and Canberra. If you're&amp;nbsp;around on the 16th of&amp;nbsp;August then feel free to attend. Don't forget to print out the &lt;A class="" title="Link to Windows Debugging Demystified slides." href="http://blogs.msdn.com/danpear/attachment/2278807.ashx" mce_href="http://blogs.msdn.com/danpear/attachment/2278807.ashx"&gt;slides&lt;/A&gt; to&amp;nbsp;write notes on.&lt;/P&gt;
&lt;P&gt;Venue: EXCOM, Level 2, 23 Barrack Street&lt;BR&gt;Date: Thursday, 16th August&lt;BR&gt;Time: 5:15 PM for a&amp;nbsp;5:30 PM start&lt;BR&gt;Close: Session generally closes by 7:30 PM&lt;BR&gt;Cost: Free!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4252952" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Attending Tech Ed on the Gold Coast</title><link>http://blogs.msdn.com/danpear/archive/2007/07/21/3932988.aspx</link><pubDate>Sat, 21 Jul 2007 09:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3932988</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/3932988.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=3932988</wfw:commentRss><description>So &lt;A class="" title="Link to Rocky Heckman's blog" href="http://blogs.msdn.com/rockyh" mce_href="http://blogs.msdn.com/rockyh"&gt;Rocky&lt;/A&gt; and &lt;A class="" title="Link to Charles Sterling's blog" href="http://blogs.msdn.com/charles_sterling" mce_href="http://blogs.msdn.com/charles_sterling"&gt;Chuck&lt;/A&gt; have managed to organize a few spots at &lt;A class="" title="Link to Microsoft Australia's Tech Ed site" href="http://www.microsoft.com/australia/teched" mce_href="http://www.microsoft.com/australia/teched"&gt;Tech Ed&lt;/A&gt; so I can share the joys of debugging with the world. If you're there then swing by my sessions on&amp;nbsp;Thursday and Friday. I'll also be around for the Ask The Experts sessions on Wednesday evening so feel free to drop by then too. Let me know if there's any interesting debugging scenarios you wish to discuss or if you just want to hear more about how Microsoft delivers technical support and we can schedule some 1:1 time throughout the conference.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3932988" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category></item><item><title>On the road again</title><link>http://blogs.msdn.com/danpear/archive/2007/05/22/2787489.aspx</link><pubDate>Tue, 22 May 2007 11:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2787489</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/2787489.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=2787489</wfw:commentRss><description>&lt;P&gt;I'll be in Canberra next month presenting to the &lt;A class="" title="Link to Canberra Windows User Group site." href="http://www.aususergroups.org/cbrwinug" mce_href="http://www.aususergroups.org/cbrwinug"&gt;Canberra Windows User Group&lt;/A&gt;. I'll be delivering the Windows Debugging Demystified session that I've presented previously in Sydney and Brisbane. If you're&amp;nbsp;around on the 12th of June then feel free to attend. Microsoft will cover the pizza! Don't forget to print out the &lt;A class="" title="Link to Windows Debugging Demystified slides." href="http://blogs.msdn.com/danpear/attachment/2278807.ashx" mce_href="http://blogs.msdn.com/danpear/attachment/2278807.ashx"&gt;slides&lt;/A&gt; to&amp;nbsp;write notes on.&lt;/P&gt;
&lt;P&gt;Venue: Microsoft, Level 2, 44 Sydney Avenue, Barton&lt;BR&gt;Date: Tuesday, 12th June&lt;BR&gt;Time: 5:30 PM for a 6 PM start&lt;BR&gt;Close: Session generally closes by 7:30 PM&lt;BR&gt;Cost: Free!&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2787489" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/danpear/attachment/2787489.ashx" length="1080" type="text/calendar" /><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Debugging Tools for Windows Updated</title><link>http://blogs.msdn.com/danpear/archive/2007/04/27/2291614.aspx</link><pubDate>Fri, 27 Apr 2007 05:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2291614</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/2291614.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=2291614</wfw:commentRss><description>&lt;P&gt;It's been a while since our last update but the latest version, 6.7.5.0, of the Debugging Tools for Windows is now available for &lt;A class="" title="Link to Debugging Tools for Windows" href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" mce_href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;download&lt;/A&gt;&amp;nbsp;from microsoft.com. There's a ton of new features and&amp;nbsp;improvements so get clicking!&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;New Features&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Add %Y{l} format specifier to take a ULONG64 argument and display a source line.&lt;/LI&gt;
&lt;LI&gt;Add $ntdll[w|n]sym built-in aliases.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;New command-line options&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Windbg: -lsrcpath to set local source path.&lt;/LI&gt;
&lt;LI&gt;All: -log[a|o]u to generate Unicode log files.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Changes to default configuration&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;When loading modules from a user-mode minidump provide available misc and CV record info from dump. This can allow symbols to be loaded in some cases when PE image file is not available.&lt;/LI&gt;
&lt;LI&gt;.reload with specific module name now defers loading. Force-loading can be done with /f as usual.&lt;/LI&gt;
&lt;LI&gt;SDK content is now installed by default.&lt;/LI&gt;
&lt;LI&gt;Samples now explicitly default to not building Vista-only.&lt;/LI&gt;
&lt;LI&gt;.remote pipe names may no longer start with ‘/’.&lt;/LI&gt;
&lt;LI&gt;Change symbol lookup order: root\file, root\extension\file, root\symbols\file. Note that you cannot depend on lookup order remaining unchanged.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;!analyze enhancements&lt;/LI&gt;
&lt;LI&gt;New and updated commands: .trap, lmDv, .allow_exec_cmds, .pcmd, .dml_file, gu, .fnent, .pagein, dt, bs, bsc, bm&lt;/LI&gt;
&lt;LI&gt;New options for commands: .foreach, .reload, .dump, .dumpcab, x, uf, ln, .call, .open&lt;/LI&gt;
&lt;LI&gt;New and updated extensions: !chksym, !cpuid, !dml_proc, !address, !chkimage, !vm, !error&lt;/LI&gt;
&lt;LI&gt;Source Server&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;CVS sample scripts.&lt;/LI&gt;
&lt;LI&gt;Updated documentation.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Additional Symbol Server support&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Allow SymSrvNoProxy to apply to WinInet functionality.&lt;/LI&gt;
&lt;LI&gt;New option to force WinInet or WinHttp regardless of whether Symbol Server is running as a service.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;ExtCpp extension improvements&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Allow empty strings as default values.&lt;/LI&gt;
&lt;LI&gt;Add Unicode output methods.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Better Debugging&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Improved handling of IA64 trap frames.&lt;/LI&gt;
&lt;LI&gt;Improved handling of DML content.&lt;/LI&gt;
&lt;LI&gt;Minidump generation improvements.&lt;/LI&gt;
&lt;LI&gt;Improved handling of CABs.&lt;/LI&gt;
&lt;LI&gt;Improved handling of out-of-memory conditions.&lt;/LI&gt;
&lt;LI&gt;Increased symbol functionality.&lt;/LI&gt;
&lt;LI&gt;Bugfixes for EXDI targets.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;New and updated Tools&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Kdsrv now automatically uses IPv4 or IPv6.&lt;/LI&gt;
&lt;LI&gt;Updates for AutoDump Plus.&lt;/LI&gt;
&lt;LI&gt;Convertstore: converts a two tier symbol store to a three tier symbol store.&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2291614" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Windows Debugging Demystified</title><link>http://blogs.msdn.com/danpear/archive/2007/04/26/2278807.aspx</link><pubDate>Thu, 26 Apr 2007 05:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2278807</guid><dc:creator>danpear</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/danpear/comments/2278807.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=2278807</wfw:commentRss><description>&lt;P&gt;I'll be presenting a session on Windows debugging to the &lt;A class="" title="Link to Brisbane Infrastructure Group site" href="http://www.aususergroups.org/default.aspx?alias=www.aususergroups.org/big" mce_href="http://www.aususergroups.org/default.aspx?alias=www.aususergroups.org/big"&gt;Brisbane Infrastructure Group&lt;/A&gt; on Tuesday, 1st May in Brisbane. The focus of the talk will be on &lt;A class="" title="Link to WDK documentation" href="http://msdn2.microsoft.com/en-us/library/ms789510.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms789510.aspx"&gt;bugchecks&lt;/A&gt; and the why, how and what to do about them. I've attached the PowerPoint slides I'll be using so feel free to print them out as they're great for taking notes on. If you're in Brisbane that evening then why not swing by. The cost is free and pizza will be provided.&lt;/P&gt;
&lt;P&gt;Venue: Microsoft, Level 9, 1 Eagle Street, Waterfront Place&lt;BR&gt;Date: Tuesday, 1st May&lt;BR&gt;Time: 5:30 PM for a 6 PM start&lt;BR&gt;Close: Session generally closes by 8 PM&lt;BR&gt;Cost: Free!&lt;/P&gt;
&lt;P&gt;The lifts close at 6 PM and please &lt;A class="" title="Link to RSVP site" href="http://www.aususergroups.org/default.aspx?tabid=663" mce_href="http://www.aususergroups.org/default.aspx?tabid=663"&gt;RSVP&lt;/A&gt; ASAP so they know how much pizza to order.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2278807" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/danpear/attachment/2278807.ashx" length="1383424" type="application/vnd.ms-powerpoint" /><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>What error?</title><link>http://blogs.msdn.com/danpear/archive/2007/04/06/2033100.aspx</link><pubDate>Thu, 05 Apr 2007 18:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2033100</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/2033100.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=2033100</wfw:commentRss><description>&lt;P&gt;A large percentage of Windows APIs return zero to indicate success and non-zero for failure. Most of the MSDN documentation for each API included with the operating system contains a Return Value section. The Return Value section documents what return values can be expected.&lt;/P&gt;
&lt;P&gt;Windows allows for developers to access an additional return code via the Last Error mechanism. A last error code is maintained for every thread in the system. It allows for API developers to return further information to the calling application such as why an API failed.&lt;/P&gt;
&lt;P&gt;The last error code is stored in the thread environment block (TEB). A TEB is a user mode structure that contains various information about each thread.&lt;/P&gt;
&lt;P&gt;There's a few different ways to read the TEB and the last error code contained within it. With a debugger there's the choice of several extensions or the TEB can be read directly. An application can use the &lt;A class="" title="Link to GetLastError documentation" href="http://msdn.microsoft.com/library/en-us/debug/base/getlasterror.asp" mce_href="http://msdn.microsoft.com/library/en-us/debug/base/getlasterror.asp"&gt;GetLastError&lt;/A&gt; API.&lt;/P&gt;
&lt;P&gt;Windows makes use of the FS segment register to store information about the current thread. The address of the TEB for the current thread is stored at FS:[18].&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;dd&amp;nbsp;fs:18&amp;nbsp;l&amp;nbsp;1&lt;BR&gt;003b:00000018&amp;nbsp;&amp;nbsp;7ffdf000&lt;/CODE&gt; 
&lt;P&gt;The TEB can either be displayed by using the !teb extension or the dt command. The !teb extension will show a formatted view whereas the dt command will show the full structure.&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;!teb&lt;BR&gt;TEB&amp;nbsp;at&amp;nbsp;7ffdf000&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExceptionList:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0007fb00&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;StackBase:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;00080000&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;StackLimit:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0006f000&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;BR&gt;&lt;BR&gt;&lt;/CODE&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;dt&amp;nbsp;_TEB&amp;nbsp;7ffdf000&lt;BR&gt;ntdll!_TEB&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;+0x000&amp;nbsp;NtTib&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;_NT_TIB&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;+0x01c&amp;nbsp;EnvironmentPointer&amp;nbsp;:&amp;nbsp;(null)&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;+0x020&amp;nbsp;ClientId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;_CLIENT_ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/CODE&gt; 
&lt;P&gt;The last error code is a ULONG value. It's stored in the LastErrorValue field at an offset of 52 (0x34) bytes from the start of the TEB.&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;dt&amp;nbsp;_TEB&amp;nbsp;7ffdf000&amp;nbsp;LastErrorValue&lt;BR&gt;ntdll!_TEB&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;+0x034&amp;nbsp;LastErrorValue&amp;nbsp;:&amp;nbsp;0&lt;/CODE&gt; 
&lt;P&gt;The GetLastError API uses the same information when it returns the last error code. It reads the location of the TEB from the FS register and then returns a ULONG value from 52 bytes into that address range.&lt;/P&gt;&lt;CODE&gt;7c839325&amp;nbsp;mov&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;eax,fs:[00000018]&lt;BR&gt;7c83932b&amp;nbsp;mov&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;eax,[eax+0x34]&lt;BR&gt;7c83932e&amp;nbsp;ret&lt;/CODE&gt; 
&lt;P&gt;In the debugger it can be entered as one command.&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;dd&amp;nbsp;poi(fs:18)+34&amp;nbsp;l&amp;nbsp;1&lt;BR&gt;7ffdf034&amp;nbsp;&amp;nbsp;00000000&lt;/CODE&gt; 
&lt;P&gt;There's one final debugger extension and that is !gle. The !gle extension returns both the LastErrorValue and LastStatusValue values. !gle goes one step further and checks several known DLLs in an attempt to locate the error code in any of their message tables. If a match is found then !gle displays both the error code and the error message.&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;!gle&lt;BR&gt;LastErrorValue:&amp;nbsp;(Win32)&amp;nbsp;0&amp;nbsp;(0)&amp;nbsp;-&amp;nbsp;The&amp;nbsp;operation&amp;nbsp;completed&amp;nbsp;...&lt;BR&gt;LastStatusValue:&amp;nbsp;(NTSTATUS)&amp;nbsp;0&amp;nbsp;-&amp;nbsp;STATUS_WAIT_0&lt;/CODE&gt; 
&lt;P&gt;The LastErrorValue field is also writable. DLLs can call &lt;A class="" title="Link to SetLastError documentation" href="http://msdn.microsoft.com/library/en-us/debug/base/setlasterror.asp" mce_href="http://msdn.microsoft.com/library/en-us/debug/base/setlasterror.asp"&gt;SetLastError&lt;/A&gt; to set the error code. Ever since Windows XP, SetLastError has an undocumented trick up it's sleeve. The following information applies to both Windows XP and Windows Server 2003.&lt;/P&gt;
&lt;P&gt;Hiding inside of kernel32's address space is a global variable called g_dwLastErrorToBreakOn. It turns out that SetLastError checks the value of this variable and if it's non-zero, calls DbgBreakPoint if the two conditions match. The downside is that SetLastError is only called from within KERNEL32.DLL. Other calls to SetLastError are redirected to a function located in NTDLL.DLL, RtlSetLastWin32Error.&lt;/P&gt;
&lt;P&gt;Still g_dwLastErrorToBreakOn can be extremely useful when trying to track down when an error occurs in Kernel32 APIs and the last error value is set. Of course you can set a breakpoint on SetLastError and check which value is passed but it can be somewhat slow. Using the global variable incurs no overhead as it's always checked.&lt;/P&gt;
&lt;P&gt;In Windows Vista, SetLastError in Kernel32 jumps directly to RtlSetLastWin32Error in&amp;nbsp;NTDLL and checks the global, g_dwLastErrorToBreakOn, which is now part of NTDLL.DLL. This allows the last error&amp;nbsp;mechanism for all DLLs to be easily debugged.&lt;/P&gt;
&lt;P&gt;The variable needs to be edited directly to enter the value to break on. In this case the error is ERROR_ACCESS_DENIED. For Windows Vista, the global ntdll!g_dwLastErrorToBreakOn should be set instead.&lt;/P&gt;&lt;CODE&gt;0:000&amp;gt;&amp;nbsp;ed&amp;nbsp;kernel32!g_dwLastErrorToBreakOn&amp;nbsp;5&lt;/CODE&gt; 
&lt;P&gt;Once&amp;nbsp;the breakpoint is&amp;nbsp;triggered, the application breaks into the debugger and a full stack trace can be read.&lt;/P&gt;&lt;CODE&gt;0:013&amp;gt;&amp;nbsp;k&lt;BR&gt;01c7d524&amp;nbsp;ntdll!DbgBreakPoint&lt;BR&gt;01c7d534&amp;nbsp;kernel32!SetLastError+0x24&lt;BR&gt;01c7d544&amp;nbsp;kernel32!BaseSetLastNTError+0x17&lt;BR&gt;01c7d828&amp;nbsp;kernel32!FindFirstFileExW+0x4c5&lt;BR&gt;01c7d84c&amp;nbsp;shell32!SHFindFirstFile+0x2a&lt;BR&gt;01c7daa0&amp;nbsp;shell32!SHFindFirstFileRetry+0x5b&lt;BR&gt;01c7dcf0&amp;nbsp;shell32!CFileSysEnum::Init+0x14b&lt;BR&gt;...&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;P&gt;All error codes that are returned by the operating system are listed in winerror.h. The MSDN Library also maintains a list of &lt;A class="" title="Link to system error codes" href="http://msdn.microsoft.com/library/en-us/debug/base/system_error_codes.asp" mce_href="http://msdn.microsoft.com/library/en-us/debug/base/system_error_codes.asp"&gt;system error codes&lt;/A&gt;. Application defined error codes will not be listed.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2033100" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>You and I, Watson, we have done our part</title><link>http://blogs.msdn.com/danpear/archive/2007/03/31/1994338.aspx</link><pubDate>Fri, 30 Mar 2007 18:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1994338</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/1994338.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=1994338</wfw:commentRss><description>&lt;P&gt;On his site, Raymond Chen discussed &lt;A class="" title="Link to 'Why is Windows Error Reporting nicknamed &amp;quot;Dr. Watson&amp;quot;?'" href="http://blogs.msdn.com/oldnewthing/archive/2005/08/10/449866.aspx" mce_href="http://blogs.msdn.com/oldnewthing/archive/2005/08/10/449866.aspx"&gt;earlier&lt;/A&gt; the origins of Dr. Watson. In fact the original name for the&amp;nbsp;tool wasn't Dr. Watson at all, it was Sherlock. This can still be seen in the 16-bit version of the application. There's three pieces of evidence that give it away. The main windows procedure, SherlockWndProc, the main dialog procedure, SherlockDialog, and the template name given to the dialog box, SherDiag. The icons were a little different then too. The&amp;nbsp;initial icon was a smoking pipe which was later changed to a doctor's bag&amp;nbsp;with a stethoscope. The final change came when the icon with the doctor and&amp;nbsp;a stethoscope together was introduced. When the port to Windows NT was made, all references to Sherlock were dropped. Sadly Dr. Watson was removed from Windows Vista to make way for &lt;A class="" title="Link to Windows Error Reporting" href="http://msdn2.microsoft.com/en-us/library/bb513641.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb513641.aspx"&gt;Windows Error Reporting&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1994338" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category></item><item><title>Narrowing down CPU usage</title><link>http://blogs.msdn.com/danpear/archive/2007/03/28/1971709.aspx</link><pubDate>Wed, 28 Mar 2007 07:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1971709</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/1971709.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=1971709</wfw:commentRss><description>&lt;P&gt;Accounting for CPU usage isn't always a straight forward task. One of the easiest methods is to use Task Manager. Task Manager provides a CPU column which breaks down each processes CPU usage into a percentage. Clicking on the CPU column header will sort the data from highest to lowest. The offending process should be easy to spot. It'll usually be sitting at the top of the list happily chewing up CPU cycles.&lt;/P&gt;
&lt;P&gt;So what if the offending process is listed as System? Then it gets a little trickier. There is no System file on disk. System is a collection of internal worker and device driver threads. It's impossible to know which system or device driver thread could be causing the issue without digging deeper.&lt;/P&gt;
&lt;P&gt;We can use several tools and techniques to pinpoint the offending code. Which one to use depends on the type of problem and the tools we have access to. There's always a risk using 3rd party tools and it's common that systems have strict change control so I tend to stick to tools that are supplied with the operating system. Performance Monitor is an extremely powerful tool and will give us most of what we need. With support from a few development tools we can break it down further.&lt;/P&gt;
&lt;P&gt;We need to identify the instance of the system thread that is utilizing the CPU. It's a good idea when working with Performance Monitor to create logs of all your monitoring because it provides the greatest flexibility when analyzing the results and they can also be used later as a baseline. Logs are also easily shareable with support staff.&lt;/P&gt;
&lt;P&gt;The object we're interested in is the Thread object. It's best to use objects and not counters. Selecting the object will record data for every thread in the system. I'd rather collect more data than is needed than less. Once the data has been collected then we're ready to analyze it.&lt;/P&gt;
&lt;P&gt;Start by adding an instance for each of the System threads to the graph. The counter to select is Thread » % Processor Time. This will give us an overview of what is going on. It should be straight forward spotting which thread it is that is causing the problem. If you get stuck then try using the Highlight tool, CTRL+H, while cycling through each thread.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Performance Monitor uses an instance count to track all threads. It shouldn't be confused with a thread ID. Add the Thread » Start Address counter for the instance identified earlier. It's easier to switch to report view to read the results. If you use a graph then the results with be in decimal and you'll have to convert them manually using a calculator.&lt;/P&gt;&lt;CODE&gt;&lt;A href="file://viper/"&gt;\\VIPER&lt;/A&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thread&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Start&amp;nbsp;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0xFA0067F0&lt;/CODE&gt; 
&lt;P&gt;The start address is the virtual address of the thread. With the start address it's possible to identify the driver and also the function. We just need a way to tie the two together. The Process and Thread Status tool is the best choice. It ships as part of the Windows Support Tools which is included on the Windows XP CD. It's important that the tool be run whilst the performance data is being collected.&lt;/P&gt;&lt;CODE&gt;C:\Program Files\Support Tools&amp;gt;pstat&lt;/CODE&gt; 
&lt;P&gt;Process Status shows each driver and the virtual address at which it is loaded. To locate the driver it's simply a matter of finding which address range the start address lies in. Start by checking the second column.&lt;/P&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;ModuleName&amp;nbsp;Load&amp;nbsp;Addr&amp;nbsp;&amp;nbsp;&amp;nbsp;Code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data&amp;nbsp;&amp;nbsp;&amp;nbsp;Paged&amp;nbsp;LinkDate&lt;BR&gt;------------------------------------------------------------&lt;BR&gt;ntoskrnl.exe&amp;nbsp;804D7000&amp;nbsp;&amp;nbsp;478976&amp;nbsp;&amp;nbsp;&amp;nbsp;93440&amp;nbsp;1243264&amp;nbsp;Wed&amp;nbsp;Aug&amp;nbsp;04&amp;nbsp;...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hal.dll&amp;nbsp;806EC000&amp;nbsp;&amp;nbsp;&amp;nbsp;29312&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6400&amp;nbsp;&amp;nbsp;&amp;nbsp;25088&amp;nbsp;Wed&amp;nbsp;Aug&amp;nbsp;04&amp;nbsp;...&lt;BR&gt;&amp;nbsp;toaster.sys&amp;nbsp;FA006000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ntdll.dll&amp;nbsp;7C900000&amp;nbsp;&amp;nbsp;503808&amp;nbsp;&amp;nbsp;&amp;nbsp;20480&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;Wed&amp;nbsp;Aug&amp;nbsp;04&amp;nbsp;...&lt;BR&gt;------------------------------------------------------------&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Total&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5013792&amp;nbsp;&amp;nbsp;507136&amp;nbsp;4408544&lt;/CODE&gt; 
&lt;P&gt;We now know the start address and the device driver. If we have access to the symbols for the device driver we can locate the function. If you're using a kernel debugger then the ln command works a treat. It displays the symbols either at or near a given address. The debuggers are available for download in the &lt;A class="" title="Link to Debugging Tools for Windows" href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" mce_href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Debugging Tools for Windows&lt;/A&gt; package.&lt;/P&gt;&lt;CODE&gt;kd&amp;gt;&amp;nbsp;ln&amp;nbsp;fa0067f0 (fa0067f0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;toaster!ToasterPollingThread&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;...&lt;BR&gt;Exact&amp;nbsp;matches:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;toaster!ToasterPollingThread&amp;nbsp;=&amp;nbsp;&amp;lt;no&amp;nbsp;type&amp;nbsp;information&amp;gt;&lt;/CODE&gt; 
&lt;P&gt;If we were using private symbols then source line information would be available too. It's then just a case of reading through the source. "Use the source, Luke".&lt;/P&gt;
&lt;P&gt;With a few easily available tools we've been able to supply more than enough information to get an understanding of what is going wrong. Armed with that information the developer should be able to correct the issue.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1971709" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/danpear/archive/tags/Performance/default.aspx">Performance</category></item><item><title>We're hiring!</title><link>http://blogs.msdn.com/danpear/archive/2007/03/27/1962506.aspx</link><pubDate>Tue, 27 Mar 2007 14:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1962506</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/1962506.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=1962506</wfw:commentRss><description>&lt;P&gt;We currently have two positions available for support engineers in our Global Technical Support Center based in Sydney. Both are in the Platforms team which covers Windows technologies. We're looking for candidates with strong &lt;A class="" title="Link to Active Directory Support Engineer" href="http://members.microsoft.com/careers/international/default.asp?lang=EN&amp;amp;loc=AUS&amp;amp;job=90044430" mce_href="http://members.microsoft.com/careers/international/default.asp?lang=EN&amp;amp;loc=AUS&amp;amp;job=90044430"&gt;Active Directory&lt;/A&gt; or &lt;A class="" title="Link to Networking Support Engineer" href="http://members.microsoft.com/careers/international/default.asp?lang=EN&amp;amp;loc=AUS&amp;amp;job=90455827" mce_href="http://members.microsoft.com/careers/international/default.asp?lang=EN&amp;amp;loc=AUS&amp;amp;job=90455827"&gt;networking&lt;/A&gt; skills. If you feel like a challenge then get clicking!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1962506" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category></item><item><title>Testing ... one, one, zero, zero, zero, zero</title><link>http://blogs.msdn.com/danpear/archive/2007/03/27/1958405.aspx</link><pubDate>Tue, 27 Mar 2007 05:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1958405</guid><dc:creator>danpear</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danpear/comments/1958405.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danpear/commentrss.aspx?PostID=1958405</wfw:commentRss><description>&lt;P&gt;My name is Daniel Pearson and I'm a Lead in support for Windows. I spend most of my day with my head either in a debugger or reading through code. I'm a huge fan of using debuggers to troubleshoot and I enjoy using them to resolve complicated issues. I've always been involved with Windows, and by Windows I mean Windows NT, since the start of my career, right through to Digital Equipment Corporation and then on to Microsoft. I’ve had the opportunity to work on various other technologies in Microsoft too. I was in sustained engineering for &lt;A class="" title="Link to Mobile Information Server" href="http://www.microsoft.com/miserver" mce_href="http://www.microsoft.com/miserver"&gt;Mobile Information Server&lt;/A&gt; for a while and have had the luck of working for Microsoft in 5 different countries so far!&lt;/P&gt;
&lt;P&gt;I decided to start writing as way to reach out to developers and IT professionals. As software and systems grow, so does the complexity of troubleshooting them. It's one thing to be able to step through code, line by line, on a development system tucked away in an office, it's another having to debug a live system that is still required to service thousands of users to determine why an application is terminating due to heap corruption, or some other serious bug, and prevent it from ever happening again. Hopefully I can share experiences that will give you the skills so you'll never need to contact support.&lt;/P&gt;
&lt;P&gt;I want to use this to create an environment that is rich with ideas and information. I have a lot of ideas of what I want to do already so you should be seeing a lot of changes. Let me know if there's something that you want to see covered or want more on.&lt;/P&gt;
&lt;P&gt;If you haven't yet seen or used the &lt;A class="" title="Link to Debugging Tools for Windows" href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" mce_href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Debugging Tools for Windows&lt;/A&gt;, then I suggest getting familar with them. We're going to use them a lot!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1958405" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danpear/archive/tags/Other/default.aspx">Other</category></item></channel></rss>