{"id":708,"date":"2008-05-22T12:04:03","date_gmt":"2008-05-22T12:04:03","guid":{"rendered":"http:\/\/6teen.ru\/?p=406"},"modified":"2008-05-22T12:04:03","modified_gmt":"2008-05-22T12:04:03","slug":"4448","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=708","title":{"rendered":"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435"},"content":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435\n\n\u041f\u043e\u0434 windows (win32) \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:\n\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:\nhsnapshot := createtoolhelp32snapshot(th32cs_snapprocess, 0);\n\nprocess32first() - \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435;\n\u0414\u0430\u043b\u0435\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 process32next() - \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435.\nunit kernlutl;\n\ninterface\n\nuses\ntlhelp32, windows, classes, sysutils;\n\nprocedure getprocesslist(list: tstrings);\nprocedure getmodulelist(list: tstrings);\nfunction getprocesshandle(processid: dword): thandle;\nprocedure getparentprocessinfo(var id: dword; var path: string);\n\nconst\nprocess_terminate = $0001;\nprocess_create_thread = $0002;\nprocess_vm_operation = $0008;\nprocess_vm_read = $0010;\nprocess_vm_write = $0020;\nprocess_dup_handle = $0040;\nprocess_create_process = $0080;\nprocess_set_quota = $0100;\nprocess_set_information = $0200;\nprocess_query_information = $0400;\nprocess_all_access = standard_rights_required or synchronize or $0fff;\n\nimplementation\n\nprocedure getprocesslist(list: tstrings);\nvar\ni: integer;\nhsnapshoot: thandle;\npe32: tprocessentry32;\nbegin\nlist.clear;\nhsnapshoot := createtoolhelp32snapshot(th32cs_snapprocess, 0);\nif (hsnapshoot = -1) then exit;\npe32.dwsize := sizeof(tprocessentry32);\nif (process32first(hsnapshoot, pe32)) then repeat\ni := list.add(format('%x, %x: %s', [pe32.th32processid,\npe32.th32parentprocessid, pe32.szexefile]));\nlist.objects[i] := pointer(pe32.th32processid);\nuntil not process32next(hsnapshoot, pe32);\nclosehandle (hsnapshoot);\nend;\n\nprocedure getmodulelist(list: tstrings);\nvar\ni: integer;\nhsnapshoot: thandle;\nme32: tmoduleentry32;\nbegin\nlist.clear;\nhsnapshoot := createtoolhelp32snapshot(th32cs_snapmodule, 0);\nif (hsnapshoot = -1) then exit;\nme32.dwsize := sizeof(tmoduleentry32);\nif (module32first(hsnapshoot, me32)) then repeat\ni := list.add(me32.szmodule);\nlist.objects[i] := pointer(me32.th32moduleid);\nuntil not module32next(hsnapshoot, me32);\nclosehandle (hsnapshoot);\nend;\n\nprocedure getparentprocessinfo(var id: dword; var path: string);\nvar\nprocessid: dword;\nhsnapshoot: thandle;\npe32: tprocessentry32;\nbegin\nprocessid := getcurrentprocessid;\nid := 0;\npath := '';\nhsnapshoot := createtoolhelp32snapshot(th32cs_snapprocess, 0);\nif (hsnapshoot = -1) then exit;\npe32.dwsize := sizeof(tprocessentry32);\nif (process32first(hsnapshoot, pe32)) then\nrepeat\nif pe32.th32processid = processid then begin\nid := pe32.th32parentprocessid;\nbreak;\nend;\nuntil not process32next(hsnapshoot, pe32);\nif id <> -1 then\nif (process32first(hsnapshoot, pe32)) then repeat\nif pe32.th32processid = id then begin\npath := pe32.szexefile;\nbreak;\nend;\nuntil not process32next(hsnapshoot, pe32);\nclosehandle (hsnapshoot);\nend;\n\nfunction getprocesshandle(processid: dword): thandle;\nbegin\nresult := openprocess(process_all_access, true, processid);\nend;\n\nend.\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[448,453],"tags":[1337,913,1645,976,1809],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/708"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=708"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/708\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=708"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}