Guest User

Untitled

a guest
Mar 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. HANDLE snap = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
  2. PROCESSENTRY32 prEntry = {};
  3. prEntry.dwSize = sizeof (PROCESSENTRY32);
  4. if (Process32First (snap, &prEntry))
  5. {
  6. do
  7. {
  8. if (prEntry.th32ProcessID)
  9. {
  10. HANLDE h = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, prEntry.th32ProcessID);
  11. // <<<< h is (-1) here
  12. if (h)
  13. {
  14. // do something
  15. CloseHandle(h);
  16. }
  17. }
  18. }
  19. while (Process32Next (snap, &prEntry));
  20. }
Add Comment
Please, Sign In to add comment