滴水 2.21 win32 通用控件和PE查看器 项目1---一周之内写出
写第一个功能 PE结构 等待 重学PE后继续写
理想界面
C语言实现
点击查看代码
#include <windows.h>
#include <tlhelp32.h> //进程快照函数头文件
#include <stdio.h>
int main()
{
printf("无法遍历带E的程序\n");
PROCESSENTRY32 p;
PROCESSENTRY32* info =&p;
int countProcess = 0;
// 在使用这个结构之前,先设置它的大小
info->dwSize = sizeof(PROCESSENTRY32);
HANDLE handlePro = NULL; //结束进程句柄
// 给系统内的所有进程拍一个快照
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
printf(" CreateToolhelp32Snapshot调用失败! \n");
return -1;
}
// 遍历进程快照,轮流显示每个进程的信息
BOOL bMore = ::Process32First(hProcessSnap, info);
while (bMore)
{
handlePro = OpenProcess(PROCESS_TERMINATE, FALSE, info->th32ProcessID);
printf("进程ID号=%5u ", p.th32ProcessID);
void* a = &p.szExeFile;
char* p = (char*)a;
char* Q = p;
int i = 0;
int z = 1;
while (*(Q) !='.')
{
printf("%c" , *(p + i));
i++;
}
printf("\n");
bMore = Process32Next(hProcessSnap, info);
//结束进程
countProcess++;
}
::CloseHandle(hProcessSnap);
}
本文来自博客园,作者:逆向狗,转载请注明原文链接:https://www.cnblogs.com/Agtw/p/17140578.html