{"componentChunkName":"component---src-templates-post-template-js","path":"/magical-windbg-vol1-05-en","result":{"data":{"markdownRemark":{"id":"02aa0c80-fd51-5b1c-9eb6-4eb74e7f3554","html":"<blockquote>\n<p>This page has been machine-translated from the <a href=\"/magical-windbg-vol1-05\">original page</a>.</p>\n</blockquote>\n<p>In Chapter 4, we analyzed a simple application crash dump.</p>\n<p>In Chapter 5, which follows, we will analyze a full memory dump collected when a simple system crash occurred.</p>\n<!-- omit in toc -->\n<h2 id=\"table-of-contents\" style=\"position:relative;\"><a href=\"#table-of-contents\" aria-label=\"table of contents permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Table of Contents</h2>\n<ul>\n<li><a href=\"#triggering-a-system-crash-and-creating-a-full-memory-dump\">Triggering a system crash and creating a full memory dump</a></li>\n<li><a href=\"#loading-the-full-memory-dump-in-windbg\">Loading the full memory dump in WinDbg</a></li>\n<li><a href=\"#analyzing-the-crash-dump-with-the-analyze-extension\">Analyzing the crash dump with the <code class=\"language-text\">!analyze</code> extension</a></li>\n<li><a href=\"#identifying-the-process-that-caused-the-crash\">Identifying the process that caused the crash</a></li>\n<li><a href=\"#reading-the-instructions-before-and-after-the-crash\">Reading the instructions before and after the crash</a></li>\n<li><a href=\"#analyzing-the-iat-import-address-table-in-windbg\">Analyzing the IAT (Import Address Table) in WinDbg</a></li>\n<li><a href=\"#chapter-5-summary\">Chapter 5 summary</a></li>\n<li><a href=\"#chapter-links\">Chapter links</a></li>\n</ul>\n<h2 id=\"triggering-a-system-crash-and-creating-a-full-memory-dump\" style=\"position:relative;\"><a href=\"#triggering-a-system-crash-and-creating-a-full-memory-dump\" aria-label=\"triggering a system crash and creating a full memory dump permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Triggering a system crash and creating a full memory dump</h2>\n<p>As we saw in Chapter 4, when an exception occurs in the processing of an application running in user mode, the application crashes and an application crash dump is generated.</p>\n<p>Similarly, if an exception occurs inside a system process running in kernel mode, a system crash called a BSOD (Blue Screen of Death) occurs, and a system crash dump is generated.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/aed56d2ac06acaecdc7941c14636d092/0b533/fulldump-003.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 49.16666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABZUlEQVQoz41S2U4CQRBcXxARF8EDwXjFC2OIiQ/GaHzwm4AlgiKigOAVj+iXufeun1J2zyywIQZ5qO2Z7p6artpRlPI3FC2EIqE0BC2If9V69bIuo1IykL6xBRbrNvKPHnIdF/tdT+wzDZnfbLs4eHax0rSw0bax9+BgrWVjt+sgUTMlMZMqmo7MrYV1Kp5++Dh+83Hy7mO742Dr3kGODuzQ+vzrB4cvHo5ePZx9+sg/uaKuElmkog+mZMnxSwMzVwaydxY1GEhem4hRbqpqIFqVtVTdFHuuzdGac5MVY2BVXzJ9eMLVpo15ahQ+FYY8KoZQCFAc8lQLEfKEfHOCblUJyZqcIFqR0/FEKvXEA0yzIo5VuY9R7JMyIZOx3GXCUsOiH2SKOFuTh1k++8Ty+TBL71nCkfNSuvBQR4oIF4gkS9LTDSY1hfzIhY4J9qYUelajnk05kDyysd/8D8ITjtU8Th/hFw2O1/mgLvuiAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/aed56d2ac06acaecdc7941c14636d092/8ac56/fulldump-003.webp 240w,\n/static/aed56d2ac06acaecdc7941c14636d092/d3be9/fulldump-003.webp 480w,\n/static/aed56d2ac06acaecdc7941c14636d092/b0a15/fulldump-003.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/aed56d2ac06acaecdc7941c14636d092/8ff5a/fulldump-003.png 240w,\n/static/aed56d2ac06acaecdc7941c14636d092/e85cb/fulldump-003.png 480w,\n/static/aed56d2ac06acaecdc7941c14636d092/0b533/fulldump-003.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/aed56d2ac06acaecdc7941c14636d092/0b533/fulldump-003.png\"\n            alt=\"A typical BSOD screen\"\n            title=\"A typical BSOD screen\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>There are several kinds of system crash dumps, but the full memory dump we will capture this time contains all page information from all physical memory accessible to the Windows system running on that machine.</p>\n<p>A full memory dump is not generated under Windows default settings, but if your environment has been configured to collect dump files according to the procedure in Chapter 1, the setting to capture a full memory dump is already in place.</p>\n<p>Therefore, we will use D4C.exe to obtain a full memory dump for analysis.</p>\n<p>First, run the D4C.exe downloaded in Chapter 1, enter <code class=\"language-text\">3</code> in the menu shown at the prompt, and press Enter.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/895194835e2bf33b1f9a1d952955a1c1/0b533/system-crash-001.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 52.5%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABIUlEQVQoz53SzU6DQBAH8AWXYneXz2BBo8GEUnwFYy9G5ODZl9LE2KRNtWptjyYmvuLfATS2aYro4ZcZlpnZXQIbjSe4ubvHLRmNp3h8nuOBzF5e8TRfkOVX3GZJtQtMpjO8vX+AHUQRojCs7FMe9noIggCuY6NjGNB1DTu63kCDwTkYYxgOz8DSfh9pOkCSJMiyrFLmIW2glIJt27CsZo7jwKDNi6IA81wXnu/D8zz4FMuXlmVBCFENbKOs53TKPM/BJDVKKdd8F67mrQeqLU1th22eULa/2p8GVtdVtep5Jf5mfWDZRAtS/Z9FfwLnBg28pG9oGlC7Jum0YG7qmrBFF1xjKC7OwUScQRyf1OImVHdUGvw4rCla53sxTq+u8QndXiVen2BFKwAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/895194835e2bf33b1f9a1d952955a1c1/8ac56/system-crash-001.webp 240w,\n/static/895194835e2bf33b1f9a1d952955a1c1/d3be9/system-crash-001.webp 480w,\n/static/895194835e2bf33b1f9a1d952955a1c1/b0a15/system-crash-001.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/895194835e2bf33b1f9a1d952955a1c1/8ff5a/system-crash-001.png 240w,\n/static/895194835e2bf33b1f9a1d952955a1c1/e85cb/system-crash-001.png 480w,\n/static/895194835e2bf33b1f9a1d952955a1c1/0b533/system-crash-001.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/895194835e2bf33b1f9a1d952955a1c1/0b533/system-crash-001.png\"\n            alt=\"Trigger a system crash with D4C.exe\"\n            title=\"Trigger a system crash with D4C.exe\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>When you execute option 3 in D4C.exe, a system crash occurs and the machine automatically reboots.</p>\n<p>After the system restarts, if a file named <code class=\"language-text\">FULL_MEMORY.DMP</code> has been created directly under the <code class=\"language-text\">C:\\Windows</code> folder, the full memory dump has been successfully captured.</p>\n<h2 id=\"loading-the-full-memory-dump-in-windbg\" style=\"position:relative;\"><a href=\"#loading-the-full-memory-dump-in-windbg\" aria-label=\"loading the full memory dump in windbg permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Loading the full memory dump in WinDbg</h2>\n<p>When analyzing a full memory dump, just as with an application crash dump, launch the 64-bit version of WinDbg as administrator and use the [Ctrl + D] shortcut to load the dump file you captured from that folder.</p>\n<p>Once loading finishes and the message <code class=\"language-text\">For analysis of this file, run !analyze -v</code> appears, the dump is ready. (Depending on the full memory dump file size, loading may take a little time.)</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/0b533/system-crash-002.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 54.58333333333334%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABhklEQVQoz42S607CQBCFef8X8qeCGC9RUAohYGsBu92lLbdyKba0x5mRoiIaNzmZdLb7zZnZrZzVn3DxYKP2+IKLhkOyUW2+kBzKuaLLJ1f26tYQV9boT1Vsx0EUjjGJQmhfwWgfvvIoF0jOGA3lvcr3f1bFcQcYjw08T1EMEIYhPKXg+z4USWuD4XCI2Wz2K6QoWIWoYnW65EhhtVqJlsulxCAIEEURFRlD0f52uxUlSSJxs0lIG1Ge53swAc+rNXTabfR6Pbiui9FoJBBxSKDBYACHxmKMkTwXYuB6vT6Y2O12n8Dbu3s89/vodrsCtG0brVYLfcpZliVi+Hw+R5qmohLwve3iY4ZX1zdoNhrigiHskGfGTljsajqdSvtxHIsjbruElDo49HyNeLEgBwsZPLdTuih/5hmVh44d/bhl5Ru5CIZx9UPFIhcQg7/GY0fHYHqHrrw1rTXNSssTWq7WiDcZkrfsW1vHsJMOJ9M5Vc+QZhmyvd7SDHGyQ5LmJw/+BuP1DupDRYTagIAoAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/8ac56/system-crash-002.webp 240w,\n/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/d3be9/system-crash-002.webp 480w,\n/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/b0a15/system-crash-002.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/8ff5a/system-crash-002.png 240w,\n/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/e85cb/system-crash-002.png 480w,\n/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/0b533/system-crash-002.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/bf0f8ecb264f0eb81cf72ac1ff52fc71/0b533/system-crash-002.png\"\n            alt=\"Load the full memory dump into WinDbg\"\n            title=\"Load the full memory dump into WinDbg\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h2 id=\"analyzing-the-crash-dump-with-the-analyze-extension\" style=\"position:relative;\"><a href=\"#analyzing-the-crash-dump-with-the-analyze-extension\" aria-label=\"analyzing the crash dump with the analyze extension permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Analyzing the crash dump with the <code class=\"language-text\">!analyze</code> extension</h2>\n<p>As with application crash dump investigations, the <code class=\"language-text\">!analyze -v</code> command is extremely useful when investigating a system crash.</p>\n<p>So let’s go through the output you get by running <code class=\"language-text\">!analyze -v</code> in the Command window, section by section.</p>\n<p>The first section shows the analysis result of the bug check data<sup id=\"fnref-1\"><a href=\"#fn-1\" class=\"footnote-ref\">1</a></sup> that can be obtained with the <code class=\"language-text\">.bugcheck</code> command, as shown below.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CRITICAL_PROCESS_DIED (ef)\n        A critical system process died\nArguments:\nArg1: ffffc18f36303080, Process object or thread object\nArg2: 0000000000000000, If this is 0, a process died. If this is 1, a thread died.\nArg3: 0000000000000000, The process object that initiated the termination.\nArg4: 0000000000000000</code></pre></div>\n<p>By referring to the output above, we can see that the cause of the system crash is <code class=\"language-text\">CRITICAL_PROCESS_DIED</code>.</p>\n<p>If you actually run the <code class=\"language-text\">.bugcheck</code> command in WinDbg, you get the following output.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">6: kd> .bugcheck\nBugcheck code 000000EF\nArguments ffffc18f`36303080 00000000`00000000 00000000`00000000 00000000`00000000</code></pre></div>\n<p>Windows bug check codes are published in the official documentation below.</p>\n<p>If you look up the value <code class=\"language-text\">000000EF</code> in that reference, you can see that it matches the bug check code for <code class=\"language-text\">CRITICAL_PROCESS_DIED</code> shown by <code class=\"language-text\">!analyze -v</code>.</p>\n<p>Also, the output of <code class=\"language-text\">!analyze -v</code> is equivalent to analyzing the bug check with the <code class=\"language-text\">!analyze -show &lt;bug check code> &lt;Arg1></code> command.</p>\n<br>\n<p>Bug check codes:</p>\n<p><a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/bug-check-code-reference2#bug-check-codes\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/bug-check-code-reference2#bug-check-codes</a></p>\n<br>\n<p>From the output of these commands, we can see that the system crash was <code class=\"language-text\">CRITICAL_PROCESS_DIED (0xef)</code>, caused by the termination of a critical Windows system process.</p>\n<p>So what exactly is meant by a critical Windows system process?</p>\n<p>Critical Windows system processes include built-in system processes such as <code class=\"language-text\">csrss.exe</code>, <code class=\"language-text\">wininit.exe</code>, <code class=\"language-text\">logonui.exe</code>, <code class=\"language-text\">smss.exe</code>, <code class=\"language-text\">services.exe</code>, <code class=\"language-text\">conhost.exe</code>, and <code class=\"language-text\">winlogon.exe</code>.</p>\n<br>\n<p>Bug Check 0xEF: <code class=\"language-text\">CRITICAL_PROCESS_DIED</code></p>\n<p><a href=\"https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0xef--critical-process-died\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0xef—critical-process-died</a></p>\n<br>\n<p>In addition, because the value of <code class=\"language-text\">Arg2</code> is <code class=\"language-text\">0</code>, we can tell that the cause was the termination of a process rather than a thread, and that the actual stopped process object exists at <code class=\"language-text\">0xffffc18f36303080</code>.</p>\n<p>If we inspect the information managed by the <code class=\"language-text\">EPROCESS</code> structure at that address, we can identify the stopped system process as <code class=\"language-text\">svchost.exe</code> with PID <code class=\"language-text\">0x3bc</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">6: kd> !process ffffc18f`36303080 0\nPROCESS ffffc18f36303080\n    SessionId: 0  Cid: 02dc    Peb: 27dedd6000  ParentCid: 03bc\n    DirBase: 7fbd5002  ObjectTable: ffffe50cc9052800  HandleCount: 1465.\n    Image: svchost.exe\n\n6: kd> dt nt!_EPROCESS 0xffffc18f`36303080\n   {{ omitted }}\n   +0x440 UniqueProcessId  : 0x00000000`000002dc Void\n   +0x5a8 ImageFileName    : [15]  \"svchost.exe\"\n   {{ omitted }}</code></pre></div>\n<p>As you can see, just by analyzing the bug check based on the initial output of <code class=\"language-text\">!analyze -v</code>, we were already able to get very close to the cause of the system crash.</p>\n<p>Let’s continue to the next section.</p>\n<p>The section after the bug check analysis also contains very interesting information. From <code class=\"language-text\">CriticalProcessDied.Process</code>, we can again see that the crashed process was <code class=\"language-text\">svchost.exe</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Debugging Details:\n------------------\n\nKEY_VALUES_STRING: 1\n\n    Key  : Analysis.CPU.mSec\n    Value: 3765\n\n    Key  : Analysis.DebugAnalysisManager\n    Value: Create\n\n    Key  : Analysis.Elapsed.mSec\n    Value: 4092\n\n    Key  : Analysis.Init.CPU.mSec\n    Value: 78343\n\n    Key  : Analysis.Init.Elapsed.mSec\n    Value: 78474127\n\n    Key  : Analysis.Memory.CommitPeak.Mb\n    Value: 128\n\n    Key  : CriticalProcessDied.ExceptionCode\n    Value: 42bd7080\n\n    Key  : CriticalProcessDied.Process\n    Value: svchost.exe\n\n    Key  : WER.OS.Branch\n    Value: vb_release\n\n    Key  : WER.OS.Timestamp\n    Value: 2019-12-06T14:06:00Z\n\n    Key  : WER.OS.Version\n    Value: 10.0.19041.1</code></pre></div>\n<p>The following section outputs the information below.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">FILE_IN_CAB:  FULL_MEMORY.DMP\n\nBUGCHECK_CODE:  ef\n\nBUGCHECK_P1: ffffc18f36303080\n\nBUGCHECK_P2: 0\n\nBUGCHECK_P3: 0\n\nBUGCHECK_P4: 0\n\nPROCESS_NAME:  svchost.exe\n\nCRITICAL_PROCESS:  svchost.exe\n\nERROR_CODE: (NTSTATUS) 0x42bd7080 - &lt;Unable to get error code text>\n\nBLACKBOXBSD: 1 (!blackboxbsd)\n\nBLACKBOXNTFS: 1 (!blackboxntfs)\n\nBLACKBOXPNP: 1 (!blackboxpnp)\n\nBLACKBOXWINLOGON: 1</code></pre></div>\n<p>The information from <code class=\"language-text\">BUGCHECK_CODE</code> through <code class=\"language-text\">BUGCHECK_P4</code> matches the bug check information we saw in the first section.</p>\n<p>Also, <code class=\"language-text\">CRITICAL_PROCESS</code> tells us that the stopped process that caused the system crash was <code class=\"language-text\">svchost.exe</code>.</p>\n<p>The next section is the stack backtrace.</p>\n<p>Here, the output is equivalent to running the <code class=\"language-text\">.cxr; .ecxr ; kb</code> command.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">STACK_TEXT:  \nffffa209`4982f838 fffff801`2d70e592 : {{ omitted }} : nt!KeBugCheckEx\nffffa209`4982f840 fffff801`2d616045 : {{ omitted }} : nt!PspCatchCriticalBreak+0x10e\nffffa209`4982f8e0 fffff801`2d4819b0 : {{ omitted }} : nt!PspTerminateAllThreads+0x15e655\nffffa209`4982f950 fffff801`2d4817ac : {{ omitted }} : nt!PspTerminateProcess+0xe0\nffffa209`4982f990 fffff801`2d2105f5 : {{ omitted }} : nt!NtTerminateProcess+0x9c\nffffa209`4982fa00 00007ff8`7accd3d4 : {{ omitted }} : nt!KiSystemServiceCopyEnd+0x25\n00000087`d59ef568 00000000`00000000 : {{ omitted }} : ntdll!NtTerminateProcess+0x14</code></pre></div>\n<p>The <code class=\"language-text\">KeBugCheckEx</code> function at the top of the stack backtrace is the function that directly triggers a system crash.<sup id=\"fnref-2\"><a href=\"#fn-2\" class=\"footnote-ref\">2</a></sup></p>\n<p>The <code class=\"language-text\">KeBugCheckEx</code> function receives a stop code and four parameters whose meanings depend on that stop code.</p>\n<p>That corresponds to the bug check information we just examined with the <code class=\"language-text\">.bugcheck</code> command and similar output.</p>\n<p>Conversely, the <code class=\"language-text\">NtTerminateProcess</code> function at the bottom of the stack backtrace is, as documented below, a function normally used when a user-mode application calls an API to terminate a process.</p>\n<br>\n<p>ZwTerminateProcess function (ntddk.h):</p>\n<p><a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/ddi/ntddk/nf-ntddk-zwterminateprocess\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/ddi/ntddk/nf-ntddk-zwterminateprocess</a></p>\n<br>\n<p>Considering the stack backtrace output together with the bug check information, we can conclude that it is highly likely that some user-mode application terminated <code class=\"language-text\">svchost.exe</code>, which is a critical system process, and that this caused the system crash.</p>\n<p>In the following output, which appears in the last section of <code class=\"language-text\">!analyze -v</code>, <code class=\"language-text\">FAILURE_BUCKET_ID</code> is also shown as <code class=\"language-text\">0xEF_svchost.exe_BUGCHECK_CRITICAL_PROCESS_42bd7080_ntdll!NtTerminateProcess</code>, so we can judge that this system crash occurred because <code class=\"language-text\">svchost.exe</code> was terminated by the <code class=\"language-text\">NtTerminateProcess</code> function.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">SYMBOL_NAME:  ntdll!NtTerminateProcess+14\n\nMODULE_NAME: ntdll\n\nIMAGE_NAME:  ntdll.dll\n\nSTACK_COMMAND:  .cxr; .ecxr ; kb\n\nBUCKET_ID_FUNC_OFFSET:  14\n\nFAILURE_BUCKET_ID:  0xEF_svchost.exe_BUGCHECK_CRITICAL_PROCESS_42bd7080_ntdll!NtTerminateProcess\n\nOS_VERSION:  10.0.19041.1\n\nBUILDLAB_STR:  vb_release\n\nOSPLATFORM_TYPE:  x64\n\nOSNAME:  Windows 10\n\nFAILURE_ID_HASH:  {f6ece2b4-3d35-e4e4-9739-fdbc46a086b0}\n\nFollowup:     MachineOwner</code></pre></div>\n<h2 id=\"identifying-the-process-that-caused-the-crash\" style=\"position:relative;\"><a href=\"#identifying-the-process-that-caused-the-crash\" aria-label=\"identifying the process that caused the crash permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Identifying the process that caused the crash</h2>\n<p>From the output of <code class=\"language-text\">!analyze -v</code>, we were able to identify the exception that directly caused the crash.</p>\n<p>However, the stack backtrace shown by <code class=\"language-text\">!analyze -v</code> did not include any information earlier than <code class=\"language-text\">ntdll!NtTerminateProcess+0x14</code>, so we still could not determine exactly what caused the exception.</p>\n<p>This is because the context associated with this exception is the process context of the terminated <code class=\"language-text\">svchost.exe</code>.</p>\n<p>You can check the current process context associated with the exception by running <code class=\"language-text\">.ecxr; !peb</code>. (The <code class=\"language-text\">!peb</code> extension<sup id=\"fnref-3\"><a href=\"#fn-3\" class=\"footnote-ref\">3</a></sup> displays the PEB (Process Environment Block) corresponding to the current process context.)</p>\n<p>Because it was difficult to investigate further from the exception-related context selected by <code class=\"language-text\">.ecxr</code>, we need to switch the context to the process that may have caused the crash in order to proceed with a more detailed investigation.</p>\n<p>In this case, that process is <code class=\"language-text\">D4C.exe</code>.</p>\n<p>If you display thread information for the exception-related context with the <code class=\"language-text\">.ecxr; !thread</code> command, you can see that <code class=\"language-text\">Owning Process</code> is <code class=\"language-text\">D4C.exe</code>, and the address of the process object is shown as <code class=\"language-text\">0xffffc18f45284080</code>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/f6ac26e1fa815010e9d28f8e905fe500/0b533/system-crash-003.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 30.83333333333333%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABGUlEQVQY042R2W6DMBBF8/8/VrWQBjBrWBqzBEjAlIqIJYhbj5UuD33oSNZ4ZM2Z6zu7NE3BmIUkSeD7Aeq6Rp5nsG0bXdchCAJEUYS2bWFZlnrnnMM0TQgh4Lqu6qXYtg07zlM8Pb/AdlzsdQ1xHCHNC+j7A66XCzzPU80E0jRNwUiErutomkaK8BGG4Q/w9WAg4gXExw1RWiGvBd6HEbd5RdV0GMcRy7JgmiaV13XFX0EwBTTk9DzL0LQCzvGEomrk5Cvu9wXjvOA/8QX7BpIPpiGVHgPw05usPfn1GOdzgU76JB6HPO37HmVZqjwMg1L9O3ZMmk8+ORIax4lqshmTi2LKO1oEe9R0p0GUDSmAhBB4nmdlDeVPgOy9uFRlynAAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/f6ac26e1fa815010e9d28f8e905fe500/8ac56/system-crash-003.webp 240w,\n/static/f6ac26e1fa815010e9d28f8e905fe500/d3be9/system-crash-003.webp 480w,\n/static/f6ac26e1fa815010e9d28f8e905fe500/b0a15/system-crash-003.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/f6ac26e1fa815010e9d28f8e905fe500/8ff5a/system-crash-003.png 240w,\n/static/f6ac26e1fa815010e9d28f8e905fe500/e85cb/system-crash-003.png 480w,\n/static/f6ac26e1fa815010e9d28f8e905fe500/0b533/system-crash-003.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/f6ac26e1fa815010e9d28f8e905fe500/0b533/system-crash-003.png\"\n            alt=\"Investigating the thread where the crash occurred\"\n            title=\"Investigating the thread where the crash occurred\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>So, use the <code class=\"language-text\">.process /r /P 0xffffc18f45284080</code> command to change the debugger’s process context to the <code class=\"language-text\">D4C.exe</code> process.</p>\n<p>If you run the <code class=\"language-text\">!peb</code> command again after changing the process context, you can confirm that the displayed information changes from the PEB for <code class=\"language-text\">svchost.exe</code> to the PEB for <code class=\"language-text\">D4C.exe</code>.</p>\n<p>This process-context switch with <code class=\"language-text\">.process /r /P &lt;process object (EPROCESS) address></code> is a command that appears frequently when analyzing full memory dumps, so it is worth remembering.</p>\n<p>Finally, with the process context changed to <code class=\"language-text\">D4C.exe</code>, run the <code class=\"language-text\">k</code> command again to output the stack backtrace. You can now inspect frames from before <code class=\"language-text\">ntdll!NtTerminateProcess+0x14</code> was called.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">6: kd> k\n # Child-SP          RetAddr               Call Site\n00 ffffa209`4982f838 fffff801`2d70e592     nt!KeBugCheckEx\n01 ffffa209`4982f840 fffff801`2d616045     nt!PspCatchCriticalBreak+0x10e\n02 ffffa209`4982f8e0 fffff801`2d4819b0     nt!PspTerminateAllThreads+0x15e655\n03 ffffa209`4982f950 fffff801`2d4817ac     nt!PspTerminateProcess+0xe0\n04 ffffa209`4982f990 fffff801`2d2105f5     nt!NtTerminateProcess+0x9c\n05 ffffa209`4982fa00 00007ff8`7accd3d4     nt!KiSystemServiceCopyEnd+0x25\n06 00000087`d59ef568 00007ff8`789643d0     ntdll!NtTerminateProcess+0x14\n07 00000087`d59ef570 00007ff6`e99012d3     KERNELBASE!TerminateProcess+0x30\n08 00000087`d59ef5a0 00007ff6`e9901a40     D4C+0x12d3\n09 00000087`d59ef860 00007ff8`7a497344     D4C+0x1a40\n0a 00000087`d59ef8a0 00007ff8`7ac826b1     KERNEL32!BaseThreadInitThunk+0x14\n0b 00000087`d59ef8d0 00000000`00000000     ntdll!RtlUserThreadStart+0x21</code></pre></div>\n<p>From this result, we can infer that the instruction immediately before offset <code class=\"language-text\">0x12d3</code> in <code class=\"language-text\">D4C.exe</code> likely called the <code class=\"language-text\">TerminateProcess</code> API and terminated <code class=\"language-text\">svchost.exe</code>.</p>\n<h2 id=\"reading-the-instructions-before-and-after-the-crash\" style=\"position:relative;\"><a href=\"#reading-the-instructions-before-and-after-the-crash\" aria-label=\"reading the instructions before and after the crash permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Reading the instructions before and after the crash</h2>\n<p>From the analysis so far, we have confirmed that the instruction immediately before offset <code class=\"language-text\">0x12d3</code> in <code class=\"language-text\">D4C.exe</code> most likely called the <code class=\"language-text\">TerminateProcess</code> API and caused the system crash.</p>\n<p>Next, we will investigate what the instructions before and after offset <code class=\"language-text\">0x12d3</code> actually looked like.</p>\n<p>As in Chapter 4, we used the <code class=\"language-text\">u</code> command and the Disassembly window to retrieve the instructions around offset <code class=\"language-text\">0x12d3</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">00007ff6`e99012b0 448b442448      mov     r8d,dword ptr [rsp+48h]\n00007ff6`e99012b5 8d48f5          lea     ecx,[rax-0Bh]\n00007ff6`e99012b8 33d2            xor     edx,edx\n00007ff6`e99012ba ff15781d0000    call    qword ptr [D4C+0x3038 (00007ff6`e9903038)]\n00007ff6`e99012c0 488bd8          mov     rbx,rax\n00007ff6`e99012c3 4885c0          test    rax,rax\n00007ff6`e99012c6 7416            je      D4C+0x12de (00007ff6`e99012de)\n00007ff6`e99012c8 33d2            xor     edx,edx\n00007ff6`e99012ca 488bc8          mov     rcx,rax\n00007ff6`e99012cd ff155d1d0000    call    qword ptr [D4C+0x3030 (00007ff6`e9903030)]\n00007ff6`e99012d3 488bcb          mov     rcx,rbx\n00007ff6`e99012d6 ff158c1d0000    call    qword ptr [D4C+0x3068 (00007ff6`e9903068)]\n00007ff6`e99012dc eb11            jmp     D4C+0x12ef (00007ff6`e99012ef)\n00007ff6`e99012de 488d54246c      lea     rdx,[rsp+6Ch]\n00007ff6`e99012e3 488d0d26410000  lea     rcx,[D4C+0x5410 (00007ff6`e9905410)]\n00007ff6`e99012ea e821fdffff      call    D4C+0x1010 (00007ff6`e9901010)\n00007ff6`e99012ef 488d542440      lea     rdx,[rsp+40h]\n00007ff6`e99012f4 488bcf          mov     rcx,rdi\n00007ff6`e99012f7 ff15431d0000    call    qword ptr [D4C+0x3040 (00007ff6`e9903040)]\n00007ff6`e99012fd 85c0            test    eax,eax</code></pre></div>\n<p>In the dump file I captured, the image base address of <code class=\"language-text\">D4C.exe</code> is <code class=\"language-text\">0x00007ff6e9900000</code>, so the virtual address of offset (RVA) <code class=\"language-text\">0x12d3</code> is <code class=\"language-text\">0x00007ff6e99012d3</code>.</p>\n<p>As an aside, calculations such as address arithmetic can also be performed with expression evaluation using the <code class=\"language-text\">?</code> command, as shown below.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\"># Identify the image base address of D4C.exe\n6: kd> ? !D4C\nEvaluate expression: 140698457210880 = 00007ff6`e9900000\n\n# Calculate the address of offset 0x12d3 in D4C.exe\n6: kd> ? !D4C+0x12d3\nEvaluate expression: 140698457215699 = 00007ff6`e99012d3</code></pre></div>\n<p>Looking at the disassembly above, we can see that the instruction immediately before offset <code class=\"language-text\">0x12d3</code>, which was added to the stack backtrace, is <code class=\"language-text\">call qword ptr [D4C+0x3030 (00007ff6e9903030)]</code>.</p>\n<p>Also, based on the later stack backtrace information, we can infer that this instruction is probably calling the <code class=\"language-text\">TerminateProcess</code> API.</p>\n<p>So let’s confirm from the dump file whether this function really does call the <code class=\"language-text\">TerminateProcess</code> function.</p>\n<h2 id=\"analyzing-the-iat-import-address-table-in-windbg\" style=\"position:relative;\"><a href=\"#analyzing-the-iat-import-address-table-in-windbg\" aria-label=\"analyzing the iat import address table in windbg permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Analyzing the IAT (Import Address Table) in WinDbg</h2>\n<p>As briefly introduced in Chapter 3 of this book, programs (<code class=\"language-text\">.exe</code> files) executed on Windows systems are generally created in PE file format.</p>\n<p>When a program is executed on Windows, the system loads various pieces of information from the PE file header and expands them into the process’s allocated memory space.</p>\n<p>One of those pieces of information is called the IAT (Import Address Table).</p>\n<p>To determine whether the function called at <code class=\"language-text\">D4C+0x3030</code> is <code class=\"language-text\">TerminateProcess</code>, let’s inspect this IAT information.</p>\n<p>First, use WinDbg to collect the header information of <code class=\"language-text\">D4C.exe</code> as it was expanded in memory from this dump file.</p>\n<p>In WinDbg, the <code class=\"language-text\">!dh</code> extension<sup id=\"fnref-4\"><a href=\"#fn-4\" class=\"footnote-ref\">4</a></sup> lets you inspect the header information of a specific image.</p>\n<p>However, when using the <code class=\"language-text\">!dh</code> extension to inspect the header information of a specific PE file from a full memory dump, you need to switch the context beforehand to the execution process of that PE file with the <code class=\"language-text\">.process /r /P &lt;process object (EPROCESS) address></code> command.</p>\n<p>After changing the process context to <code class=\"language-text\">D4C.exe</code>, run the <code class=\"language-text\">!dh -f !D4C</code> command to retrieve the information.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">6: kd> !dh -f !D4C\n\n{{ omitted }}\n\n   0 [       0] address [size] of Export Directory\n5B40 [      C8] address [size] of Import Directory\n9000 [     1E8] address [size] of Resource Directory\n8000 [     1D4] address [size] of Exception Directory\n   0 [       0] address [size] of Security Directory\nA000 [      3C] address [size] of Base Relocation Directory\n5610 [      70] address [size] of Debug Directory\n   0 [       0] address [size] of Description Directory\n   0 [       0] address [size] of Special Directory\n   0 [       0] address [size] of Thread Storage Directory\n54D0 [     140] address [size] of Load Configuration Directory\n   0 [       0] address [size] of Bound Import Directory\n3000 [     248] address [size] of Import Address Table Directory\n   0 [       0] address [size] of Delay Import Directory\n   0 [       0] address [size] of COR20 Header Directory\n   0 [       0] address [size] of Reserved Directory</code></pre></div>\n<p>Because what we want to inspect here is the IAT, focus on the <code class=\"language-text\">Import Address Table Directory</code> line in the output above.</p>\n<p>That line tells us that the IAT offset is <code class=\"language-text\">0x3000</code> and its size is <code class=\"language-text\">0x248</code>.</p>\n<p>Next, use the <code class=\"language-text\">dps</code> command<sup id=\"fnref-5\"><a href=\"#fn-5\" class=\"footnote-ref\">5</a></sup>, which resolves the contents of memory within a specified range as a series of addresses in the symbol table, to resolve the IAT symbols.</p>\n<p>This resolves the symbols in the IAT expanded into process memory, confirming that the function at virtual address <code class=\"language-text\">0x00007ff6e9903030</code>, in other words <code class=\"language-text\">D4C+0x3030</code>, is <code class=\"language-text\">KERNEL32!TerminateProcessStub</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\"># dps !&lt;module_name>+&lt;IAT address> !&lt;module_name>+&lt;IAT address>+&lt;IAT size>\n\n6: kd> dps !D4C+0x3000 !D4C+0x3000+0x248\n00007ff6`e9903000  00007ff8`7ab57880 ADVAPI32!AdjustTokenPrivilegesStub\n00007ff6`e9903008  00007ff8`7ab56920 ADVAPI32!OpenProcessTokenStub\n00007ff6`e9903010  00007ff8`7ab4f970 ADVAPI32!LookupPrivilegeValueW\n00007ff6`e9903018  00000000`00000000\n00007ff6`e9903020  00007ff8`7a495f00 KERNEL32!GetLastErrorStub\n00007ff6`e9903028  00007ff8`7a4a4ba0 KERNEL32!GetCurrentProcessId\n00007ff6`e9903030  00007ff8`7a4a0a70 KERNEL32!TerminateProcessStub\n00007ff6`e9903038  00007ff8`7a49b0f0 KERNEL32!OpenProcessStub\n00007ff6`e9903040  00007ff8`7a4a2740 KERNEL32!Process32NextW\n00007ff6`e9903048  00007ff8`7a4a29a0 KERNEL32!Process32FirstW\n{{ omitted }}</code></pre></div>\n<p>Also, even without going out of your way to analyze the IAT in WinDbg like this, you can easily identify the function at <code class=\"language-text\">D4C+0x3030</code> by using the automatic analysis features of a decompiler such as Ghidra.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/37bb1a5b06acf83c2dcb7c32fce18cd5/0b533/ghidra-iat-01.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 22.916666666666668%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABCklEQVQY022Q2U6DUBRF+f+v0hjTKvVBU7BaLC1wGcqMtGW43CWD8cmT7OwhOS9LC/2QPCvJc+ha5hukoqqavxwFFcn5QihqqmLZUf9L273v8LyQkwNpOoybou16rEPC1KSUpHZGJgoSL6DOauQwMKhFiuVn+HXt7vjAo79hFX2NbvFa7zG6D+7tN7bNJ2a3Y+3qrIWOnj2hJwYrf8smNXnJzdn1szHuJs+xgba39pw8HxFJXNFTNz2NbLHshFvf0soG3xEEIiDOPKK4wPVz4vybrKxniaAgjMvx94Z2OhzxvYQ4guY6MVu42YcC2Y9YpmzHuE6G55TEI8tL3XG9dNyuPW0j5z5JKcUPCZZ6HxunuPMAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/37bb1a5b06acf83c2dcb7c32fce18cd5/8ac56/ghidra-iat-01.webp 240w,\n/static/37bb1a5b06acf83c2dcb7c32fce18cd5/d3be9/ghidra-iat-01.webp 480w,\n/static/37bb1a5b06acf83c2dcb7c32fce18cd5/b0a15/ghidra-iat-01.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/37bb1a5b06acf83c2dcb7c32fce18cd5/8ff5a/ghidra-iat-01.png 240w,\n/static/37bb1a5b06acf83c2dcb7c32fce18cd5/e85cb/ghidra-iat-01.png 480w,\n/static/37bb1a5b06acf83c2dcb7c32fce18cd5/0b533/ghidra-iat-01.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/37bb1a5b06acf83c2dcb7c32fce18cd5/0b533/ghidra-iat-01.png\"\n            alt=\"Ghidra disassembly result\"\n            title=\"Ghidra disassembly result\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>The disassembly at offset <code class=\"language-text\">0x3030</code> is automatically analyzed as well, making it easy to investigate that the function called here is <code class=\"language-text\">TerminateProcess</code>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 500px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/cac71f1f2674618b04dc9ab65b91d0de/0b533/ghidra-iat-02.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 53.75%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB2klEQVQoz32S6XKcQAyEef8Xy9/YScWOvWFPdrkWmIOBYYAvArJJqnKIakalkVpqQXRTEw9cm3FDHbhUPUnt5fQk1SD+IHfhJ1I9r1jqHv6CKJNXZliLDpld8e1q+XrUvF9avuxLXg65+BVxatb7hfz3QR5YCT9J4knIUj3xdCp4uzUcC8+Htzuv14FTEbZGecsxd5zK7o+pHpMuiHaSmKiRVKS+HBXvZ5nw3PIxLnlLLOfMS6KosHBVgZteCmUtgo1kWdNEpmFRGyX1SNIghT3vByPyWl73mlj83clyvDmupZBWgV2hOFQd8d3ylFz4fEt5vl55PosyYTzLzqO8spTSQTkEI42b6J3H5XecbnG1pi0b2trQelbYfsL0I/oHTB9Q3SCnSOZh88jge8LQ45zDmBZrW+qmRmmFNoauc/i+I4SBf1lUWUsfAtMo0tOMqmlQSrO/KLKipyzvKInVdb3GreRP08w8/x1RnOd0w9Yxk0nc4JmZiPOMuChEXr8JkOf/thDKhK3fCGbpWt4NZa5pKkcqflZohvCLaBgHxmlc4UdPGMMa86JwnjfSSCsrMpC9CWFuSeX/MJl8hN2ZUNbMInmuKpCG1i/r8SuZ6Q3OuzVmXC9r2Ai/A2l4TBBW70BYAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/cac71f1f2674618b04dc9ab65b91d0de/8ac56/ghidra-iat-02.webp 240w,\n/static/cac71f1f2674618b04dc9ab65b91d0de/d3be9/ghidra-iat-02.webp 480w,\n/static/cac71f1f2674618b04dc9ab65b91d0de/b0a15/ghidra-iat-02.webp 500w\"\n              sizes=\"(max-width: 500px) 100vw, 500px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/cac71f1f2674618b04dc9ab65b91d0de/8ff5a/ghidra-iat-02.png 240w,\n/static/cac71f1f2674618b04dc9ab65b91d0de/e85cb/ghidra-iat-02.png 480w,\n/static/cac71f1f2674618b04dc9ab65b91d0de/0b533/ghidra-iat-02.png 500w\"\n            sizes=\"(max-width: 500px) 100vw, 500px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/cac71f1f2674618b04dc9ab65b91d0de/0b533/ghidra-iat-02.png\"\n            alt=\"Ghidra disassembly result\"\n            title=\"Ghidra disassembly result\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>In this way, rather than analyzing only with WinDbg, there are cases where analysis proceeds more efficiently by using multiple powerful tools such as decompilers and approaching the problem from different angles.</p>\n<p>This completes the identification, through dump file analysis, that the system crash was caused by <code class=\"language-text\">svchost.exe</code> being terminated by the <code class=\"language-text\">TerminateProcess</code> API called from <code class=\"language-text\">D4C.exe</code>.</p>\n<h2 id=\"chapter-5-summary\" style=\"position:relative;\"><a href=\"#chapter-5-summary\" aria-label=\"chapter 5 summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Chapter 5 summary</h2>\n<p>That concludes the analysis of this simple system crash dump.</p>\n<p>As with the application crash dump analyzed in Chapter 4, the direct cause (exception) of the BSOD itself can be identified relatively easily from the dump file.</p>\n<p>Of course, if you want to investigate the program behavior that caused that exception, it will rarely be identified as easily as it was in this chapter.</p>\n<p>In such cases, not only analyzing the dump file with WinDbg but also tracing the environment while reproducing the problem with tools such as Process Monitor or packet capture, using source code or decompiled results for offline debugging, and even live debugging may help you investigate the cause more efficiently.</p>\n<h2 id=\"chapter-links\" style=\"position:relative;\"><a href=\"#chapter-links\" aria-label=\"chapter links permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Chapter links</h2>\n<ul>\n<li><a href=\"/magical-windbg-vol1-00-en\">Preface</a></li>\n<li><a href=\"/magical-windbg-vol1-01-en\">Chapter 1: Environment Setup</a></li>\n<li><a href=\"/magical-windbg-vol1-02-en\">Chapter 2: Basic WinDbg Operations</a></li>\n<li><a href=\"/magical-windbg-vol1-03-en\">Chapter 3: Prerequisites for Analysis</a></li>\n<li><a href=\"/magical-windbg-vol1-04-en\">Chapter 4: Analyzing an Application Crash Dump</a></li>\n<li><a href=\"/magical-windbg-vol1-05-en\">Chapter 5: Analyzing a Full Memory Dump from a System Crash</a></li>\n<li><a href=\"/magical-windbg-vol1-06-en\">Chapter 6: Investigating a User-Mode Application Memory Leak from a Process Dump</a></li>\n<li><a href=\"/magical-windbg-vol1-07-en\">Chapter 7: Investigating a User-Mode Memory Leak from a Full Memory Dump</a></li>\n<li><a href=\"/magical-windbg-vol1-50-en\">Appendix A: WinDbg Tips</a></li>\n<li><a href=\"/magical-windbg-vol1-51-en\">Appendix B: Analyzing Crash Dumps with Volatility 3</a></li>\n</ul>\n<div class=\"footnotes\">\n<hr>\n<ol>\n<li id=\"fn-1\">\n<p>Blue Screen Data <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/blue-screen-data\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/blue-screen-data</a></p>\n<a href=\"#fnref-1\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-2\">\n<p>Windows Internals, 6th Edition, Vol. 2, p.606 (Mark E. Russinovich・David A. Solomon・Alex Ionescu / translated by 株式会社クイープ / 日経 BP / 2013)</p>\n<a href=\"#fnref-2\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-3\">\n<p><code class=\"language-text\">!peb</code> extension <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/-peb\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/-peb</a></p>\n<a href=\"#fnref-3\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-4\">\n<p><code class=\"language-text\">!dh</code> <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/-dh\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/-dh</a></p>\n<a href=\"#fnref-4\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-5\">\n<p><code class=\"language-text\">dps</code> <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/dds--dps--dqs--display-words-and-symbols-\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/debugger/dds—dps—dqs—display-words-and-symbols-</a></p>\n<a href=\"#fnref-5\" class=\"footnote-backref\">↩</a>\n</li>\n</ol>\n</div>","fields":{"slug":"/magical-windbg-vol1-05-en","tagSlugs":["/tag/magical-win-dbg/","/tag/windows/","/tag/win-dbg/","/tag/english/"]},"frontmatter":{"date":"2023-11-15","description":"This is the web edition of Magical WinDbg - Enjoying Windows Dump Analysis and Troubleshooting by Feel - VOL.1, distributed at Tech Book Fest 15.","tags":["Magical WinDbg","Windows","WinDbg","English"],"title":"Magical WinDbg VOL.1 [Chapter 5: Analyzing a Full Memory Dump from a System Crash]","socialImage":{"publicURL":"/static/2dbf3e09d59db889dc9dc41adcc8e827/magical-windbg-vol1.png"}}}},"pageContext":{"slug":"/magical-windbg-vol1-05-en"}},"staticQueryHashes":["251939775","401334301","825871152"]}