* @brief MainWindow::AddAlertSummary - Add an alert to the table of alerts. * @param Alert - The alert to add. */
| 337 | * @param Alert - The alert to add. |
| 338 | */ |
| 339 | void MainWindow::AddAlertSummary(PBASE_ALERT_INFO Alert) |
| 340 | { |
| 341 | std::time_t currentTime; |
| 342 | std::string date; |
| 343 | std::string alertName; |
| 344 | |
| 345 | PSTACK_VIOLATION_ALERT stackViolationAlert; |
| 346 | PFILTER_VIOLATION_ALERT filterViolationAlert; |
| 347 | PREMOTE_OPERATION_ALERT remoteOperationAlert; |
| 348 | STACK_RETURN_INFO* stackHistory; |
| 349 | ULONG stackHistorySize; |
| 350 | ULONG i; |
| 351 | |
| 352 | // |
| 353 | // Filter source path. |
| 354 | // |
| 355 | for(std::wstring filteredSourcePath : alertFalsePositives.SourcePathFilter) |
| 356 | { |
| 357 | if(wcsstr(Alert->SourcePath, filteredSourcePath.c_str()) != NULL) |
| 358 | { |
| 359 | printf("MainWindow!AddAlertSummary: Ignoring alert, matched source path filter %ls.\n", filteredSourcePath.c_str()); |
| 360 | return; |
| 361 | } |
| 362 | } |
| 363 | // |
| 364 | // Filter target path. |
| 365 | // |
| 366 | for(std::wstring filteredTargetPath : alertFalsePositives.TargetPathFilter) |
| 367 | { |
| 368 | if(wcsstr(Alert->TargetPath, filteredTargetPath.c_str()) != NULL) |
| 369 | { |
| 370 | printf("MainWindow!AddAlertSummary: Ignoring alert, matched target path filter %ls.\n", filteredTargetPath.c_str()); |
| 371 | return; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | // |
| 376 | // Get the current time. |
| 377 | // |
| 378 | currentTime = std::time(nullptr); |
| 379 | date = std::ctime(¤tTime); |
| 380 | date[date.length()-1] = '\0'; // Remove the newline. |
| 381 | |
| 382 | // |
| 383 | // Determine the alert type. |
| 384 | // |
| 385 | switch(Alert->AlertType) |
| 386 | { |
| 387 | case StackViolation: |
| 388 | alertName = "Stack Violation"; |
| 389 | stackViolationAlert = RCAST<PSTACK_VIOLATION_ALERT>(Alert); |
| 390 | // |
| 391 | // Set the stack history info for this alert. |
| 392 | // |
| 393 | stackHistory = stackViolationAlert->StackHistory; |
| 394 | stackHistorySize = stackViolationAlert->StackHistorySize; |
| 395 | break; |
| 396 | case FilterViolation: |
no test coverage detected