LRESULT CRaidAnalyzerDlg::OnSuspendThreads(WPARAM wParam, LPARAM lParam) { m_enStateProgram = enResume; m_GatherByJPG.SetWindowTextW(_T("RESUME")); SuspendThreads(); SuspendThreads(); return TRUE; }
LRESULT CRaidAnalyzerDlg::OnShowMissmatchDlg(WPARAM wParam, LPARAM lParam) { SuspendThreads(); CResumeDlg MissmatchDlg; INT_PTR iResult = -1; LONGLONG *pLBA = NULL; pLBA = (LONGLONG * )lParam; MissmatchDlg.setLBAPosition(pLBA); iResult = MissmatchDlg.DoModal(); m_TabDialogs->m_pParityDlg->UpdateChecked(MissmatchDlg.CheckResult()); switch (iResult) { case IDOK: ResumeThreads(); // Continue ... break; case IDCANCEL: AbortThreads(); // Exit ... break; default: TRACE("Show Missmatch Dialog return unknown value"); } return TRUE; }
void CRaidAnalyzerDlg::AbortThreads() { SuspendThreads(); if (hComunicateLock != NULL) { ::SetEvent(hComunicateLock[1]); } }
static void keypress (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; // this is required, because some of the variables down there are not initialized at that point while (status_ctx->devices_status == STATUS_INIT) usleep (100000); const bool quiet = user_options->quiet; tty_break (); while (status_ctx->shutdown_outer == false) { int ch = tty_getchar (); if (ch == -1) break; if (ch == 0) continue; //https://github.com/hashcat/hashcat/issues/302 //#if defined (_POSIX) //if (ch != '\n') //#endif hc_thread_mutex_lock (status_ctx->mux_display); event_log_info (hashcat_ctx, NULL); switch (ch) { case 's': case '\r': case '\n': event_log_info (hashcat_ctx, NULL); status_display (hashcat_ctx); event_log_info (hashcat_ctx, NULL); if (quiet == false) send_prompt (hashcat_ctx); break; case 'b': event_log_info (hashcat_ctx, NULL); bypass (hashcat_ctx); event_log_info (hashcat_ctx, "Next dictionary / mask in queue selected. Bypassing current one."); event_log_info (hashcat_ctx, NULL); if (quiet == false) send_prompt (hashcat_ctx); break; case 'p': if (status_ctx->devices_status != STATUS_PAUSED) { event_log_info (hashcat_ctx, NULL); SuspendThreads (hashcat_ctx); if (status_ctx->devices_status == STATUS_PAUSED) { event_log_info (hashcat_ctx, "Paused"); } event_log_info (hashcat_ctx, NULL); } if (quiet == false) send_prompt (hashcat_ctx); break; case 'r': if (status_ctx->devices_status == STATUS_PAUSED) { event_log_info (hashcat_ctx, NULL); ResumeThreads (hashcat_ctx); if (status_ctx->devices_status != STATUS_PAUSED) { event_log_info (hashcat_ctx, "Resumed"); } event_log_info (hashcat_ctx, NULL); } if (quiet == false) send_prompt (hashcat_ctx); break; case 'c': event_log_info (hashcat_ctx, NULL); stop_at_checkpoint (hashcat_ctx); if (status_ctx->checkpoint_shutdown == true) { event_log_info (hashcat_ctx, "Checkpoint enabled. Will quit at next restore-point update."); } else { event_log_info (hashcat_ctx, "Checkpoint disabled. Restore-point updates will no longer be monitored."); } event_log_info (hashcat_ctx, NULL); if (quiet == false) send_prompt (hashcat_ctx); break; case 'q': event_log_info (hashcat_ctx, NULL); myquit (hashcat_ctx); break; default: if (quiet == false) send_prompt (hashcat_ctx); break; } //https://github.com/hashcat/hashcat/issues/302 //#if defined (_POSIX) //if (ch != '\n') //#endif hc_thread_mutex_unlock (status_ctx->mux_display); } tty_fix (); }
void CRaidAnalyzerDlg::OnBnClickedButtonJpg() { IDeviceFactory *pDevFactory = new CDiskFactory(); IDevice *pDevice = new CDiskDevice(); delete pDevFactory; CDiviceList DevList; DevList.AddDevice(pDevice); //DevList.RemoveAll(); size_t iCountHDD = m_vecSelDrives.size(); if (iCountHDD < 2) { AfxMessageBox(_T("HDD must 2 or more"),MB_ICONERROR); return ; } HANDLE hEventStart; DWORD bytesPerSector = m_vecSelDrives.at(0).getBytesPerSector(); CString strText = _T(""); CString strPath ( settings::CSettings::getSetting()->getWorkFolder().c_str() ); switch (m_enStateProgram) { case enStart: ClearData(); Utility::DeleteDirectory(strPath); if (!Utility::CreateStepDirectory(strPath)) { AfxMessageBox(_T("Error Create Directory ()..."),MB_ICONERROR); return; } //system("exlorer.exe C:\\JPG\\"); strPath = Utility::getDirectoryPath(strPath,0); Utility::CreateStepDirectory(strPath); m_pSingleton = CSingletonJPGs::GetInstance(); m_pSingleton->setDirectory(strPath); m_pSingleton->setDrives(m_vecSelDrives); m_vecSelDrives.at(0).getBytesPerSector(); m_Data = new CAllocator(DEFAULT_SECTORS_SIZE*bytesPerSector, 2000); hEventStart = CreateEvent(NULL,TRUE,FALSE,_T("Event, wait for start")); hComunicateLock = new HANDLE[2]; hComunicateLock[0] = CreateEvent(NULL,TRUE,ToUnLock,_T("Run")); hComunicateLock[1] = CreateEvent(NULL,TRUE,ToLock,_T("Break")); pMAP = new CMapForJPG(); pMAP->setBytesPerSector(m_vecSelDrives.at(0).getBytesPerSector()); pMAP->setSingleton(m_pSingleton); pMAP->SetAllocator(m_Data); pMAP->setDiskCount(iCountHDD); //pMAP->setSelectedDrives(m_vecSelDrives); pMAP->setComunicateHandle(hComunicateLock); pMAP->hMainWindow = ::AfxGetApp()->m_pMainWnd->GetSafeHwnd(); pReadDisk = new CReadDisk[iCountHDD]; for (size_t iDisk = 0; iDisk < iCountHDD; ++iDisk) { pReadDisk[iDisk].setBlockSize(DEFAULT_SECTORS_SIZE); pReadDisk[iDisk].setIndent(0); pReadDisk[iDisk].setBytesPerSector(m_vecSelDrives.at(iDisk).getBytesPerSector()); pReadDisk[iDisk].setDevicePath(m_vecSelDrives.at(iDisk).getDiskPath()); pReadDisk[iDisk].setDeviceNumber(iDisk); pReadDisk[iDisk].setAllocator(m_Data); pReadDisk[iDisk].setStartEvent(hEventStart); pReadDisk[iDisk].setReadRange(verifyMinMax.lFrom,verifyMinMax.lTo); pReadDisk[iDisk].setMapPointer(pMAP); pReadDisk[iDisk].setComunicateHandle(hComunicateLock); pReadDisk[iDisk].StartThreads(); } pMAP->StartThreads(); //m_GatherByJPG.EnableWindow(FALSE); ::SetEvent(hEventStart); m_enStateProgram = enPause; strText.Format(_T("PAUSE")); m_GatherByJPG.SetWindowTextW(strText); ShellExecute(this->GetSafeHwnd(),_T("explore"),strPath, NULL, NULL, SW_SHOWNORMAL); ::PostMessageW(this->GetSafeHwnd(),WM_SHOW_CUTTING_DIGLOG,0,0); // Starting Gather by JPG //pCuttingDialog->setStateProgram(m_enStateProgram); //pCuttingDialog->ShowWindow(SW_SHOW); // End "S T A R T" break; case enPause: m_enStateProgram = enResume; strText.Format(_T("RESUME")); m_GatherByJPG.SetWindowTextW(strText); SuspendThreads(); // End "P A U S E" break; case enResume: m_enStateProgram = enPause; strText.Format(_T("PAUSE")); m_GatherByJPG.SetWindowTextW(strText); ResumeThreads(); // End "R E S U M E" break; } }
int hashcat_session_pause (hashcat_ctx_t *hashcat_ctx) { return SuspendThreads (hashcat_ctx); }