| 发表于:2007-08-25 03:18:1311楼 得分:14 |
#include <stdio.h> #include <windows.h> #include <tlhelp32.h> void showmodule(dword pid,char *strexepath) { handle hsnapshot; bool fok; hsnapshot=createtoolhelp32snapshot(th32cs_snapmodule,pid); moduleentry32 me={sizeof(me)}; for(fok=module32first(hsnapshot,&me);fok;fok=module32next(hsnapshot,&me)) { if (strstr(me.szexepath,strexepath) != null) { printf( "%s\n ",me.szexepath); } } } void showprocess() { handle hsnapshot; processentry32 pe; pe.dwsize = sizeof(processentry32); hsnapshot = createtoolhelp32snapshot(th32cs_snapprocess,0); for(bool bok=process32first(hsnapshot,&pe);bok;bok=process32next(hsnapshot,&pe)) { showmodule(pe.th32processid,pe.szexefile); } } int main(int argc, char* argv[]) { showprocess(); return 0; } 以上是全部代码。 | | |
|