예제 #1
0
        public AmsiMalwareScanner()
        {
            AmsiContextSafeHandle handle;
            int pInvokeResult = AmsiNativeMethods.AmsiInitialize(AppIdentifier, out handle);

            if (pInvokeResult != 0 || handle.IsInvalid)
            {
                throw new MalwareScanningException(
                          "Failed to initialize AMSI context. For more details see inner exception.",
                          new Win32Exception(Marshal.GetLastWin32Error()));
            }

            this.contextHandle = handle;
        }
예제 #2
0
 public static extern int AmsiScanBuffer(AmsiContextSafeHandle amsiContext, [In][MarshalAs(UnmanagedType.LPArray)] byte[] buffer, uint length, [In()][MarshalAs(UnmanagedType.LPWStr)] string contentName, IntPtr session, out AMSI_RESULT result);
예제 #3
0
 public static extern void AmsiCloseSession(AmsiContextSafeHandle amsiContext, IntPtr session);
예제 #4
0
 public static extern int AmsiOpenSession(AmsiContextSafeHandle amsiContext, out IntPtr session);
예제 #5
0
 public static extern int AmsiInitialize([MarshalAs(UnmanagedType.LPWStr)] string appName, out AmsiContextSafeHandle amsiContext);