LONG CuDlgSqlQueryPageXML::OnDisplayResult (WPARAM wParam, LPARAM lParam) { CaSqlQuerySelectData* pData = (CaSqlQuerySelectData*)lParam; ASSERT (pData); if (!pData) return 0L; ASSERT (m_pQueryRowParam); if (!m_pQueryRowParam) return 0L; CWaitCursor waitCursor; try { CaSession* pCurrentSession = m_pQueryRowParam->GetSession(); pCurrentSession->SetSessionNone(); CString strTitle; strTitle.LoadString(IDS_TITLE_FETCHING_ROW); #if defined (_ANIMATION_) CxDlgWait dlgWait(strTitle, NULL); dlgWait.SetDeleteParam(FALSE); dlgWait.SetExecParam (m_pQueryRowParam); dlgWait.SetUseAnimateAvi(AVI_FETCHR); dlgWait.SetUseExtraInfo(); dlgWait.SetShowProgressBar(FALSE); dlgWait.SetHideCancelBottonAlways(TRUE); dlgWait.DoModal(); #else m_pQueryRowParam->Run(); #endif CuWebBrowser2* pIe = (CuWebBrowser2*)GetDlgItem (IDC_EXPLORER1); if (pIe && IsWindow (pIe->m_hWnd)) { pIe->ShowWindow(SW_SHOW); CString strFile = m_bXMLSource? m_pQueryRowParam->GetFileXML(): m_pQueryRowParam->GetFileXSL(); if (!strFile.IsEmpty() && _taccess(strFile, 0) == 0) { COleVariant vaURL(strFile); pIe->Navigate2 (vaURL, 0, NULL, NULL, NULL); } } } catch(CMemoryException* e) { theApp.OutOfMemoryMessage(); e->Delete(); } catch (CeSqlException e) { AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK); } catch (...) { AfxMessageBox (_T("CuDlgSqlQueryPageXML::OnDisplayResult: unknown error")); } return (LONG)0; }
bool ecAdminDialog::EvalTclFile(int nargc, const wxString& Argv, const wxString& msg) { wxProgressDialog dlgWait(msg, _("Please wait..."), 100, this); dlgWait.Update(50); //TRACE (_T("Evaluating ecosadmin.tcl %s\n"), pszArgv); // set up the data structure which is passed to the Tcl thread wxString strArgc; strArgc.Printf (wxT("%d"), nargc); std::string argv0 = ecUtils::UnicodeToStdStr (m_strRepository) + "/ecosadmin.tcl"; std::string argv = ecUtils::UnicodeToStdStr (Argv); std::string argc = ecUtils::UnicodeToStdStr (strArgc); Tcl_Interp * interp = Tcl_CreateInterp (); #ifdef __WXMSW__ Tcl_Channel outchan = Tcl_OpenFileChannel (interp, "nul", "a+", 777); Tcl_SetStdChannel (outchan, TCL_STDOUT); // direct standard output to NUL: #endif const char * pszStatus = Tcl_SetVar (interp, "argv0", (char*) argv0.c_str(), 0); pszStatus = Tcl_SetVar (interp, "argv", (char*) argv.c_str(), 0); pszStatus = Tcl_SetVar (interp, "argc", (char*) argc.c_str(), 0); pszStatus = Tcl_SetVar (interp, "gui_mode", "1", 0); // return errors in result string int nStatus = Tcl_EvalFile (interp, (char*) argv0.c_str()); const char* result = Tcl_GetStringResult (interp); #ifdef __WXMSW__ Tcl_SetStdChannel (NULL, TCL_STDOUT); Tcl_UnregisterChannel (interp, outchan); #endif Tcl_DeleteInterp (interp); wxString strErrorMessage (result); // report any error if (! strErrorMessage.IsEmpty ()) { wxString msg (_("Command execution error:\n\n") + strErrorMessage); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); return FALSE; } else if (TCL_OK != nStatus) { wxString msg (_("Command execution error")); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); return FALSE; } return TRUE; }
/// <summary> /// Async inject routine /// </summary> void MainDlg::Inject() { InjectContext context; auto& cfg = _profileMgr.config(); DWORD result = 0; // Fill in context context.flags = (blackbone::eLoadFlags)cfg.manualMapFlags; context.images = _images; context.initRoutine = blackbone::Utils::WstringToAnsi( cfg.initRoutine ); context.initRoutineArg = cfg.initArgs; context.procMode = (ProcMode)cfg.processMode; context.injectMode = (MapMode)cfg.injectMode; context.pid = _procList.itemData( _procList.selection() ); context.procCmdLine = cfg.procCmdLine; context.procPath = _processPath; context.hijack = cfg.hijack; context.unlinkImage = cfg.unlink; context.erasePE = cfg.erasePE; context.delay = cfg.delay; context.period = cfg.period; _status.SetText( 2, L"Injecting..." ); // Show wait dialog if (context.procMode == ManualLaunch) { DlgWait dlgWait( _core, context ); dlgWait.RunModal( _hwnd ); result = dlgWait.status(); } else { result = _core.InjectMultiple( &context ); } // Close after successful injection if (cfg.close && result == ERROR_SUCCESS) { SaveConfig(); CloseDialog(); // Somehow main thread still waits on GetMessage indefinitely after dialog destruction... TerminateProcess( GetCurrentProcess(), 0 ); return; } _status.SetText( 2, L"Idle" ); }
/// <summary> /// Async inject routine /// </summary> void MainDlg::Inject() { InjectContext context; auto& cfg = _profileMgr.config(); DWORD result = 0; // Fill in context context.cfg = cfg; context.images = _images; context.pid = _procList.itemData( _procList.selection() ); context.procPath = _processPath; context.skippedCount = 0; context.procList.clear(); context.procDiff.clear(); _status.SetText( 2, L"Injecting..." ); // Show wait dialog if (context.cfg.processMode == ManualLaunch) { DlgWait dlgWait( _core, context ); dlgWait.RunModal( _hwnd ); result = dlgWait.status(); } else { result = _core.InjectMultiple( &context ); } // Close after successful injection if (cfg.close && result == ERROR_SUCCESS) { SaveConfig(); CloseDialog(); return; } _status.SetText( 2, L"Idle" ); }