tabs to spaces and bugfixes

This commit is contained in:
Akash Mozumdar 2018-07-25 10:46:59 -07:00
parent 9c5be4be80
commit d0b1efd033
7 changed files with 96 additions and 98 deletions

View File

@ -19,11 +19,6 @@ add_definitions(
/DITH_HAS_CRT /DITH_HAS_CRT
) )
include_directories(
.
texthook
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)

View File

@ -41,7 +41,7 @@ QString TextThreadString(TextThread* thread)
QString::number(tp.hook, 16), QString::number(tp.hook, 16),
QString::number(tp.retn, 16), QString::number(tp.retn, 16),
QString::number(tp.spl, 16) QString::number(tp.spl, 16)
).toUpper() + QString::fromWCharArray(Host::GetHookName(tp.pid, tp.hook).c_str()); ).toUpper();
} }
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
@ -78,29 +78,31 @@ void MainWindow::AddProcess(unsigned int processId)
void MainWindow::RemoveProcess(unsigned int processId) void MainWindow::RemoveProcess(unsigned int processId)
{ {
processCombo->removeItem(processCombo->findText(QString::number(processId), Qt::MatchStartsWith)); processCombo->removeItem(processCombo->findText(QString::number(processId) + ":", Qt::MatchStartsWith));
} }
void MainWindow::AddThread(TextThread* thread) void MainWindow::AddThread(TextThread* thread)
{ {
ttCombo->addItem(TextThreadString(thread)); ttCombo->addItem(
TextThreadString(thread) +
QString::fromWCharArray(Host::GetHookName(thread->GetThreadParameter().pid, thread->GetThreadParameter().hook).c_str())
);
} }
void MainWindow::RemoveThread(TextThread* thread) void MainWindow::RemoveThread(TextThread* thread)
{ {
int threadIndex = ttCombo->findText(QString::number(thread->Number()), Qt::MatchStartsWith); int threadIndex = ttCombo->findText(QString::number(thread->Number()) + ":", Qt::MatchStartsWith);
ttCombo->removeItem(threadIndex); ttCombo->removeItem(threadIndex);
if (threadIndex == ttCombo->currentIndex()) if (threadIndex == ttCombo->currentIndex())
{ {
ttCombo->setCurrentIndex(0); ttCombo->setCurrentIndex(0);
on_ttCombo_activated(0); on_ttCombo_activated(0);
} }
delete thread;
} }
void MainWindow::ThreadOutput(TextThread* thread, QString output) void MainWindow::ThreadOutput(TextThread* thread, QString output)
{ {
if (TextThreadString(thread) == ttCombo->currentText()) if (ttCombo->currentText().startsWith(TextThreadString(thread)))
{ {
textOutput->moveCursor(QTextCursor::End); textOutput->moveCursor(QTextCursor::End);
textOutput->insertPlainText(output); textOutput->insertPlainText(output);
@ -121,4 +123,5 @@ void MainWindow::on_detachButton_clicked()
void MainWindow::on_ttCombo_activated(int index) void MainWindow::on_ttCombo_activated(int index)
{ {
textOutput->setText(QString::fromWCharArray(Host::GetThread(ttCombo->itemText(index).split(":")[0].toInt())->GetStore().c_str())); textOutput->setText(QString::fromWCharArray(Host::GetThread(ttCombo->itemText(index).split(":")[0].toInt())->GetStore().c_str()));
textOutput->moveCursor(QTextCursor::End);
} }

View File

@ -235,7 +235,7 @@ void RemoveThreads(bool(*RemoveIf)(ThreadParameter, ThreadParameter), ThreadPara
{ {
if (onRemove) onRemove(i.second); if (onRemove) onRemove(i.second);
//delete i.second; // Artikash 7/24/2018: FIXME: Qt GUI updates on another thread, so I can't delete this yet. //delete i.second; // Artikash 7/24/2018: FIXME: Qt GUI updates on another thread, so I can't delete this yet.
//i.second->Clear(); // Temp workaround to free some memory. i.second->Clear(); // Temp workaround to free some memory.
removedThreads.push_back(i.first); removedThreads.push_back(i.first);
} }
for (auto i : removedThreads) textThreadsByParams.erase(i); for (auto i : removedThreads) textThreadsByParams.erase(i);