1
0
Fork 0

DBG+GUI: trim error descriptions in RegisterView and format functions

This commit is contained in:
Duncan Ogilvie 2017-12-03 22:26:55 +01:00
parent e11701d7c3
commit 37e83c9436
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 12 additions and 9 deletions

View File

@ -29,7 +29,7 @@ static FORMATRESULT formatErrorMsg(HMODULE DLL, const String & errName, DWORD co
if((Entry->Flags & MESSAGE_RESOURCE_UNICODE) != 0)
{
String UTF8Description = StringUtils::Utf16ToUtf8((const wchar_t*)Entry->Text);
String UTF8Description = StringUtils::TrimRight(StringUtils::Utf16ToUtf8((const wchar_t*)Entry->Text));
if(UTF8Description.size() + 3 + errName.size() > destCount)
return FORMAT_BUFFER_TOO_SMALL;
else
@ -40,8 +40,7 @@ static FORMATRESULT formatErrorMsg(HMODULE DLL, const String & errName, DWORD co
}
else
{
0;//printf("%s\n", (const char*)Entry->Text);
String UTF8Description = StringUtils::LocalCpToUtf8((const char*)Entry->Text);
String UTF8Description = StringUtils::TrimRight(StringUtils::LocalCpToUtf8((const char*)Entry->Text));
if(UTF8Description.size() + 3 + errName.size() > destCount)
return FORMAT_BUFFER_TOO_SMALL;
else

View File

@ -1621,21 +1621,25 @@ QString RegistersView::helpRegister(REGISTER_NAME reg)
case MxCsr_RC:
return tr("Bits 13 and 14 of the MXCSR register (the rounding control [RC] field) control how the results of SIMD floating-point instructions are rounded.");
case LastError:
{
char dat[1024];
LASTERROR* error;
error = (LASTERROR*)registerValue(&wRegDumpStruct, LastError);
if(DbgFunctions()->StringFormatInline(QString().sprintf("{winerror@%X}", error->code).toUtf8().constData(), sizeof(dat), dat) == 1) //FORMAT_SUCCESS
if(DbgFunctions()->StringFormatInline(QString().sprintf("{winerror@%X}", error->code).toUtf8().constData(), sizeof(dat), dat))
return dat;
else
return tr("The value of GetLastError(). This value is stored in the TEB.");
}
case LastStatus:
char dat1[1024];
LASTSTATUS* error1;
error1 = (LASTSTATUS*)registerValue(&wRegDumpStruct, LastStatus);
if(DbgFunctions()->StringFormatInline(QString().sprintf("{ntstatus@%X}", error1->code).toUtf8().constData(), sizeof(dat1), dat1) == 1) //FORMAT_SUCCESS
return dat1;
{
char dat[1024];
LASTSTATUS* error;
error = (LASTSTATUS*)registerValue(&wRegDumpStruct, LastStatus);
if(DbgFunctions()->StringFormatInline(QString().sprintf("{ntstatus@%X}", error->code).toUtf8().constData(), sizeof(dat), dat))
return dat;
else
return tr("The NTSTATUS in the LastStatusValue field of the TEB.");
}
#ifdef _WIN64
case GS:
return tr("The TEB of the current thread can be accessed as an offset of segment register GS (x64).\nThe TEB can be used to get a lot of information on the process without calling Win32 API.");