Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <stdlib.h>
- #include <windows.h>
- int Revival(char *cmd,int m) // 실패시 -1
- {
- char command[512] = {0x0,};
- STARTUPINFO si = {0,}; //구조체 선언, 초기화
- PROCESS_INFORMATION pi;
- time_t timer;
- struct tm* t;
- timer = time(NULL);
- t = localtime(&timer);
- int ch;
- int cm;
- int cs;
- ch = t->tm_hour;
- cm = t->tm_min;
- cs = t->tm_sec;
- cm +=m;
- if ( cs >= 50 )
- cm+=1;
- si.cb = sizeof(STARTUPINFO);
- si.dwX = 0;
- si.dwY = 0;
- si.dwXSize = 0;
- si.dwYSize =0;
- si.dwXCountChars = 0;
- si.dwYCountChars = 0;
- si.dwFlags = STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_HIDE;
- si.lpReserved2 = NULL;
- si.cbReserved2 = 0;
- wsprintfA(command,"at %d:%d %s",ch,cm,cmd);
- if(!CreateProcessA(NULL,command,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,(LPSTARTUPINFOA)&si,&pi)){
- printf("shit\n");
- return -1;
- }
- return 1;
- //!CreateProcessA(NULL,"at 22:49 C:\\Users\\Debug\\tt.exe",NULL,NULL,TRUE,CREATE_NEW_CONSOLE,NULL,NULL,(LPSTARTUPINFOA)&si,&pi);
- }
- void main()
- {
- Revival("calc.exe",1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement