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.

164 lines
4.6 KiB

  1. //
  2. // MODULE: APGTSCFG.CPP
  3. // Fully implements class CDBLoadConfiguration
  4. //
  5. // PURPOSE:
  6. // Brings together the persistent pieces of the online troubleshooter configuration:
  7. // - the Topic Shop
  8. // - the registry
  9. // - the threads that maintain these.
  10. // - the template file for error reporting
  11. // Provides functions to get latest values on registry variables and to acquire a
  12. // smart pointer to a CTopic based on its name.
  13. //
  14. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  15. //
  16. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  17. //
  18. // AUTHOR: Roman Mach
  19. //
  20. // ORIGINAL DATE: 8-2-96
  21. //
  22. // NOTES:
  23. // 1. Based on Print Troubleshooter DLL
  24. //
  25. // Version Date By Comments
  26. //--------------------------------------------------------------------
  27. // V0.1 - RM Original
  28. // V3.0 9/14/98 JM Major revisions as classes for file management have
  29. // all been rewritten
  30. //
  31. #pragma warning(disable:4786)
  32. #include "stdafx.h"
  33. #include "apgtscfg.h"
  34. //
  35. //
  36. CDBLoadConfiguration::CDBLoadConfiguration(HMODULE hModule,
  37. CThreadPool * pThreadPool,
  38. const CString& strTopicName,
  39. CHTMLLog *pLog)
  40. : m_TopicShop(),
  41. m_pThreadPool(pThreadPool),
  42. m_DirectoryMonitor(m_TopicShop ,strTopicName ),
  43. m_RegistryMonitor(m_DirectoryMonitor, pThreadPool, strTopicName, pLog )
  44. {
  45. }
  46. //
  47. //
  48. CDBLoadConfiguration::~CDBLoadConfiguration()
  49. {
  50. }
  51. CString CDBLoadConfiguration::GetFullResource()
  52. {
  53. CString str;
  54. m_RegistryMonitor.GetStringInfo(CAPGTSRegConnector::eResourcePath, str);
  55. return str;
  56. }
  57. CString CDBLoadConfiguration::GetLogDir()
  58. {
  59. CString str;
  60. m_RegistryMonitor.GetStringInfo(CAPGTSRegConnector::eLogFilePath, str);
  61. return str;
  62. }
  63. CString CDBLoadConfiguration::GetVrootPath()
  64. {
  65. CString str;
  66. m_RegistryMonitor.GetStringInfo(CAPGTSRegConnector::eVrootPath, str);
  67. return str;
  68. }
  69. DWORD CDBLoadConfiguration::GetMaxThreads()
  70. {
  71. DWORD dw;
  72. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eMaxThreads, dw);
  73. return dw;
  74. }
  75. // cookie life in minutes (before V3.0, was hours)
  76. DWORD CDBLoadConfiguration::GetCookieLife()
  77. {
  78. DWORD dw;
  79. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eCookieLife, dw);
  80. return dw;
  81. }
  82. DWORD CDBLoadConfiguration::GetReloadDelay()
  83. {
  84. DWORD dw;
  85. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eReloadDelay, dw);
  86. return dw;
  87. }
  88. DWORD CDBLoadConfiguration::GetThreadsPP()
  89. {
  90. DWORD dw;
  91. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eThreadsPP, dw);
  92. return dw;
  93. }
  94. DWORD CDBLoadConfiguration::GetMaxWQItems()
  95. {
  96. DWORD dw;
  97. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eMaxWQItems, dw);
  98. return dw;
  99. }
  100. bool CDBLoadConfiguration::HasDetailedEventLogging()
  101. {
  102. DWORD dw;
  103. m_RegistryMonitor.GetNumericInfo(CAPGTSRegConnector::eDetailedEventLogging, dw);
  104. return dw ? true : false;
  105. }
  106. void CDBLoadConfiguration::GetListOfTopicNames(vector<CString>&arrstrTopic)
  107. {
  108. m_TopicShop.GetListOfTopicNames(arrstrTopic);
  109. }
  110. // Call this function to obtain a CP_TOPIC as a pointer to the topic (identified by
  111. // strTopic) that you want to operate on. As long as the CP_TOPIC remains undeleted,
  112. // the associated CTopic is guaranteed to remain undeleted.
  113. // Warning: this function can wait a long time for the topic to be built.
  114. CP_TOPIC & CDBLoadConfiguration::GetTopic(
  115. const CString & strTopic, CP_TOPIC & cpTopic, bool bNewCookie)
  116. {
  117. return m_TopicShop.GetTopic(strTopic, cpTopic, bNewCookie);
  118. }
  119. // Call this function to obtain a CP_TEMPLATE as a pointer to the template (identified by
  120. // strTopic) that you want to operate on. As long as the CP_TEMPLATE remains undeleted,
  121. // the associated CAPGTSHTIReader is guaranteed to remain undeleted.
  122. // Warning: this function can wait a long time for the template to be built.
  123. CP_TEMPLATE & CDBLoadConfiguration::GetTemplate(
  124. const CString & strTemplate, CP_TEMPLATE & cpTemplate, bool bNewCookie)
  125. {
  126. return m_TopicShop.GetTemplate(strTemplate, cpTemplate, bNewCookie);
  127. }
  128. // Call this function to add a template to the topic shop catalog of templates and
  129. // to add it to the directory monitor list of templates to track for changes.
  130. void CDBLoadConfiguration::AddTemplate( const CString & strTemplateName )
  131. {
  132. m_TopicShop.AddTemplate( strTemplateName );
  133. // Notify the directory monitor to track this file.
  134. m_DirectoryMonitor.AddTemplateToTrack( strTemplateName );
  135. return;
  136. }
  137. bool CDBLoadConfiguration::RetTemplateInCatalogStatus( const CString & strTemplate, bool & bValid )
  138. {
  139. return( m_TopicShop.RetTemplateInCatalogStatus( strTemplate, bValid ) );
  140. }
  141. void CDBLoadConfiguration::CreateErrorPage(const CString & strError, CString& out)
  142. {
  143. m_DirectoryMonitor.CreateErrorPage(strError, out);
  144. }