{"id":266,"date":"2009-08-26T04:09:14","date_gmt":"2009-08-26T08:09:14","guid":{"rendered":"http:\/\/www.cchsu.com\/arthur\/?p=266"},"modified":"2009-08-30T13:18:21","modified_gmt":"2009-08-30T20:18:21","slug":"windows-%e9%99%a4%e9%8c%af%e7%9a%84%e7%ac%ac%e4%b8%80%e6%ad%a5","status":"publish","type":"post","link":"https:\/\/www.cchsu.com\/arthur\/2009\/08\/26\/266\/","title":{"rendered":"Windows \u9664\u932f\u7684\u7b2c\u4e00\u6b65"},"content":{"rendered":"<p>\u6700\u8fd1\u6bd4\u8f03\u6709\u7a7a\u4e9b\uff0c\u525b\u597d\u8001\u95c6\u6709\u8981\u6c42\u8981\u6574\u7406\u4e00\u4e0b\u6b77\u5e74\u4f86\u548c\u87f2\u87f2\u4f5c\u6230\u7684\u5fc3\u5f97\uff0c\u65e2\u7136\u5beb\u4e86\u82f1\u6587\u7248\u5c31\u9806\u624b\u54c8\u5566\u4e00\u4e0b\u4e2d\u6587\u7684\uff0c\u4e5f\u53ef\u4ee5\u8907\u7fd2\u4e00\u4e0b\u5f88\u4e45\u6c92\u7528\u7684\u884c\u5217\u8f38\u5165\u6cd5 \ud83d\ude42  \u672c\u7cfb\u5217\u6587\u7ae0\u4f7f\u7528\u7684\u7bc4\u4f8b\u7a0b\u5f0f\u53ef\u4ee5\u5f9e <a href=\"http:\/\/peonsamples.codeplex.com\" target=\"_blank\">Codeplex<\/a> \u4e0b\u8f09\u3002\u6211\u4f7f\u7528 Codeplex \u800c\u975e SourceForge \u7684\u539f\u56e0\u662f\u56e0\u70ba\u6211\u7684\u7db2\u8def\u9023 Codeplex \u5feb\u5f88\u591a\uff0c\u672c\u4eba\u4e26\u672a\u66ff Codeplex \u80cc\u66f8\uff0c\u672c\u7cfb\u5217\u6587\u7ae0\u4e5f\u6c92\u6709\u5fae\u8edf\u7684\u80cc\u66f8 :p<\/p>\n<p>\u53e6\u5916\u5462\uff0c\u8a31\u591a\u82f1\u6587\u7684\u5c08\u6709\u540d\u8a5e\u6211\u76f4\u63a5\u5c31\u5217\u4e86\uff0c\u56e0\u70ba\u548c\u4e2d\u6587\u7ffb\u8b6f\u7684\u540d\u8a5e\u812b\u7bc0\u6709\u6bb5\u6642\u9593\uff0c\u6240\u4ee5\u5beb\u82f1\u6587\u6bd4\u8f03\u5feb\u4e9b\u3002\u597d\u5427\u5ee2\u8a71\u4e0d\u591a\u8aaa\uff0c\u76f4\u63a5\u5f9e\u6700\u7c21\u55ae\u7684 HelloCrash \u9019\u652f\u7a0b\u5f0f\u958b\u59cb\u3002\u7528 VC 2008 \u7de8\u8b6f\u4e26\u57f7\u884c\u5f8c\u9019\u96bb\u7a0b\u5f0f\u6703\u639b\u6389 (\u622a\u5716\u7686\u70ba\u82f1\u6587\u7248\uff0c\u56e0\u70ba\u6211\u7684 OS \u662f\u82f1\u6587\u7684 \ud83d\ude00 \u4e2d\u6587\u7684\u756b\u9762\u5c31\u8acb\u81ea\u884c\u7528\u667a\u6167\u4eba\u8166\u4ee3\u63db\u6cd5\u4f86\u63db\u6587\u5b57)<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/24238190@N00\/3858664820\/\" class=\"tt-flickr tt-flickr-Small\" title=\"hellocrash1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/farm4.static.flickr.com\/3548\/3858664820_8481b0ded8_m.jpg\" alt=\"hellocrash1\" width=\"240\" height=\"120\" \/><\/a><\/p>\n<p>\u628a\u9019\u500b\u5c0d\u8a71\u76d2\u76f4\u63a5\u95dc\u6389\uff0c\u5176\u5be6\u6c92\u6709\u592a\u5927\u7684\u95dc\u4fc2\u3002Windows \u4ecd\u6703\u5728\u5b83\u7684\u65e5\u8a8c\u4e2d\uff0c\u61c9\u7528\u7a0b\u5f0f\u7684\u90e8\u4efd\u53bb\u8a18\u9304\u9019\u500b crash:<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/24238190@N00\/3857876093\/\" class=\"tt-flickr tt-flickr-Medium\" title=\"hellocrash2\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/farm3.static.flickr.com\/2588\/3857876093_f915cb07d5.jpg\" alt=\"hellocrash2\" width=\"500\" height=\"349\" \/><\/a> <\/p>\n<p>\u9019\u7b46\u8a18\u9304\u5176\u5be6\u6709\u5f88\u591a\u91cd\u8981\u7684\u8cc7\u8a0a\u5728\u88e1\u982d\u3002\u5728\u6211\u5011\u8df3\u4e0b\u53bb\u8490\u96c6\u4e26\u5206\u6790 crash dump \u4e4b\u524d\uff0c\u5176\u5be6\u53ef\u4ee5\u5229\u7528\u4e00\u4e0b\u73fe\u6210\u7684\u8cc7\u8a0a\u4f86\u505a\u521d\u6b65\u7684\u5206\u6790\u3002\u6211\u767c\u73fe\u5f88\u591a\u4eba\u5728\u5b78\u4e86 WinDBG \u4e4b\u5f8c\uff0c\u5c31\u5fd8\u8a18\u5176\u5be6\u9084\u6709\u66f4\u7c21\u55ae\u7684\u5de5\u5177\u53ef\u4ee5\u7528 \ud83d\ude42 \u9019\u500b\u8aa4\u5340\u5176\u5be6\u662f\u53ef\u4ee5\u907f\u514d\u7684\u3002<\/p>\n<p>\u5728\u6211\u5011\u7684\u4f8b\u5b50\u88e1\uff0c\u6211\u5011\u77e5\u9053 crash \u767c\u751f\u7684 module \u548c offset (\u898b\u4e0a\u5716\u7684\u9ec3\u8272\u9ad8\u4eae\u90e8\u4efd)\uff0c\u9019\u8868\u793a\u6211\u5011\u53ef\u4ee5\u76f4\u63a5\u7531 map \u6a94\u548c\u7d44\u5408\u8a9e\u8a00\u5217\u8868\u53bb\u627e\u51fa crash \u767c\u751f\u5728\u54ea\u652f\u7a0b\u5f0f\u7684\u54ea\u4e00\u884c\u3002\u96d6\u7136\u9019\u672a\u5fc5\u662f 100% \u6b63\u78ba (\u7406\u7531\u5728\u5f8c\u7e8c\u7684\u6587\u7ae0\u6703\u63d0\u5230)\uff0c\u4f46\u4e5f\u662f\u500b\u503c\u5f97\u53c3\u8003\u7684\u8cc7\u8a0a\u3002\u4f8b\u5b50\u4e2d module \u662f HelloCrash.exe\uff0coffset 0x1002\uff0c\u67e5\u627e map \u6a94\u53ef\u5f97\u77e5<\/p>\n<blockquote><p>\nPreferred load address is <b><font color=\"blue\">00400000<\/font><\/b><br \/>\n&#8230;<\/p>\n<p>Address         Publics by Value              Rva+Base       Lib:Object<\/p>\n<p>0000:00000001       ___safe_se_handler_count   00000001     <absolute><br \/>\n0000:00000000       ___ImageBase               00400000     <linker-defined>\n0001:00000000       _wmain                     <b><font color=\"blue\">00401000<\/font><\/b> f   HelloCrash.obj<br \/>\n0001:00000017       @__security_check_cookie@4 <b><font color=\"blue\">00401017<\/font><\/b> f   MSVCRT:secchk.obj<br \/>\n&#8230;\n<\/p><\/blockquote>\n<p>crash \u7684\u9ede\u61c9\u662f\u843d\u5728 _wmain \u51fd\u6578 (offset 0x1000 to 0x1016)\uff0c\u5728\u51fd\u6578\u5167\u7684 offset \u70ba 0x2\u3002\u82e5\u5728 VC \u7684\u8a2d\u5b9a\u4e2d\u6709\u53eb\u5b83\u7522\u751f\u7d44\u5408\u8a9e\u8a00\u5217\u8868 (\/FAcs)\uff0c\u5c31\u53ef\u76f4\u63a5\u627e\u51fa\u8a72\u884c:<\/p>\n<blockquote><p>\n; 9    :     TCHAR* p = NULL;<\/p>\n<p>  00000\t33 c0\t\t xor\t eax, eax<\/p>\n<p>; 10   :     _tprintf(_T(&#8220;Hello, crash: %s\\n&#8221;), *p); \/\/ deref NULL pointer<\/p>\n<p>  <b><font color=\"blue\">00002<\/font><\/b>\t0f b7 00\t movzx\t eax, WORD PTR [eax]\n<\/p><\/blockquote>\n<p>\u9019\u500b\u4f8b\u5b50\u592a\u7c21\u55ae\uff0c\u4e00\u773c\u5c31\u53ef\u770b\u51fa\u662f\u932f\u8aa4\u7684\u53d6\u7528\u6307\u6a19\u9020\u6210 crash\u3002\u9019\u500b\u4f8b\u5b50\u4e3b\u8981\u662f\u8b1b\u8ff0\u5982\u4f55\u4f7f\u7528 map \u6a94\u4f86\u505a\u521d\u6b65\u7684\u5224\u65b7\uff0c\u63a5\u4e0b\u4f86\u7684\u6587\u7ae0\u5c07\u70ba\u60a8\u5c55\u793a\u5176\u4ed6\u627e\u51fa\u554f\u984c\u9ede\u7684\u65b9\u6cd5\uff0c\u656c\u8acb\u671f\u5f85\u56c9 \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 map \u8207\u7d44\u5408\u8a9e\u8a00\u5217\u8868\u4f86\u627e\u51fa\u554f\u984c\u9ede<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,25,6,2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/266"}],"collection":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":6,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":284,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/266\/revisions\/284"}],"wp:attachment":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}