{"id":296,"date":"2022-04-30T15:50:46","date_gmt":"2022-04-30T07:50:46","guid":{"rendered":"https:\/\/aaaahui.top\/?p=296"},"modified":"2022-08-13T21:25:20","modified_gmt":"2022-08-13T13:25:20","slug":"memory","status":"publish","type":"post","link":"https:\/\/ahui.blog\/index.php\/2022\/04\/30\/memory\/","title":{"rendered":"\u57fa\u7840\u5b66\u4e60\u8bb0\u5f55\u2014\u2014\u5185\u5b58\u53ca\u5185\u5b58\u64cd\u4f5c"},"content":{"rendered":"<h2>\u5185\u5b58<\/h2>\n<p>\u8fd9\u91cc\u4e3b\u8981\u5173\u6ce8\u865a\u62df\u5185\u5b58\uff0c\u7269\u7406\u5185\u5b58\u6211\u4eec\u4e0d\u592a\u9700\u8981\u8003\u8651\uff0c\u90fd\u6709\u7cfb\u7edf\u6765\u81ea\u52a8\u5206\u914d\u3002<\/p>\n<h3>\u7269\u7406\u5185\u5b58\u548c\u865a\u62df\u5185\u5b58<\/h3>\n<p>\u7269\u7406\u5185\u5b58\u5c31\u662f\u6211\u4eec\u4f7f\u7528\u7684\u5185\u5b58\u6761\u4e2d\u7684\u5b9e\u9645\u5185\u5b58\uff0c\u5185\u5b58\u6761\u7684\u5bb9\u91cf\u4e5f\u5c31\u662f\u7cfb\u7edf\u4e2d\u7269\u7406\u5185\u5b58\u7684\u5bb9\u91cf\u3002\u6bd4\u5982\u4e00\u67618GB\u7684\u5185\u5b58\u6761\u5c31\u662f8GB\u7684\u5185\u5b58\u5bb9\u91cf\u3002<\/p>\n<p>\u865a\u62df\u5185\u5b58\u662f\u5185\u5b58\u7ba1\u7406\u7684\u4e00\u79cd\u6280\u672f\uff0c\u4e3a\u6bcf\u4e2a\u8fdb\u7a0b\u5206\u914d\u4e00\u5757\u8fde\u7eed\u7684\u865a\u62df\u5185\u5b58\uff0c\u5b9e\u9645\u4e0a\u8fd9\u4e9b\u865a\u62df\u5185\u5b58\u5e76\u4e0d\u662f\u4e00\u5b9a\u5b58\u5728\u4e8e\u7269\u7406\u5185\u5b58\u4e2d\uff0c\u7cfb\u7edf\u4f1a\u5300\u51fa\u4e00\u90e8\u5206\u786c\u76d8\u7a7a\u95f4\u6765\u5145\u5f53\u5185\u5b58\u4f7f\u7528\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u4f60\u7684\u786c\u76d8\u7a7a\u95f4\u4e2d\u4e00\u4e2a\u540d\u4e3aPageFile.Sys\u7684\u6587\u4ef6\uff0c\u8fd9\u4e2a\u5c31\u662f\u7cfb\u7edf\u5c06\u786c\u76d8\u7684\u4e00\u90e8\u5206\u5145\u5f53\u4e3a\u865a\u62df\u5185\u5b58\u7684\u786c\u76d8\u7a7a\u95f4\u3002<\/p>\n<h3>\u8fdb\u7a0b\u7684\u5185\u5b58<\/h3>\n<p>Windows\u4e3a\u6bcf\u4e2a32\u4f4d\u8fdb\u7a0b\u5206\u914d\u4e864GB\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u3002\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u62e5\u67094GB\u7684\u5185\u5b58\u7a7a\u95f4\uff0c 4GB\u7684\u5927\u5c0f\u662f\u56e0\u4e3a\uff1a32\u4f4d CPU\u53ef\u4ee5\u53d6\u5730\u5740\u7684\u7a7a\u95f4\u4e3a2\u768432\u6b21\u65b9\uff0c\u5c31\u662f4GB\u5927\u5c0f\u3002\u800c64\u4f4d\u8fdb\u7a0b\uff0c CPU\u53ef\u4ee5\u53d6\u5730\u5740\u7684\u7a7a\u95f4\u4e3a2\u768464\u6b21\u65b9\uff0c\u6240\u4ee564\u4f4d\u8fdb\u7a0b\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u5927\u5c0f\u4e3a16EB\u3002<\/p>\n<p>\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6709\u81ea\u5df1\u4e13\u7528\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u4e0e\u5176\u4ed6\u8fdb\u7a0b\u6240\u62e5\u6709\u7684\u5185\u5b58\u4e4b\u95f4\u662f\u76f8\u4e92\u9694\u79bb\u5f00\u7684\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u6240\u521b\u5efa\u7684\u7ebf\u7a0b\u90fd\u53ea\u80fd\u8bbf\u95ee\u5b83\u6240\u5728\u8fdb\u7a0b\u7684\u5185\u5b58\u3002<\/p>\n<p>\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u88ab\u521b\u5efa\u65f6\uff0c\u7cfb\u7edf\u4f1a\u4e3a\u8be5\u8fdb\u7a0b\u5206\u914d4GB\u7684\u865a\u62df\u5185\u5b58\uff0c\u90a3\u4e48\u5730\u5740\u7a7a\u95f4\u5c31\u662f0x00000000~0xFFFFFFFF\uff0c\u5176\u4e2d2GB\u7684\u5185\u5b58\u662f\u8be5\u8fdb\u7a0b\u72ec\u6709\u7684\uff0c\u7528\u4e8e\u5b58\u653e\u7a0b\u5e8f\u7684\u4ee3\u7801\u3001\u6570\u636e\u3001\u5806\u6808\u7b49\uff0c\u53e6\u59162GB\u7528\u4e8e\u5171\u4eab\u7cfb\u7edf\u7684\u4f7f\u7528\u3002<\/p>\n<p>\u5f53\u8fdb\u7a0b\u64cd\u4f5c\u5185\u5b58\u65f6\uff0c\u7cfb\u7edf\u4f1a\u4ece\u7269\u7406\u5185\u5b58\u4e2d\u5bf9\u8fdb\u7a0b\u6240\u7533\u8bf7\u7684\u5185\u5b58\u8fdb\u884c\u6620\u5c04\uff0c\u5c06\u8fdb\u7a0b\u7684\u865a\u62df\u5185\u5b58\u6620\u5c04\u4e3a\u7269\u7406\u5185\u5b58\uff0c\u518d\u8fdb\u884c\u5185\u5b58\u7a7a\u95f4\u7684\u4f7f\u7528\u3002<\/p>\n<p>\u6bcf\u4e2a\u8fdb\u7a0b\u67092GB\u7684\u865a\u62df\u5185\u5b58\uff0c\u4f46\u662f\u5f53\u8fdb\u7a0b\u6ca1\u6709\u4f7f\u7528\u8fd9\u4e9b\u5185\u5b58\u7a7a\u95f4\u65f6\uff0c\u8fd92GB\u7684\u5185\u5b58\u901a\u5e38\u88ab\u5206\u5272\u6210\u591a\u4e2a\u7269\u7406\u5185\u5b58\u788e\u7247\uff0c\u8fd8\u6709\u90e8\u5206\u6682\u65f6\u5b58\u50a8\u5728\u5916\u90e8\u78c1\u76d8\u5b58\u50a8\u5668\u4e0a\uff0c\u53ea\u6709\u9700\u8981\u7528\u5230\u8fd9\u90e8\u5206\u5185\u5b58\u7684\u65f6\u5019\uff0c\u624d\u4f1a\u88c5\u8f7d\u5230\u7269\u7406\u5185\u5b58\u4e2d\u8fdb\u884c\u6570\u636e\u7684\u4ea4\u6362\u3002<\/p>\n<h3>\u5b9e\u5730\u5740\u548c\u865a\u5730\u5740<\/h3>\n<p>\u8fdb\u7a0b\u6240\u4f7f\u7528\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u4f8b\u5982\u6253\u5370\u6307\u9488\u6240\u663e\u793a\u7684\u5bf9\u5e94\u7684\u5185\u5b58\u5730\u5740\uff0c\u5176\u5b9e\u662f\u865a\u5730\u5740\uff0c\u4e5f\u88ab\u79f0\u4e3a\u903b\u8f91\u5730\u5740\uff0c\u5176\u5bf9\u7528\u7684\u5b58\u50a8\u7a7a\u95f4\u79f0\u4e3a\u865a\u5b58\u7a7a\u95f4\u6216\u903b\u8f91\u5730\u5740\u7a7a\u95f4\uff1b\u800c\u7269\u7406\u5185\u5b58\u7684\u5730\u5740\u5219\u6210\u4e3a\u5b9e\u5730\u5740\u6216\u7269\u7406\u5730\u5740\uff0c\u5176\u5bf9\u5e94\u7684\u5b58\u50a8\u7a7a\u95f4\u6210\u4e3a\u7269\u7406\u5b58\u50a8\u7a7a\u95f4\u6216\u4e3b\u5b58\u7a7a\u95f4\u3002<strong>\u7a0b\u5e8f\u8fdb\u884c\u865a\u5730\u5740\u5230\u5b9e\u5730\u5740\u8f6c\u6362\u7684\u8fc7\u7a0b\u79f0\u4e3a\u7a0b\u5e8f\u7684\u518d\u5b9a\u4f4d\u3002<\/strong><\/p>\n<h3>\u865a\u62df\u5185\u5b58\u8bbf\u95ee\u8fc7\u7a0b<\/h3>\n<p>\u865a\u62df\u5185\u5b58\u6309\u7167\u8fdb\u7a0b\u7684\u865a\u5730\u5740\u5b58\u653e\u5728\u8f85\u5b58\u79cd\uff0c\u5f53\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u7cfb\u7edf\u4f1a\u6839\u636e\u521b\u5efa\u8fdb\u7a0b\u65f6\u7ed9\u8fdb\u7a0b\u5206\u914d\u7684\u5b9e\u5730\u5740\u5c06\u7a0b\u5e8f\u7684\u4e00\u90e8\u5206\u8c03\u5165\u7269\u7406\u5185\u5b58\u3002\u8fdb\u7a0b\u6bcf\u6b21\u8bbf\u95ee\u6570\u636e\u65f6\uff0c\u7cfb\u7edf\u9996\u5148\u4f1a\u5224\u65ad\u8be5\u865a\u62df\u5730\u5740\u662f\u5426\u5728\u7269\u7406\u5185\u5b58\u4e2d\u6709\u5b9e\u9645\u6620\u5c04\u7684\u5730\u5740\uff0c\u5982\u679c\u6709\uff0c\u5219\u8fdb\u884c\u76f8\u5e94\u7684\u5730\u5740\u8f6c\u6362\u5e76\u4f7f\u7528\u5b9e\u5730\u5740\u8bbf\u95ee\u4e3b\u5b58\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u5c06\u8f85\u5b58\u4e2d\u7684\u76f8\u5e94\u90e8\u5206\u7a0b\u5e8f\u6620\u5c04\u5230\u7269\u7406\u5730\u5740\uff0c\u518d\u4f7f\u7528\u5b9e\u5730\u5740\u8bbf\u95ee\u4e3b\u5b58\u3002<\/p>\n<h3>\u5185\u5b58\u7684\u5c5e\u6027<\/h3>\n<p>Windows\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u5b58\u6709\u4e09\u79cd\u5c5e\u6027\uff0c\u5206\u522b\u4e3a\uff1a\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u53ef\u6267\u884c\u3002<\/p>\n<h2>\u5185\u5b58\u64cd\u4f5c<\/h2>\n<h3>C\u8bed\u8a00\u5185\u5b58\u7ba1\u7406\u51fd\u6570<\/h3>\n<p>C\u8bed\u8a00\u4e2d\u63d0\u4f9b\u4e86\u4e00\u4e9b\u64cd\u4f5c\u5185\u5b58\u7684\u51fd\u6570\uff0c\u5982\u4e0b\uff1a<\/p>\n<p><strong>void *calloc(int num, int size);<\/strong><br \/>\n\u5728\u5185\u5b58\u4e2d\u52a8\u6001\u5730\u5206\u914d num \u4e2a\u957f\u5ea6\u4e3a size \u7684\u8fde\u7eed\u7a7a\u95f4\uff0c\u5e76\u5c06\u6bcf\u4e00\u4e2a\u5b57\u8282\u90fd\u521d\u59cb\u5316\u4e3a0\u3002\u6240\u4ee5\u5b83\u7684\u7ed3\u679c\u662f\u5206\u914d\u4e86 num*size \u4e2a\u5b57\u8282\u957f\u5ea6\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u4e14\u6bcf\u4e2a\u5b57\u8282\u7684\u503c\u90fd\u662f0\u3002<\/p>\n<p><strong>void free(void *address);<\/strong><br \/>\n\u8be5\u51fd\u6570\u91ca\u653e address \u6240\u6307\u5411\u7684\u5185\u5b58\u5757,\u91ca\u653e\u7684\u662f\u52a8\u6001\u5206\u914d\u7684\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n<p><strong>void *malloc(int num);<\/strong><br \/>\n\u5728\u5806\u533a\u5206\u914d\u4e00\u5757\u6307\u5b9a\u5927\u5c0f\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u7528\u6765\u5b58\u653e\u6570\u636e\u3002\u8fd9\u5757\u5185\u5b58\u7a7a\u95f4\u5728\u51fd\u6570\u6267\u884c\u5b8c\u6210\u540e\u4e0d\u4f1a\u88ab\u521d\u59cb\u5316\uff0c\u5b83\u4eec\u7684\u503c\u662f\u672a\u77e5\u7684\u3002<\/p>\n<p><strong>void *realloc(void *address, int newsize);<\/strong><br \/>\n\u8be5\u51fd\u6570\u91cd\u65b0\u5206\u914d\u5185\u5b58\uff0c\u628a\u5185\u5b58\u6269\u5c55\u5230 <strong>newsize<\/strong>\u3002<\/p>\n<p>\u4ee5\u4e0a\u51fd\u6570\u90fd\u6bd4\u8f83\u5bb9\u6613\u7406\u89e3\uff0c\u5e76\u4e14\u7533\u8bf7\u5185\u5b58\u6216\u8005\u6307\u5b9a\u5185\u5b58\u7684\u51fd\u6570\u8fd4\u56de\u503c\u90fd\u662f\u6307\u9488\u5f62\u5f0f\uff0c\u6240\u4ee5\u6211\u4eec\u63a5\u6536\u8fd4\u56de\u503c\u65f6\u4e5f\u9700\u8981\u4f7f\u7528\u6307\u9488\u53d8\u91cf\u53bb\u63a5\u53d7\uff0c\u4f8b\u5982\u5982\u4e0b\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-c\">#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\nint main()\n{\n    char *p;\n    p=(char *)calloc(5,20);\n    printf(&quot;%p&quot;,p);\n}<\/code><\/pre>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u4f7f\u7528calloc\u51fd\u6570\u7533\u8bf7\u4e865\u5757\u8fde\u7eed\u7684\u957f\u5ea6\u4e3a20\u5b57\u8282\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u5e76\u4e14\u6bcf\u4e2a\u5b57\u8282\u7684\u503c\u90fd\u4e3a0\u3002<\/p>\n<p>\u4f46\u662f\u5e76\u6ca1\u6709\u5e73\u5e38\u5728shellcodeloader\u4e2d\u770b\u5230\u7684\u7533\u8bf7\u5185\u5b58\u7684\u51fd\u6570\uff0c\u4f8b\u5982VirtualAlloc\u3001CopyMemory\u7b49\uff0c\u5176\u5b9e\u8fd9\u4e9b\u51fd\u6570\u5e76\u4e0d\u662fC\u8bed\u8a00\u4e2d\u7684\u51fd\u6570\uff0c\u800c\u662fWindows API\u51fd\u6570\uff0c\u63a5\u7740\u770b\u4e00\u4e0bWindowsAPI\u51fd\u6570\u7684\u7528\u6cd5\u3002<\/p>\n<h2>\u5185\u5b58\u76f8\u5173\u7684WindowsAPI<\/h2>\n<h3>WindowsAPI<\/h3>\n<p>WindowsAPI\u662fWindows\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u7cfb\u7edf\u7f16\u7a0b\u63a5\u53e3\uff0c\u5f00\u53d1\u8005\u5728\u7f16\u7a0b\u65f6\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u8c03\u7528\u8fd9\u4e9bWindowsAPI\u51fd\u6570\u6765\u64cd\u4f5cWindows\u7cfb\u7edf\u4e2d\u7684\u5185\u5b58\u3001\u8d44\u6e90\u7b49\u3002<\/p>\n<h3>\u5185\u5b58\u76f8\u5173API<\/h3>\n<p><strong>\u5185\u5b58\u4fdd\u62a4\u5c5e\u6027\u548c\u5b58\u53d6\u6743\u9650<\/strong><br \/>\n\u5c5e\u6027\u5e38\u91cf \u610f\u4e49<br \/>\nPAGE_EXECUTE \u53ef\u6267\u884c<br \/>\nPAGE_EXECUTE_READ \u53ef\u8bfb,\u53ef\u6267\u884c<br \/>\nPAGE_EXECUTE_READWRITE \u53ef\u8bfb,\u53ef\u5199,\u53ef\u6267\u884c<br \/>\nPAGE_EXECUTE_WRITECOPY \u53ef\u8bfb,\u53ef\u5199,\u53ef\u6267\u884c,\u4ee5Read-on-write\u548ccopy-on-write\u65b9\u5f0f\u5171\u4eab<br \/>\nPAGE_NOACCESS \u4e0d\u53ef\u8bbf\u95ee<br \/>\nPAGE_READONLY \u53ea\u8bfb<br \/>\nPAGE_READWRITE \u53ef\u8bfb,\u53ef\u5199<br \/>\nPAGE_WRITECOPY copy-on-write\u4fdd\u62a4\u673a\u5236<br \/>\nPAGE_GUARD \u4fdd\u62a4,\u5982\u679c\u8bbf\u95ee\u5219\u5f02\u5e38(\u4e0d\u80fd\u5355\u72ec\u4f7f\u7528)<br \/>\nPAGE_NOCACHE \u4e0d\u8fdb\u884cCPU\u7f13\u5b58(\u4e0d\u80fd\u5355\u72ec\u4f7f\u7528)<br \/>\nPAGE_WRITECOMBINE write-combined\u4f18\u5316(\u4e0d\u80fd\u5355\u72ec\u4f7f\u7528)<\/p>\n<p><strong>\u5806\u7ba1\u7406API<\/strong><br \/>\nHeapCreate \u4e3a\u8fdb\u7a0b\u521b\u5efa\u4e00\u4e2a\u5806,\u8fd4\u56de\u4e00\u4e2a\u5806\u53e5\u67c4<br \/>\nGetProcessHeap \u83b7\u53d6\u5f53\u524d\u8fdb\u7a0b\u4e2d\u7684\u4e00\u4e2a\u5806<br \/>\nHeapAlloc \u4ece\u6307\u5b9a\u5806\u4e0a\u5206\u914d\u5185\u5b58\u5757<br \/>\nHeapReAlloc \u91cd\u65b0\u5206\u914d\u5185\u5b58,\u6539\u53d8\u5df2\u7ecf\u5206\u914d\u597d\u7684\u5806\u5185\u5b58\u5757\u5927\u5c0f<br \/>\nGetSystemInfo \u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f<br \/>\nHeapSize \u83b7\u53d6\u6307\u5b9a\u5806\u5927\u5c0f,\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d\u8fd4\u56de\u5806\u5927\u5c0f\u4fe1\u606f<br \/>\nHeapFree \u91ca\u653eHeapAlloc\u548cHeapReAlloc\u6240\u5206\u914d\u7684\u5185\u5b58<br \/>\nHeapDestroy \u9500\u6bc1\u7531HeapCreate\u521b\u5efa\u7684\u5806<br \/>\nLocalAlloc \u4ece\u5806\u4e2d\u5206\u914d\u6307\u5b9a\u5927\u5c0f\u7684\u5b57\u8282\u6570<\/p>\n<p><strong>\u5168\u5c40\u548c\u5c40\u90e8\u5185\u5b58\u7ba1\u7406API\u51fd\u6570<\/strong><br \/>\nGlobalAlloc \u5728\u9ed8\u8ba4\u5806\u4e0a\u5206\u914d\u6307\u5b9a\u5c5e\u6027\u7684\u5927\u5c0f\u7684\u5185\u5b58<br \/>\nGlobalFree \u91ca\u653e\u7531GlobalAlloc\u5206\u914d\u7684\u5185\u5b58<br \/>\nGlobalReAlloc \u91cd\u65b0\u5206\u914d\u5185\u5b58,\u6539\u53d8\u5df2\u7ecf\u5206\u914d\u597d\u7684\u5185\u5b58\u5757\u5927\u5c0f<br \/>\nGlobalLock \u5c06GlobalAlloc\u53caGlobalReAlloc\u5206\u914d\u5c5e\u6027\u4e3aGMEM_MOVEABLE\u5185\u5b58\u5757\u8bbe\u4e3a\u56fa\u5b9a<br \/>\nGlobalHandle \u4e0eGlobalLock\u76f8\u5bf9<br \/>\nGlobalSize \u83b7\u53d6\u5185\u5b58\u5927\u5c0f<\/p>\n<p><strong>\u865a\u62df\u5185\u5b58\u7ba1\u7406API\u51fd\u6570<\/strong><br \/>\nVirtualAlloc &quot;\u4fdd\u7559&quot;\u6216&quot;\u63d0\u4ea4&quot;\u5185\u5b58\u9875\u9762,\u5c06&quot;\u7a7a\u95f2\u7684&quot;\u5185\u5b58\u9875\u9762\u53d8\u4e3a&quot;\u4fdd\u7559\u7684&quot;\u6216&quot;\u5df2\u7ecf\u63d0\u4ea4\u7684&quot;,\u4fdd\u7559\u7684\u6539\u4e3a\u5df2\u63d0\u4ea4\u7684\uff0c\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u7533\u8bf7\u4e00\u5757\u5185\u5b58<br \/>\nVirtualAllocEx \u7c7b\u4f3cVirtualAlloc\u529f\u80fd,\u4e0d\u8fc7\u53ef\u4ee5\u4e3a\u5176\u4ed6\u8fdb\u7a0b\u5206\u914d\u5185\u5b58<br \/>\nVirtualFree \u5c06\u5185\u5b58\u72b6\u6001\u4ece&quot;\u5df2\u7ecf\u63d0\u4ea4\u7684&quot;\u53d8\u4e3a&quot;\u4fdd\u7559\u7684&quot;<br \/>\nVirtualFreeEx \u91ca\u653eVirtualAllocEx\u5206\u914d\u7684\u5185\u5b58,\u529f\u80fd,\u4f7f\u7528\u65b9\u6cd5\u548cVirtualFree\u7c7b\u4f3c<br \/>\nVirtualProtect \u6539\u53d8\u6307\u5b9a\u865a\u62df\u5185\u5b58\u5206\u9875\u7684\u4fdd\u62a4\u5c5e\u6027<\/p>\n<p><strong>\u5185\u5b58\u64cd\u4f5c\u4e0e\u5185\u5b58\u4fe1\u606f\u7ba1\u7406API\u51fd\u6570<\/strong><br \/>\nCopyMemory \u590d\u5236\u5185\u5b58,\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a\u76ee\u7684\u5730\u5740,\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a\u6e90\u5730\u5740,\u7b2c\u4e09\u4e2a\u53c2\u6570\u4e3a\u590d\u5236\u6570\u636e\u5927\u5c0f<br \/>\nFillMemory \u586b\u5145\u5185\u5b58,\u5c06\u4e00\u6bb5\u5185\u5b58\u586b\u5145\u4e3a\u540c\u4e00\u4e2a\u503c<br \/>\nMoveMemory \u529f\u80fd\u548cCopyMemory\u7c7b\u4f3c,\u4e0d\u540c\u7684\u662f\u6e90\u5730\u5740\u548c\u76ee\u7684\u5730\u5740\u53ef\u4ee5\u76f8\u540c<br \/>\nZeroMemory \u5c06\u6307\u5b9a\u5185\u5b58\u533a\u57df\u6e05\u96f6<br \/>\nGlobalMemoryStatusEx \u7528\u4e8e\u83b7\u53d6\u7cfb\u7edf\u5f53\u524d\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<br \/>\nIsBadCodePtr \u5224\u65ad\u8c03\u7528\u8fdb\u7a0b\u662f\u5426\u62e5\u6709\u5bf9\u6307\u5b9a\u5730\u5740\u5185\u5b58\u7684\u8bfb\u64cd\u4f5c\u6743\u9650<br \/>\nIsBadReadPtr \u5224\u65ad\u8c03\u7528\u8fdb\u7a0b\u662f\u5426\u6709\u5bf9\u6307\u5b9a\u5730\u5740\u6bb5\u5185\u5b58\u7684\u8bfb\u64cd\u4f5c\u6743\u9650<br \/>\nISBadStringPtr \u5224\u65ad\u8c03\u7528\u8fdb\u7a0b\u662f\u5426\u62e5\u6709\u5bf9\u5b57\u7b26\u4e32\u6307\u9488\u7684\u8bfb\u53d6\u6743\u9650<br \/>\nIsBadWritePtr \u5224\u65ad\u8c03\u7528\u8fdb\u7a0b\u662f\u5426\u62e5\u6709\u5bf9\u6307\u5b9a\u5730\u5740\u6bb5\u5185\u5b58\u7684\u5199\u64cd\u4f5c\u6743\u9650<br \/>\nRtlCopyMemory \u540cCopyMemory\u4e00\u6837<br \/>\nRtlMoveMemory \u4ece\u6307\u5b9a\u5185\u5b58\u4e2d\u590d\u5236\u5185\u5b58\u81f3\u53e6\u4e00\u5185\u5b58\u91cc\uff0c\u548cCopyMemory\u4e00\u6837<br \/>\nRtlCopyBytes \u590d\u5236\u7ed9\u5b9a\u7684\u5b57\u8282\u6570\u4ece\u4e00\u4e2a\u4f4d\u7f6e\u5230\u53e6\u4e00\u4e2a\u5730\u65b9\uff0c\u548cRtlCopyMemory\u4e00\u6837<\/p>\n<p><strong>\u5176\u4ed6<\/strong><\/p>\n<p>ReadProcessMemory \/\/\u4e00\u4e2a\u5185\u5b58\u64cd\u4f5c\u51fd\u6570\uff0c \u5176\u4f5c\u7528\u4e3a\u6839\u636e\u8fdb\u7a0b\u53e5\u67c4\u8bfb\u5165\u8be5\u8fdb\u7a0b\u7684\u67d0\u4e2a\u5185\u5b58\u7a7a\u95f4<br \/>\nWriteProcessMemory \/\/\u6b64\u51fd\u6570\u80fd\u5199\u5165\u67d0\u4e00\u8fdb\u7a0b\u7684\u5185\u5b58\u533a\u57df\uff08\u76f4\u63a5\u5199\u5165\u4f1a\u51faAccess Violation\u9519\u8bef\uff09\uff0c\u6545\u9700\u6b64\u51fd\u6570\u5165\u53e3\u533a\u5fc5\u987b\u53ef\u4ee5\u8bbf\u95ee\uff0c\u5426\u5219\u64cd\u4f5c\u5c06\u5931\u8d25<br \/>\nCreateFileMapping \/\/\u521b\u5efa\u4e00\u4e2a\u5185\u5b58\u6587\u4ef6\u6620\u5c04\u5bf9\u8c61<br \/>\nMapViewOfFile \u5c06\u5185\u5b58\u6620\u5c04\u6587\u4ef6\u6620\u5c04\u5230\u8fdb\u7a0b\u7684\u865a\u62df\u5730\u5740\u4e2d<br \/>\nOpenFileMapping \u6253\u5f00\u4e00\u4e2a\u547d\u540d\u7684\u6587\u4ef6\u6620\u5c04\u5185\u6838\u5bf9\u8c61<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5185\u5b58 \u8fd9\u91cc\u4e3b\u8981\u5173\u6ce8\u865a\u62df\u5185\u5b58\uff0c\u7269\u7406\u5185\u5b58\u6211\u4eec\u4e0d\u592a\u9700\u8981\u8003\u8651\uff0c\u90fd\u6709\u7cfb\u7edf\u6765\u81ea\u52a8\u5206\u914d\u3002 \u7269\u7406\u5185\u5b58\u548c\u865a\u62df\u5185\u5b58 \u7269\u7406\u5185\u5b58\u5c31\u662f\u6211 &#8230; <a title=\"\u57fa\u7840\u5b66\u4e60\u8bb0\u5f55\u2014\u2014\u5185\u5b58\u53ca\u5185\u5b58\u64cd\u4f5c\" class=\"read-more\" href=\"https:\/\/ahui.blog\/index.php\/2022\/04\/30\/memory\/\" aria-label=\"\u7ee7\u7eed\u9605\u8bfb\u57fa\u7840\u5b66\u4e60\u8bb0\u5f55\u2014\u2014\u5185\u5b58\u53ca\u5185\u5b58\u64cd\u4f5c\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[28,27],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-basic_knowledge","tag-28","tag-27"],"_links":{"self":[{"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":1,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions\/298"}],"wp:attachment":[{"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahui.blog\/index.php\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}