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.

1133 lines
48 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. TaxonomyDatabase.h
  5. Abstract:
  6. Handles DB manipulation of taxonomy
  7. Revision History:
  8. Anand Arvind (aarvind) 2000-03-29
  9. created
  10. Davide Massarenti (dmassare) 2000-04-08
  11. taking ownership
  12. ******************************************************************************/
  13. #if !defined(__INCLUDED___HCP___TAXONOMYDATABASE_H___)
  14. #define __INCLUDED___HCP___TAXONOMYDATABASE_H___
  15. #include <MPC_COM.h>
  16. #include <MPC_Utils.h>
  17. #include <MPC_Config.h>
  18. #include <MPC_Security.h>
  19. #include <set>
  20. #include <JetBlueLib.h>
  21. #include <QueryResult.h>
  22. namespace HHK
  23. {
  24. class Merger;
  25. class Writer;
  26. };
  27. ////////////////////////////////////////////////////////////////////////////////
  28. namespace Taxonomy
  29. {
  30. typedef std::set<MPC::wstring,MPC::NocaseLess> WordSet;
  31. typedef WordSet::iterator WordIter;
  32. typedef WordSet::const_iterator WordIterConst;
  33. typedef std::set<long> MatchSet;
  34. typedef MatchSet::iterator MatchIter;
  35. typedef MatchSet::const_iterator MatchIterConst;
  36. typedef std::map<long,long> WeightedMatchSet;
  37. typedef WeightedMatchSet::iterator WeightedMatchIter;
  38. typedef WeightedMatchSet::const_iterator WeightedMatchIterConst;
  39. ////////////////////////////////////////////////////////////////////////////////
  40. const WCHAR s_szSKU_32_PERSONAL [] = L"Personal_32";
  41. const WCHAR s_szSKU_32_PROFESSIONAL [] = L"Professional_32";
  42. const WCHAR s_szSKU_32_SERVER [] = L"Server_32";
  43. const WCHAR s_szSKU_32_BLADE [] = L"Blade_32";
  44. const WCHAR s_szSKU_32_ADVANCED_SERVER[] = L"AdvancedServer_32";
  45. const WCHAR s_szSKU_32_DATACENTER [] = L"DataCenter_32";
  46. const WCHAR s_szSKU_64_PROFESSIONAL [] = L"Professional_64";
  47. const WCHAR s_szSKU_64_ADVANCED_SERVER[] = L"AdvancedServer_64";
  48. const WCHAR s_szSKU_64_DATACENTER [] = L"DataCenter_64";
  49. class HelpSet;
  50. class Settings;
  51. class Updater;
  52. class KeywordSearch;
  53. class Cache;
  54. ////////////////////
  55. struct Strings;
  56. struct InstanceBase;
  57. struct Instance;
  58. struct Package;
  59. struct ProcessedPackage;
  60. struct InstalledInstance;
  61. class Logger;
  62. class LockingHandle;
  63. class InstallationEngine;
  64. class InstalledInstanceStore;
  65. ////////////////////////////////////////////////////////////////////////////////
  66. class HelpSet
  67. {
  68. public:
  69. static MPC::wstring m_strSKU_Machine;
  70. static long m_lLCID_Machine;
  71. MPC::wstring m_strSKU;
  72. long m_lLCID;
  73. ////////////////////
  74. static HRESULT SetMachineInfo( /*[in]*/ const InstanceBase& inst );
  75. static LPCWSTR GetMachineSKU () { return m_strSKU_Machine.c_str(); }
  76. static long GetMachineLanguage() { return m_lLCID_Machine ; }
  77. static DWORD GetMachineLCID ( );
  78. static DWORD GetUserLCID ( );
  79. static void GetLCIDDisplayString( /*[in]*/ long lLCID, /*[out]*/ MPC::wstring& str );
  80. ////////////////////////////////////////////////////////////////////////////////
  81. HelpSet( /*[in]*/ LPCWSTR szSKU = NULL, /*[in]*/ long lLCID = 0 );
  82. HelpSet ( /*[in]*/ const HelpSet& ths );
  83. HelpSet& operator=( /*[in]*/ const HelpSet& ths );
  84. //////////////////////////////////////////////////////////////////////
  85. HRESULT Initialize( /*[in]*/ LPCWSTR szSKU, /*[in]*/ long lLCID );
  86. HRESULT Initialize( /*[in]*/ LPCWSTR szSKU, /*[in]*/ LPCWSTR szLanguage );
  87. LPCWSTR GetSKU () const { return m_strSKU.c_str(); }
  88. long GetLanguage() const { return m_lLCID ; }
  89. //////////////////////////////////////////////////////////////////////
  90. bool IsMachineHelp() const;
  91. //////////////////////////////////////////////////////////////////////
  92. bool operator==( /*[in]*/ const HelpSet& sel ) const;
  93. bool operator< ( /*[in]*/ const HelpSet& sel ) const;
  94. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ HelpSet& val );
  95. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const HelpSet& val );
  96. };
  97. class Settings : public HelpSet
  98. {
  99. public:
  100. Settings( /*[in]*/ LPCWSTR szSKU = NULL, /*[in]*/ long lLCID = 0 );
  101. Settings( /*[in]*/ const HelpSet& ths );
  102. //////////////////////////////////////////////////////////////////////
  103. static HRESULT SplitNodePath( /*[in]*/ LPCWSTR szNodeStr, /*[out]*/ MPC::WStringVector& vec );
  104. HRESULT BaseDir ( /*[out]*/ MPC::wstring& strRES, /*[in]*/ bool fExpand = true ) const;
  105. HRESULT HelpFilesDir( /*[out]*/ MPC::wstring& strRES, /*[in]*/ bool fExpand = true, /*[in]*/ bool fMUI = false ) const;
  106. HRESULT DatabaseDir ( /*[out]*/ MPC::wstring& strRES ) const;
  107. HRESULT DatabaseFile( /*[out]*/ MPC::wstring& strRES ) const;
  108. HRESULT IndexFile ( /*[out]*/ MPC::wstring& strRES, /*[in]*/ long lScoped = -1 ) const;
  109. HRESULT GetDatabase( /*[out]*/ JetBlue::SessionHandle& handle, /*[out]*/ JetBlue::Database*& db, /*[in]*/ bool fReadOnly ) const;
  110. //////////////////////////////////////////////////////////////////////
  111. HRESULT LookupNode ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  112. HRESULT LookupSubNodes ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  113. HRESULT LookupNodesAndTopics( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  114. HRESULT LookupTopics ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  115. HRESULT LocateContext ( /*[in]*/ LPCWSTR szURL , /*[in]*/ LPCWSTR szSubSite, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  116. HRESULT KeywordSearch ( /*[in]*/ LPCWSTR szQueryStr, /*[in]*/ LPCWSTR szSubSite, /*[in]*/ CPCHQueryResultCollection* pColl ,
  117. /*[in]*/ MPC::WStringList* lst ) const;
  118. HRESULT GatherNodes ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  119. HRESULT GatherTopics ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl ) const;
  120. };
  121. ////////////////////////////////////////////////////////////////////////////////
  122. ////////////////////////////////////////////////////////////////////////////////
  123. struct QueryResultEntry
  124. {
  125. long m_ID_node;
  126. long m_ID_topic;
  127. long m_ID_parent;
  128. long m_ID_owner;
  129. long m_lOriginalPos;
  130. CPCHQueryResult::Payload m_data;
  131. ////////////////////
  132. QueryResultEntry();
  133. };
  134. class QueryResults
  135. {
  136. typedef std::vector<QueryResultEntry*> ResultVec;
  137. typedef ResultVec::iterator ResultIter;
  138. typedef ResultVec::const_iterator ResultIterConst;
  139. class Compare
  140. {
  141. public:
  142. bool operator()( /*[in]*/ const QueryResultEntry* left, /*[in]*/ const QueryResultEntry* right ) const;
  143. };
  144. Taxonomy::Updater& m_updater;
  145. ResultVec m_vec;
  146. ////////////////////
  147. HRESULT AllocateNew( /*[in]*/ LPCWSTR szCategory, /*[out]*/ QueryResultEntry*& qre );
  148. HRESULT Sort();
  149. public:
  150. QueryResults( /*[in]*/ Taxonomy::Updater& updater );
  151. ~QueryResults();
  152. void Clean();
  153. HRESULT Append( /*[in]*/ Taxonomy::RS_Data_Taxonomy* rs, /*[in]*/ LPCWSTR szCategory );
  154. HRESULT Append( /*[in]*/ Taxonomy::RS_Data_Topics* rs, /*[in]*/ LPCWSTR szCategory );
  155. HRESULT LookupNodes ( /*[in]*/ LPCWSTR szCategory, /*[in]*/ long ID_node, /*[in]*/ bool fVisibleOnly );
  156. HRESULT LookupTopics( /*[in]*/ LPCWSTR szCategory, /*[in]*/ long ID_node, /*[in]*/ bool fVisibleOnly );
  157. HRESULT MakeRoomForInsert( /*[in]*/ LPCWSTR szMode, /*[in]*/ LPCWSTR szID, /*[in]*/ long ID_node, /*[out]*/ long& lPosRet );
  158. HRESULT PopulateCollection( /*[in]*/ CPCHQueryResultCollection* pColl );
  159. };
  160. ////////////////////////////////////////////////////////////////////////////////
  161. ////////////////////////////////////////////////////////////////////////////////
  162. typedef enum
  163. {
  164. UPDATER_SET_STOPSIGNS = 0,
  165. UPDATER_SET_STOPSIGNS_ATENDOFWORD ,
  166. UPDATER_SET_STOPWORDS ,
  167. UPDATER_SET_OPERATOR_NOT ,
  168. UPDATER_SET_OPERATOR_AND ,
  169. UPDATER_SET_OPERATOR_OR ,
  170. UPDATER_SET_OPERATOR_MAX
  171. } Updater_Set;
  172. struct Updater_Stat
  173. {
  174. struct Entity
  175. {
  176. int m_iCreated;
  177. int m_iModified;
  178. int m_iDeleted;
  179. int m_iNoOp;
  180. Entity()
  181. {
  182. m_iCreated = 0;
  183. m_iModified = 0;
  184. m_iDeleted = 0;
  185. m_iNoOp = 0;
  186. }
  187. void Created () { m_iCreated ++; }
  188. void Modified() { m_iModified++; }
  189. void Deleted () { m_iDeleted ++; }
  190. void NoOp () { m_iNoOp ++; }
  191. };
  192. ////////////////////
  193. Entity m_entContentOwners ;
  194. Entity m_entSynSets ;
  195. Entity m_entHelpImage ;
  196. Entity m_entIndexFiles ;
  197. Entity m_entFullTextSearch;
  198. Entity m_entScope ;
  199. Entity m_entTaxonomy ;
  200. Entity m_entTopics ;
  201. Entity m_entSynonyms ;
  202. Entity m_entKeywords ;
  203. Entity m_entMatches ;
  204. };
  205. class Updater
  206. {
  207. public:
  208. struct WordSetDef
  209. {
  210. LPCWSTR szName;
  211. bool fSplitAtDelimiter;
  212. LPCWSTR szDefault;
  213. LPCWSTR szAlwaysPresent;
  214. };
  215. struct WordSetStatus
  216. {
  217. Updater* m_updater;
  218. const WordSetDef* m_def;
  219. WordSet m_set;
  220. bool m_fLoaded;
  221. bool m_fModified;
  222. WordSetStatus();
  223. HRESULT Close( );
  224. HRESULT Init ( /*[in]*/ Updater* updater, /*[in]*/ const WordSetDef* def );
  225. HRESULT Load();
  226. HRESULT Save();
  227. HRESULT Add ( /*[in]*/ LPCWSTR szValue );
  228. HRESULT Remove( /*[in]*/ LPCWSTR szValue );
  229. };
  230. private:
  231. Settings m_ts;
  232. JetBlue::Database* m_db;
  233. Cache* m_cache;
  234. bool m_fUseCache;
  235. RS_DBParameters* m_rsDBParameters;
  236. RS_ContentOwners* m_rsContentOwners;
  237. RS_SynSets* m_rsSynSets;
  238. RS_HelpImage* m_rsHelpImage;
  239. RS_IndexFiles* m_rsIndexFiles;
  240. RS_FullTextSearch* m_rsFullTextSearch;
  241. RS_Scope* m_rsScope;
  242. RS_Taxonomy* m_rsTaxonomy;
  243. RS_Topics* m_rsTopics;
  244. RS_Synonyms* m_rsSynonyms;
  245. RS_Keywords* m_rsKeywords;
  246. RS_Matches* m_rsMatches;
  247. long m_ID_owner;
  248. bool m_fOEM;
  249. MPC::wstring m_strDBLocation;
  250. WordSetStatus m_sets[UPDATER_SET_OPERATOR_MAX];
  251. JetBlue::Id2Node m_nodes;
  252. JetBlue::Node2Id m_nodes_reverse;
  253. Updater_Stat m_stat;
  254. ////////////////////////////////////////
  255. HRESULT DeleteAllTopicsUnderANode ( /*[in]*/ RS_Topics* rs, /*[in]*/ long ID_node, /*[in]*/ bool fCheck );
  256. HRESULT DeleteAllSubNodes ( /*[in]*/ RS_Taxonomy* rs, /*[in]*/ long ID_node, /*[in]*/ bool fCheck );
  257. HRESULT DeleteAllMatchesPointingToTopic( /*[in]*/ RS_Matches* rs, /*[in]*/ long ID_topic );
  258. ////////////////////////////////////////
  259. bool NodeCache_FindNode( /*[in]*/ MPC::wstringUC& strPathUC, /*[out]*/ JetBlue::Id2NodeIter& itNode );
  260. bool NodeCache_FindId ( /*[in]*/ long ID_node , /*[out]*/ JetBlue::Node2IdIter& itId );
  261. void NodeCache_Add ( /*[in]*/ MPC::wstringUC& strPathUC, /*[in]*/ long ID_node );
  262. void NodeCache_Remove( /*[in]*/ long ID_node );
  263. void NodeCache_Clear ( );
  264. ////////////////////////////////////////
  265. private: // Disable copy constructors...
  266. Updater ( /*[in]*/ const Updater& );
  267. Updater& operator=( /*[in]*/ const Updater& );
  268. public:
  269. Updater();
  270. ~Updater();
  271. ////////////////////////////////////////
  272. HRESULT FlushWordSets( );
  273. HRESULT Close ( );
  274. HRESULT Init ( /*[in]*/ const Settings& ts, /*[in]*/ JetBlue::Database* db, /*[in]*/ Cache* cache = NULL );
  275. void SetCacheFlag( /*[in]*/ bool fOn ) { m_fUseCache = fOn; }
  276. HRESULT GetWordSet ( /*[in]*/ Updater_Set id, /*[out]*/ WordSet* *pVal = NULL );
  277. HRESULT GetDBParameters ( /*[out]*/ RS_DBParameters* *pVal = NULL );
  278. HRESULT GetContentOwners ( /*[out]*/ RS_ContentOwners* *pVal = NULL );
  279. HRESULT GetSynSets ( /*[out]*/ RS_SynSets* *pVal = NULL );
  280. HRESULT GetHelpImage ( /*[out]*/ RS_HelpImage* *pVal = NULL );
  281. HRESULT GetIndexFiles ( /*[out]*/ RS_IndexFiles* *pVal = NULL );
  282. HRESULT GetFullTextSearch( /*[out]*/ RS_FullTextSearch* *pVal = NULL );
  283. HRESULT GetScope ( /*[out]*/ RS_Scope* *pVal = NULL );
  284. HRESULT GetTaxonomy ( /*[out]*/ RS_Taxonomy* *pVal = NULL );
  285. HRESULT GetTopics ( /*[out]*/ RS_Topics* *pVal = NULL );
  286. HRESULT GetSynonyms ( /*[out]*/ RS_Synonyms* *pVal = NULL );
  287. HRESULT GetKeywords ( /*[out]*/ RS_Keywords* *pVal = NULL );
  288. HRESULT GetMatches ( /*[out]*/ RS_Matches* *pVal = NULL );
  289. ////////////////////////////////////////
  290. long GetOwner() { return m_ID_owner; }
  291. bool IsOEM () { return m_fOEM; }
  292. const MPC::wstring& GetHelpLocation();
  293. Updater_Stat& Stat() { return m_stat; }
  294. ////////////////////////////////////////
  295. HRESULT ReadDBParameter ( /*[in]*/ LPCWSTR szName, /*[out]*/ MPC::wstring& strValue, /*[out]*/ bool *pfFound = NULL );
  296. HRESULT ReadDBParameter ( /*[in]*/ LPCWSTR szName, /*[out]*/ long& lValue, /*[out]*/ bool *pfFound = NULL );
  297. HRESULT WriteDBParameter( /*[in]*/ LPCWSTR szName, /*[in ]*/ LPCWSTR szValue );
  298. HRESULT WriteDBParameter( /*[in]*/ LPCWSTR szName, /*[in ]*/ long lValue );
  299. HRESULT AddWordToSet ( /*[in]*/ Updater_Set id, /*[in]*/ LPCWSTR szValue );
  300. HRESULT RemoveWordFromSet( /*[in]*/ Updater_Set id, /*[in]*/ LPCWSTR szValue );
  301. HRESULT ExpandURL ( /*[in/out]*/ MPC::wstring& strURL );
  302. HRESULT CollapseURL( /*[in/out]*/ MPC::wstring& strURL );
  303. HRESULT ListAllTheHelpFiles( /*[out]*/ MPC::WStringList& lstFiles );
  304. HRESULT GetIndexInfo( /*[out]*/ MPC::wstring& strLocation, /*[out]*/ MPC::wstring& strDisplayName, /*[in]*/ LPCWSTR szScope );
  305. ////////////////////////////////////////
  306. HRESULT DeleteOwner( );
  307. HRESULT LocateOwner( /*[in]*/ LPCWSTR szDN );
  308. HRESULT CreateOwner( /*[out]*/ long& ID_owner, /*[in]*/ LPCWSTR szDN, /*[in]*/ bool fIsOEM );
  309. ////////////////////////////////////////
  310. HRESULT DeleteSynSet( /*[in]*/ LPCWSTR szName );
  311. HRESULT LocateSynSet( /*[out]*/ long& ID_synset, /*[in]*/ LPCWSTR szName );
  312. HRESULT CreateSynSet( /*[out]*/ long& ID_synset, /*[in]*/ LPCWSTR szName );
  313. HRESULT DeleteSynonym( /*[in]*/ long ID_synset, /*[in]*/ LPCWSTR szName );
  314. HRESULT CreateSynonym( /*[in]*/ long ID_synset, /*[in]*/ LPCWSTR szName );
  315. HRESULT LocateSynonyms( /*[in]*/ LPCWSTR szName, /*[out]*/ MPC::WStringList& lst, /*[in]*/ bool fMatchOwner );
  316. ////////////////////////////////////////
  317. HRESULT AddFile ( /*[in]*/ LPCWSTR szFile );
  318. HRESULT RemoveFile( /*[in]*/ LPCWSTR szFile );
  319. ////////////////////////////////////////
  320. HRESULT RemoveScope( /*[in ]*/ long ID_Scope );
  321. HRESULT LocateScope( /*[out]*/ long& ID_Scope, /*[out]*/ long& lOwner, /*[in]*/ LPCWSTR szID );
  322. HRESULT CreateScope( /*[out]*/ long& ID_Scope , /*[in]*/ LPCWSTR szID, /*[in]*/ LPCWSTR szName, /*[in]*/ LPCWSTR szCategory );
  323. ////////////////////////////////////////
  324. HRESULT AddIndexFile ( /*[in]*/ long ID_Scope, /*[in]*/ LPCWSTR szStorage, /*[in]*/ LPCWSTR szFile );
  325. HRESULT RemoveIndexFile( /*[in]*/ long ID_Scope, /*[in]*/ LPCWSTR szStorage, /*[in]*/ LPCWSTR szFile );
  326. ////////////////////////////////////////
  327. HRESULT AddFullTextSearchQuery ( /*[in]*/ long ID_Scope, /*[in]*/ LPCWSTR szCHM, /*[in]*/ LPCWSTR szCHQ );
  328. HRESULT RemoveFullTextSearchQuery( /*[in]*/ long ID_Scope, /*[in]*/ LPCWSTR szCHM );
  329. ////////////////////////////////////////
  330. HRESULT DeleteTaxonomyNode( /*[in ]*/ long ID_node );
  331. HRESULT LocateTaxonomyNode( /*[out]*/ long& ID_node, /*[in]*/ LPCWSTR szTaxonomyPath ,
  332. /*[in]*/ bool fLookForFather );
  333. HRESULT CreateTaxonomyNode( /*[out]*/ long& ID_node, /*[in]*/ LPCWSTR szTaxonomyPath ,
  334. /*[in]*/ LPCWSTR szTitle ,
  335. /*[in]*/ LPCWSTR szDescription ,
  336. /*[in]*/ LPCWSTR szURI ,
  337. /*[in]*/ LPCWSTR szIconURI ,
  338. /*[in]*/ bool fVisible ,
  339. /*[in]*/ bool fSubsite ,
  340. /*[in]*/ long lNavModel ,
  341. /*[in]*/ long lPos );
  342. ////////////////////////////////////////
  343. HRESULT DeleteTopicEntry( /*[in ]*/ long ID_topic );
  344. HRESULT LocateTopicEntry( /*[out]*/ long& ID_topic ,
  345. /*[in ]*/ long ID_node ,
  346. /*[in ]*/ LPCWSTR szURI ,
  347. /*[in ]*/ bool fCheckOwner );
  348. HRESULT CreateTopicEntry( /*[out]*/ long& ID_topic ,
  349. /*[in ]*/ long ID_node ,
  350. /*[in ]*/ LPCWSTR szTitle ,
  351. /*[in ]*/ LPCWSTR szURI ,
  352. /*[in ]*/ LPCWSTR szDescription ,
  353. /*[in ]*/ LPCWSTR szIconURI ,
  354. /*[in ]*/ long lType ,
  355. /*[in ]*/ bool fVisible ,
  356. /*[in ]*/ long lPos );
  357. ////////////////////////////////////////
  358. HRESULT CreateMatch( /*[in]*/ LPCWSTR szKeyword, /*[in]*/ long ID_topic, /*[in]*/ long lPriority = 0, /*[in]*/ bool fHHK = true );
  359. ////////////////////////////////////////
  360. HRESULT MakeRoomForInsert( /*[in]*/ LPCWSTR szNodeStr, /*[in]*/ LPCWSTR szMode, /*[in]*/ LPCWSTR szID, /*[out]*/ long& lPos );
  361. HRESULT LocateSubNodes ( /*[in]*/ long ID_node, /*[in]*/ bool fRecurse, /*[in]*/ bool fOnlyVisible, /*[out]*/ MatchSet& res );
  362. HRESULT LocateNodesFromURL( /*[in]*/ LPCWSTR szURL , /*[out]*/ MatchSet& res );
  363. HRESULT LookupNode ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ CPCHQueryResultCollection* pColl );
  364. HRESULT LookupSubNodes ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl );
  365. HRESULT LookupNodesAndTopics( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl );
  366. HRESULT LookupTopics ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl );
  367. HRESULT LocateContext ( /*[in]*/ LPCWSTR szURL , /*[in]*/ LPCWSTR szSubSite, /*[in]*/ CPCHQueryResultCollection* pColl );
  368. HRESULT KeywordSearch ( /*[in]*/ LPCWSTR szQueryStr, /*[in]*/ LPCWSTR szSubSite, /*[in]*/ CPCHQueryResultCollection* pColl ,
  369. /*[in]*/ MPC::WStringList* lst );
  370. HRESULT GatherNodes ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl );
  371. HRESULT GatherTopics ( /*[in]*/ LPCWSTR szNodeStr , /*[in]*/ bool fVisibleOnly, /*[in]*/ CPCHQueryResultCollection* pColl );
  372. };
  373. ////////////////////////////////////////////////////////////////////////////////
  374. ////////////////////////////////////////////////////////////////////////////////
  375. class KeywordSearch
  376. {
  377. typedef enum
  378. {
  379. TOKEN_INVALID = -1,
  380. TOKEN_EMPTY ,
  381. TOKEN_TEXT ,
  382. TOKEN_PAREN_OPEN ,
  383. TOKEN_PAREN_CLOSE ,
  384. TOKEN_NOT ,
  385. TOKEN_AND_IMPLICIT ,
  386. TOKEN_AND ,
  387. TOKEN_OR
  388. } TOKEN;
  389. struct Token
  390. {
  391. TOKEN m_type;
  392. MPC::wstring m_strToken;
  393. WeightedMatchSet m_results;
  394. Token* m_left; // Only for operators.
  395. Token* m_right; //
  396. Token();
  397. ~Token();
  398. bool HasNOT();
  399. bool HasExplicitOperators();
  400. void AddHit( /*[in]*/ long ID, /*[in]*/ long priority );
  401. HRESULT ExecuteText( /*[in]*/ LPCWSTR szKeyword, /*[in]*/ RS_Keywords* rsKeywords, /*[in]*/ RS_Matches* rsMatches );
  402. HRESULT Execute ( /*[in]*/ MatchSet& setAllTheTopics, /*[in]*/ Updater& updater , /*[in]*/ RS_Keywords* rsKeywords, /*[in]*/ RS_Matches* rsMatches );
  403. void CollectKeywords( /*[in/out]*/ MPC::WStringList& lst ) const;
  404. HRESULT Stringify( /*[in]*/ MPC::wstring& strNewQuery );
  405. };
  406. ////////////////////////////////////////
  407. Updater& m_updater;
  408. RS_Topics* m_rsTopics;
  409. RS_Keywords* m_rsKeywords;
  410. RS_Matches* m_rsMatches;
  411. WordSet* m_setStopSignsWithoutContext;
  412. WordSet* m_setStopSignsAtEnd;
  413. WordSet* m_setStopWords;
  414. WordSet* m_setOpNOT;
  415. WordSet* m_setOpAND;
  416. WordSet* m_setOpOR;
  417. ////////////////////////////////////////
  418. LPCWSTR SkipWhite( /*[in]*/ LPCWSTR szStr );
  419. bool IsNotString( /*[in]*/ LPCWSTR szSrc, /*[in]*/ WCHAR cQuote );
  420. bool IsQueryChar( /*[in]*/ WCHAR c );
  421. void RemoveStopSignsWithoutContext( /*[in]*/ LPWSTR szText );
  422. void RemoveStopSignsAtEnd ( /*[in]*/ LPWSTR szText );
  423. void CopyAndEliminateExtraWhiteSpace( /*[in]*/ LPCWSTR szSrc, /*[out]*/ LPWSTR szDst );
  424. TOKEN NextToken( /*[in/out]*/ LPCWSTR& szSrc, /*[out]*/ LPWSTR szToken );
  425. ////////////////////////////////////////
  426. HRESULT AllocateQuery ( /*[in] */ const MPC::wstring& strQuery, /*[out]*/ LPWSTR& szInput, /*[out]*/ LPWSTR& szOutput );
  427. HRESULT PreprocessQuery( /*[in/out]*/ MPC::wstring& strQuery );
  428. ////////////////////////////////////////
  429. HRESULT Parse( /*[in/out]*/ LPCWSTR& szInput, /*[in]*/ LPWSTR szTmpBuf, /*[in]*/ bool fSubExpr, /*[out]*/ Token*& res );
  430. HRESULT GenerateResults( /*[in]*/ Token* obj, /*[in]*/ CPCHQueryResultCollection* pColl, /*[in]*/ MPC::WStringUCSet& setURLs, /*[in]*/ Taxonomy::MatchSet* psetNodes );
  431. public:
  432. KeywordSearch( /*[in]*/ Updater& updater );
  433. ~KeywordSearch();
  434. HRESULT Execute( /*[in]*/ LPCWSTR szQuery, /*[in]*/ LPCWSTR szSubsite, /*[in]*/ CPCHQueryResultCollection* pColl, /*[in]*/ MPC::WStringList* lst );
  435. };
  436. ////////////////////////////////////////////////////////////////////////////////
  437. ////////////////////////////////////////////////////////////////////////////////
  438. class Cache : public CComObjectRootEx<MPC::CComSafeMultiThreadModel> // Just to have locking...
  439. {
  440. public:
  441. class NodeEntry;
  442. class QueryEntry;
  443. class SortEntries;
  444. class CachedHelpSet;
  445. ////////////////////
  446. class NodeEntry
  447. {
  448. friend class CachedHelpSet;
  449. ////////////////////
  450. RS_Data_Taxonomy m_rs_data;
  451. ////////////////////
  452. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ NodeEntry& val );
  453. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const NodeEntry& val );
  454. public:
  455. NodeEntry();
  456. bool operator< ( /*[in]*/ NodeEntry const &en ) const;
  457. bool operator==( /*[in]*/ long ID ) const;
  458. class MatchNode
  459. {
  460. long m_ID;
  461. public:
  462. MatchNode( /*[in]*/ long ID );
  463. bool operator()( /*[in]*/ NodeEntry const &en ) const;
  464. };
  465. };
  466. class QueryEntry
  467. {
  468. friend class CachedHelpSet;
  469. friend class SortEntries;
  470. ////////////////////
  471. MPC::wstring m_strID;
  472. int m_iType;
  473. int m_iSequence;
  474. bool m_fNull;
  475. DWORD m_dwSize;
  476. DATE m_dLastUsed;
  477. bool m_fRemoved;
  478. ////////////////////
  479. void Touch();
  480. HRESULT GetFile( /*[out]*/ MPC::wstring& strFile );
  481. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ QueryEntry& val );
  482. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const QueryEntry& val );
  483. ////////////////////
  484. public:
  485. QueryEntry();
  486. bool operator<( /*[in]*/ QueryEntry const &en ) const;
  487. HRESULT Store ( /*[in]*/ MPC::StorageObject& disk, /*[in]*/ const CPCHQueryResultCollection* pColl );
  488. HRESULT Retrieve( /*[in]*/ MPC::StorageObject& disk, /*[in]*/ CPCHQueryResultCollection* pColl );
  489. HRESULT Release ( /*[in]*/ MPC::StorageObject& disk );
  490. };
  491. typedef std::set<NodeEntry> NodeEntrySet;
  492. typedef NodeEntrySet::iterator NodeEntryIter;
  493. typedef NodeEntrySet::const_iterator NodeEntryIterConst;
  494. typedef std::set<QueryEntry> QueryEntrySet;
  495. typedef QueryEntrySet::iterator QueryEntryIter;
  496. typedef QueryEntrySet::const_iterator QueryEntryIterConst;
  497. typedef std::vector<QueryEntry*> SortedEntryVec;
  498. typedef SortedEntryVec::iterator SortedEntryIter;
  499. typedef SortedEntryVec::const_iterator SortedEntryIterConst;
  500. class SortEntries
  501. {
  502. public:
  503. bool operator()( /*[in]*/ QueryEntry* const &left, /*[in]*/ QueryEntry* const &right ) const;
  504. };
  505. class CachedHelpSet
  506. {
  507. friend class Cache;
  508. Taxonomy::HelpSet m_ths;
  509. MPC::wstring m_strFile;
  510. MPC::StorageObject m_disk;
  511. bool m_fLoaded;
  512. bool m_fDirty;
  513. bool m_fMarkedForLoad;
  514. DATE m_dLastSaved;
  515. long m_lTopNode;
  516. NodeEntrySet m_setNodes;
  517. QueryEntrySet m_setQueries;
  518. int m_iLastSequence;
  519. void Init ( );
  520. void Clean ( );
  521. HRESULT Load ( );
  522. HRESULT Save ( );
  523. HRESULT EnsureInSync( /*[in]*/ bool fForceSave = false );
  524. ////////////////////
  525. HRESULT GenerateDefaultQueries( /*[in]*/ Taxonomy::Settings& ts ,
  526. /*[in]*/ Taxonomy::Updater& updater ,
  527. /*[in]*/ long ID ,
  528. /*[in]*/ long lLevel );
  529. HRESULT GenerateDefaultQueries( /*[in]*/ Taxonomy::Settings& ts ,
  530. /*[in]*/ Taxonomy::Updater& updater );
  531. bool LocateNode( /*[in]*/ long ID_parent, /*[in]*/ LPCWSTR szEntry, /*[out]*/ NodeEntryIter& it );
  532. public:
  533. CachedHelpSet();
  534. ~CachedHelpSet();
  535. // copy constructors...
  536. CachedHelpSet ( /*[in]*/ const CachedHelpSet& chs );
  537. CachedHelpSet& operator=( /*[in]*/ const CachedHelpSet& chs );
  538. bool operator<( /*[in]*/ CachedHelpSet const &chs ) const;
  539. HRESULT PrePopulate ( /*[in]*/ Cache* parent );
  540. HRESULT Erase ( );
  541. HRESULT PrepareToLoad( );
  542. HRESULT LoadIfMarked ( );
  543. HRESULT MRU ( );
  544. HRESULT LocateNode( /*[in]*/ long ID_parent, /*[in]*/ LPCWSTR szEntry, /*[out]*/ RS_Data_Taxonomy& rs_data );
  545. HRESULT LocateSubNodes ( /*[in]*/ long ID_node, /*[in]*/ bool fRecurse, /*[in]*/ bool fOnlyVisible, /*[out]*/ MatchSet& res );
  546. HRESULT LocateNodesFromURL( /*[in]*/ LPCWSTR szURL , /*[out]*/ MatchSet& res );
  547. HRESULT BuildNodePath( /*[in]*/ long ID, /*[out]*/ MPC::wstring& strPath , /*[in]*/ bool fParent );
  548. HRESULT LocateQuery( /*[in]*/ LPCWSTR szID, /*[in]*/ int iType, /*[out]*/ QueryEntry* &pEntry, /*[in]*/ bool fCreate );
  549. };
  550. typedef std::set<CachedHelpSet> CacheSet;
  551. typedef CacheSet::iterator CacheIter;
  552. typedef CacheSet::const_iterator CacheIterConst;
  553. private:
  554. ////////////////////
  555. CacheSet m_skus;
  556. HRESULT Locate( /*[in]*/ const Taxonomy::HelpSet& ths, /*[out]*/ CacheIter& it );
  557. void Shutdown();
  558. ////////////////////
  559. public:
  560. Cache();
  561. ~Cache();
  562. ////////////////////////////////////////////////////////////////////////////////
  563. static Cache* s_GLOBAL;
  564. static HRESULT InitializeSystem();
  565. static void FinalizeSystem ();
  566. ////////////////////////////////////////////////////////////////////////////////
  567. HRESULT PrePopulate ( /*[in]*/ const Taxonomy::HelpSet& ths );
  568. HRESULT Erase ( /*[in]*/ const Taxonomy::HelpSet& ths );
  569. HRESULT PrepareToLoad( /*[in]*/ const Taxonomy::HelpSet& ths );
  570. HRESULT LoadIfMarked ( /*[in]*/ const Taxonomy::HelpSet& ths );
  571. HRESULT LocateNode( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ long ID_parent, /*[in]*/ LPCWSTR szEntry, /*[out]*/ RS_Data_Taxonomy& rs_data );
  572. HRESULT LocateSubNodes ( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ long ID_node, /*[in]*/ bool fRecurse, /*[in]*/ bool fOnlyVisible, /*[out]*/ MatchSet& res );
  573. HRESULT LocateNodesFromURL( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ LPCWSTR szURL , /*[out]*/ MatchSet& res );
  574. HRESULT BuildNodePath( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ long ID, /*[out]*/ MPC::wstring& strPath, /*[in]*/ bool fParent );
  575. HRESULT StoreQuery ( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ LPCWSTR szID, /*[in]*/ int iType, /*[in]*/ const CPCHQueryResultCollection* pColl );
  576. HRESULT RetrieveQuery( /*[in]*/ const Taxonomy::HelpSet& ths, /*[in]*/ LPCWSTR szID, /*[in]*/ int iType, /*[in]*/ CPCHQueryResultCollection* pColl );
  577. };
  578. ////////////////////////////////////////////////////////////////////////////////
  579. ////////////////////////////////////////////////////////////////////////////////
  580. struct Strings
  581. {
  582. static LPCWSTR const s_file_PackageDescription;
  583. static LPCWSTR const s_tag_root_PackageDescription;
  584. static LPCWSTR const s_tag_root_HHT;
  585. static LPCWSTR const s_tag_root_SAF;
  586. };
  587. class Logger
  588. {
  589. MPC::FileLog m_obj;
  590. DWORD m_dwLogging;
  591. public:
  592. Logger();
  593. ~Logger();
  594. HRESULT StartLog ( /*[in]*/ LPCWSTR szLocation = NULL );
  595. HRESULT EndLog ( );
  596. HRESULT WriteLogV( /*[in]*/ HRESULT hr, /*[in]*/ LPCWSTR szLogFormat, /*[in]*/ va_list arglist );
  597. HRESULT WriteLog ( /*[in]*/ HRESULT hr, /*[in]*/ LPCWSTR szLogFormat, ... );
  598. };
  599. struct InstanceBase // MACHINE-INDEPENDENT
  600. {
  601. Taxonomy::HelpSet m_ths;
  602. MPC::wstring m_strDisplayName;
  603. MPC::wstring m_strProductID;
  604. MPC::wstring m_strVersion;
  605. bool m_fDesktop;
  606. bool m_fServer;
  607. bool m_fEmbedded;
  608. ////////////////////
  609. InstanceBase();
  610. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ InstanceBase& val );
  611. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const InstanceBase& val );
  612. bool Match( /*[in]*/ LPCWSTR szSKU, /*[in]*/ LPCWSTR szLanguage );
  613. bool Match( /*[in]*/ const Package& pkg );
  614. };
  615. struct Instance : public InstanceBase // MACHINE-DEPENDENT
  616. {
  617. bool m_fSystem;
  618. bool m_fMUI;
  619. bool m_fExported;
  620. DATE m_dLastUpdated;
  621. MPC::wstring m_strSystem;
  622. MPC::wstring m_strHelpFiles;
  623. MPC::wstring m_strDatabaseDir;
  624. MPC::wstring m_strDatabaseFile;
  625. MPC::wstring m_strIndexFile;
  626. MPC::wstring m_strIndexDisplayName;
  627. ////////////////////
  628. Instance();
  629. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ Instance& val );
  630. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const Instance& val );
  631. HRESULT LoadFromStream( /*[in]*/ IStream* stream );
  632. HRESULT SaveToStream ( /*[in]*/ IStream* stream ) const;
  633. HRESULT InitializeFromBase( /*[in]*/ const InstanceBase& base, /*[in]*/ bool fSystem, /*[in]*/ bool fMUI );
  634. ////////////////////
  635. void SetTimeStamp();
  636. HRESULT GetFileName( /*[out]*/ MPC::wstring& strFile );
  637. HRESULT Import ( /*[in]*/ LPCWSTR szFile, /*[in/out]*/ DWORD* pdwCRC );
  638. HRESULT Remove ( );
  639. };
  640. typedef std::list<Instance> InstanceList;
  641. typedef InstanceList::iterator InstanceIter;
  642. typedef InstanceList::const_iterator InstanceIterConst;
  643. ////////////////////
  644. struct Package
  645. {
  646. static const DWORD c_Cmp_SKU = 0x0001;
  647. static const DWORD c_Cmp_ID = 0x0002;
  648. static const DWORD c_Cmp_VERSION = 0x0004;
  649. MPC::wstring m_strFileName; // VOLATILE
  650. bool m_fTemporary; // VOLATILE Used for packages not yet authenticated.
  651. long m_lSequence;
  652. DWORD m_dwCRC;
  653. MPC::wstring m_strSKU;
  654. MPC::wstring m_strLanguage;
  655. MPC::wstring m_strVendorID;
  656. MPC::wstring m_strVendorName;
  657. MPC::wstring m_strProductID;
  658. MPC::wstring m_strVersion;
  659. bool m_fMicrosoft;
  660. bool m_fBuiltin; // Used for packages installed as part of the setup.
  661. ////////////////////
  662. Package();
  663. ~Package();
  664. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ Package& val );
  665. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const Package& val );
  666. int Compare( /*[in]*/ const Package& pkg, /*[in]*/ DWORD dwMode = -1 ) const;
  667. HRESULT GenerateFileName();
  668. HRESULT Import ( /*[in]*/ Logger& log, /*[in]*/ LPCWSTR szFile, /*[in]*/ long lSequence, /*[in]*/ MPC::Impersonation* imp );
  669. HRESULT Authenticate( /*[in]*/ Logger& log );
  670. HRESULT Remove ( /*[in]*/ Logger& log );
  671. HRESULT ExtractFile ( /*[in]*/ Logger& log, /*[in]*/ LPCWSTR szFileDestination , /*[in]*/ LPCWSTR szNameInCabinet );
  672. HRESULT ExtractXMLFile( /*[in]*/ Logger& log, /*[in]*/ MPC::XmlUtil& xml, /*[in]*/ LPCWSTR szTag, /*[in]*/ LPCWSTR szNameInCabinet );
  673. HRESULT ExtractPkgDesc( /*[in]*/ Logger& log, /*[in]*/ MPC::XmlUtil& xml );
  674. };
  675. typedef std::list<Package> PackageList;
  676. typedef PackageList::iterator PackageIter;
  677. typedef PackageList::const_iterator PackageIterConst;
  678. ////////////////////
  679. struct ProcessedPackage
  680. {
  681. long m_lSequence;
  682. bool m_fProcessed;
  683. bool m_fDisabled;
  684. ////////////////////
  685. ProcessedPackage();
  686. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ ProcessedPackage& val );
  687. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const ProcessedPackage& val );
  688. };
  689. typedef std::list<ProcessedPackage> ProcessedPackageList;
  690. typedef ProcessedPackageList::iterator ProcessedPackageIter;
  691. typedef ProcessedPackageList::const_iterator ProcessedPackageIterConst;
  692. ////////////////////
  693. struct InstalledInstance
  694. {
  695. Instance m_inst;
  696. ProcessedPackageList m_lst;
  697. bool m_fInvalidated;
  698. bool m_fRecreateCache;
  699. bool m_fCreateIndex;
  700. bool m_fCreateIndexForce;
  701. DWORD m_dwCRC;
  702. DWORD m_dwRef; // VOLATILE
  703. ////////////////////
  704. InstalledInstance();
  705. friend HRESULT operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ InstalledInstance& val );
  706. friend HRESULT operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const InstalledInstance& val );
  707. bool InUse() { return (m_dwRef != 0); }
  708. HRESULT InstallFiles ( /*[in]*/ bool fAlsoHelpFiles, /*[in]*/ InstalledInstanceStore* store );
  709. HRESULT UninstallFiles( /*[in]*/ bool fAlsoHelpFiles );
  710. };
  711. typedef std::list<InstalledInstance> InstalledInstanceList;
  712. typedef InstalledInstanceList::iterator InstalledInstanceIter;
  713. typedef InstalledInstanceList::const_iterator InstalledInstanceIterConst;
  714. ////////////////////
  715. class LockingHandle
  716. {
  717. friend class InstalledInstanceStore;
  718. InstalledInstanceStore* m_main; // We have a lock on it.
  719. Logger* m_logPrevious;
  720. void Attach( /*[in]*/ InstalledInstanceStore* main ,
  721. /*[in]*/ Logger* log );
  722. public:
  723. LockingHandle ();
  724. ~LockingHandle();
  725. void Release();
  726. };
  727. class InstallationEngine
  728. {
  729. public:
  730. bool m_fTaxonomyModified;
  731. bool m_fRecreateIndex;
  732. ////////////////////
  733. InstallationEngine()
  734. {
  735. ResetModificationFlags();
  736. }
  737. void ResetModificationFlags()
  738. {
  739. m_fTaxonomyModified = false;
  740. m_fRecreateIndex = false;
  741. }
  742. virtual HRESULT ProcessPackage( /*[in]*/ InstalledInstance& instance, /*[in]*/ Package& pkg ) = 0;
  743. virtual HRESULT RecreateIndex ( /*[in]*/ InstalledInstance& instance, /*[in]*/ bool fForce ) = 0;
  744. };
  745. class InstalledInstanceStore : public CComObjectRootEx<MPC::CComSafeMultiThreadModel> // Just to get locking...
  746. {
  747. static const DWORD s_dwVersion = 0x03314351; // QC1 03
  748. friend class LockingHandle;
  749. InstanceList m_lstInstances;
  750. PackageList m_lstPackages;
  751. InstalledInstanceList m_lstSKUs;
  752. MPC::wstring m_strStore;
  753. bool m_fLoaded;
  754. bool m_fDirty;
  755. Logger* m_log;
  756. DWORD m_dwRecurse;
  757. bool m_fShutdown;
  758. ////////////////////////////////////////
  759. void Clean ( );
  760. HRESULT Load ( );
  761. HRESULT LoadFromDisk ( /*[in]*/ LPCWSTR szFile );
  762. HRESULT LoadFromRegistry( );
  763. HRESULT LoadFromStream ( /*[in]*/ IStream* stream );
  764. HRESULT Save ( );
  765. HRESULT SaveToDisk ( /*[in]*/ LPCWSTR szFile );
  766. HRESULT SaveToRegistry ( );
  767. HRESULT SaveToStream ( /*[in]*/ IStream* stream );
  768. HRESULT EnsureInSync ( );
  769. public:
  770. InstalledInstanceStore();
  771. ~InstalledInstanceStore();
  772. ////////////////////////////////////////////////////////////////////////////////
  773. static InstalledInstanceStore* s_GLOBAL;
  774. static HRESULT InitializeSystem();
  775. static void FinalizeSystem ();
  776. void Shutdown();
  777. bool IsShutdown() { return m_fShutdown; }
  778. ////////////////////////////////////////////////////////////////////////////////
  779. HRESULT InUse_Lock ( /*[in]*/ const Taxonomy::HelpSet& ths );
  780. HRESULT InUse_Unlock( /*[in]*/ const Taxonomy::HelpSet& ths );
  781. HRESULT GrabControl ( /*[in]*/ LockingHandle& handle, /*[in]*/ Logger* log = NULL );
  782. ////////////////////////////////////////////////////////////////////////////////
  783. HRESULT Instance_GetList( /*[out]*/ InstanceIterConst& itBegin, /*[out]*/ InstanceIterConst& itEnd );
  784. HRESULT Package_GetList ( /*[out]*/ PackageIterConst& itBegin, /*[out]*/ PackageIterConst& itEnd );
  785. HRESULT SKU_GetList ( /*[out]*/ InstalledInstanceIterConst& itBegin, /*[out]*/ InstalledInstanceIterConst& itEnd );
  786. HRESULT Instance_Find ( /*[in]*/ const Taxonomy::HelpSet& ths , /*[out]*/ bool& fFound, /*[out]*/ InstanceIter& it );
  787. HRESULT Instance_Add ( /*[in]*/ LPCWSTR szFile, /*[in]*/ const Instance& data, /*[out]*/ bool& fFound, /*[out]*/ InstanceIter& it );
  788. HRESULT Instance_Remove( /*[in ]*/ InstanceIter& it );
  789. HRESULT Package_Find ( /*[in]*/ const Package& pkg , /*[out]*/ bool& fFound, /*[out]*/ PackageIter& it );
  790. HRESULT Package_Add ( /*[in]*/ LPCWSTR szFile, /*[in]*/ MPC::Impersonation* imp ,
  791. /*[in]*/ const Taxonomy::HelpSet* ths , /*[in ]*/ bool fInsertAtTop,
  792. /*[out]*/ bool& fFound, /*[out]*/ PackageIter& it );
  793. HRESULT Package_Remove ( /*[in ]*/ PackageIter& it );
  794. HRESULT SKU_Find ( /*[in]*/ const Taxonomy::HelpSet& ths , /*[out]*/ bool& fFound, /*[out]*/ InstalledInstanceIter& it );
  795. HRESULT SKU_Add ( /*[in]*/ const Instance& data, /*[out]*/ bool& fFound, /*[out]*/ InstalledInstanceIter& it );
  796. HRESULT SKU_Updated ( /*[in ]*/ InstalledInstanceIter& it );
  797. HRESULT SKU_Remove ( /*[in ]*/ InstalledInstanceIter& it );
  798. ////////////////////////////////////////////////////////////////////////////////
  799. HRESULT State_InvalidateSKU ( /*[in]*/ const Taxonomy::HelpSet& ths , /*[in]*/ bool fAlsoDatabase );
  800. HRESULT State_InvalidatePackage( /*[in]*/ long lSequence );
  801. ////////////////////////////////////////////////////////////////////////////////
  802. HRESULT MakeReady( /*[in]*/ InstallationEngine& engine, /*[in]*/ bool fNoOp, /*[in]*/ bool& fWorkToProcess );
  803. };
  804. };
  805. ////////////////////////////////////////////////////////////////////////////////
  806. #endif // !defined(__INCLUDED___HCP___TAXONOMYDATABASE_H___)