示例#1
0
        private LameScanResult FetchResult(IntPtr resp)
        {
            try
            {
                var _result = (ScanResult_)Marshal.PtrToStructure(resp, typeof(ScanResult_));

                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)
            {
            }

            return(null);
        }
示例#2
0
        private int LameScanAlarm(string fname, IntPtr resp, IntPtr uuserdata)
        {
            LameScanResult result = null;

            if (resp != IntPtr.Zero)
            {
                result = FetchResult(resp);
            }
            if (result == null)
            {
                return((int)LSCT.CONTINUE);
            }
            return((int)AlarmEvent(fname, result));
        }
示例#3
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;
            }
        }
示例#4
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;
            }
        }