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

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - 秋衫客

多久没来过这里了 发现上一篇日志是在两年前 终于要离开了,感觉有点那个吧 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