Source code of Windows XP (NT5)
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.

137 lines
3.3 KiB

  1. //-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: catdb.hxx
  8. //
  9. // Contents: Microsoft Internet Security Catalog Utilities
  10. //
  11. // History: 23-Oct-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef CATDB_HXX
  15. #define CATDB_HXX
  16. #include "cbfile.hxx"
  17. #pragma pack(8)
  18. //
  19. // the following are global tracking files (eg: only one in the "CatRoot")
  20. //
  21. #define SYSMAST_NAME L"SYSMAST"
  22. typedef struct SysMast_
  23. {
  24. DWORD SysId;
  25. GUID SysGuid; // GuidIdx
  26. WCHAR SubDir[REG_MAX_GUID_TEXT];
  27. } SysMast;
  28. typedef struct SysMastRec_
  29. {
  30. DWORD SysId;
  31. GUID SysGuid; // GuidIdx
  32. char SubDir[REG_MAX_GUID_TEXT];
  33. } SysMastRec;
  34. //
  35. // the following are "localized" tracking files. eg: they live in each
  36. // sub-systems directory.
  37. //
  38. #define CATMAST_NAME L"CATMAST"
  39. typedef struct CatMast_
  40. {
  41. DWORD CatId; // CatIdIdx
  42. DWORD SysId;
  43. WCHAR OrigName[MAX_PATH];
  44. WCHAR CurName[MAX_PATH];
  45. FILETIME InstDate;
  46. } CatMast;
  47. typedef struct CatMastRec_
  48. {
  49. DWORD CatId; // CatIdIdx
  50. DWORD SysId;
  51. char OrigName[MAX_PATH];
  52. char CurName[MAX_PATH];
  53. FILETIME InstDate;
  54. } CatMastRec;
  55. #define HASHMAST_NAME L"HASHMAST"
  56. #define MAX_HASH_LEN 20 // SHA1
  57. typedef struct HashMast_
  58. {
  59. BYTE Hash[MAX_HASH_LEN]; // HashIdx
  60. DWORD SysId;
  61. WCHAR CatName[MAX_PATH];
  62. } HashMast;
  63. typedef struct HashMastRec_
  64. {
  65. BYTE Hash[MAX_HASH_LEN]; // HashIdx
  66. DWORD SysId;
  67. char CatName[MAX_PATH];
  68. } HashMastRec;
  69. #pragma pack()
  70. #define CATDB_VERSION_1 0x0001
  71. class cCatalogDB_
  72. {
  73. public:
  74. cCatalogDB_(WCHAR *pwszBaseDirIn, WCHAR *pwszSubSysDirIn);
  75. virtual ~cCatalogDB_(void);
  76. BOOL Initialize(void);
  77. DWORD SysMast_GetNewId(void);
  78. BOOL SysMast_Get(const GUID *pgSubSys, SysMast *psData);
  79. BOOL SysMast_Add(SysMast *psData);
  80. BOOL SysMast_GetFirst(SysMast *psData);
  81. BOOL SysMast_GetNext(SysMast *psData);
  82. DWORD SysMast_NumKeys(void);
  83. DWORD CatMast_GetNewId(void);
  84. BOOL CatMast_Get(DWORD ulId, CatMast *psData);
  85. BOOL CatMast_Add(CatMast *psData);
  86. private:
  87. cBFile_ *pSysMast;
  88. cBFile_ *pCatMast;
  89. };
  90. class cHashDB_
  91. {
  92. public:
  93. WCHAR *pwszSubSysDir;
  94. cHashDB_(WCHAR *pwszBaseDirIn, WCHAR *pwszSubSysDirIn, BOOL *pfCreatedOK);
  95. virtual ~cHashDB_(void);
  96. BOOL Initialize(void);
  97. BOOL HashMast_Get(DWORD dwStartRec, BYTE *pbHash, DWORD cbHash, HashMast *psData);
  98. BOOL HashMast_Add(HashMast *psData);
  99. DWORD HashMast_GetRecNum(void) { return(pHashMast->getRecNum()); }
  100. DWORD HashMast_GetKeyNum(void) { return(pHashMast->getKeyNum()); }
  101. private:
  102. cBFile_ *pHashMast;
  103. };
  104. #endif // CATDB_HXX