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.

234 lines
10 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. pchupdate.h
  5. Abstract:
  6. This file contains the declaration of the CPCHUpdate class, that implements
  7. the IPCHUpdate interface.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 00/00/2000
  10. created
  11. ******************************************************************************/
  12. #ifndef __PCHUPDATE_H_
  13. #define __PCHUPDATE_H_
  14. #include <SvcResource.h>
  15. #include <TaxonomyDatabase.h>
  16. namespace HCUpdate
  17. {
  18. class Engine;
  19. class VersionItem;
  20. ////////////////////
  21. class ATL_NO_VTABLE VersionItem :
  22. public CComObjectRootEx<MPC::CComSafeMultiThreadModel>,
  23. public IDispatchImpl<IPCHVersionItem, &IID_IPCHVersionItem, &LIBID_HelpServiceTypeLib>
  24. {
  25. friend class Engine;
  26. Taxonomy::Package m_pkg;
  27. ////////////////////////////////////////
  28. public:
  29. BEGIN_COM_MAP(VersionItem)
  30. COM_INTERFACE_ENTRY(IDispatch)
  31. COM_INTERFACE_ENTRY(IPCHVersionItem)
  32. END_COM_MAP()
  33. // IHCPHelpSessionItem
  34. STDMETHOD(get_SKU )( /*[out, retval]*/ BSTR *pVal );
  35. STDMETHOD(get_Language )( /*[out, retval]*/ BSTR *pVal );
  36. STDMETHOD(get_VendorID )( /*[out, retval]*/ BSTR *pVal );
  37. STDMETHOD(get_VendorName)( /*[out, retval]*/ BSTR *pVal );
  38. STDMETHOD(get_ProductID )( /*[out, retval]*/ BSTR *pVal );
  39. STDMETHOD(get_Version )( /*[out, retval]*/ BSTR *pVal );
  40. STDMETHOD(Uninstall)();
  41. };
  42. /////////////////////////////////////////////////////////////////////////////
  43. // Engine
  44. class ATL_NO_VTABLE Engine :
  45. public CComObjectRootEx<MPC::CComSafeMultiThreadModel>,
  46. public IDispatchImpl< IPCHUpdate, &IID_IPCHUpdate, &LIBID_HelpServiceTypeLib >,
  47. public CComCoClass < Engine , &CLSID_PCHUpdate >,
  48. public Taxonomy::InstallationEngine
  49. {
  50. friend class VersionItem;
  51. MPC::wstring m_strWinDir;
  52. Taxonomy::Logger m_log;
  53. Taxonomy::Updater m_updater;
  54. Taxonomy::Settings m_ts;
  55. Taxonomy::InstalledInstance* m_sku;
  56. Taxonomy::Package* m_pkg;
  57. bool m_fCreationMode;
  58. DWORD m_dwRefCount;
  59. JetBlue::SessionHandle m_handle;
  60. JetBlue::Session* m_sess;
  61. JetBlue::Database* m_db;
  62. ////////////////////////////////////////////////////////////////////////////////
  63. typedef enum
  64. {
  65. ACTION_ADD,
  66. ACTION_DELETE
  67. } Action;
  68. static const LPCWSTR s_ActionText[];
  69. ////////////////////////////////////////////////////////////////////////////////
  70. static long CountNodes( /*[in]*/ IXMLDOMNodeList* poNodeList );
  71. ////////////////////////////////////////////////////////////////////////////////
  72. void DeleteTempFile ( /*[in/out]*/ MPC::wstring& strFile );
  73. HRESULT PrepareTempFile( /*[in/out]*/ MPC::wstring& strFile );
  74. ////////////////////////////////////////////////////////////////////////////////
  75. HRESULT AppendVendorDir( LPCWSTR szURL, LPCWSTR szOwnerID, LPCWSTR szWinDir, LPWSTR szDest, int iMaxLen );
  76. HRESULT LookupAction ( /*[in]*/ LPCWSTR szAction, /*[out]*/ Action& id );
  77. HRESULT LookupBoolean ( /*[in]*/ LPCWSTR szString, /*[out]*/ bool& fVal, /*[in]*/ bool fDefault = false );
  78. HRESULT LookupNavModel( /*[in]*/ LPCWSTR szString, /*[out]*/ long& lVal, /*[in]*/ long lDefault = QR_DEFAULT );
  79. HRESULT UpdateStopSign( /*[in]*/ Action idAction, /*[in]*/ const MPC::wstring& strContext , /*[in]*/ const MPC::wstring& strStopSign );
  80. HRESULT UpdateStopWord( /*[in]*/ Action idAction, /*[in]*/ const MPC::wstring& strStopWord );
  81. HRESULT UpdateOperator( /*[in]*/ Action idAction, /*[in]*/ const MPC::wstring& strOperator, /*[in]*/ const MPC::wstring& strOperation );
  82. ////////////////////////////////////////////////////////////////////////////////
  83. bool IsMicrosoft() { return m_pkg->m_fMicrosoft; }
  84. bool IsAborted() { return (Taxonomy::InstalledInstanceStore::s_GLOBAL && Taxonomy::InstalledInstanceStore::s_GLOBAL->IsShutdown()); }
  85. ////////////////////////////////////////////////////////////////////////////////
  86. HRESULT GetNodeDepth( /*[in]*/ LPCWSTR szCategory, /*[out]*/ int& iDepth );
  87. HRESULT CheckNode( /*[in]*/ LPCWSTR szCategory, /*[out]*/ bool& fExist, /*[out]*/ bool& fCanCreate );
  88. HRESULT CheckTopic( /*[in]*/ long ID_node, /*[in]*/ LPCWSTR szURI, /*[in]*/ LPCWSTR szCategory );
  89. ////////////////////////////////////////////////////////////////////////////////
  90. HRESULT InsertNode( /*[in]*/ Action idAction ,
  91. /*[in]*/ LPCWSTR szCategory ,
  92. /*[in]*/ LPCWSTR szEntry ,
  93. /*[in]*/ LPCWSTR szTitle ,
  94. /*[in]*/ LPCWSTR szDescription ,
  95. /*[in]*/ LPCWSTR szURI ,
  96. /*[in]*/ LPCWSTR szIconURI ,
  97. /*[in]*/ bool fVisible ,
  98. /*[in]*/ bool fSubsite ,
  99. /*[in]*/ long lNavModel ,
  100. /*[in]*/ long lPos );
  101. HRESULT InsertTaxonomy( /*[in]*/ MPC::XmlUtil& oXMLUtil ,
  102. /*[in]*/ IXMLDOMNode* poNode );
  103. ////////////////////////////////////////////////////////////////////////////////
  104. HRESULT AcquireDatabase();
  105. void ReleaseDatabase();
  106. HRESULT ProcessHHTFile( /*[in]*/ LPCWSTR szHHTName ,
  107. /*[in]*/ MPC::XmlUtil& oXMLUtil );
  108. HRESULT ProcessRegisterContent( /*[in]*/ Action idAction ,
  109. /*[in]*/ LPCWSTR szURI );
  110. HRESULT ProcessInstallFile( /*[in]*/ Action idAction ,
  111. /*[in]*/ LPCWSTR szSource ,
  112. /*[in]*/ LPCWSTR szDestination ,
  113. /*[in]*/ bool fSys ,
  114. /*[in]*/ bool fSysHelp );
  115. HRESULT ProcessSAFFile( /*[in]*/ Action idAction ,
  116. /*[in]*/ LPCWSTR szSAFName ,
  117. /*[in]*/ MPC::XmlUtil& oXMLUtil );
  118. ////////////////////////////////////////////////////////////////////////////////
  119. public:
  120. DECLARE_REGISTRY_RESOURCEID(IDR_HCUPDATE)
  121. DECLARE_NOT_AGGREGATABLE(Engine)
  122. BEGIN_COM_MAP(Engine)
  123. COM_INTERFACE_ENTRY(IPCHUpdate)
  124. COM_INTERFACE_ENTRY(IDispatch)
  125. END_COM_MAP()
  126. Engine();
  127. HRESULT FinalConstruct();
  128. void FinalRelease ();
  129. ////////////////////////////////////////
  130. HRESULT StartLog ( ) { return m_log.StartLog ( ); }
  131. HRESULT EndLog ( ) { return m_log.EndLog ( ); }
  132. HRESULT WriteLogV( /*[in]*/ HRESULT hr, /*[in]*/ LPCWSTR szLogFormat, /*[in]*/ va_list arglist ) { return m_log.WriteLogV( hr, szLogFormat, arglist ); }
  133. HRESULT WriteLog ( /*[in]*/ HRESULT hr, /*[in]*/ LPCWSTR szLogFormat, ... );
  134. Taxonomy::Logger& GetLogger() { return m_log; }
  135. ////////////////////////////////////////
  136. HRESULT SetSkuInfo( /*[in]*/ LPCWSTR szSKU, /*[in]*/ long lLCID );
  137. HRESULT PopulateDatabase( /*[in]*/ LPCWSTR szCabinet ,
  138. /*[in]*/ LPCWSTR szHHTFile ,
  139. /*[in]*/ LPCWSTR szLogFile ,
  140. /*[in]*/ LPCWSTR szSKU ,
  141. /*[in]*/ long lLCID ,
  142. /*[in]*/ JetBlue::Session* sess ,
  143. /*[in]*/ JetBlue::Database* db );
  144. HRESULT InternalCreateIndex( /*[in]*/ VARIANT_BOOL bForce );
  145. HRESULT InternalUpdatePkg( /*[in]*/ LPCWSTR szPathname, /*[in]*/ bool fImpersonate );
  146. HRESULT InternalRemovePkg( /*[in]*/ LPCWSTR szPathname, /*[in]*/ Taxonomy::Package* pkg, /*[in]*/ bool fImpersonate );
  147. HRESULT ForceSystemRestore();
  148. // IPCHUpdate
  149. public:
  150. STDMETHOD(get_VersionList)( /*[out, retval]*/ IPCHCollection* *ppC );
  151. STDMETHOD(LatestVersion)( /*[in ]*/ BSTR bstrVendorID ,
  152. /*[in ]*/ BSTR bstrProductID ,
  153. /*[in,optional]*/ VARIANT vSKU ,
  154. /*[in,optional]*/ VARIANT vLanguage ,
  155. /*[out, retval]*/ BSTR *pVal );
  156. STDMETHOD(CreateIndex)( /*[in ]*/ VARIANT_BOOL bForce ,
  157. /*[in,optional]*/ VARIANT vSKU ,
  158. /*[in,optional]*/ VARIANT vLanguage );
  159. STDMETHOD(UpdatePkg )( /*[in]*/ BSTR bstrPathname, /*[in]*/ VARIANT_BOOL bSilent );
  160. STDMETHOD(RemovePkg )( /*[in]*/ BSTR bstrPathname );
  161. STDMETHOD(RemovePkgByID)( /*[in]*/ BSTR bstrVendorID, /*[in]*/ BSTR bstrProductID, /*[in,optional]*/ VARIANT vVersion );
  162. // Taxonomy::InstallationEngine
  163. HRESULT ProcessPackage( /*[in]*/ Taxonomy::InstalledInstance& instance, /*[in]*/ Taxonomy::Package& pkg );
  164. HRESULT RecreateIndex ( /*[in]*/ Taxonomy::InstalledInstance& instance, /*[in]*/ bool fForce );
  165. };
  166. };
  167. #endif //__PCHUPDATE_H_