{"id":56,"date":"2008-10-15T17:11:47","date_gmt":"2008-10-15T17:11:47","guid":{"rendered":"http:\/\/kumouse.aafox.com\/?p=56"},"modified":"2008-10-15T17:11:47","modified_gmt":"2008-10-15T17:11:47","slug":"%e5%a0%86%e7%ae%a1%e7%90%86%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.kumouse.com\/?p=56","title":{"rendered":"\u5806\u7ba1\u7406\u51fd\u6570"},"content":{"rendered":"<p>\u5806\u7ba1\u7406\u51fd\u6570<br \/>1.\u79c1\u6709\u5806\u7684\u521b\u5efa\u548c\u91ca\u653e<br \/>\u79c1\u6709\u5806\u7684\u521b\u5efa<\/p>\n<blockquote><p>invoke HeapCreate,flOptions,dwInitialSize,dwMaximumSize<br \/>.if eax &#038;&#038; (eax&lt;0c0000000h)<br \/>    mov hHeap,eax<br \/>.endif<\/p><\/blockquote>\n<p>flOptions\u6307\u5b9a\u5806\u5c5e\u6027,\u6709\u4e24\u4e2a\u503c<br \/>HEAP_NO_SERIALIZE:\u6807\u5fd7\u79c1\u6709\u5806\u4e0d\u8fdb\u884c\u72ec\u5360\u68c0\u6d4b<br \/>HEAP_GENERATE_EXCEPTIONS:\u6307\u5b9a\u51fd\u6570\u5931\u8d25\u7684\u8fd4\u56de\u503c,\u4e0d\u6307\u5b9a\u5931\u8d25\u8fd4\u56deNULL<br \/>dwInitialSize\u6307\u5b9a\u521b\u5efa\u5806\u65f6\u5206\u914d\u7684\u7269\u7406\u5185\u5b58<br \/>dwMaximumSize\u4e3a\u5806\u81ea\u52a8\u6269\u5c55\u7684\u6700\u5927\u503c.\u4e3a0\u5219\u6ca1\u6709\u6700\u5927\u9650\u5236,\u975e0\u65f6\u5728\u5806\u4e2d\u7533\u8bf7\u7684\u5185\u5b58\u5757\u4e0d\u80fd\u5927\u4e8e7FFF8h(524K)<\/p>\n<p>\u79c1\u6709\u5806\u7684\u91ca\u653e<\/p>\n<blockquote><p>invoke HeapDestroy,hHeap<\/p><\/blockquote>\n<p>\u5c06\u91ca\u653e\u5806\u4e2d\u6240\u6709\u7684\u5185\u5b58\u5757.\u6210\u529f\u8fd0\u884c\u8fd4\u56deTRUE,\u5f53\u8fdb\u7a0b\u7ec8\u6b62\u65f6\u7cfb\u7edf\u4e5f\u4f1a\u81ea\u52a8\u8c03\u7528\u6b64\u51fd\u6570<\/p>\n<p>2.\u5806\u4e2d\u5206\u914d\u548c\u91ca\u653e\u5185\u5b58\u5757<br \/>\u5806\u4e2d\u5206\u914d\u5185\u5b58\u5757<\/p>\n<blockquote><p>invoke HeapAlloc,hHeap,dwFlags,dwBytes<br \/>.if eax &#038;&#038; (eax&lt;0c0000000h)<br \/>    mov lpMemory,eax<br \/>.endif<\/p><\/blockquote>\n<p>hHeap:\u662f\u521b\u5efa\u5806\u65f6\u7684\u53e5\u67c4<br \/>dwFlags\u6709\u4e09\u4e2a\u503c<br \/>HEAP_NO_SERIALIZE:\u4e0d\u8fdb\u884c\u72ec\u5360\u68c0\u6d4b,\u5982\u679c\u521b\u5efa\u5806\u65f6\u7528\u4e86,\u8fd9\u91cc\u5c31\u53ef\u4ee5\u7701\u4e86<br \/>HEAP_GENERATE_EXCEPTIONS:\u5931\u8d25\u8fd4\u56de\u51fa\u9519\u539f\u56e0,\u800c\u4e0d\u4ec5\u662f\u4e00\u4e2aNULL,\u521b\u5efa\u5806\u65f6\u7528\u4e86,\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u7701\u4e86<br \/>HEAP_ZERO_MEMORY:\u5c06\u5206\u914d\u5185\u5b58\u75280\u521d\u59cb\u5316<br \/>dwBytes:\u662f\u8981\u5206\u914d\u7684\u5185\u5b58\u5757\u7684\u5b57\u8282\u6570<br \/>\u5206\u914d\u6210\u529f\u8fd4\u56de\u503c\u662f\u6307\u5411\u5185\u5b58\u5757\u7b2c\u4e00\u4e2a\u5b57\u8282\u7684\u6307\u9488,\u5931\u8d25\u8fd4\u56de\u9519\u8bef\u4ee3\u7801\u6216NULL,\u8981\u770bdwFlags<br \/>STATUS_NO_MEMORY:\u53d6\u503c\u4e3a0c0000017h\u8868\u793a\u5185\u5b58\u4e0d\u591f<br \/>STATUS_ACCESS_VIOLATION:\u53d6\u503c\u4e3a0c0000005h\u8868\u793a\u53c2\u6570\u4e0d\u6b63\u786e\u6216\u5806\u88ab\u7834\u574f<br \/>\u5728\u5806\u4e2d\u5206\u914d\u5185\u5b58\u5757\u53ea\u80fd\u662f\u56fa\u5b9a\u5730\u5740\u7684\u5185\u5b58\u5757.<\/p>\n<p>\u5806\u4e2d\u91ca\u653e\u5185\u5b58\u5757<\/p>\n<blockquote><p>invoke HeapFree,hHeap,dwFlags,lpMemory<\/p><\/blockquote>\n<p>hHeap:\u5806\u53e5\u67c4<br \/>dwFlags:\u53ef\u4ee5\u4f7f\u7528HEAP_NO_SERIALIZE<br \/>lpMemory:\u662fHeapAlloc\u51fd\u6570\u8fd4\u56de\u7684\u5185\u5b58\u5757\u6307\u9488<br \/>\u6210\u529f\u8fd4\u56de\u975e0\u503c,\u5931\u8d25\u8fd4\u56de0<\/p>\n<p>\u5806\u4e2d\u8c03\u6574\u5185\u5b58\u5757\u5927\u5c0f<\/p>\n<blockquote><p>invoke HeapReAlloc,hHeap,dwFlags,lpMemory,dwBytes<br \/>.if eax &#038;&#038; (eax&lt;0c0000000h)<br \/>    mov lpMemory,eax<br \/>.endif<\/p><\/blockquote>\n<p>hHeap:\u5806\u53e5\u67c4<br \/>dwFlags\u56db\u4e2a\u503c<br \/>HEAP_GENERATE_EXCEPTIONS:\u8fd4\u56de\u503c<br \/>HEAP_NO_SERIALIZE:\u72ec\u5360\u68c0\u6d4b<br \/>HEAP_ZERO_MEMORY:\u521d\u59cb\u5316\u4e3a0<br \/>HEAP_REALLOC_IN_PLACE_ONLY:\u5206\u914d\u5185\u5b58\u65f6\u4e0d\u53ef\u79fb\u52a8\u5185\u5b58\u5757,\u4f7f\u7528\u6b64\u6807\u5fd7,\u6307\u9488\u5fc5\u5b9a\u548c\u539f\u6765\u76f8\u540c<br \/>lpMemory:\u4e3a\u5806\u4e2d\u5185\u5b58\u5757\u7684\u6307\u9488<br \/>dwBytes:\u8981\u6539\u53d8\u7684\u5185\u5b58\u5757\u7684\u5927\u5c0f\u7684\u5b57\u8282\u6570<\/p>\n<p>3.\u5176\u5b83\u5806\u7ba1\u7406\u51fd\u6570<br \/>HeapLock,HeapUnlock,GetProcessHeaps,GetProcessHeap,HeapCompact,HeapSize,<br \/>HeapValidate,HeapWalk.<\/p>\n<blockquote><p>invoke GetProcessHeaps,NumberOfHeaps,lpHeaps<\/p><\/blockquote>\n<p>NumberOfHeaps:\u6307\u5b9a\u4e86\u7f13\u51b2\u533a\u53ef\u4ee5\u5b58\u653e\u53e5\u67c4\u7684\u6570\u91cf<br \/>lpHeaps:\u662f\u4e00\u4e2a\u6307\u9488,\u6307\u5411\u7528\u6765\u63a5\u6536\u5806\u53e5\u67c4\u7684\u7f13\u51b2\u533a,\u7f13\u51b2\u533a\u957f\u5ea6\u5e94\u8be5\u7b49\u4e8eNumberOfHeaps*4<br \/>\u6267\u884c\u540e\u51fd\u6570\u8fd4\u56de\u8fdb\u7a0b\u4e2d\u6240\u6709\u5806\u7684\u53e5\u67c4\u5230\u7f13\u51b2\u533a\u4e2d,\u4e5f\u5305\u62ec\u9ed8\u8ba4\u5806\u7684\u53e5\u67c4<\/p>\n<blockquote><p>.repeat<br \/>  invoke HeapWalk,hHeap,lpEntry<br \/>  push eax<br \/>  pop eax<br \/>.until !eax<\/p><\/blockquote>\n<p>hHeap:\u662f\u5806\u7684\u53e5\u67c4<br \/>lpEntry:\u6307\u5411\u4e00\u4e2a\u53e5\u542b\u6709PROCESS_HEAP_ENTRY\u7ed3\u6784\u7684\u7f13\u51b2\u533a<br \/>\u6bcf\u6b21\u6267\u884c\u8fd4\u56de\u4e00\u4e2aPROCESS_HEAP_ENTRY\u7684\u7ed3\u6784\u5757\u4fe1\u606f,\u5982\u679c\u8fd8\u6709\u5176\u4ed6\u7684\u5185\u5b58\u5757,\u51fd\u6570\u8fd4\u56deTRUE,\u7a0b\u5e8f\u4e00\u76f4\u5faa\u73af\u8c03\u7528\u76f4\u5230\u8fd4\u56deFALSE\u4e3a\u6b62,\u5728\u591a\u7ebf\u7a0b\u7684\u7a0b\u5e8f\u4e2d\u4f7f\u7528,\u5fc5\u987b\u5148\u4f7f\u7528HeapLock\u51fd\u6570,\u5426\u5219\u4f1a\u8c03\u7528\u5931\u8d25.<\/p>\n<blockquote><p>invoke HeapValidate,hHeap,dwFlags,lpMemory<\/p><\/blockquote>\n<p>\u9a8c\u8bc1\u5806\u7684\u5b8c\u6574\u6027\u6216\u5806\u4e2d\u67d0\u4e2a\u5185\u5b58\u5757\u7684\u5b8c\u6574\u6027<br \/>lpMemory\u4e3aNULL\u51fd\u6570\u987a\u5e8f\u9a8c\u8bc1\u5806\u4e2d\u6240\u6709\u7684\u5185\u5b58\u5757,\u5982\u679clpMemory\u6307\u5b9a\u4e86\u4e00\u4e2a\u5185\u5b58\u5757,\u5219\u53ea\u9a8c\u8bc1\u8fd9\u4e2a\u5185\u5b58\u5757<br \/>dwFlags:\u53ef\u4ee5\u6307\u5b9aHEAP_NO_SERIALIZE,\u72ec\u5360\u6807\u5fd7<br \/>\u5982\u679c\u6240\u6709\u5185\u5b58\u5757\u90fd\u5b8c\u597d\u65e0\u635f,\u8fd4\u56de\u975e0\u503c,\u5426\u5219\u8fd4\u56de0<\/p>\n<blockquote><p>invoke HeapLock,hHeap<br \/>invoke HeapUnlock,hHeap<\/p><\/blockquote>\n<p>\u9500\u5b9a\u548c\u89e3\u9500\u5806,\u4e3b\u8981\u7528\u4e8e\u7ebf\u7a0b\u540c\u6b65,\u6210\u529f\u8fd4\u56de\u975e0\u503c,\u5426\u5219\u8fd4\u56de0,\u5728\u7a0b\u5e8f\u4e2d\u4e00\u822c\u7528HEAP_NO_SERIALIZE\u6765\u63a7\u5236<\/p>\n<blockquote><p>invoke HeapCompact,hHeap,dwFlags<\/p><\/blockquote>\n<p>\u5408\u5e76\u5806\u4e2d\u7684\u7a7a\u95f2\u5185\u5b58\u5757\u5e76\u91ca\u653e\u4e0d\u5728\u4f7f\u7528\u4e2d\u7684\u5185\u5b58\u9875\u9762<\/p>\n<blockquote><p>invoke HeapSize,hHeap,dwFlags,lpMemory<\/p><\/blockquote>\n<p>\u8fd4\u56de\u5806\u4e2d\u67d0\u4e2a\u5185\u5b58\u5757\u5927\u5c0flpMemory\u6307\u5b9a\u4e86\u9700\u8981\u8fd4\u56de\u5927\u5c0f\u7684\u5185\u5b58\u5757,\u6210\u529f\u8fd4\u56de\u5185\u5b58\u5757\u5927\u5c0f,\u5931\u8d25\u8fd4\u56de-1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5806\u7ba1\u7406\u51fd\u65701.\u79c1\u6709\u5806\u7684\u521b\u5efa\u548c\u91ca\u653e\u79c1\u6709\u5806\u7684\u521b\u5efa invoke HeapCreate,flOptions,dwIn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-12"],"_links":{"self":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=56"}],"version-history":[{"count":0,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}