#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>

int main()
{
	HANDLE hSnapshot;
	PROCESSENTRY32 entry;

	hSnapshot = CreateToolhelp32Snapshot(
		TH32CS_SNAPPROCESS,
		0
	);

	if (hSnapshot == INVALID_HANDLE_VALUE) {
		return 1;
	}

	entry.dwSize = sizeof(PROCESSENTRY32);

	if (!Process32First(hSnapshot, &entry)) {
		goto Exit;
	}

	do {
		printf("ExeFile = %ls\n", entry.szExeFile);
	} while (Process32Next(hSnapshot, &entry));


Exit:
	CloseHandle(hSnapshot);

	return 0;
}