| 661 | } |
| 662 | |
| 663 | bool IScanner::ScanFile(const std::string & szFileName, EFileScanTypes fileType) |
| 664 | { |
| 665 | std::lock_guard <std::recursive_mutex> __lock(m_Mutex); |
| 666 | |
| 667 | SCANNER_LOG(LL_SYS, "File scanner has been started! Target file: %s", szFileName.c_str()); |
| 668 | |
| 669 | if (IsScannedFile(szFileName)) |
| 670 | { |
| 671 | SCANNER_LOG(LL_SYS, "File already scanned!"); |
| 672 | return false; |
| 673 | } |
| 674 | |
| 675 | // Add to checked list |
| 676 | m_vScannedFileNames.push_back(szFileName); |
| 677 | |
| 678 | // Scan routine |
| 679 | |
| 680 | /// 1 |
| 681 | // Exist check |
| 682 | auto bRet = CheckFileExist(szFileName); |
| 683 | SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File exist scan completed! Result: %d", bRet); |
| 684 | |
| 685 | /// 2 |
| 686 | // File name + file size + Entropy + Hash |
| 687 | bRet = CheckFileBasicInformations(szFileName); |
| 688 | SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File basic information scan completed! Result: %d", bRet); |
| 689 | |
| 690 | /// 3 |
| 691 | // nFileIndexLow, nFileIndexHigh, dwVolumeSerialNumber |
| 692 | bRet = CheckFileInformations(szFileName); |
| 693 | SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File information scan completed! Result: %d", bRet); |
| 694 | |
| 695 | /// 4 |
| 696 | // PE Informations |
| 697 | bRet = CheckFilePEInformations(szFileName); |
| 698 | SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File PE information scan completed! Result: %d", bRet); |
| 699 | |
| 700 | /// 4 |
| 701 | // Region hash Informations |
| 702 | bRet = CheckFileRegionHashes(szFileName); |
| 703 | SCANNER_LOG(bRet ? LL_SYS : LL_ERR, "File PE information scan completed! Result: %d", bRet); |
| 704 | |
| 705 | return true; |
| 706 | } |
| 707 | |
| 708 | bool IScanner::ScanFile(HANDLE hProcess, EFileScanTypes fileType) |
| 709 | { |
nothing calls this directly
no test coverage detected