define.h
上传用户:chaoyu
上传日期:2013-04-28
资源大小:18k
文件大小:4k
源码类别:

杀毒

开发平台:

Visual C++

  1. #pragma once
  2. //////////////////////////////////////////////////////////////////////////
  3. //
  4. // ENUM
  5. //
  6. enum BAV_ACTION{ BA_SCAN, BA_ASK, BA_CLEAN, BA_DELETE};
  7. enum BAV_RESULT{ BR_EXCEPTION=-1, BR_NO_VIRUS, BR_WITH_VIRUS, BR_CLEARED, BR_CLEAR_FAILED, BR_DELETED, BR_DELETE_FAILED, BR_IGNORE};
  8. enum BAV_SIGN_TYPE { BS_PHY_FILE=0 /*physical file*/, BS_STRUCT_OFFSET /*offset of a struct*/ };
  9. enum BAV_SIGN_LOGIC_OPERATION { BL_EQUAL=0, BL_NOT_EQUAL };
  10. enum BAV_OBJ_TYPE {BO_PHY_FILE=0, BO_MEM_FILE, BO_BOOT_SECTOR};
  11. enum BAV_TREAT_TYPE { BT_SCANONLY, BT_RENAME, BT_DELETE }; //目前只有几种处理方法,实际会有很多。
  12. //////////////////////////////////////////////////////////////////////////
  13. //
  14. // KEY STRUCTS
  15. //
  16. typedef struct tagScanParam
  17. {
  18. // control the struct version
  19. INT nSize;
  20. // Using CString first, it support both ASCII and UNICODE.
  21. // We can replace it by any compatible class later.
  22. CString strPathName;
  23. // what action will be taken
  24. BAV_ACTION eAction;
  25. }SCAN_PARAM, *PSCAN_PARAM;
  26. class CScanObject;
  27. typedef struct tagScanRecord
  28. {
  29. // Virus ID, use this to query the name and other information
  30. DWORD dwVirusID;
  31. // how the infected file was treated
  32. BAV_RESULT eResult;
  33. // scan object
  34. CScanObject* pScanObject;
  35. // link to next record
  36. tagScanRecord* pNext;
  37. }SCAN_RECORD, *PSCAN_RECORD;
  38. typedef struct tagScanResults
  39. {
  40. // control the struct version
  41. INT nSize;
  42. // total objects count, include all files and other objects.
  43. DWORD dwObjCount;
  44. // total time used
  45. DWORD dwTime;
  46. // total count of records which will be displayed.
  47. DWORD dwRecCount;
  48. PSCAN_RECORD pScanRecords;
  49. }SCAN_RESULTS, *PSCAN_RESULTS;
  50. //////////////////////////////////////////////////////////////////////////
  51. //
  52. // VSIGNATURE 
  53. //
  54. #define MAX_SIGNATURE_LEN 32
  55. // BAV_SIGN_TYPE.dwType == BS_PHY_FILE
  56. // dwSubType: 0
  57. // nOffset: offset in file
  58. // nSize: size of signature (in bytes)
  59. // eLogicOp: how the signature compare with the target
  60. // Signature: signatures array. max length is MAX_SIGNATURE_LEN defined above.
  61. // BAV_SIGN_TYPE.dwType == BS_STRUCT_OFFSET
  62. // dwSubType:
  63. #define BS_SUB_PE_BEGIN 0x00000100
  64. #define BS_SUB_NT_HEADERS (BS_SUB_PE_BEGIN+1)
  65. #define BS_SUB_ENTRY_POINT (BS_SUB_PE_BEGIN+2)
  66. #define BS_SUB_PE_END (BS_SUB_PE_BEGIN+0xFF)
  67. typedef struct tagVSIGNATURE
  68. {
  69. BAV_SIGN_TYPE eType;
  70. DWORD dwSubType;
  71. INT nOffset;
  72. INT nSize;
  73. BAV_SIGN_LOGIC_OPERATION eLogicOp;
  74. BYTE Signature[MAX_SIGNATURE_LEN];
  75. }VSIGNATURE, *PVSIGNATURE;
  76. typedef struct tagVTREATMENT
  77. {
  78. BAV_TREAT_TYPE eType;
  79. DWORD dwParam1;
  80. DWORD dwParam2;
  81. }VTREATMENT, *PVTREATMENT;
  82. typedef struct tagVRECORD
  83. {
  84. // control the struct version
  85. INT nSize;
  86. DWORD dwVirusID;
  87. DWORD dwSignCount;
  88. PVSIGNATURE pVSing[8];
  89. DWORD dwTreatCount;
  90. PVTREATMENT pVTreat[8];
  91. }VRECORD, *PVRECORD;
  92. #define MAX_SECTIONS 64
  93. #define MAX_IMPORTS 64
  94. // File Struct PE
  95. typedef struct tagFSPE
  96. {
  97. // control the struct version
  98. INT nSize;
  99. INT m_nSectionCount;
  100. INT m_nImportCount;
  101. bool m_bMZFile;
  102. bool m_bPEFile;
  103. PIMAGE_DOS_HEADER m_pImageDosHeader;
  104. PIMAGE_FILE_HEADER m_pFileHeader;
  105. PIMAGE_OPTIONAL_HEADER32 m_pOptionalHeader;
  106. PIMAGE_SECTION_HEADER m_aSectionHeaders[MAX_SECTIONS];
  107. PIMAGE_NT_HEADERS m_pNtHeaders;
  108. PIMAGE_IMPORT_DESCRIPTOR m_aImportDescriptors[MAX_IMPORTS];
  109. PIMAGE_EXPORT_DIRECTORY m_pExportDirectory;
  110. PIMAGE_RESOURCE_DIRECTORY m_pResourceDirectory;
  111. // common use
  112. LPBYTE m_pEntryPoint;
  113. }FSPE, *PFSPE;