{"id":239005,"date":"2014-10-02T21:05:03","date_gmt":"2014-10-02T17:05:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=239005"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=239005","title":{"rendered":"<span class=\"post_title\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 .net framework \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438\u043b\u0438 \u00ab\u0443\u0442\u0435\u0447\u043a\u0430\u00bb .Net Framework 5.0<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0417\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u2014 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0445\u0430\u043a. \u0412\u043e\u043f\u0440\u043e\u0441, \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0446\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0418\u0442\u0430\u043a \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <b>mscorlib<\/b> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041d\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 (\u0434\u043b\u044f runtime \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0449\u0438, \u0438 \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438). Mscorlib \u044f \u0432\u0437\u044f\u043b \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u0443 \u0432\u0441\u0435\u0445 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0445\u0430\u043a\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e.<\/p>\n<p>  \u0412\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u00ab\u0430\u0434\u0430 dll\u00bb, Microsoft \u043f\u043e\u043c\u0438\u043c\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0434\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u043e\u043c, public key \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u00ab\u043f\u0440\u0438\u0448\u043b\u0430\u00bb \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0430 \u043d\u0435 \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0431\u0440\u043e\u0441\u043e\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0442.\u043e., \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u0432 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u044e\u0447\u0438\u043a public key \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u0435\u043c \u0436\u0435, \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0435\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c, \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. <\/p>\n<p>  \u041d\u0430\u0448\u0430 \u043c\u0438\u043d\u0438 \u0446\u0435\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0432\u0435\u043b\u0430 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0442\u0435\u043a\u0441\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/8c6\/0f0\/e3d\/8c60f0e3d36248ce86ae82a76f5d6997.png\"\/><\/p>\n<p>  <b>PS:<\/b> \u044d\u0442\u043e \u2014 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430<br \/>  . <br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:  <\/p>\n<ol>\n<li><a href=\"#Intro\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#Driver\">\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/a><\/li>\n<li><a href=\"#DriverResults\">\u0412\u044b\u0432\u043e\u0434\u044b \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/a> <\/li>\n<li><a href=\"#WinService\">\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Windows<\/a><\/li>\n<li><a href=\"#Mscorlib\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 mscorlib.dll<\/a><\/li>\n<li><a href=\"#Results\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f<\/a><\/li>\n<\/ol>\n<p>  <a name=\"Intro\"><\/a>  <\/p>\n<h2><font color=\"#0e3d78\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u0431\u043e\u0440\u043a\u0430\u0445, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u0432 GAC \u0438 \u0432 NAC. \u042f \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e .NET Framework \u043e\u0447\u0435\u043d\u044c \u0447\u0443\u0442\u043a\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 GAC. \u041e\u043d \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0435\u0439 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043e\u0442\u0442\u0443\u0434\u0430 \u0441\u0431\u043e\u0440\u043a\u0438, \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u043e\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u043c\u0435\u043d\u0443 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e: \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0443\u0440\u043e\u0432\u043d\u044f \u044f\u0434\u0440\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u0432 \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u042f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e filesystem filters. \u0421\u0443\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0430: \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u0441\u0430\u043c\u043e\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435, \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043c\u0435\u0436\u0434\u0443 Kernel-space \u0438 user-space. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b user-space \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 windows \u2014 service \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041e\u043d\u043e \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c, \u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0410 \u0442\u043e\u0442 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, mscorlib, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0431\u043e Reflexil, \u043b\u0438\u0431\u043e Mono::Cecil.<\/p>\n<p>  \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:  <\/p>\n<ul>\n<li>\u041c\u0435\u043d\u044f\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443 (Reflexil \u0438\u043b\u0438 Mono::Cecil) \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 mscorlib \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u0435 \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/li>\n<li>\u041a\u043b\u0430\u0434\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 tmp \u043a\u0430\u0442\u0430\u043b\u043e\u0433<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c redirection \u00abC:\\Windows\\Microsoft.NET\\assembly\\GAC_64\\mscorlib\\v4.0_4.0.0.0__b77a5c561934e089\\mscorlib.dll\u00bb \u043d\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abC:\\tmp\\mscorlib64.dll\u00bb \u2014 \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 <\/li>\n<\/ul>\n<p>  \u0418 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0445 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 .net \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0414\u043b\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u043a\u043e\u043c\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u0430\u0432\u0430\u0442\u044c \u00ab\u043b\u0435\u0432\u0430\u043a\u00bb, \u0430 \u043a\u043e\u043c\u0443 \u2014 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<p>  <a name=\"Driver\"><\/a>  <\/p>\n<h2><font color=\"#0e3d78\">\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c VirtualBox. \u041e\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440. \u041d\u0430\u043c \u0436\u0435 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0448 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u043e \u0442\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u043c \u0438 \u0432\u044b\u043b\u0435\u0442\u0430\u0442\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 (\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441 BSOD&#8217;\u043e\u043c). \u041d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0438 \u043d\u0430\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0437\u044b Windows XP \u0438 Windows 7, x86 \u0438 x64 \u0438 \u0441\u043d\u0438\u043c\u0430\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043a\u0443\u0434\u0430 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0434\u0435\u0432\u0435\u043b\u043e\u043f\u0435\u0440\u0441\u043a\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 VisualDDK, WinDDK, \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0438\u0445 \u0447\u0430\u0441\u0442\u0438. \u041e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u0438\u0448\u0435\u043c \u043c\u044b Minifilter Filesystem Driver.<\/p>\n<p>  1) \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430:  <\/p>\n<pre><code>const FLT_OPERATION_REGISTRATION Callbacks[] = {  \t{ IRP_MJ_CREATE,\t\t\t\t\t\t\t\t \t  0,\t\t\t\t\t\t\t\t\t\t\t \t  PbPreOperationCreateCallback, \t  PbPostOperationCreateCallback },  \t{ IRP_MJ_NETWORK_QUERY_OPEN, \t  0, \t  PbPreOperationNetworkQueryOpenCallback, \t  NULL }, \t \t{ IRP_MJ_OPERATION_END } };  CONST FLT_REGISTRATION FilterRegistration = {      sizeof( FLT_REGISTRATION ),         \/\/  Size     FLT_REGISTRATION_VERSION,           \/\/  Version     0,                                  \/\/  Flags      NULL,                               \/\/  Context     Callbacks,                          \/\/  Operation callbacks      PtFilterUnload,                     \/\/  FilterUnload      PtInstanceSetup,                    \/\/  InstanceSetup     PtInstanceQueryTeardown,            \/\/  InstanceQueryTeardown     PtInstanceTeardownStart,            \/\/  InstanceTeardownStart     PtInstanceTeardownComplete,         \/\/  InstanceTeardownComplete  \tPtGenerateFileName,                 \/\/  GenerateFileName     PtNormalizeNameComponent            \/\/  NormalizeNameComponent }; <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u0432\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0424\u0438\u043b\u044c\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 volumes, \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e CreateFile (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\/\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430)<\/p>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0443 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e, \u0447\u0442\u043e \u0442\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:  <\/p>\n<ul>\n<li>\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/li>\n<li>\u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u043e \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/li>\n<li>\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f Communitation Port \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c (3 \u043a\u043e\u043b\u044c\u0446\u043e \u0437\u0430\u0449\u0438\u0442\u044b, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Windows), \u0433\u0434\u0435 \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 Windows, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0438\u0436\u0435 <\/li>\n<\/ul>\n<pre><code class=\"cpp\">CPP_DRIVER_ENTRY (     __in PDRIVER_OBJECT DriverObject,     __in PUNICODE_STRING RegistryPath     )  { \t\/* locals *\/     NTSTATUS             status; \tOBJECT_ATTRIBUTES    attr; \tUNICODE_STRING       portName; \t\tPSECURITY_DESCRIPTOR securityDescriptor;  \t\/* unused *\/     UNREFERENCED_PARAMETER( RegistryPath );  \t\/* code *\/ \t__try {  \t\t\/\/ Set DRIVER_DATA to zeroes \t\tmemset(&DRIVER_DATA, 0, sizeof(DRIVER_DATA));  \t\t\/* Setup process creation callback *\/ \t\tstatus = Xu(&PsProcessNotify, FALSE); \t\tif( !NT_SUCCESS( status )) __leave;  \t\tSetFlag(DRIVER_DATA.initialized, FILTER_SUBSYSTEM_PROCESS);  \t\t\/\/ Get exported OS functions \t\tDECLARE_CONST_UNICODE_STRING( Func1, L&quot;IoReplaceFileObjectName&quot; );\t\t\t\t\/\/ Win7+ \t\tDRIVER_DATA.pfnIoReplaceFileObjectName = (PIOREPLACEFILEOBJECTNAME) MmGetSystemRoutineAddress((PUNICODE_STRING) &Func1 );  \t\t\/\/ Register filter \t\tstatus =  FltRegisterFilter( DriverObject, \t\t\t\t\t\t\t\t\t&FilterRegistration, \t\t\t\t\t\t\t\t\t&DRIVER_DATA.fltHandle ); \t\tif ( !NT_SUCCESS( status )) __leave;  \t\tSetFlag(DRIVER_DATA.initialized, FILTER_SUBSYSTEM_DRIVER);  \t\tFltInitializePushLock(&DRIVER_DATA.Sync); \t\tSetFlag(DRIVER_DATA.initialized, FILTER_SUBSYSTEM_LOCK);  \t\t\/\/ Setup security descriptor \t\tstatus = FltBuildDefaultSecurityDescriptor( &securityDescriptor, FLT_PORT_ALL_ACCESS ); \t\tif ( !NT_SUCCESS( status )) __leave;  \t\tRtlInitUnicodeString( &portName, PbCommPortName );  \t\tInitializeObjectAttributes( &attr, &portName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, securityDescriptor ); \t\tstatus = FltCreateCommunicationPort( DRIVER_DATA.fltHandle, &DRIVER_DATA.Connection.ServerPort, &attr, NULL, CommPortConnect, CommPortDisconnect, CommPortMessageNotify, 1 ); \t\tif ( !NT_SUCCESS( status )) __leave;  \t\tSetFlag(DRIVER_DATA.initialized, FILTER_SUBSYSTEM_COMPORT);  \t\t\/\/  Free the security descriptor in all cases. It is not needed once the call to FltCreateCommunicationPort( ) is made. \t\tFltFreeSecurityDescriptor( securityDescriptor ); \t\tif ( !NT_SUCCESS( status )) __leave; \t\t \t\t\/\/  Start filtering i\/o \t\tstatus = FltStartFiltering( DRIVER_DATA.fltHandle );  \t\tif ( !NT_SUCCESS( status )) __leave; \t\t \t \t\tASSERT( NT_SUCCESS( status ) );  \t\tDRIVER_DATA.State = DRIVER_STATE_STARTED;  \t} __finally  \t{ \t\tif(!NT_SUCCESS( status )) \t\t{ \t\t\tDeregisterFilter(); \t\t}     }  \treturn status; } <\/code><\/pre>\n<p>  \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0441\u0442:<br \/>  \u0421\u043a\u0430\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e <b>DeregisterFilter<\/b> \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u043b\u0430\u0433\u0430\u0445 \u0432 DRIVER_DATA.Initialized (\u0441\u043c. \u043a\u043e\u0434 \u0432\u044b\u0448\u0435)<\/p>\n<pre><code class=\"cpp\">NTSTATUS  PtFilterUnload(     __in FLT_FILTER_UNLOAD_FLAGS Flags     ) {     UNREFERENCED_PARAMETER( Flags );      PAGED_CODE();      DeregisterFilter(); \t     DbgPrint(&quot;PoliciesSandbox!PtFilterUnload: Entered\\n&quot;);      return STATUS_SUCCESS; } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u0438 \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041a\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0438 \u043a\u0443\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u0447\u0438\u043a \u043c\u0435\u0436\u0434\u0443 kernel-mode \u0438 user-mode \u043f\u043e communication port, \u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0434\u043d\u044f\u043b\u0438 \u0432 DriverEntry<\/p>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434:  <\/p>\n<pre><code class=\"cpp\">typedef enum {  \t\/\/ From verson = v1.0 \t\/\/ From User-space to Kernel-space \tGetVersion, \t\t \tGetFilesystemRedirections, \tAddFilesystemByPIDRedirection, \tRemoveFilesystemByPIDRedirection, \t\t \tGetRegistryRedirections, \tAddRegistryByPIDRedirection, \tRemoveRegistryByPIDRedirection, \t\t \t\/\/ From Kernel-space to User-space \tProcessAttached, \t\t \tCancelIOCompletionPort  \t\/\/ Version v2.0 is here } COMM_COMMAND; <\/code><\/pre>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u0430\u0437\u044b \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:  <\/p>\n<pre><code class=\"cpp\">typedef struct {     COMM_COMMAND Command;     USHORT Data[]; } COMM_MESSAGE, *PCOMM_MESSAGE; <\/code><\/pre>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c\u0443\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0443 Windows \u0434\u043b\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435:  <\/p>\n<pre><code class=\"cpp\">typedef struct  {     ULONG Pid; } COMM_PROCESS_ATTACHED, *PCOMM_PROCESS_ATTACHED; <\/code><\/pre>\n<p>  \u041e\u043f\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443-\u043e\u0442\u0432\u0435\u0442:  <\/p>\n<pre><code class=\"cpp\">typedef struct {\t \tUSHORT NeedToMonitor; \tUSHORT IsCompleted;          \/\/ true, if this packet contains all redirections, needed by driver. Otherwice, driver needs to ask more \tUSHORT PairsCount;           \/\/ redirections count. Actually, count of null-terminated strings in Data \t \tstruct {                     \/\/ positions of redirections to make searching fast  \t\tUSHORT From; \t\tUSHORT To; \t} Positions[64];   \tWCHAR  Data[]; } COMM_FS_REDIRECTIONS, *PCOMM_FS_REDIRECTIONS; <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432\u0432\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"cpp\">typedef struct _MAPPING_ENTRY {      UNICODE_STRING OldName;      UNICODE_STRING NewName;      _MAPPING_ENTRY *Next;  } MAPPING_ENTRY, *PMAPPING_ENTRY;  typedef struct _PROCESSES_MAP_ENTRY { \t \tULONG Pid; \tPMAPPING_ENTRY entries; \t_PROCESSES_MAP_ENTRY *Prev, *Next; } PROCESSES_MAP_ENTRY, *PPROCESSES_MAP_ENTRY; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (\u0430 \u043c\u044b \u0443\u0436\u0435 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c) \u043e\u043f\u043e\u0432\u0435\u0441\u0442\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0430\u043f\u043e\u043a \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043e\u0447\u0438\u0449\u0430\u044e\u0449\u0438\u0445 \u043f\u0430\u043c\u044f\u0442\u044c, \u0442.\u043a. \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. <br \/>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0438 \u0444\u043b\u0430\u0433, \u0441\u043e\u0437\u0434\u0430\u043d \u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043b\u0438\u0431\u043e \u043e\u043d \u0443\u043c\u0438\u0440\u0430\u0435\u0442. \u0422.\u0435. \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u0442 \u043d\u0430\u0441 \u0438 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u043e \u0441\u043c\u0435\u0440\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u0435\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f, \u043c\u044b \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441 Windows, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f PID \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 PID \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0443 \u0441\u0435\u0431\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430 \u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u0438\u0445 \u043d\u0430\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">VOID PsProcessNotify (     IN HANDLE  ParentId,     IN HANDLE  ProcessId,     IN BOOLEAN  Create     ) { \tNTSTATUS status;  \tif( HandleToULong( ProcessId ) &lt;= 4) return;  \t\/* Check exsisting data *\/  \tif(Create) \t{ \t\tLARGE_INTEGER liTimeout; \t\tDbgPrint(&quot;Process created: %x&quot;, ProcessId); \t\tliTimeout.QuadPart = -((LONGLONG)1 * 10 * 1000 * 1000); \t\tULONG SenderBufferLength = MESSAGE_BUFFER_SIZE; \t\tULONG ReplyLength = MESSAGE_BUFFER_SIZE; \t\tPCOMM_MESSAGE message = (PCOMM_MESSAGE)myNonPagedAlloc(MESSAGE_BUFFER_SIZE); \t\tmessage-&gt;Command = ProcessAttached; \t\t((PCOMM_PROCESS_ATTACHED)(&message-&gt;Data[0]))-&gt;Pid = HandleToULong(ProcessId); \t\tstatus = FltSendMessage(DRIVER_DATA.fltHandle, &DRIVER_DATA.Connection.ClientPort,  \t\t\t                   message, SenderBufferLength, message, &ReplyLength,  \t\t\t\t\t\t\t   &liTimeout);  \t\tif(ReplyLength &gt; 0) \t\t{ \t\t\tPCOMM_FS_REDIRECTIONS Redirections = (PCOMM_FS_REDIRECTIONS)&message-&gt;Data[0]; \t\t\tDbgPrint(&quot;Recieved reply from user-mode: NeedToMonitor = %s\\n&quot;, Redirections-&gt;NeedToMonitor ? &quot;TRUE&quot; : &quot;FALSE&quot; ); \t\t\tif(Redirections-&gt;NeedToMonitor) \t\t\t{ \t\t\t\tPbRepInitializeMapping(HandleToULong(ProcessId), Redirections); \t\t\t} else { \t\t\t\tDbgPrint(&quot;Thread %d not needed to be monitored. Skipping.&quot;, HandleToULong(ProcessId)); \t\t\t} \t\t} \t\t \t\tif(!message) myFree(message); \t} \telse \t{ \t\tDbgPrint(&quot;Process destroyed: %x\\n&quot;, ProcessId);  \t\tPPROCESSES_MAP_ENTRY entry = DRIVER_DATA.Mapping; \t\twhile( entry != NULL ) \t\t{ \t\t\tif(entry-&gt;Pid == HandleToULong(ProcessId)) \t\t\t{ \t\t\t\tPbRepDeleteMapping(entry); \t\t\t\tbreak; \t\t\t} \t\t} \t} } <\/code><\/pre>\n<p>  \u041a\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Windows:  <\/p>\n<pre><code class=\"cpp\">NTSTATUS PbRepInitializeMapping( __in ULONG pid, __in PCOMM_FS_REDIRECTIONS Redirections ) {     NTSTATUS status = STATUS_SUCCESS;  \tFltAcquirePushLockExclusive( &DRIVER_DATA.Sync );  \t__try \t{ \t\tDbgPrint(&quot;PlociesSandbox!PbRepInitializeMapping: redirections count: %d\\n&quot;, Redirections-&gt;PairsCount);  \t\tPMAPPING_ENTRY current = NULL;  \t\t\/\/ Lookup PID in map \t\tPPROCESSES_MAP_ENTRY currentProcess = DRIVER_DATA.Mapping; \t\twhile(currentProcess != NULL) \t\t{ \t\t\tif(currentProcess-&gt;Pid == pid) \t\t\t{\t\t\t \t\t\t\tDbgPrint(&quot;PlociesSandbox!PbRepInitializeMapping: Already initialized; skipping&quot;); \t\t\t\treturn STATUS_SUCCESS; \t\t\t} \t\t\tcurrentProcess = currentProcess-&gt;Next; \t\t}  \t\tcurrentProcess = (PPROCESSES_MAP_ENTRY)myNonPagedAlloc(sizeof(PROCESSES_MAP_ENTRY)); \t\tcurrentProcess-&gt;Pid = pid; \t\tcurrentProcess-&gt;Next = DRIVER_DATA.Mapping; \t\tcurrentProcess-&gt;Prev = NULL; \t\tif(DRIVER_DATA.Mapping != NULL) DRIVER_DATA.Mapping-&gt;Prev = currentProcess; \t\tDRIVER_DATA.Mapping = currentProcess;  \t\tfor(int i=0; i &lt; Redirections-&gt;PairsCount; i++) \t\t{ \t\t\t\/\/ Copying a pair of pathes From-&gt;To to internal mapping structure \t\t\tint FromLen = wcslen(&Redirections-&gt;Data[Redirections-&gt;Positions[i].From]); \t\t\tint ToLen   = wcslen(&Redirections-&gt;Data[Redirections-&gt;Positions[i].To]); \t\t\tPMAPPING_ENTRY mappingEntry = (PMAPPING_ENTRY)myAlloc(NonPagedPool, sizeof(MAPPING_ENTRY));  \t\t\tmappingEntry-&gt;OldName.Buffer = (WCHAR*)myAlloc(NonPagedPool, (FromLen + 1) * sizeof(WCHAR)); \t\t\twcscpy(mappingEntry-&gt;OldName.Buffer, &Redirections-&gt;Data[Redirections-&gt;Positions[i].From]); \t\t\tmappingEntry-&gt;OldName.Length = mappingEntry-&gt;OldName.MaximumLength = wcslen(mappingEntry-&gt;OldName.Buffer) * sizeof(WCHAR);  \t\t\tmappingEntry-&gt;NewName.Buffer = (WCHAR*)myAlloc(NonPagedPool, (ToLen + 1) * sizeof(WCHAR)); \t\t\twcscpy(mappingEntry-&gt;NewName.Buffer, &Redirections-&gt;Data[Redirections-&gt;Positions[i].To]); \t\t\tmappingEntry-&gt;NewName.Length = mappingEntry-&gt;NewName.MaximumLength = wcslen(mappingEntry-&gt;NewName.Buffer) * sizeof(WCHAR);  \t\t\tif(current == NULL) \t\t\t{ \t\t\t\tcurrent = mappingEntry; \t\t\t\tcurrentProcess-&gt;entries = current; \t\t\t} else { \t\t\t\tcurrent-&gt;Next = mappingEntry; \t\t\t\tcurrent = mappingEntry; \t\t\t}  \t\t\tcurrent-&gt;Next = NULL; \t\t}  \t} __finally {  \t\tFltReleasePushLock( &DRIVER_DATA.Sync );  \t} \tDbgPrint(&quot;PlociesSandbox!PbRepInitializeMapping: done\\n&quot;);  \treturn status; } <\/code><\/pre>\n<p>  \u0418, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430. \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 STATUS_SUCCESS \u0438 \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c:  <\/p>\n<pre><code class=\"cpp\">bool PbIsFolder(PUNICODE_STRING path) { \treturn path-&gt;Buffer[path-&gt;Length\/2 - 1] == L'\\\\'; }  NTSTATUS PbLookupRedirection(__in PUNICODE_STRING FilePath, __out PUNICODE_STRING *FileFound) { \t\/\/ Possible redirections: \t\/\/ Full change:    \\Device\\HarddiskVolume2\\InternalPath\\Path\\To\\Some\\File.Ext -&gt; \\Device\\.\\Temporary\\File.ext \t\/\/ Partial change: \\Device\\HarddiskVolume2\\InternalPath\\ -&gt; \\Device\\HarddiskVolume2\\Temporary\\ \t\/\/   in this case all pathes, starts with ..\\InternalPath should be changed. For ex.: \t\/\/     \\Device\\HarddiskVolume2\\InternalPath\\Some\\Path\\To\\File.Ext -&gt; \\Device\\HarddiskVolume2\\Temporary\\Some\\Path\\To\\File.Ext \tULONG Pid = HandleToULong(PsGetCurrentProcessId()); \tFltAcquirePushLockShared( &DRIVER_DATA.Sync ); \t__try  \t{ \t\tPPROCESSES_MAP_ENTRY currentProcess = DRIVER_DATA.Mapping; \t\twhile(currentProcess != NULL) \t\t{ \t\t\tif(currentProcess-&gt;Pid == Pid) \t\t\t{ \t\t\t\tPMAPPING_ENTRY current = currentProcess-&gt;entries; \t\t\t\twhile(current != NULL) \t\t\t\t{ \t\t\t\t\tif(PbIsFolder(&current-&gt;OldName)) \t\t\t\t\t{ \t\t\t\t\t\t\/\/ Folders prefixes are identical, please note that all lengthes are double-sized \t\t\t\t\t\tif(wcsncmp(current-&gt;OldName.Buffer, FilePath-&gt;Buffer, current-&gt;OldName.Length \/ 2) == NULL) \t\t\t\t\t\t{ \t\t\t\t\t\t\tint newlength = (FilePath-&gt;Length - current-&gt;OldName.Length) + current-&gt;NewName.Length; \t\t\t\t\t\t\tPUNICODE_STRING ret = PbAllocUnicodeString(newlength + 2); \t\t\t\t\t\t\tRtlCopyUnicodeString(ret, &current-&gt;NewName); \t\t\t\t\t\t\tRtlCopyMemory( Add2Ptr(ret-&gt;Buffer, ret-&gt;Length), \t\t\t\t\t\t\t\t\t\t   Add2Ptr(FilePath-&gt;Buffer, current-&gt;OldName.Length), \t\t\t\t\t\t\t\t\t\t   (FilePath-&gt;Length - current-&gt;OldName.Length) + 2);  \t\t\t\t\t\t\tret-&gt;Length = wcslen(ret-&gt;Buffer) * 2; \t\t\t\t\t\t\t*FileFound = ret; \t\t\t\t\t\t\treturn STATUS_SUCCESS; \t\t\t\t\t\t} \t\t\t\t\t} else { \t\t\t\t\t\tif(wcscmp(current-&gt;OldName.Buffer, FilePath-&gt;Buffer) == NULL) \t\t\t\t\t\t{ \t\t\t\t\t\t\tPUNICODE_STRING ret = PbAllocUnicodeString(current-&gt;NewName.Length + 2); \t\t\t\t\t\t\tRtlCopyUnicodeString(ret, &current-&gt;NewName); \t\t\t\t\t\t\t*FileFound = ret; \t\t\t\t\t\t\treturn STATUS_SUCCESS; \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t\tcurrent = current-&gt;Next; \t\t\t\t} \t\t\t} \t\t\tcurrentProcess = currentProcess-&gt;Next; \t\t} \t\treturn STATUS_NOT_FOUND; \t} __finally  \t{ \t\tFltReleasePushLock( &DRIVER_DATA.Sync ); \t} }  <\/code><\/pre>\n<p>  <a name=\"DriverResults\"><\/a>  <\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/h3>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u0434\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>  <a name=\"WinService\"><\/a>  <\/p>\n<h2><font color=\"#0e3d78\">\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Windows<\/font><\/h2>\n<p>  \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u043e\u0431\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0438\u0445. \u041e\u0436\u0438\u0434\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 IoCompletionPort. \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 (\u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0434\u043b\u044f \u0447\u0435\u0433\u043e), \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u043e \u043f\u043e\u0440\u0442\u0443 \u0432\u0438\u0441\u0435\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0443\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u043e\u0441\u044b\u043f\u0430\u0435\u0442\u0441\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041c\u044b \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0447\u0438\u0441\u0442\u044b\u0439, \u043d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0442\u043e \u043d\u0430\u0434\u043e:  <\/p>\n<ul>\n<li>FilterConnectCommunicationPort \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043d\u0430\u0441 \u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c<\/li>\n<li>CreateIoCompletionPort \u0441\u043e\u0437\u0434\u0430\u0435\u0442 i\/o completion port, \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438, \u0433\u0434\u0435 \u043e \u043d\u0435\u043c \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0441\u0442\u044c \u0432 \u043a\u043e\u0434\u0435<\/li>\n<li>MessagingManagerThread \u2014 \u043a\u043b\u0430\u0441\u0441, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430<\/li>\n<li>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 (Stop) \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0432\u0441\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 io completion port, \u0438\u043d\u0430\u0447\u0435 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0441\u0435\u0442\u044c<\/li>\n<\/ul>\n<pre><code class=\"cs\">\tpublic unsafe class MessagingManager \t{ \t\tprivate const string FilterCommunicationPortName = &quot;\\\\PoliciesInjectorCom0&quot;; \t\tprivate IntPtr m_filterPortHandle;         private IntPtr m_ioCompletionPortHandle;         private IntPtr[] m_buffers;         private MessagingManagerThread[] m_threads;         private CancellationTokenSource m_cancellationToken;          \t\tpublic unsafe MessagingManager(Dictionary&lt;string,string&gt; redirections) \t\t{ \t\t\tuint hr = WinApi.FilterConnectCommunicationPort(FilterCommunicationPortName, 0, IntPtr.Zero, 0, IntPtr.Zero, out m_filterPortHandle); \t\t\tif(hr != 0x0) \t\t\t{ \t\t\t\tthrow WinApi.CreateWin32Exception(String.Format(&quot;Cannot connect to driver via '{0}' port&quot;, FilterCommunicationPortName)); \t\t\t} \t\t\tConsole.WriteLine(&quot;Connected to {0}&quot;, FilterCommunicationPortName); \t\t\t \t\t\t\/\/ For more info, ENG: http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365198(v=vs.85).aspx \t\t\t\/\/ For more info, RUS: http:\/\/www.rsdn.ru\/article\/baseserv\/threadpool.xml \t\t\t  \t\t\tint threadsCount = Environment.ProcessorCount * 2; \t\t\tm_ioCompletionPortHandle = WinApi.CreateIoCompletionPort(m_filterPortHandle, IntPtr.Zero, IntPtr.Zero, threadsCount); \t\t\tif(m_ioCompletionPortHandle == IntPtr.Zero) \t\t\t{ \t\t\t\tthrow WinApi.CreateWin32Exception(&quot;Cannot create I\/O Completeon port&quot;); \t\t\t} \t\t\t \t\t\t\/\/ Make thread for each processor and threads cancellation token \t\t\tm_threads = new MessagingManagerThread[threadsCount];             m_buffers = new IntPtr[threadsCount]; \t\t\tm_cancellationToken = new CancellationTokenSource(); \t\t\tConsole.WriteLine(&quot;Number of threads to monitor: {0}&quot;, threadsCount); \t\t\t\t \t\t\tfor(int i=0; i&lt;m_threads.Length; i++) \t\t\t{ \t\t\t\tm_threads[i] = new MessagingManagerThread(m_ioCompletionPortHandle, m_cancellationToken.Token, m_filterPortHandle, redirections); \t\t\t\tunsafe                 {                     m_buffers[i] = Marshal.AllocHGlobal( sizeof(F2U.IncomingMessagePacket) );                     WinApi.RtlZeroMemory( m_buffers[i], sizeof(F2U.IncomingMessagePacket) );                     var buffer = (F2U.IncomingMessagePacket *) m_buffers[i];  \t\t\t\t\t\/\/  Make street magic (see DDK Examples-&gt;mini filters-&gt;scanner)                     hr = WinApi.FilterGetMessage( m_filterPortHandle, out buffer-&gt;Header, Marshal.SizeOf(typeof(F2U.IncomingMessagePacket)),                                                     ref buffer-&gt;Overlapped );                      if ( hr != WinApi.HRESULT_FROM_WIN32( WinApi.ERROR_IO_PENDING ) )                     {                     \tthrow WinApi.CreateWin32Exception( String.Format(&quot;Cannot get filter message. 0x{0:X}&quot;, hr ));                     }                 } \t\t\t} \t\t} \t\t \t\tpublic unsafe bool Stop() \t\t{ \t\t\tbool successfull = true; \t\t\tm_cancellationToken.Cancel();  \t\t\tConsole.WriteLine(&quot;Starting to cancel I\/O.&quot;);             if (!WinApi.CancelIoEx(m_filterPortHandle, IntPtr.Zero))             {             \tvar errstr = String.Format(&quot;Cannot cancel I\/O operations (0x{0:X}).&quot;, Marshal.GetLastWin32Error());             \tConsole.WriteLine(errstr);             \tsuccessfull = false;             \t\/\/\tthrow WinApi.CreateWin32Exception(errstr);             } \t\t\t \t\t\tforeach(var thread in m_threads.AsEnumerable()) \t\t\t{ \t\t\t\tvar overlapped = new F2U.IncomingMessagePacket(); \t\t\t\tIntPtr *completionKey; \t\t\t\toverlapped.Message.Command = Command.CancelIOCompletionPort; \t\t\t\tWinApi.PostQueuedCompletionStatus(m_ioCompletionPortHandle, (uint)sizeof(F2U.IncomingMessagePacket), out completionKey, (NativeOverlapped *) &overlapped);\t\t\t\t \t\t\t} \t\t\t \t\t\tforeach(var thread in m_threads.AsEnumerable()) \t\t\t{ \t\t\t\tif(!thread.WaitHandle.WaitOne(2000)) \t\t\t\t{ \t\t\t\t\tConsole.WriteLine(&quot;Failed while waiting for thread {0} is stopped&quot;, thread.ThreadId); \t\t\t\t\tsuccessfull = false; \t\t\t\t\t\/\/ TODO: kill thread and report confusing bug \t\t\t\t} \t\t\t} \t\t\t \t\t\treturn successfull; \t\t} \t} <\/code><\/pre>\n<p>  \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043a\u043b\u0430\u0441\u0441 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430:  <\/p>\n<pre><code class=\"cs\">\tpublic class MessagingManagerThread \t{ \t\tprivate ManualResetEvent  m_resetEvent; \t\tprivate IntPtr            m_ioCompletionPortHandle; \t\tprivate IntPtr            m_filterPortHandle; \t\tprivate CancellationToken m_cancelToken; \t\tprivate Thread            m_thread; \t\tprivate Int32             m_threadId; \t\tprivate Dictionary&lt;string,string&gt; m_redirections;  \t\tprivate const int timeoutCompletionStatus = 5000; \t\t \t\t\/\/\/ &lt;summary&gt; \t\t\/\/\/ Builds MessagingManagerThread object \t\t\/\/\/ &lt;\/summary&gt; \t\t\/\/\/ &lt;param name=&quot;handle&quot;&gt;I\/O Completion Port Handle (Win32)&lt;\/param&gt; \t\tpublic MessagingManagerThread(IntPtr ioCompletionPortHandle, CancellationToken token, IntPtr filterPortHandle, Dictionary&lt;string,string&gt; redirections) \t\t{ \t\t\tm_ioCompletionPortHandle = ioCompletionPortHandle; \t\t\tm_filterPortHandle = filterPortHandle; \t\t\tm_cancelToken = token; \t\t\tm_redirections = redirections; \t\t\tm_resetEvent = new ManualResetEvent(false); \t\t\tm_thread = new Thread( Start ); \t\t\tm_thread.Start(); \t\t} \t\t \t\tpublic WaitHandle WaitHandle  \t\t{ \t\t\tget { return m_resetEvent; } \t\t} \t\t \t\tpublic Int32 ThreadId \t\t{ \t\t\tget { return m_threadId; } \t\t}  \t\tpublic unsafe void Start() \t\t{ \t\t\ttry  \t\t\t{ \t\t\t\t\/\/ Get current thread id (unmanaged) \t\t\t\tm_threadId = WinApi.GetCurrentThreadId(); \t\t\t\tConsole.WriteLine(&quot;Monitoring thread {0} is started&quot;, m_threadId); \t\t\t\t\/\/ Messages processing queue \t\t\t\twhile(true) \t\t\t\t{ \t\t\t\t\t\/\/ If cancellation requested, we should to leave thread \t\t\t\t\tif(m_cancelToken.IsCancellationRequested) \t\t\t\t\t{ \t\t\t\t\t\tConsole.WriteLine(&quot;Cancellation on thread {0} is requested&quot;, m_threadId); \t\t\t\t\t\treturn; \t\t\t\t\t} \t\t\t\t\t \t\t\t\t\t\/\/ Otherwise, we should read completion port  \t\t\t\t\tuint numberOfBytesTransferred; \t\t\t\t\tUIntPtr lpCompletionKey; \t\t\t\t\tNativeOverlapped* lpOverlapped; \t\t\t\t\t \t\t\t\t\tConsole.WriteLine(&quot;Starting waiting for message at {0}... &quot;, m_threadId); \t\t\t\t\tif(!WinApi.GetQueuedCompletionStatus(m_ioCompletionPortHandle, out numberOfBytesTransferred, out lpCompletionKey, out lpOverlapped, -1)) \t\t\t\t\t{ \t\t\t\t\t\t\/\/ Something wrong happend \t\t\t\t\t\tvar error = Marshal.GetLastWin32Error(); \t\t\t\t\t\tif(error == WinApi.ERROR_OPERATION_ABORTED) \t\t\t\t\t\t{ \t\t\t\t\t\t\treturn;\t \t\t\t\t\t\t} \t\t\t\t\t\tif(error == WinApi.WAIT_TIMEOUT)  \t\t\t\t\t\t{ \t\t\t\t\t\t\tConsole.WriteLine(&quot;Time out {0}&quot;, m_threadId); \t\t\t\t\t\t\tcontinue; \t\t\t\t\t\t} \t\t\t\t\t\tConsole.WriteLine(&quot;WinApi.GetQueuedCompletionStatus returns error code: {0:X}&quot;, error); \t\t\t\t\t\tthrow WinApi.CreateWin32Exception(&quot;GetQueuedCompletionStatus&quot;, (uint)error); \t\t\t\t\t} \t\t\t\t\t \t\t\t\t\tConsole.WriteLine(&quot;GetQueuedCompletionStatus finished successfully, Message is recieved&quot;); \t\t\t\t\t \t\t\t\t\t\/\/ Message recieved \t\t\t\t\tvar request = (F2U.IncomingMessagePacket *)lpOverlapped; \t\t\t\t\tif(request-&gt;Message.Command == Command.ProcessAttached) \t\t\t\t\t{ \t\t\t\t\t\tRun_ProcessAttached(request); \t\t\t\t\t} else  \t\t\t\t\tif(request-&gt;Message.Command == Command.CancelIOCompletionPort) \t\t\t\t\t{ \t\t\t\t\t\tConsole.WriteLine(&quot;Thread destroying requested&quot;);\t\t\t\t\t \t\t\t\t\t} \t\t\t\t\t                     \/\/ Queue a new request completion.                     WinApi.RtlZeroMemory( (IntPtr) request, Marshal.SizeOf(request-&gt;GetType()));                     uint hr = WinApi.FilterGetMessage( m_filterPortHandle, out request-&gt;Header, Marshal.SizeOf(request-&gt;GetType()),                                                     ref request-&gt;Overlapped );                      if (hr != WinApi.HRESULT_FROM_WIN32(WinApi.ERROR_IO_PENDING))                     {                         throw WinApi.CreateWin32Exception( &quot;Cannot get filter message&quot;, hr );                     }\t\t\t\t \t\t\t\t} \t\t\t} finally  \t\t\t{ \t\t\t\t\/\/ Send signal to owner \t\t\t\tm_resetEvent.Set(); \t\t\t} \t\t} \t\t \t\tprivate unsafe void Run_ProcessAttached(F2U.IncomingMessagePacket *data) \t\t{ \t\t\tvar pid = ((F2U.ProcessAttached *)data-&gt;Message.Data)-&gt;ProcessId; \t\t\tConsole.WriteLine(&quot;Incoming request for PID = {0}&quot;, pid); \t\t\t \t\t\tvar reply = new IncomingMessagePacketReply(); \t\t\treply.Header.NtStatus = 0; \t\t\treply.Header.MessageId = data-&gt;Header.MessageId; \t\t\treply.Message.Command = Command.ProcessAttached; \t\t\tint size= Message.MAX_DATA_SIZE; \t\t\t \t\t\tvar pAttachedReply = ((ProcessAttachedReply *)(&reply.Message.Data[0])); \t\t\tpAttachedReply-&gt;NeedToMonitor=1; \t\t\tProcess process = null; \t\t\ttry { \t\t\t\tprocess = Process.GetProcessById(pid); \t\t\t\tConsole.WriteLine(&quot;Retrieved name by pid: {0}; Managed: ???&quot;, process.ProcessName); \t\t\t} catch(ArgumentException ex) \t\t\t{ \t\t\t\tpAttachedReply-&gt;NeedToMonitor=0; \t\t\t} \t\t\t \t\t\tif(!process.ProcessName.Contains(&quot;testredir&quot;)) \t\t\t\tpAttachedReply-&gt;NeedToMonitor = 0; \t\t\t \t\t\tif(pAttachedReply-&gt;NeedToMonitor==1) \t\t\t{ \t\t\t\tint pos = 0, index = 0; \t\t\t\tConsole.WriteLine(&quot;Redirections registered: {0}&quot;, m_redirections.Count); \t\t\t\tforeach(var redirection in m_redirections ) \t\t\t\t{ \t\t\t\t\tConsole.WriteLine(&quot; -- Trying to add redirection: \\n    {0}\\n    {1}&quot;, redirection.Key, redirection.Value); \t\t\t\t\tunchecked { \t\t\t\t\t\t((ProcessAttachedReply_Positions *)&pAttachedReply-&gt;Positions[index])-&gt;From = (ushort)pos; \t\t\t\t\t\tAppendStringToArray(&pAttachedReply-&gt;Data, redirection.Key, ref pos); \t\t\t\t\t\t((ProcessAttachedReply_Positions *)&pAttachedReply-&gt;Positions[index])-&gt;To = (ushort)pos; \t\t\t\t\t\tAppendStringToArray(&pAttachedReply-&gt;Data, redirection.Value, ref pos); \t\t\t\t\t\tindex++; \t\t\t\t\t} \t\t\t\t} \t\t\t\tpAttachedReply-&gt;PairsCount = (ushort)m_redirections.Count; \t\t\t} \t\t\tuint status = WinApi.FilterReplyMessage(m_filterPortHandle, ref reply.Header, (int)size); \t\t\t \t\t\tConsole.WriteLine(&quot;Making reply: Command = ProcessAttached, NeedToMonitor = True, Size = {0}, ReplyStat=0x{1:X}&quot;, size, status); \t\t} \t\t \t\tprivate unsafe void AppendStringToArray(ushort *arr, string str, ref int position) \t\t{ \t\t\tforeach(var ch in str) \t\t\t{ \t\t\t\tarr[position] = ch; \t\t\t\tposition++; \t\t\t} \t\t\tarr[position]=0; \t\t\tposition++; \t\t} \t} <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u0435 \u0445\u0438\u0442\u0440\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cs\">  var redir = new RedirectionsManager();   redir.Add(typeof(Environment).Assembly.GetName(), &quot;\\\\temp\\\\GAC32\\\\mscorlib.dll&quot;); <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0431\u043e\u0440\u043a\u0435 <b>mscorlib.dll<\/b> \u0432 GAC \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0443 \u0432 \u043f\u0430\u043f\u043a\u0443 \u00abC:\\temp\\GAC32\\mscorlib.dll\u00bb \u0434\u043b\u044f 32-\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f 64-\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0430\u043f\u043a\u0438.<\/p>\n<p>  <a name=\"Mscorlib\"><\/a>  <\/p>\n<h2><font color=\"#0e3d78\">\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c mscorlib.dll<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 mscorlib \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f .Net Reflector + Reflexil, \u0441\u0442\u0430\u0440\u044b\u043c\u0438 freeware \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438.<br \/>  \u0412 \u043d\u0438\u0445 \u044f \u0437\u0430\u043c\u0435\u043d\u0438\u043b System.Environment.get_Version() \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u044b\u043b \u00ab5.0.40930.0\u00bb<\/p>\n<p>  <a name=\"Results\"><\/a>  <\/p>\n<h2><font color=\"#0e3d78\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c .Net Framework 4.0 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e <b>testredir<\/b>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0448 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p>  \u0422\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442 \u0434\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/p>\n<pre><code class=\"cs\">using System;  namespace testredir  {     public static class testredir     { \t\tpublic static void Main(string[] args) \t\t{ \t\t\tConsole.WriteLine(&quot;Ver: {0}!&quot;, System.Environment.Version);\t\t\t \t\t\tConsole.Write(&quot;Press any key to continue . . . &quot;); \t\t\tConsole.ReadKey(true); \t\t}     }  } <\/code><\/pre>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<br \/>  <code> Ver: 5.0.40930.0! <\/code><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u043a\u0430:<br \/>  \u0418\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u043b\u0438\u0442 \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f. \u0425\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0447\u0435\u043c \u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c<\/p>\n<p>  \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:  <\/p>\n<ul>\n<li><a href=\"http:\/\/fsfilters.blogspot.com\/\">http:\/\/fsfilters.blogspot.com\/<\/a><\/li>\n<li>DDK Examples-&gt;mini filters-&gt;scanner<\/li>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365198\">msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365198<\/a>(v=vs.85).aspx<\/li>\n<li><a href=\"http:\/\/www.rsdn.ru\/article\/baseserv\/threadpool.xml\">www.rsdn.ru\/article\/baseserv\/threadpool.xml<\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/company\/luxoft\/blog\/239005\/\"> http:\/\/habrahabr.ru\/company\/luxoft\/blog\/239005\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0417\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u2014 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0445\u0430\u043a. \u0412\u043e\u043f\u0440\u043e\u0441, \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0446\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0418\u0442\u0430\u043a \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <b>mscorlib<\/b> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041d\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 (\u0434\u043b\u044f runtime \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0449\u0438, \u0438 \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438). Mscorlib \u044f \u0432\u0437\u044f\u043b \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u0443 \u0432\u0441\u0435\u0445 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0445\u0430\u043a\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e.<\/p>\n<p>  \u0412\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u00ab\u0430\u0434\u0430 dll\u00bb, Microsoft \u043f\u043e\u043c\u0438\u043c\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0434\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u043e\u043c, public key \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u00ab\u043f\u0440\u0438\u0448\u043b\u0430\u00bb \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0430 \u043d\u0435 \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0431\u0440\u043e\u0441\u043e\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0442.\u043e., \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u0432 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u044e\u0447\u0438\u043a public key \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u0435\u043c \u0436\u0435, \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0435\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c, \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. <\/p>\n<p>  \u041d\u0430\u0448\u0430 \u043c\u0438\u043d\u0438 \u0446\u0435\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0432\u0435\u043b\u0430 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0442\u0435\u043a\u0441\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/8c6\/0f0\/e3d\/8c60f0e3d36248ce86ae82a76f5d6997.png\"\/><\/p>\n<p>  <b>PS:<\/b> \u044d\u0442\u043e \u2014 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430<br \/>  .   <\/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-239005","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/239005","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=239005"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/239005\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=239005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=239005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=239005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}