Skip to content

Commit

Permalink
disambiguate timeout errors origin
Browse files Browse the repository at this point in the history
  • Loading branch information
cbucher committed Feb 14, 2015
1 parent 2bd3e9a commit 52af7be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Console/ConsoleHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ void ConsoleHandler::StartShellProcess

// wait for PID of shell launched in admin ConsoleZ
if (::WaitForSingleObject(pid.GetReqEvent(), 10000) == WAIT_TIMEOUT)
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (PID)"));

pi.dwProcessId = *pid.Get();
pi.hProcess = ::OpenProcess(SYNCHRONIZE, FALSE, pi.dwProcessId);
Expand Down Expand Up @@ -663,7 +663,7 @@ void ConsoleHandler::StartShellProcess

// wait for hook DLL to set console handle
if (::WaitForSingleObject(m_consoleParams.GetReqEvent(), 10000) == WAIT_TIMEOUT)
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (hook)"));

ShowWindow(SW_HIDE);
}
Expand Down Expand Up @@ -704,7 +704,7 @@ void ConsoleHandler::StartShellProcessAsAdministrator

// wait for shared objects creation
if (::WaitForSingleObject(pid.GetRespEvent(), 10000) == WAIT_TIMEOUT)
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (shared objects creation)"));

// inject our hook DLL into console process
try
Expand Down Expand Up @@ -772,7 +772,7 @@ void ConsoleHandler::AttachToShellProcess(

// wait for hook DLL to set console handle
if (::WaitForSingleObject(m_consoleParams.GetReqEvent(), 10000) == WAIT_TIMEOUT)
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (hook2)"));

ShowWindow(SW_HIDE);
}
Expand Down Expand Up @@ -1229,7 +1229,7 @@ void ConsoleHandler::InjectHookDLL(PROCESS_INFORMATION& pi)

if (::WaitForSingleObject(wowProcess.get(), 5000) == WAIT_TIMEOUT)
{
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (ConsoleWow.exe)"));
}

::GetExitCodeProcess(wowProcess.get(), reinterpret_cast<DWORD*>(&fnWow64LoadLibrary));
Expand Down Expand Up @@ -1460,7 +1460,7 @@ void ConsoleHandler::InjectHookDLL2(PROCESS_INFORMATION& pi)

if (::WaitForSingleObject(wowProcess.get(), 5000) == WAIT_TIMEOUT)
{
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout"));
throw ConsoleException(boost::str(boost::wformat(Helpers::LoadString(IDS_ERR_DLL_INJECTION_FAILED)) % L"timeout (ConsoleWow.exe)"));
}

::GetExitCodeProcess(wowProcess.get(), reinterpret_cast<DWORD*>(&fnWow64LoadLibrary));
Expand Down
2 changes: 1 addition & 1 deletion shared/NamedPipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class NamedPipe
break;

case WAIT_TIMEOUT:
throw std::exception("timeout");
throw std::exception("timeout (NamedPipe::WaitConnect)");
break;

case WAIT_FAILED:
Expand Down

0 comments on commit 52af7be

Please sign in to comment.