diff options
| author | Mason Reed <mason@vector35.com> | 2025-03-27 14:47:31 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-03-27 14:47:31 -0400 |
| commit | 180a554d7efd100ff9138d097ba11018fcbf0dea (patch) | |
| tree | c255c331af731a786972c3a1e01182e7b6bd812a /plugins/rtti/microsoft.cpp | |
| parent | 2a23d379d97eb765b9a59352395f5b3b6279e057 (diff) | |
RTTI: Add background task back and make it cancellable
If the background task gets stuck, this is the commit to ponder at
Diffstat (limited to 'plugins/rtti/microsoft.cpp')
| -rw-r--r-- | plugins/rtti/microsoft.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/rtti/microsoft.cpp b/plugins/rtti/microsoft.cpp index 66015042..95c76311 100644 --- a/plugins/rtti/microsoft.cpp +++ b/plugins/rtti/microsoft.cpp @@ -620,6 +620,7 @@ MicrosoftRTTIProcessor::MicrosoftRTTIProcessor(const Ref<BinaryView> &view, bool void MicrosoftRTTIProcessor::ProcessRTTI() { + auto bgTask = new BackgroundTask("Scanning for Microsoft RTTI...", true); auto start_time = std::chrono::high_resolution_clock::now(); uint64_t startAddr = m_view->GetOriginalImageBase(); uint64_t endAddr = m_view->GetEnd(); @@ -630,6 +631,8 @@ void MicrosoftRTTIProcessor::ProcessRTTI() for (uint64_t coLocatorAddr = segment->GetStart(); coLocatorAddr < segment->GetEnd() - 0x18; coLocatorAddr += addrSize) { + if (bgTask->IsCancelled()) + break; optReader.Seek(coLocatorAddr); uint32_t sigVal = optReader.Read32(); if (sigVal == COL_SIG_REV1) @@ -683,6 +686,7 @@ void MicrosoftRTTIProcessor::ProcessRTTI() } } + bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; m_logger->LogDebug("ProcessRTTI took %f seconds", elapsed_time.count()); @@ -691,6 +695,7 @@ void MicrosoftRTTIProcessor::ProcessRTTI() void MicrosoftRTTIProcessor::ProcessVFT() { + auto bgTask = new BackgroundTask("Scanning for Microsoft RTTI...", true); std::map<uint64_t, uint64_t> vftMap = {}; std::map<uint64_t, std::optional<VirtualFunctionTableInfo>> vftFinishedMap = {}; auto start_time = std::chrono::high_resolution_clock::now(); @@ -712,6 +717,8 @@ void MicrosoftRTTIProcessor::ProcessVFT() uint64_t endAddr = segment->GetEnd(); for (uint64_t vtableAddr = startAddr; vtableAddr < endAddr - 0x18; vtableAddr += addrSize) { + if (bgTask->IsCancelled()) + break; optReader.Seek(vtableAddr); uint64_t coLocatorAddr = optReader.ReadPointer(); auto coLocator = m_classInfo.find(coLocatorAddr); @@ -806,6 +813,7 @@ void MicrosoftRTTIProcessor::ProcessVFT() for (const auto &[coLocatorAddr, _]: vftMap) ProcessClassAndBases(coLocatorAddr); + bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; m_logger->LogDebug("ProcessVFT took %f seconds", elapsed_time.count()); |
