Advertisement
kaspyx

NeverDieProcess

Jan 15th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.09 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <windows.h>
  5.  
  6. int Revival(char *cmd,int m)    // 실패시 -1
  7. {
  8.     char command[512] = {0x0,};
  9.  
  10.     STARTUPINFO si = {0,};    //구조체 선언, 초기화
  11.     PROCESS_INFORMATION pi;
  12.    
  13.     time_t timer;
  14.     struct tm* t;
  15.  
  16.     timer = time(NULL);
  17.     t = localtime(&timer);
  18.  
  19.     int ch;
  20.     int cm;
  21.     int cs;
  22.  
  23.     ch = t->tm_hour;
  24.     cm = t->tm_min;
  25.     cs = t->tm_sec;
  26.  
  27.     cm +=m;
  28.  
  29.     if ( cs >= 50 )
  30.         cm+=1;
  31.  
  32.     si.cb = sizeof(STARTUPINFO);
  33.     si.dwX = 0;
  34.     si.dwY = 0;
  35.     si.dwXSize = 0;
  36.     si.dwYSize =0;
  37.     si.dwXCountChars = 0;
  38.     si.dwYCountChars = 0;
  39.     si.dwFlags = STARTF_USESHOWWINDOW;
  40.     si.wShowWindow = SW_HIDE;
  41.     si.lpReserved2 = NULL;
  42.     si.cbReserved2 = 0;
  43.  
  44.     wsprintfA(command,"at %d:%d %s",ch,cm,cmd);
  45.  
  46.     if(!CreateProcessA(NULL,command,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,(LPSTARTUPINFOA)&si,&pi)){
  47.         printf("shit\n");
  48.         return -1;
  49.     }
  50.  
  51.     return 1;
  52.  
  53.     //!CreateProcessA(NULL,"at 22:49 C:\\Users\\Debug\\tt.exe",NULL,NULL,TRUE,CREATE_NEW_CONSOLE,NULL,NULL,(LPSTARTUPINFOA)&si,&pi);
  54.  
  55.  
  56. }
  57.  
  58. void main()
  59. {
  60.     Revival("calc.exe",1);
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement