sakiir

Process Faggots Skill

Oct 14th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #include <windows.h>
  2. #include <tlhelp32.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7.  
  8. void usage(void);
  9. DWORD GetPidByName(const char *process);
  10. int KillProcess(DWORD pid);
  11.  
  12.  
  13. int main(int argc, char **argv)
  14. {
  15.     if(argc != 2)
  16.     {
  17.         usage();
  18.         exit(1);
  19.     }
  20.     char *process;
  21.     process = argv[1];
  22.     while(1)
  23.     {
  24.         while(GetPidByName(process) == -1) Sleep(500);
  25.         KillProcess(process);
  26.         MessageBox(NULL, "FAGGOTS", "MOUAHAHAHAHAH Can't Run Program ;) ;) ;) ;) ;) ;) ;) ;)", MB_OK | MB_ICONWARNING);
  27.     }
  28. }
  29.  
  30. void usage(void)
  31. {
  32.     printf("Sakiir Faggots Process\n");
  33.     printf("USAGE : ./prog <process>");
  34.     Sleep(5000);
  35. }
  36.  
  37. DWORD GetPidByName(const char *process)
  38. {
  39.     PROCESSENTRY32 p;
  40.     HANDLE hProcessSnap;
  41.  
  42.     hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  43.     p.dwSize = sizeof(PROCESSENTRY32);
  44.     if(Process32First(hProcessSnap, &p))
  45.     {
  46.         do{
  47.             if(!strcmp(process, p.szExeFile)) return (p.th32ProcessID);
  48.         }while(Process32Next(hProcessSnap, &p));
  49.         return (-1);
  50.     }
  51.     return(-1);
  52. }
  53.  
  54. int KillProcess(const char *process)
  55. {
  56.     HANDLE hProcess;
  57.     DWORD pid
  58.     while((pid = GetPidByName(process)) == -1) Sleep(500);
  59.     hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
  60.     if(hProcess == NULL )
  61.     {
  62.         printf("Failed To OpenProcess With PROCESS_ALL_ACCESS\n");
  63.         exit(1);
  64.     }
  65.     if(TerminateProcess(hProcess, NULL) == 0)
  66.     {
  67.         printf("Failed To Kill Process :(\n");
  68.         exit(1);
  69.     }
  70.  
  71. }
Add Comment
Please, Sign In to add comment