Beispiel #1
0
DWORD RYSandBox::ProcessDebugEvents(LPDEBUG_EVENT event)
{
	switch (event->dwDebugEventCode)
	{
	case EXCEPTION_DEBUG_EVENT:
		if (!bDebugProcRuning && event->u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT)
			return DBG_CONTINUE;
		return OnExceptionOccur(event);
	case CREATE_THREAD_DEBUG_EVENT:
		return OnCreateThread(event);
	case CREATE_PROCESS_DEBUG_EVENT:
		return OnCreateProcess(event);
	case EXIT_THREAD_DEBUG_EVENT:
		return OnExitThread(event);
	case EXIT_PROCESS_DEBUG_EVENT:
		return OnExitProcess(event);
	case LOAD_DLL_DEBUG_EVENT:
		return OnLoadDll(event);
	case UNLOAD_DLL_DEBUG_EVENT:
		return OnUnloadDll(event);
	case OUTPUT_DEBUG_STRING_EVENT:
		return OnOutputDebugString(event);
	default:
		return DBG_CONTINUE;
	}
}
Beispiel #2
0
LRESULT MainFrame::OnScriptRun(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
   if (m_view.GetModify())
   {
      if (!DoFileSave())
         return 0;
   }

   CString cszFilename = m_view.GetFilePath();
   if (cszFilename.IsEmpty())
      return 0;

   {
      CString cszText;
      cszText.Format(_T("Start executing file %s...\n\n"),
         cszFilename.GetString());

      m_ecOutputWindow.OutputText(cszText);
   }

   m_processor.Stop();

   try
   {
      m_processor.LoadScript(cszFilename);

      m_processor.Run();
   }
   catch (const Lua::Exception& ex)
   {
      CString cszText;
      cszText.Format(_T("%s(%u): %s"),
         ex.LuaSourceFile().GetString(),
         ex.LuaLineNumber(),
         ex.LuaErrorMessage().GetString());

      OnOutputDebugString(cszText);

      UIEnable(ID_SCRIPT_RUN, true);
      UIEnable(ID_SCRIPT_STOP, false);
   }

   return 0;
}