Beispiel #1
0
        public LameScanResult ScanFile(string sFile)
        {
            try
            {
                if (string.IsNullOrEmpty(sFile))
                {
                    throw new Exception("Invalid param");
                }
                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }


                var _result = new ScanResult_();
                if (LameUtity.lame_scan_file_(pEngine, sFile, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();
                result.EngineID      = _result.engid;
                result.VirusName     = _result.vname;
                result.VirusTypeName = _result.kclass;
                result.VirusTypeDesc = _result.kclass_desc_a;
                result.HitTag        = _result.hitag;
                result.VirusID32     = _result.vid32;
                result.VirusID40     = _result.vid40;
                result.VirusType     = _result.vtype;
                result.TreatResult   = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #2
0
        public LameScanResult ScanMem(byte[] bytes)
        {
            try
            {
                if (bytes == null || bytes.Length == 0)
                {
                    throw new Exception("Invalid param");
                }

                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }

                var _result = new ScanResult_();
                if (LameUtity.lame_scan_mem_(pEngine, bytes, (uint)bytes.Length, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();

                result.EngineID    = _result.engid;
                result.VirusName   = _result.vname;
                result.HitTag      = _result.hitag;
                result.VirusID32   = _result.vid32;
                result.VirusID40   = _result.vid40;
                result.VirusType   = _result.vtype;
                result.TreatResult = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #3
0
 public static extern int lame_scan_mem_(IntPtr pEngine, byte[] data, uint uSize, ref ScanResult_ result);
Beispiel #4
0
 public static extern int lame_scan_file_(IntPtr pEngine, string pFileName, ref ScanResult_ result);