{"id":275013,"date":"2016-02-26T12:34:03","date_gmt":"2016-02-26T09:34:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=275013"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=275013","title":{"rendered":"\u0425\u0443\u043a\u0438 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e (\u0447\u0430\u0441\u0442\u044c 3)"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad3\/802\/710\/ad3802710ec84a344d96f0996768959c.jpg\" alt=\"image\"\/><br \/>  \u041a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u0434\u043b\u044f \u0445\u0443\u043a\u043e\u0432. <a href=\"https:\/\/habrahabr.ru\/company\/infopulse\/blog\/140456\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a> \u0431\u044b\u043b\u0430 \u043e\u0431 \u043e\u0431\u0449\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u0430\u0437\u0435 Detours, <a href=\"https:\/\/habrahabr.ru\/company\/infopulse\/blog\/213309\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u2014 \u043e \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u043e\u0439 (\u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 madCodeHook. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"http:\/\/www.nektra.com\/products\/deviare-api-hook-windows\/\">Deviare<\/a> \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Nektra. \u00ab\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0445\u0443\u043a\u043e\u0432?\u00bb \u2014 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u00ab\u0422\u0430\u043a\u0430\u044f \u0436\u0435, \u0434\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f\u00bb \u2014 \u043e\u0442\u0432\u0435\u0447\u0443 \u044f. \u0423 Deviare \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445 \u0435\u0451 \u0438 \u043e\u0442 Detours \u0438 \u043e\u0442 madCodeHook \u0438 \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0439 \u0435\u0451 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5><b>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 \u2014 GPL\\\u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0430\u044f<\/b>.<\/h5>\n<p>\u0414\u043b\u044f \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043e\u043d\u0430 \u0436\u0438\u0432\u0451\u0442 \u043d\u0430 <a href=\"https:\/\/github.com\/nektra\/Deviare-InProc\/\">GitHub<\/a>, \u0430 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 \u043f\u0440\u0430\u0432\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442.\u0422\u043e \u0435\u0441\u0442\u044c \u0434\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u044f\u043c\u043e \u0432\u0437\u044f\u0442\u044c \u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0435\u0451 \u0441 GitHub \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u0451\u043c \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0432 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0438 \u043a\u043e\u043f\u0435\u0439\u043a\u0438. \u0427\u0443\u0434\u043e, \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435 \u0434\u043b\u044f Detours \u0438 madCodeHook. \u041d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u043b \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c, \u043d\u043e \u043f\u043e\u0442\u043e\u043c Nektra \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0431\u043b\u0438\u0436\u0435 \u043a \u043b\u044e\u0434\u044f\u043c. <\/p>\n<h5><b>\u041d\u0430 \u0431\u0430\u0437\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441\u0434\u0435\u043b\u0430\u043d \u043c\u043e\u0449\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 <a href=\"http:\/\/nektra.com\/products\/spystudio-api-monitor\/\">SpyStudio<\/a> <\/b><\/h5>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u0434 \u0434\u043b\u044f \u0445\u0443\u043a\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430 \u0447\u0442\u043e \u043e\u043d\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430. \u041d\u0430 \u0431\u0430\u0437\u0435 Detours \u0438 madCodeHook \u0442\u043e\u0436\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u043d\u043e \u0432\u043e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u041f\u041e \u043e\u0442 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u0441\u0430\u043c\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u0442.<\/p>\n<h5><b>\u0410\u0432\u0442\u043e\u0440\u044b \u043d\u0430\u043a\u0438\u0434\u0430\u043b\u0438 \u0432 \u0441\u0432\u043e\u0451\u043c \u0431\u043b\u043e\u0433\u0435 \u043a\u0443\u0447\u0443 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0445\u0443\u043a\u043e\u0432<\/b><\/h5>\n<p>\u0422\u0443\u0442 \u0432\u0430\u043c \u0438 <a href=\"http:\/\/blog.nektra.com\/main\/2013\/06\/26\/sql-server-interception-and-sql-injection-attacks-prevention\/\">\u0445\u0443\u043a\u0438 \u043d\u0430 SQL Server<\/a> \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439, \u0438 <a href=\"http:\/\/blog.nektra.com\/main\/2013\/07\/23\/instrumenting-direct3d-applications-to-capture-video-and-calculate-frames-per-second\/\">\u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0438\u0434\u0435\u043e \u0438\u0437 \u0438\u0433\u0440<\/a>, \u0440\u0438\u0441\u0443\u0435\u043c\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 DirectX, \u0438 <a href=\"https:\/\/github.com\/nektra\/Direct3D-Invisible-Walls\">\u0447\u0438\u0442\u044b<\/a>, \u0438 <a href=\"http:\/\/blog.nektra.com\/main\/2012\/06\/13\/controlling-the-speed-of-youtube-flash-html5-and-desktop-videos-with-deviare-hooks\/\">\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0435\u0435\u0440\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/a>. \u0427\u0438\u0442\u0430\u0435\u0448\u044c \u2014 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0443\u043a\u0438.<\/p>\n<h5><b>\u041a\u0440\u043e\u043c\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0421++ \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f COM-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0445\u0443\u043a\u0438 \u043e\u0442\u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e (C#, Python, VB, Delphi \u0438 \u0442.\u0434.)<\/b><\/h5>\n<p>\u0414\u0430, \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0443\u043a\u0438, \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044f\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \ud83d\ude42<\/p>\n<h5><b>\u0425\u0443\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0448\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b COM-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u0438 \u043d\u0430 .NET-\u043c\u0435\u0442\u043e\u0434\u044b<\/b><\/h5>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0438\u0447\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u043d\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0443\u0431\u043e\u0439\u043d\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 .NET \u0438 \u0442\u0430\u043a \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441 \u043c\u0435\u0442\u0430\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0435\u0439, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u2014 \u0443\u043c\u0435\u043b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0441\u0430\u043c. \u041d\u043e \u0442\u0430\u043a, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0438\u0448\u0435\u043d\u043a\u0438 \u043d\u0430 \u043f\u0438\u0440\u043e\u0433\u0435 \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442.<\/p>\n<h5><b>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0436\u0438\u043b\u0430 \u0432\u0441\u0435 \u00ab\u0434\u0435\u0442\u0441\u043a\u0438\u0435\u00bb \u0431\u043e\u043b\u0435\u0437\u043d\u0438<\/b><\/h5>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438\u0437 Fortune 500, \u0430 \u043f\u0430\u0440\u0442\u043d\u0451\u0440\u0441\u0442\u0432\u043e \u0441 VmWare \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c, <a href=\"http:\/\/blog.nektra.com\/main\/2013\/11\/05\/nektra-and-vmware-are-collaborating-to-simplify-application-virtualization-packaging\/\">\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<\/a>, \u043f\u043e\u0440\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0442\u0443\u0442 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u0434\u0430 (\u0433\u043b\u0443\u043f\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 <a href=\"https:\/\/github.com\/nektra\/Deviare-InProc\/tree\/master\/Samples\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438<\/a> \u043d\u0430 GitHub). \u041d\u0443 \u0447\u0438\u0441\u0442\u043e \u0442\u0430\u043a, \u043e\u0431\u0437\u043e\u0440\u043d\u043e.<\/p>\n<p>  \u0418\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u0441\u0432\u043e\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441:  <\/p>\n<pre><code class=\"cpp\">#include &quot;NktHookLib.h&quot; NktHookLibHelpers::InjectDllByPidW(dwPid, L&quot;myDll.dll&quot;); <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0445\u0443\u043a\u0430 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">#include &quot;NktHookLib.h&quot;  typedef int (WINAPI *lpfnMessageBoxW)(__in_opt HWND hWnd, __in_opt LPCWSTR lpText, __in_opt LPCWSTR lpCaption, __in UINT uType); static int WINAPI Hooked_MessageBoxW(__in_opt HWND hWnd, __in_opt LPCWSTR lpText, __in_opt LPCWSTR lpCaption, __in UINT uType);  static struct {   SIZE_T nHookId;   lpfnMessageBoxW fnMessageBoxW; } sMessageBoxW_Hook = { 0, NULL };  int WinMainCRTStartup() {   CNktHookLib cHookMgr;   HINSTANCE hUser32Dll;   LPVOID fnOrigMessageBoxW;   DWORD dwOsErr;    hUser32Dll = NktHookLibHelpers::GetModuleBaseAddress(L&quot;user32.dll&quot;);   if (hUser32Dll == NULL) {     ::MessageBoxW(0, L&quot;Error: Cannot get handle of user32.dll&quot;, L&quot;HookTest&quot;, MB_OK|MB_ICONERROR);     return 0;   }   fnOrigMessageBoxW = NktHookLibHelpers::GetProcedureAddress(hUser32Dll, &quot;MessageBoxW&quot;);   if (fnOrigMessageBoxW == NULL) {     ::MessageBoxW(0, L&quot;Error: Cannot get address of MessageBoxW&quot;, L&quot;HookTest&quot;, MB_OK|MB_ICONERROR);     return 0;   }    dwOsErr = cHookMgr.Hook(&(sMessageBoxW_Hook.nHookId), (LPVOID*)&(sMessageBoxW_Hook.fnMessageBoxW),                           fnOrigMessageBoxW, Hooked_MessageBoxW,                           NKTHOOKLIB_DisallowReentrancy);    ::MessageBoxW(0, L&quot;This should be hooked&quot;, L&quot;HookTest&quot;, MB_OK);   dwOsErr = cHookMgr.Unhook(sMessageBoxW_Hook.nHookId);    ::MessageBoxW(0, L&quot;This should NOT be hooked&quot;, L&quot;HookTest&quot;, MB_OK);    return 0; }  static int WINAPI Hooked_MessageBoxW(__in_opt HWND hWnd, __in_opt LPCWSTR lpText, __in_opt LPCWSTR lpCaption, __in UINT uType) {   return ::MessageBoxW(hWnd, lpText, L&quot;HOOKED!!!&quot;, uType); } <\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u0438\u0437 Python \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f Notepad, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0445\u0443\u043a \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e CreateFileW:<\/p>\n<pre><code class=\"python\">import win32com.client import ctypes, sys  from EventHandlers import NktSpyMgrEvents from AuxFunctions import *  if sys.version_info.major &lt; 3: \twarnings.warn(&quot;Need Python 3.0 for this program to run&quot;, RuntimeWarning) \tsys.exit(0)  win32com.client.pythoncom.CoInitialize() spyManager = win32com.client.DispatchWithEvents(&quot;DeviareCOM.NktSpyMgr&quot;, NktSpyMgrEvents) result = spyManager.Initialize()  if not result == 0: \tprint (&quot;ERROR: Could not initialize the SpyManager. Error code: %d&quot; % (result)) \tsys.exit(0)  notepad = StartNotepadAndHook(spyManager)  MessageBox = ctypes.windll.user32.MessageBoxW MessageBox(None, &quot;Press OK to end the demo.&quot;, &quot;Deviare Python Demo&quot;, 0)  notepad.Terminate(0) <\/code><\/pre>\n<p>  \u0423\u0434\u0430\u0447\u0438 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439!               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/277995\/\"> https:\/\/habrahabr.ru\/post\/277995\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ad3\/802\/710\/ad3802710ec84a344d96f0996768959c.jpg\" alt=\"image\"\/><br \/>  \u041a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u0434\u043b\u044f \u0445\u0443\u043a\u043e\u0432. <a href=\"https:\/\/habrahabr.ru\/company\/infopulse\/blog\/140456\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a> \u0431\u044b\u043b\u0430 \u043e\u0431 \u043e\u0431\u0449\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u0430\u0437\u0435 Detours, <a href=\"https:\/\/habrahabr.ru\/company\/infopulse\/blog\/213309\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u2014 \u043e \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u043e\u0439 (\u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 madCodeHook. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"http:\/\/www.nektra.com\/products\/deviare-api-hook-windows\/\">Deviare<\/a> \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Nektra. \u00ab\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0445\u0443\u043a\u043e\u0432?\u00bb \u2014 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u00ab\u0422\u0430\u043a\u0430\u044f \u0436\u0435, \u0434\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f\u00bb \u2014 \u043e\u0442\u0432\u0435\u0447\u0443 \u044f. \u0423 Deviare \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445 \u0435\u0451 \u0438 \u043e\u0442 Detours \u0438 \u043e\u0442 madCodeHook \u0438 \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0439 \u0435\u0451 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-275013","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275013"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275013\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}