* @brief InvestigateProcessWindow::on_ImagesTable_cellClicked - Grab the stack for the new image. * @param row - Row of the image selected. * @param column - Column of the image selected. */
| 272 | * @param column - Column of the image selected. |
| 273 | */ |
| 274 | void InvestigateProcessWindow::on_ImagesTable_cellClicked(int row, int column) |
| 275 | { |
| 276 | IMAGE_SUMMARY image; |
| 277 | PIMAGE_DETAILED_REQUEST imageDetailed; |
| 278 | ULONG i; |
| 279 | QString stackHistoryString; |
| 280 | QString tooltip; |
| 281 | CHAR tempBuffer[sizeof(IMAGEHLP_SYMBOL64) + MAX_SYM_NAME]; |
| 282 | PIMAGEHLP_SYMBOL64 currentSymbolInformation; |
| 283 | ULONG64 offset; |
| 284 | QTableWidgetItem* newWidget; |
| 285 | bool stackHistoryViolation; |
| 286 | |
| 287 | memset(tempBuffer, 0, sizeof(tempBuffer)); |
| 288 | currentSymbolInformation = RCAST<PIMAGEHLP_SYMBOL64>(tempBuffer); |
| 289 | currentSymbolInformation->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); |
| 290 | currentSymbolInformation->MaxNameLength = MAX_SYM_NAME; |
| 291 | |
| 292 | image = images[row]; |
| 293 | imageDetailed = communicator->RequestDetailedImage(this->ProcessId, this->EpochExecutionTime, row, image.StackSize); |
| 294 | if (imageDetailed == NULL || imageDetailed->Populated == FALSE) |
| 295 | { |
| 296 | return; |
| 297 | } |
| 298 | |
| 299 | // |
| 300 | // Copy the stack history. |
| 301 | // |
| 302 | this->ui->ImageStackHistoryTable->setRowCount(imageDetailed->StackHistorySize); |
| 303 | for(i = 0; i < imageDetailed->StackHistorySize; i++) |
| 304 | { |
| 305 | stackHistoryViolation = false; |
| 306 | // |
| 307 | // First, try a symbol lookup. |
| 308 | // |
| 309 | if(SymGetSymFromAddr64(GetCurrentProcess(), RCAST<DWORD64>(imageDetailed->StackHistory[i].RawAddress), &offset, currentSymbolInformation)) |
| 310 | { |
| 311 | stackHistoryString = stackHistoryString.sprintf("%s+0x%llx", currentSymbolInformation->Name, offset); |
| 312 | tooltip = tooltip.sprintf("%ls+0x%llx", imageDetailed->StackHistory[i].BinaryPath, imageDetailed->StackHistory[i].BinaryOffset); |
| 313 | } |
| 314 | else |
| 315 | { |
| 316 | if(wcslen(imageDetailed->StackHistory[i].BinaryPath) == 0) |
| 317 | { |
| 318 | stackHistoryString = stackHistoryString.sprintf("0x%llx", imageDetailed->StackHistory[i].RawAddress); |
| 319 | stackHistoryViolation = true; |
| 320 | } |
| 321 | else |
| 322 | { |
| 323 | stackHistoryString = stackHistoryString.sprintf("%ls+0x%llx", imageDetailed->StackHistory[i].BinaryPath, imageDetailed->StackHistory[i].BinaryOffset); |
| 324 | } |
| 325 | |
| 326 | tooltip = stackHistoryString; |
| 327 | } |
| 328 | |
| 329 | this->ui->ImageStackHistoryTable->setRowCount(i + 1); |
| 330 | newWidget = new QTableWidgetItem(stackHistoryString); |
| 331 |
no test coverage detected