보안공부/리버싱

현재 실행중인 Process정보

lee ho jun 2016. 7. 6. 12:27
반응형

현재 실행중인 process명 그리고 pid를 출력해주는 소스.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "windows.h"
#include "tlhelp32.h"
#include "tchar.h"
#include <stdio.h>
 
int _tmain()
{
    HANDLE hSnapSot = INVALID_HANDLE_VALUE;
    PROCESSENTRY32 pe;
 
    pe.dwSize = sizeof(PROCESSENTRY32);
    hSnapSot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
 
// 첫번째 스냅샷을 pe 구조체에 셋팅
    Process32First(hSnapSot, &pe);
 
    do
    {
        wprintf(L"%s    %d\n", pe.szExeFile , pe.th32ProcessID);
    } while (Process32Next(hSnapSot, &pe));
 
    return 0;
}
cs


반응형