首页 网络安全 安全学院 查看内容

列系统进程C代码

2009-10-15 09:06 922 0

摘要: //#include "stdafx.h"#include <stdio.h>#include <windows.h>#include <tlhelp32.h>in...
关键词: hProcessSnap include 32 printf CreateToolhelp bMore pe Snapshot 进程 HANDLE

//#include "stdafx.h"#include <stdio.h>#include <windows.h>#include <tlhelp32.h>int main(int argc, char* argv[]){printf("进程ID\t\t进程名\n");PROCESSENTRY32 pe32;pe32.dwSize = sizeof (pe32);HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);if(INVALID_HANDLE_VALUE == hProcessSnap){printf("CreateToolhelp32Snapshot 调用失败\n");return -1;}BOOL bMore = ::Process32First(hProcessSnap,&pe32);while(bMore){printf("%5u\t%s\n",pe32.th32ProcessID,pe32.szExeFile);bMore = ::Process32Next(hProcessSnap,&pe32);}CloseHandle(hProcessSnap);   return 0;}
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部