Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1.     bool isAlive(const char* pN)
  2.         {
  3.                 HANDLE SnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  4.          
  5.                 if (SnapShot == INVALID_HANDLE_VALUE)
  6.                             {
  7.                                             delete SnapShot;
  8.                         return false;
  9.                             }
  10.          
  11.                 PROCESSENTRY32 procEntry;
  12.                 procEntry.dwSize = sizeof(PROCESSENTRY32);
  13.          
  14.                 if (!Process32First(SnapShot, &procEntry))
  15.                             {
  16.                                             delete SnapShot;
  17.                         return false;
  18.                             }
  19.             //crash here
  20.                 do
  21.                 {
  22.                         if (strcmp(procEntry.szExeFile, pN) == 0)
  23.                                             {
  24.                                                     delete SnapShot;
  25.                             return true;
  26.                                             }
  27.                 } while (Process32Next(SnapShot, &procEntry));
  28.         //^^^^^^^^^^^^ send halp
  29.                 return false;
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement