Leaked source code of windows server 2003
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.

213 lines
4.8 KiB

  1. //
  2. // MODULE: CACHEGEN.H
  3. //
  4. // PURPOSE: Cache Generator Header
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  9. //
  10. // AUTHOR: Roman Mach
  11. //
  12. // ORIGINAL DATE: 8/7/97
  13. //
  14. // NOTES:
  15. // 1. >>> Data members in this file could sure use documentation! - JM
  16. //
  17. // Version Date By Comments
  18. //--------------------------------------------------------------------
  19. // V0.2 8/7/97 RM Local Version for Memphis
  20. // V0.3 3/24/98 JM Local Version for NT5
  21. //
  22. #ifndef __CACHEGEN_H_
  23. #define __CACHEGEN_H_ 1
  24. typedef struct _GTS_CACHE_FILE_HEADER
  25. {
  26. unsigned char signature[8];
  27. UINT crcdsc;
  28. UINT crcself;
  29. UINT count; // item count of node data (one item = a set node and rec node structure)
  30. UINT netoffset;
  31. unsigned char reserved[28];
  32. } GTS_CACHE_FILE_HEADER;
  33. // -- property data --
  34. //
  35. // property start block
  36. typedef struct _GTS_CACHE_PROP_NETSTART_BLK
  37. {
  38. UINT netpropoffset;
  39. UINT netpropcount;
  40. UINT nodecountnetwork;
  41. UINT nodecountfile;
  42. } GTS_CACHE_PROP_NETSTART_BLK;
  43. // node item offset block
  44. typedef struct _GTS_CACHE_PROP_NODEOFF_BLK
  45. {
  46. UINT nodeid;
  47. UINT nodeoffset;
  48. } GTS_CACHE_PROP_NODEOFF_BLK;
  49. // node item offset block
  50. typedef struct _GTS_CACHE_PROP_NODESTART_BLK
  51. {
  52. UINT labelnode;
  53. UINT nodestringcount;
  54. } GTS_CACHE_PROP_NODESTART_BLK;
  55. // node item offset block
  56. typedef struct _GTS_CACHE_PROP_STR_BLK
  57. {
  58. UINT nameoffset;
  59. UINT stringoffset;
  60. } GTS_CACHE_PROP_STR_BLK;
  61. #define G_SYMBOLIC_NAME "GSN"
  62. #define G_FULL_NAME "GFN"
  63. #define G_S0_NAME "GS0"
  64. #define G_S1_NAME "GS1"
  65. // node property support
  66. /*
  67. typedef struct _GTS_NODE_SUPPORT
  68. {
  69. fpos_t ctlposition;
  70. fpos_t dataposition;
  71. UINT nodeid;
  72. ESTDLBL albl;
  73. CString sGSymName;
  74. CString sGFullName;
  75. CString sGState0Name;
  76. CString sGState1Name;
  77. CString sHProbTxt;
  78. CString sHNodeHd;
  79. CArray<CString,CString> sHNodeTxt;
  80. } GTS_NODE_SUPPORT;
  81. */
  82. class GTS_NODE_ITEM : public CObject
  83. {
  84. public:
  85. GTS_NODE_ITEM(CString sStringN) { sStringName = sStringN; };
  86. CString sStringName;
  87. CStringArray sStringArr;
  88. fpos_t ctlposition;
  89. fpos_t snameposition;
  90. fpos_t sdataposition;
  91. };
  92. class GTS_NODE_SUPPORT : public CObject
  93. {
  94. public:
  95. fpos_t ctlposition;
  96. fpos_t dataposition;
  97. UINT nodeid;
  98. UINT albl;
  99. CPtrList lData;
  100. };
  101. // -- recommendation data --
  102. //
  103. typedef struct _GTS_CACHE_NODE
  104. {
  105. UINT node; // may be more than one UINT if count > 1
  106. UINT state; // may be more than one UINT if count > 1
  107. } GTS_CACHE_NODE;
  108. // reference structure for set node and rec node
  109. typedef struct _GTS_CACHE_FILE_SETDATA
  110. {
  111. UINT count;
  112. GTS_CACHE_NODE item[1]; // may be more than one UINT if count > 1
  113. } GTS_CACHE_FILE_SETDATA;
  114. // reference structure for rec node
  115. typedef struct _GTS_CACHE_FILE_RECDATA
  116. {
  117. UINT count;
  118. UINT item[1]; // may be more than one UINT if count > 1
  119. } GTS_CACHE_FILE_RECDATA;
  120. // -- node ordering structure
  121. typedef struct _GTS_NODE_ORDER
  122. {
  123. UINT nodeid;
  124. int depth;
  125. } GTS_NODE_ORDER;
  126. // cache item data
  127. /*
  128. typedef struct _BN_CACHE_ITEM {
  129. UINT uNodeCount, uRecCount;
  130. UINT *uName;
  131. UINT *uValue;
  132. UINT *uRec;
  133. } BN_CACHE_ITEM;
  134. */
  135. #define GTS_CACHE_SIG "TSCACH02"
  136. #define STATE_UNKNOWN 102
  137. #define MAX_SYM_NAME_BUF_LEN 500
  138. class GTSCacheGenerator
  139. {
  140. friend class BCache;
  141. public:
  142. GTSCacheGenerator( BOOL bScanAll = FALSE, \
  143. const char *szLogFile = NULL, \
  144. const char *szBNTSLogFile = NULL);
  145. ~GTSCacheGenerator();
  146. static bool TcharToChar(char szOut[], LPCTSTR szIn, int &OutLen);
  147. BOOL ReadCacheFileHeader(CString &sCacheFilename, const CString& strCacheFileWithinCHM);
  148. BOOL GetNextCacheEntryFromFile(BOOL &bErr, CBNCache *pCache);
  149. BOOL FindNetworkProperty(LPCSTR szName, CString &sResult, int index = 0);
  150. BOOL FindNodeProperty(UINT nodeid, LPCSTR szName, CString &sResult, int index = 0);
  151. BOOL IsNodePresent(UINT nodeid);
  152. int GetNodeCount();
  153. BOOL GetNodeIDFromSymName(LPCTSTR szSymName, UINT &nodeid);
  154. BOOL GetLabelOfNode(UINT nodeid, UINT &lbl);
  155. protected:
  156. BOOL NodeTraverse( FILE *fp, \
  157. BNTS *bp, \
  158. int depth, \
  159. CArray<int,int> &newnodes, \
  160. CArray<int,int> &newstates, \
  161. int currnode, \
  162. int currstate);
  163. void UninstantiateAll(BNTS *bp);
  164. void SetNodes(BNTS *bp, CArray<int,int> &nodes, CArray<int,int> &states);
  165. void LogOut(TCHAR *szcFormat, ...);
  166. BOOL GetNCEFF(BN_CACHE_ITEM *pCacheItem, CBNCache *pCache);
  167. void SaveNetItem(CPtrList *nsp, BNTS *bp, FILE *fp, LPCSTR name);
  168. protected:
  169. BOOL m_bScanAll;
  170. UINT m_nCount;
  171. UINT m_nItemCount;
  172. CArray<int,int> m_oldnodes;
  173. const char *m_szBNTSLogFile;
  174. FILE *m_fp;
  175. fpos_t m_headposition;
  176. UINT m_netstartoffset;
  177. char *m_filedata;
  178. GTS_NODE_ORDER *m_nodeorder;
  179. GTS_CACHE_FILE_SETDATA *m_cachepos;
  180. };
  181. #endif