1

I've searched now for more hours about information on how to scan files in .NET (C#) with the local Windows registered virus scan engine. Found e.g. this (.NET virus scanning API) and some older other examples... It seems that some virus scan engines like MacAfee or Bitdefender or clamav do have good APIs. Even virustotal.com seems to be supported with good APIs.

But how can I access the API of the local installed virus engine? Is it possible at all? I expected stuff like this:

Using System.Security.AntiMaleware;
...
MalewareEngine me = new MalewareEngine(...);
var result = me.scanFile("...test.txt...");
...

I am working on a project with a local .NET (C#) application and I handle a lot of files and so I just want to check for malware; if it is possible in this step: I don't want to upload the file to a cloud malware check (planned as a alternative option).

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Eloy
  • 19
  • 4
  • "it seems that some virus scan engines like mcafee or bitdefender or clamav do have good APIs." - in reference to McAfee, BitDefender and ClamAV, by "API" are you referring to Web Services? Because your wording suggests you're referring to some kind of _local_ API, but then it gets complicated... – Dai Mar 12 '22 at 19:05
  • 1
    As _Windows Defender_ is now built-in to Windows, there's a C-style API in Win32 for that: https://learn.microsoft.com/en-us/windows/win32/lwef/mpscanstart - you'll need to use P/Invoke to access it from C#/.NET though. – Dai Mar 12 '22 at 19:06

0 Answers0