{"id":165,"date":"2023-07-22T22:36:18","date_gmt":"2023-07-22T14:36:18","guid":{"rendered":"http:\/\/192.168.1.15:89\/?p=165"},"modified":"2023-07-22T22:36:18","modified_gmt":"2023-07-22T14:36:18","slug":"dll-reverse","status":"publish","type":"post","link":"https:\/\/www.skyblogs.xyz\/index.php\/2023-07-22\/dll-reverse\/","title":{"rendered":"DLL\u52ab\u6301\u548c\u51fd\u6570\u8f6c\u53d1"},"content":{"rendered":"<p>\u4eca\u65e5\u63a5\u5230\u4e00\u9006\u5411\u9700\u6c42\uff0c\u8981\u6c42\u4fee\u6539\u4e00\u4e2a\u6309\u94ae\u7684\u529f\u80fd\u3002<br \/>\n\u521d\u4ee5\u4e3a\u662f\u8f83\u4e3a\u5e38\u89c1\u7684\u529f\u80fd\uff0c\u4ed4\u7ec6\u770b\u8fc7\u540e\u624d\u53d1\u73b0\u8be5\u8f6f\u4ef6\u91c7\u7528\u4e86\u81ea\u7814\u7684\u4e8c\u7ea7\u6846\u67b6<br \/>\n\u4e0d\u8fc7\u6240\u5e78\u8f6f\u4ef6\u7684\u5b89\u5168\u63aa\u65bd\u8f83\u4e3a\u8584\u5f31\uff0c\u7ecf\u5386\u4e86\u6574\u6574\u4e00\u5929\u7684\u6298\u817e\u540e\u7ec8\u4e8e\u6253\u901a\uff0c\u4fbf\u5728\u6b64\u5904\u7559\u4e2a\u968f\u7b14\u505a\u8bb0\u5f55\u3002<\/p>\n<h2 class=\"h-title\">\u5173\u952e\u51fd\u6570\u5b9a\u4f4d<\/h2>\n<p>\u5148\u901a\u8fc7\u62c6\u5305\u548cpe\u5934\u5206\u6790\uff0c\u627e\u51fa\u53ef\u7591xml\u6587\u4ef6\uff0c\u67e5\u770b\u540e\u53d1\u73b0\u4e3aui\u6587\u4ef6\uff0c\u4e8e\u662f\u901a\u8fc7\u8be5\u6587\u4ef6\u540d\u5728ida\u8fdb\u884c\u67e5\u627e<\/p>\n<p>\u540c\u65f6\u4e00\u8def\u5206\u6790\u4ee3\u7801\u8c03\u7528\uff0c\u6700\u7ec8\u5b9a\u4f4d\u5230\u4e86\u4ee5\u4e0b\u7247\u6bb5\uff1a<br \/>\n<img alt=\"\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-166 alignleft\"  src=\"https:\/\/www.skyblogs.xyz\/wp-content\/themes\/lolimeow-lolimeowV13.13\/assets\/images\/loading.gif\" data-src=\"http:\/\/192.168.1.15:89\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220149-300x105.png\" class=\"lazy\" loading=\"lazy\" alt=\"\" srcset=\"https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220149-300x105.png 300w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220149-768x270.png 768w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220149.png 917w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u901a\u8fc7\u5bf9\u5176\u4ed6dll\u6a21\u5757\u8fdb\u884c\u5206\u6790\uff0c\u6700\u7ec8\u5b9a\u4f4d\u5230\u8be5\u51fd\u6570\u540d\u4e3aonSavePictureFileMenuClick\uff0c\u4f4d\u4e8eNTCourseExt.dll\u4e2d<\/p>\n<h2 class=\"h-title\">DLL\u6ce8\u5165<\/h2>\n<p>\u901a\u8fc7vs\u521b\u5efadll\u9879\u76ee\uff0c\u518d\u901a\u8fc7extern &#8220;C&#8221;\u7b49\u6807\u8bc6\u7b26\u5bfc\u51fa\u76ee\u6807\u51fd\u6570\u3002\u6700\u540e\u751f\u6210dll<br \/>\n\u518d\u901a\u8fc7StudyPE\u5728\u5bfc\u5165\u8868\u4e2d\u5c06\u6d4b\u8bd5dll\u53ca\u76f8\u5173\u51fd\u6570\u6ce8\u5165\u5373\u53ef\u3002<\/p>\n<h2 class=\"h-title\">\u6c47\u7f16hook<\/h2>\n<p>dll\u7ecf\u8fdb\u7a0b\u5f39\u7a97\u68c0\u6d4b\u6ce8\u5165\u6210\u529f\uff0c\u4f46\u662f\u56e0\u4e3aUI\u6846\u67b6\u662f\u5bf9\u65b9\u81ea\u7814\uff0c\u6ca1\u6cd5\u7528\u73b0\u6210\u7684API\u8fdb\u884c\u6309\u94ae\u6355\u83b7\uff0c\u4e8e\u662f\u53ea\u80fd\u5bc4\u5e0c\u671b\u4e8e\u4fee\u6539\u6c47\u7f16\u7684\u51fd\u6570\u8c03\u7528\u6765\u5b9e\u73b0\u529f\u80fd\u4fee\u6539\u3002<br \/>\n\u901a\u8fc7\u5728ida\u4e2d\u7684\u5206\u6790\uff0c\u6211\u4eec\u5feb\u901f\u5728x64dbg\u4e2d\u5b9a\u4f4d\u5230\u4e86\u76f8\u5173call\u56de\u8c03\u4ee3\u7801\uff1a<br \/>\n<img alt=\"\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-167 aligncenter\"  src=\"https:\/\/www.skyblogs.xyz\/wp-content\/themes\/lolimeow-lolimeowV13.13\/assets\/images\/loading.gif\" data-src=\"http:\/\/192.168.1.15:89\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-300x144.png\" class=\"lazy\" loading=\"lazy\" alt=\"\" srcset=\"https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-300x144.png 300w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-1024x491.png 1024w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-768x368.png 768w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-1536x737.png 1536w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/\u5c4f\u5e55\u622a\u56fe-2023-07-22-220933-2048x983.png 2048w\" sizes=\"(max-width: 1091px) 100vw, 1091px\" \/><\/p>\n<p>\u7f16\u8005\u5728\u6b64\u5904\u5c1d\u8bd5\u901a\u8fc7\u76f8\u5bf9\u5730\u5740\u6765\u8c03\u7528\u6240\uff0c\u4f46\u56e0\u4e3aalsr\u7b49\u95ee\u9898\u5bfc\u81f4\u518d\u6b21\u6253\u5f00\u7684\u65f6\u5019\u53d8\u4f1a\u51fa\u73b0\u5bfb\u5740\u9519\u8bef\u7684\u95ee\u9898<\/p>\n<p>\u518d\u5173\u95edalsr\u4e2d\uff0c\u76f8\u540c\u7684\u95ee\u9898\u56e0\u7cfb\u7edf\u539f\u56e0\u4ecd\u65e0\u6cd5\u907f\u514d\u3002\u4e8e\u662f\u7f16\u8005\u53c8\u5f00\u59cb\u5c1d\u8bd5\u901a\u8fc7IAT\u8868\u68c0\u7d22\u51fd\u6570\u5165\u53e3\u5730\u5740\u518d\u8fdb\u884c\u5bfc\u5165\uff0c\u540c\u6837\u7531\u4e8e\u8be5\u6bb5\u7684\u7a7a\u95f4\u6709\u9650\u3002\u540c\u65f6\u5bf9IAT\u8868\u7684\u64cd\u4f5c\u5b58\u5728\u56f0\u96be\uff0c\u6b64\u8def\u4e0d\u901a\uff0c\u653e\u5f03\u3002<\/p>\n<h2 class=\"h-title\">DLL\u52ab\u6301\u4e0e\u51fd\u6570\u8f6c\u53d1<\/h2>\n<p>\u65e2\u7136\u6c47\u7f16\u5c42\u9762\u6ca1\u6709\u624b\u6bb5\uff0c\u90a3\u662f\u5426\u80fd\u901a\u8fc7\u52ab\u6301dll\u6765\u505a\u5230\u5bf9onSavePictureFileMenuClick()\u51fd\u6570\u7684\u91cd\u5199\u5462\uff1f<br \/>\n\u4e8e\u662f\u7f16\u8005\u5f00\u59cb\u7814\u7a76\u8d77\u4e86DLL\u8f6c\u53d1\u3002<br \/>\n\u5047\u8bbe\u73b0\u5728\u6709a.exe\u4e0eb.dll\uff0c\u90a3\u4e48dll\u8f6c\u53d1\u5c31\u662f\u505a\u4e00\u4e2a\u5047\u7684b.dll\u8fdb\u53bb\uff0c\u7136\u540e\u5145\u5f53\u4e2d\u95f4\u5546\u7ed9\u771f\u6b63\u7684dll\u901a\u4fe1<br \/>\n\u4e5f\u5c31\u53d8\u6210\u4e86 a.exe b.dll(\u5047\u7684\u8f6c\u53d1dll) c.dll(\u771f\u6b63\u7684b.dll\u6539\u540d\u800c\u6765)<br \/>\n\u800c\u8981\u8fdb\u884cdll\u8f6c\u53d1\uff0c\u4e5f\u5c31\u662f\u8981\u5728\u5047\u7684dll\u4e2d\u4e3ab.dll\u4e2d\u6240\u6709\u7684\u51fd\u6570\u5efa\u7acb\u4fe1\u9053\uff0c\u5c31\u7f16\u8005\u76ee\u6d4b\u8fd9\u4e2adll\u5e93\u81f3\u5c11\u6709\u6570\u5343\u6761\u51fd\u6570<br \/>\n\u4e8e\u662f\u679c\u65ad\u653e\u5f03\u4e86\u4eba\u5de5\u7f16\u5199\uff0c\u8f6c\u800c\u770b\u5411\u751f\u6210\u5de5\u5177\u3002\u8fd9\u91cc\u7f16\u8005\u63a8\u8350\u7684\u662f\uff1aSharpDllProxy<br \/>\n\u9879\u76ee\u5730\u5740\uff1a<a class=\"links_btn\" href=\"https:\/\/github.com\/Flangvik\/SharpDllProxy\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/Flangvik\/SharpDllProxy<\/a><br \/>\n\u6309\u7167README.md\u4f7f\u7528\u8be5\u5e93\uff0c\u6700\u7ec8\u751f\u6210\u4e86\u4e13\u7528\u4e8edll\u52ab\u6301\u7684C\u8bed\u8a00\u6587\u4ef6\uff1a<img alt=\"\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-169\"  src=\"https:\/\/www.skyblogs.xyz\/wp-content\/themes\/lolimeow-lolimeowV13.13\/assets\/images\/loading.gif\" data-src=\"http:\/\/192.168.1.15:89\/wp-content\/uploads\/2023\/07\/3-1024x517.png\" class=\"lazy\" loading=\"lazy\" alt=\"\" srcset=\"https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/3-1024x517.png 1024w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/3-300x152.png 300w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/3-768x388.png 768w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/3-1536x776.png 1536w, https:\/\/www.skyblogs.xyz\/wp-content\/uploads\/2023\/07\/3-2048x1034.png 2048w\" sizes=\"(max-width: 1060px) 100vw, 1060px\" \/><\/p>\n<p>\u5bf9\u4ee3\u7801\u8fdb\u884c\u9002\u5e94\u6027\u4fee\u6539\u540e\u6784\u5efa\u9879\u76ee\uff0c\u6d4b\u8bd5\u751f\u6210\u7684dll\u53ef\u5b8c\u7f8e\u5145\u5f53exe\u4e0e\u539f\u751f\u5e93\u7684\u63e1\u624b\u4eba\uff0cdll\u8f6c\u53d1\u6210\u529f\u3002<\/p>\n<p>\u518d\u901a\u8fc7\u5fae\u8f6f\u63d0\u4f9b\u7684detour\u5e93\u7f16\u5199\u4ee3\u7801\u5b9e\u73b0\u51fd\u6570\u7684\u62e6\u622a\u91cd\u5199\uff1a<pre class=\"prettyprint linenums\">BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){<\/p>\n<p>switch (fdwReason){<\/p>\n<p>case DLL_PROCESS_ATTAC:{<\/p>\n<p>\/\/ \u5728 DLL \u52a0\u8f7d\u65f6\uff0c\u4f7f\u7528 Microsoft Detours \u4fee\u6539\u88ab\u8f6c\u53d1\u7684\u51fd\u6570\u5730\u5740<\/p>\n<p>HMODULE moduleHandle = GetModuleHandle(L&#8221;NTCourseExt.dll&#8221;);<\/p>\n<p>OriginalFunctionType originalFunction = reinterpret_cast&lt;OriginalFunctionType&gt;(GetProcAddress(moduleHandle, &#8220;?onSavePictureFileMenuClick@NTCourseEditView@NTCourseExt@@AEAAXXZ&#8221;));<\/p>\n<p>OriginalFunctionType* originalFunctionPtr = &amp;originalFunction;<\/p>\n<p>DetourTransactionBegin();<\/p>\n<p>DetourUpdateThread(GetCurrentThread());<\/p>\n<p>DetourAttach(reinterpret_cast&lt;void**&gt;(originalFunctionPtr), reinterpret_cast&lt;void*&gt;(&amp;onSavePictureFileMenuClick));<\/p>\n<p>DetourTransactionCommit();<\/p>\n<p>      }<\/p>\n<p>break;<\/p>\n<p>&nbsp;<\/p>\n<p>case DLL_PROCESS_DETACH:{<\/p>\n<p>\/\/ \u5728 DLL \u5378\u8f7d\u65f6\uff0c\u6062\u590d\u88ab\u8f6c\u53d1\u7684\u51fd\u6570\u5730\u5740<\/p>\n<p>HMODULE moduleHandle = GetModuleHandle(L&#8221;NTCourseExt.dll&#8221;);<\/p>\n<p>OriginalFunctionType originalFunction = reinterpret_cast&lt;OriginalFunctionType&gt;(GetProcAddress(moduleHandle, &#8220;?onSavePictureFileMenuClick@NTCourseEditView@NTCourseExt@@AEAAXXZ&#8221;));<\/p>\n<p>OriginalFunctionType* originalFunctionPtr = &amp;originalFunction;<\/p>\n<p>DetourTransactionBegin();<\/p>\n<p>DetourUpdateThread(GetCurrentThread());<\/p>\n<p>DetourDetach(reinterpret_cast&lt;void**&gt;(originalFunctionPtr), reinterpret_cast&lt;void*&gt;(&amp;onSavePictureFileMenuClick));<\/p>\n<p>DetourTransactionCommit();<\/p>\n<p>      }<\/p>\n<p>break;<\/p>\n<p>   }<\/p>\n<p>return TRUE;<\/p>\n<p>}<\/pre><\/p>\n<p>\u518d\u6b21\u6784\u5efadll\uff0c\u8fdb\u884c\u6d4b\u8bd5\uff0c\u529f\u80fd\u4fee\u6539\u6210\u529f\u4e14\u8fd0\u884c\u6b63\u5e38\u3002\u9879\u76ee\u6536\u5c3e\u5b8c\u7ed3\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u65e5\u63a5\u5230\u4e00\u9006\u5411\u9700\u6c42\uff0c\u8981\u6c42\u4fee\u6539\u4e00\u4e2a\u6309\u94ae\u7684\u529f\u80fd\u3002 \u521d\u4ee5\u4e3a\u662f\u8f83\u4e3a\u5e38\u89c1\u7684\u529f\u80fd\uff0c\u4ed4\u7ec6\u770b\u8fc7\u540e\u624d\u53d1\u73b0\u8be5\u8f6f\u4ef6\u91c7\u7528\u4e86\u81ea\u7814\u7684\u4e8c\u7ea7\u6846\u67b6 \u4e0d\u8fc7\u6240\u5e78\u8f6f\u4ef6\u7684\u5b89\u5168\u63aa\u65bd\u8f83\u4e3a\u8584\u5f31\uff0c\u7ecf\u5386\u4e86\u6574\u6574\u4e00\u5929\u7684\u6298\u817e\u540e\u7ec8\u4e8e\u6253\u901a\uff0c\u4fbf\u5728\u6b64\u5904\u7559\u4e2a\u968f\u7b14\u505a\u8bb0\u5f55\u3002 \u5173\u952e\u51fd\u6570\u5b9a\u4f4d \u5148\u901a\u8fc7\u62c6\u5305\u548cpe\u5934\u5206\u6790\uff0c\u627e\u51fa\u53ef\u7591xml\u6587\u4ef6\uff0c\u67e5\u770b\u540e\u53d1\u73b0\u4e3aui\u6587\u4ef6\uff0c\u4e8e\u662f\u901a\u8fc7\u8be5\u6587\u4ef6\u540d\u5728ida\u8fdb\u884c\u67e5\u627e \u540c\u65f6\u4e00\u8def\u5206\u6790\u4ee3\u7801\u8c03\u7528\uff0c\u6700\u7ec8\u5b9a\u4f4d\u5230\u4e86\u4ee5\u4e0b\u7247\u6bb5\uff1a &nbsp; &nbsp; &#038;nbs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":167,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[6],"tags":[33,35,36,28,12],"class_list":{"0":"post-165","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-teck-discussion","8":"tag-cpp","9":"tag-dll","11":"tag-28","12":"tag-12"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":6,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":213,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions\/213"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/media\/167"}],"wp:attachment":[{"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyblogs.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}