add error descriptions to x64dbg failure messages
This commit is contained in:
parent
4ea3a8e3af
commit
4cf5508b5f
|
|
@ -6,6 +6,7 @@
|
|||
#include "disasm_helper.h"
|
||||
#include "disasm_fast.h"
|
||||
#include "plugin_loader.h"
|
||||
#include "stringformat.h"
|
||||
#include "value.h"
|
||||
|
||||
#define MAX_INSTRUCTIONS_TRACED_FULL_REG_DUMP 512
|
||||
|
|
@ -405,7 +406,8 @@ void TraceRecordManager::TraceExecuteRecord(const Zydis & newInstruction)
|
|||
if(written < DWORD(WriteBufferPtr - WriteBuffer)) //Disk full?
|
||||
{
|
||||
CloseHandle(rtFile);
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Run trace has stopped unexpectedly because WriteFile() failed. GetLastError()= %X .\r\n"), GetLastError());
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Run trace has stopped unexpectedly because WriteFile() failed. GetLastError()= %s .\r\n"), error.c_str());
|
||||
rtEnabled = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -549,7 +551,8 @@ bool TraceRecordManager::enableRunTrace(bool enabled, const char* fileName)
|
|||
}
|
||||
else
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Cannot create run trace file. GetLastError()= %X .\r\n"), GetLastError());
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Cannot create run trace file. GetLastError()= %s .\r\n"), error.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "GetPeArch.h"
|
||||
#include "database.h"
|
||||
#include "exception.h"
|
||||
#include "stringformat.h"
|
||||
|
||||
static bool skipInt3Stepping(int argc, char* argv[])
|
||||
{
|
||||
|
|
@ -186,7 +187,8 @@ bool cbDebugStop(int argc, char* argv[])
|
|||
break;
|
||||
|
||||
case WAIT_FAILED:
|
||||
dprintf_untranslated("WAIT_FAILED, GetLastError() = %d (%s)\n", GetLastError(), ErrorCodeToName(GetLastError()).c_str());
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf_untranslated("WAIT_FAILED, GetLastError() = %s\n", error.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "debugger.h"
|
||||
#include "exception.h"
|
||||
#include "value.h"
|
||||
#include "stringformat.h"
|
||||
|
||||
bool cbGetPrivilegeState(int argc, char* argv[])
|
||||
{
|
||||
|
|
@ -85,7 +86,8 @@ bool cbHandleClose(int argc, char* argv[])
|
|||
return false;
|
||||
if(!handle || !DuplicateHandle(fdProcessInfo->hProcess, HANDLE(handle), NULL, NULL, 0, FALSE, DUPLICATE_CLOSE_SOURCE))
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "DuplicateHandle failed: %s\n"), ErrorCodeToName(GetLastError()).c_str());
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "DuplicateHandle failed: %s\n"), error.c_str());
|
||||
return false;
|
||||
}
|
||||
#ifdef _WIN64
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "argument.h"
|
||||
#include "filemap.h"
|
||||
#include "debugger.h"
|
||||
#include "stringformat.h"
|
||||
|
||||
/**
|
||||
\brief Directory where program databases are stored (usually in \db). UTF-8 encoding.
|
||||
|
|
@ -135,7 +136,8 @@ void DbSave(DbLoadSaveType saveType, const char* dbfile, bool disablecompression
|
|||
|
||||
if(!dumpSuccess)
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "\nFailed to write database file!"));
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "\nFailed to write database file!(GetLastError() = %s)\n"), error.c_str());
|
||||
json_decref(root);
|
||||
return;
|
||||
}
|
||||
|
|
@ -197,7 +199,8 @@ void DbLoad(DbLoadSaveType loadType, const char* dbfile)
|
|||
FileMap<char> dbMap;
|
||||
if(!dbMap.Map(databasePathW.c_str()))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "\nFailed to read database file!"));
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "\nFailed to read database file!(GetLastError() = %s)\n"), error.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +328,10 @@ void DbSetPath(const char* Directory, const char* ModulePath)
|
|||
if(!CreateDirectoryW(StringUtils::Utf8ToUtf16(Directory).c_str(), nullptr))
|
||||
{
|
||||
if(GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Warning: Failed to create database folder '%s'. Path may be read only.\n"), Directory);
|
||||
{
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Warning: Failed to create database folder '%s'. GetLastError() = %s\n"), Directory, error.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +374,8 @@ void DbSetPath(const char* Directory, const char* ModulePath)
|
|||
auto hFile = CreateFileW(testfile.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr);
|
||||
if(hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Cannot write to the program directory, try running x64dbg as admin..."));
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Cannot write to the program directory(GetLastError() = %s), try running x64dbg as admin...\n"), error.c_str());
|
||||
return false;
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
|
|
|
|||
|
|
@ -2597,9 +2597,7 @@ static void debugLoopFunction(void* lpParameter, bool attach)
|
|||
{
|
||||
auto lastError = GetLastError();
|
||||
auto isElevated = IsProcessElevated();
|
||||
auto error = ErrorCodeToName(lastError);
|
||||
if(error.empty())
|
||||
error = StringUtils::sprintf("%d (0x%X)", lastError);
|
||||
String error = stringformatinline(StringUtils::sprintf("{winerror@%d}", lastError));
|
||||
if(lastError == ERROR_ELEVATION_REQUIRED && !isElevated)
|
||||
{
|
||||
auto msg = StringUtils::Utf8ToUtf16(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "The executable you are trying to debug requires elevation. Restart as admin?")));
|
||||
|
|
@ -2699,8 +2697,8 @@ static void debugLoopFunction(void* lpParameter, bool attach)
|
|||
{
|
||||
if(AttachDebugger(pid, true, fdProcessInfo, (void*)cbAttachDebugger) == false)
|
||||
{
|
||||
unsigned int errorCode = GetLastError();
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Attach to process failed! GetLastError() = %d (%s)\n"), int(errorCode), ErrorCodeToName(errorCode).c_str());
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Attach to process failed! GetLastError() = %s\n"), error.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "exception.h"
|
||||
#include "expressionfunctions.h"
|
||||
#include "formatfunctions.h"
|
||||
#include "stringformat.h"
|
||||
#include "yara/yara.h"
|
||||
#include "dbghelp_safe.h"
|
||||
|
||||
|
|
@ -504,7 +505,10 @@ static DWORD WINAPI DbgScriptDllExecThread(void* a)
|
|||
if(FreeLibrary(hScriptDll))
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "success!\n"));
|
||||
else
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "failure (%08X)...\n"), GetLastError());
|
||||
{
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "failure (%s)...\n"), error.c_str());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -538,17 +542,26 @@ static bool DbgScriptDllExec(const char* dll)
|
|||
dputs(QT_TRANSLATE_NOOP("DBG", "[Script DLL] \"Start\" returned!\n"));
|
||||
}
|
||||
else
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "[Script DLL] Failed to find the exports \"AsyncStart\" or \"Start\" (%s)!\n"), ErrorCodeToName(GetLastError()).c_str());
|
||||
{
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "[Script DLL] Failed to find the exports \"AsyncStart\" or \"Start\" (%s)!\n"), error.c_str());
|
||||
}
|
||||
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "[Script DLL] Calling FreeLibrary..."));
|
||||
if(FreeLibrary(hScriptDll))
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "success!\n"));
|
||||
else
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "failure (%s)...\n"), ErrorCodeToName(GetLastError()).c_str());
|
||||
{
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "failure (%s)...\n"), error.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "[Script DLL] LoadLibary failed (%s)!\n"), ErrorCodeToName(GetLastError()).c_str());
|
||||
{
|
||||
String error = stringformatinline(StringUtils::sprintf("{wineerror@%d}", GetLastError()));
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "[Script DLL] LoadLibary failed (%s)!\n"), error.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue