You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

  1. #nullable enable
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Runtime.InteropServices;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace IPA.AntiMalware.WinAPI
  9. {
  10. [Guid("82d29c2e-f062-44e6-b5c9-3d9a2f24a2df")]
  11. [ComVisible(true)]
  12. internal interface IAntimalware
  13. {
  14. void Scan([In] IAmsiStream stream, [Out] out AmsiResult result, [Out] out IAntimalwareProvider provider);
  15. void CloseSession([In] ulong session);
  16. }
  17. [Guid("3e47f2e5-81d4-4d3b-897f-545096770373")]
  18. [ComVisible(true)]
  19. internal interface IAmsiStream
  20. {
  21. unsafe void GetAttribute([In] AmsiAttribute attribute, [In] uint dataSize, [Out] byte* buffer, out uint writtenData);
  22. unsafe void Read([In] ulong position, [In] uint dataSize, [Out] byte* buffer, out uint readSize);
  23. }
  24. [Guid("b2cabfe3-fe04-42b1-a5df-08d483d4d125")]
  25. [ComVisible(true)]
  26. internal interface IAntimalwareProvider
  27. {
  28. [return: MarshalAs(UnmanagedType.LPWStr)] string DisplayName();
  29. AmsiResult Scan([In] IAmsiStream stream);
  30. void CloseSession([In] ulong session);
  31. }
  32. internal enum AmsiResult
  33. {
  34. Clean = 0,
  35. NotDetected = 1,
  36. BlockedByAdminStart = 0x4000,
  37. BlockedByAdminEnd = 0x4fff,
  38. Detected = 32768
  39. }
  40. internal enum AmsiAttribute
  41. {
  42. AppName = 0,
  43. ContentName = 1,
  44. ContentSize = 2,
  45. ContentAddress = 3,
  46. Session = 4,
  47. RedirectChainSize = 5,
  48. RedirectChainAddress = 6,
  49. AllSize = 7,
  50. AllAddress = 8,
  51. }
  52. }