Try   HackMD

VS Code 產生的 C / C++ .exe 檔存取被拒

Why ?

  • 某些檔案不想被 Avira 及時偵測
  • 用 VS Code 寫 C / C++ 時突然被嚇到

btw 我現在已經沒在用 Avira 了 : )

被防毒軟體偵錯的過程

  1. 在桌面創建空資料夾 ( myFile )

  2. 用 VS Code 打開該資料夾

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 新增一個 .c 檔,隨意打些內容

  4. 執行 code runner ( 產生 .exe 檔 )

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    到這個步驟程式是可以正常運作的。
    但接下來使用終端機操作時將觸發(?)防毒軟體...

  5. 用終端機執行 .exe 檔

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    此時出現了 " 存取被拒 " 字樣,Avira 也跳出了警示,說明 test.exe 已被移至隔離區。
    我們也可以從左方欄位看出它 " 被消失 " 了。

    接下來有兩點事項要處理:

    • 刪除已經出問題的 test.exe
    • 設定 myFile 為 Avira 略過的檔案

在 Avira 把資料夾排除,略過及時掃描

刪除被隔離的檔案

  1. 打開 Avira,選取安全性中的 " 隔離區 "

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 勾選後刪除,檔案就會移除了!

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    注意:不要選取 " 還原 ",否則之後檔案將很難刪除。
    如果你真的真的真的不小心按到還原,我是進入 Windows 10 的安全模式刪除。

設定 Avira 在即時掃描時略過 myFile

  1. 在安全性中點選 " 防護選項 "

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 點選即時防護的小齒輪(到底有誰會注意到..)

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 點選左欄的 " 例外 " 並選取要略過的資料夾(myFile)

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  4. 點選 " 新增 " ,出現在左方欄位後按下 " 套用 "" 確定 " 就完成了!

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    接著重新 run 一次 code 吧!

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    在執行 Code Runner 後,會發現產生了 tempCodeRunnerFile.exe,是正常的!
    (個人猜測是為了與被隔離的那個檔名做區隔)

    之後只要在這個 myFile 底下寫 code 就好了!