2012-11-09 40 views
3

我正在製作一個簡單的程序,使用VS2010從pop3服務器獲取電子郵件。 可能會使用開源OpenPOP的一些。 它應該然後將電子郵件和附件保存在MS SQL數據庫中。在下載電子郵件附件時在C#中使用Microsoft Security Essentials

但問題是,雖然附件很容易從郵件服務器上下載,但有什麼方法可以掃描附件? 我在這裏工作的小公司只使用微軟的安全要領。

已經搜索到了,但似乎無法找到任何有關此事的信息。

+2

檢查,如果你能得到您的防病毒應用程序進行掃描,通過命令行參數的文件。像'Process.Start(..)'一樣使用該命令行選項 – Davio

回答

3

您可以使用:

"%ProgramFiles%\Microsoft Security Client\MpCmdRun.exe" -Scan -ScanType 3 -File "<Path>" 

並檢查返回代碼。

其他信息:

-Scan [-ScanType value] 
    0 Default, according to your configuration 
    1 Quick scan 
    2 Full system scan 
    3 File and directory custom scan 

     [-File <path>] 
      Indicates the file or directory to be scanned, only valid for 
      custom scan. 

     [-DisableRemediation] 
      This option is valid only for custom scan. 
      When specified: 
       - File exclusions are ignored. 
       - Archive files are scanned. 
       - Actions are not applied after detection. 
       - Event log entries are not written after detection. 
       - Detections from the custom scan are not displayed in the user 
       interface. 

    Return code is 
    0 if no malware is found or malware is successfully remediated and no 
     additional user action is required 
    2 if malware is found and not remediated or additional user action is 
     required to complete remediation or there is error in scanning. 
     Please check History for more information. 
相關問題