in process
#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>
int main()
{
PROCESSENTRY32W pe;
pe.dwSize = sizeof(PROCESSENTRY32W);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE)
{
printf("Cant get snapshot\n");
return 1;
}
if (!Process32FirstW(hSnapshot, &pe))
{
printf("Process32First failed: %lu\n", GetLastError());
CloseHandle(hSnapshot);
return 1;
}
do
{
wprintf(L"%ls\n", pe.szExeFile);
} while (Process32NextW(hSnapshot, &pe));
CloseHandle(hSnapshot);
return 0;
}
Nhận xét
Đăng nhận xét