1
0
Fork 0

DBG+GUI: misc changes

This commit is contained in:
mrexodia 2016-07-25 23:42:15 +02:00
parent 57b8c59aa9
commit fc6a125810
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
7 changed files with 19 additions and 29 deletions

View File

@ -56,6 +56,9 @@ void ExpressionFunctions::Init()
RegisterEasy("disasm.sel\1dis.sel", disasmsel); RegisterEasy("disasm.sel\1dis.sel", disasmsel);
RegisterEasy("dump.sel", dumpsel); RegisterEasy("dump.sel", dumpsel);
RegisterEasy("stack.sel", stacksel); RegisterEasy("stack.sel", stacksel);
RegisterEasy("peb\1PEB", peb);
RegisterEasy("teb\1TEB", teb);
} }
bool ExpressionFunctions::Register(const String & name, int argc, CBEXPRESSIONFUNCTION cbFunction, void* userdata) bool ExpressionFunctions::Register(const String & name, int argc, CBEXPRESSIONFUNCTION cbFunction, void* userdata)

View File

@ -1,6 +1,7 @@
#include "exprfunc.h" #include "exprfunc.h"
#include "symbolinfo.h" #include "symbolinfo.h"
#include "module.h" #include "module.h"
#include "debugger.h"
namespace Exprfunc namespace Exprfunc
{ {
@ -46,4 +47,14 @@ namespace Exprfunc
{ {
return selstart(GUI_STACK); return selstart(GUI_STACK);
} }
duint peb()
{
return duint(GetPEBLocation(fdProcessInfo->hProcess));
}
duint teb()
{
return duint(GetTEBLocation(hActiveThread));
}
} }

View File

@ -12,4 +12,7 @@ namespace Exprfunc
duint disasmsel(); duint disasmsel();
duint dumpsel(); duint dumpsel();
duint stacksel(); duint stacksel();
duint peb();
duint teb();
} }

View File

@ -1448,21 +1448,6 @@ bool valapifromstring(const char* name, duint* value, int* value_size, bool prin
return true; return true;
} }
bool valenvfromstring(const char* string, duint* Address)
{
if(scmp(string, "peb"))
{
*Address = (duint)GetPEBLocation(fdProcessInfo->hProcess);
return true;
}
else if(scmp(string, "teb"))
{
*Address = (duint)GetTEBLocation(hActiveThread);
return true;
}
return false;
}
/** /**
\brief Check if a string is a valid decimal number. This function also accepts "-" or "." as prefix. \brief Check if a string is a valid decimal number. This function also accepts "-" or "." as prefix.
\param string The string to check. \param string The string to check.
@ -1723,8 +1708,6 @@ bool valfromstring_noexpr(const char* string, duint* value, bool silent, bool ba
*isvar = true; *isvar = true;
return true; return true;
} }
else if(valenvfromstring(string, value)) //environment block
return true;
else if(strstr(string, "sub_") == string) //then come sub_ functions else if(strstr(string, "sub_") == string) //then come sub_ functions
{ {
auto result = sscanf(string, "sub_%" fext "X", value) == 1; auto result = sscanf(string, "sub_%" fext "X", value) == 1;

View File

@ -141,7 +141,6 @@ void ReferenceView::referenceSetCurrentTaskProgressSlot(int progress, QString ta
void ReferenceView::addColumnAt(int width, QString title) void ReferenceView::addColumnAt(int width, QString title)
{ {
printf("addColumnAt(%d, %s)\n", width, title.toUtf8().constData());
int charwidth = mList->getCharWidth(); int charwidth = mList->getCharWidth();
if(width) if(width)
width = charwidth * width + 8; width = charwidth * width + 8;
@ -159,7 +158,6 @@ void ReferenceView::addColumnAt(int width, QString title)
void ReferenceView::setRowCount(dsint count) void ReferenceView::setRowCount(dsint count)
{ {
printf("setRowCount(%d)\n", count);
emit mCountTotalLabel->setText(QString("%1").arg(count)); emit mCountTotalLabel->setText(QString("%1").arg(count));
mSearchBox->setText(""); mSearchBox->setText("");
mList->setRowCount(count); mList->setRowCount(count);
@ -167,7 +165,6 @@ void ReferenceView::setRowCount(dsint count)
void ReferenceView::setCellContent(int r, int c, QString s) void ReferenceView::setCellContent(int r, int c, QString s)
{ {
printf("setCellContent(%d, %d, %s)\n", r, c, s.toUtf8().constData());
mSearchBox->setText(""); mSearchBox->setText("");
mList->setCellContent(r, c, s); mList->setCellContent(r, c, s);
} }

View File

@ -209,7 +209,6 @@ QString GetDataTypeString(void* buffer, duint size, ENCODETYPE type)
QString ToDateString(const QDate & date) QString ToDateString(const QDate & date)
{ {
/*
static const char* months[] = static const char* months[] =
{ {
"Jan", "Jan",
@ -226,8 +225,6 @@ QString ToDateString(const QDate & date)
"Dec" "Dec"
}; };
return QString().sprintf("%s %d %d", months[date.month() - 1], date.day(), date.year()); return QString().sprintf("%s %d %d", months[date.month() - 1], date.day(), date.year());
*/
return QLocale(QString(currentLocale)).toString(date);
} }
QString FILETIMEToDate(const FILETIME & date) QString FILETIMEToDate(const FILETIME & date)

View File

@ -18,23 +18,19 @@ static QString ToPtrString(duint Address)
// ((int32)0xFFFF0000) == 0xFFFFFFFFFFFF0000 with sign extension // ((int32)0xFFFF0000) == 0xFFFFFFFFFFFF0000 with sign extension
// //
char temp[32];
#ifdef _WIN64 #ifdef _WIN64
char temp[33];
sprintf_s(temp, "%016llX", Address); sprintf_s(temp, "%016llX", Address);
#else #else
char temp[17];
sprintf_s(temp, "%08X", Address); sprintf_s(temp, "%08X", Address);
#endif // _WIN64 #endif // _WIN64
return QString(temp); return QString(temp);
} }
static QString ToLongLongHexString(unsigned long long Value) static QString ToLongLongHexString(unsigned long long Value)
{ {
char temp[33]; char temp[32];
sprintf_s(temp, "%llX", Value); sprintf_s(temp, "%llX", Value);
return QString(temp); return QString(temp);
} }