惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
F
Fortinet All Blogs
Vercel News
Vercel News
C
Check Point Blog
P
Privacy International News Feed
Know Your Adversary
Know Your Adversary
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
T
The Exploit Database - CXSecurity.com
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
P
Proofpoint News Feed
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
IT之家
IT之家
D
DataBreaches.Net
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
Y
Y Combinator Blog
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
Lohrmann on Cybersecurity
T
Tenable Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 最新话题
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
K
Kaspersky official blog
PCI Perspectives
PCI Perspectives
A
Arctic Wolf
Latest news
Latest news
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
雷峰网
雷峰网
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
Schneier on Security
Schneier on Security
M
MIT News - Artificial intelligence

博客园 - 秋衫客

多久没来过这里了 发现上一篇日志是在两年前 终于要离开了,感觉有点那个吧 Visual C#.Net 网络程序开发-Socket篇 用C#下的Raw Socket编程实现网络封包监视 debian安装详细过程 MUTT文档中的Configuration variables 据说只有山东人才能看懂的笑话 转的一篇有用的装LAMP的文章 回应bobicqx朋友的留言 转:近视手术的黑幕!!!"医生"的良心何在???...... 为公司一个项目写的一个数据库操作类,使用了SQL Relay 今天刚知道的Javascript中parseInt函数的另一个参数 SQL Relay的PHP API使用方法 PHP的数据库连接池的实现 寒冷是有味道的 我侄女生病了,着急,担心 QQ的HTTP接口探究 无意中发现的一个很不错的QQWry.dat文件格式的原理
刚刚写了个小程序,显示系统中正在运行的进程及进程中模块的
秋衫客 · 2005-12-23 · via 博客园 - 秋衫客

这个程序没什么特殊的,就是用了Toolhelp库里的函数,主要是用CreateToolhelp32Snapshot建立句柄
然后分Process32First和Process32Next列举进程,然后在有参数的情况下用Module32First和Module32Next
列举对应进程所加载的模块,使用方法,直接运行pl列举进程,在查看到进程的对应pID时运行pl pID
此时则列举pID进程加载的模块,另,本程序没有加列举线程及终止进程、线程卸载模块的功能,等
有时间的时候再加上吧,应该会用到TerminateProcess/TerminateThread此类的函数,应该还会涉及到提
权的问题,有兴趣的朋友可以交流下呀。

#include <windows.h>
#include 
<tlhelp32.h>
#include 
<stdio.h>
#include 
<stdlib.h>int main(int argc, char *argv[]) {
    
if(argc==1) {
        HANDLE handle 
= (HANDLE)CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
        PROCESSENTRY32 Info;
        Info.dwSize 
= sizeof(PROCESSENTRY32);
        
if(Process32First(handle, &Info)) {
            printf(
"Process List:\n\n");
            printf(
"%-6s\t%s""PID""Process Name");
            
do {
                printf(
"\n%-6d\t%-10s", (int)Info.th32ProcessID, Info.szExeFile);
            }
while (Process32Next(handle, &Info));
        }
        CloseHandle(handle);
        
return 0;
    }
else {
        HANDLE handle 
= (HANDLE)CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, atoi(argv[1]));

        MODULEENTRY32 lInfo;
        lInfo.dwSize 

= sizeof(MODULEENTRY32);if(Module32First(handle, &lInfo)) {
            printf(
"Module List of %s:\n\n", lInfo.szModule);
            printf(
"%-16s\t%s""Module Name""Module Path");
            
do{
                printf(
"\n%-16s\t%s", lInfo.szModule, lInfo.szExePath);
            }
while(Module32Next(handle, &lInfo));
        }
        CloseHandle(handle);
        
return 0;
    }
}

已编译版本下载地址:https://files.cnblogs.com/tobylee/pl.rar