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.

111 lines
3.0 KiB

  1. //
  2. // MODULE: LocalLSTReader.H
  3. //
  4. // PURPOSE: Implementation of the CLocalLSTReader class.
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint - Local TS only
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  9. //
  10. // AUTHOR: Oleg Kalosha
  11. //
  12. // ORIGINAL DATE: 01-22-99
  13. //
  14. // NOTES:
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V3.1 01-22-99 OK Original
  19. //
  20. //////////////////////////////////////////////////////////////////////
  21. #include "stdafx.h"
  22. #include "LocalLSTReader.h"
  23. #include "apgts.h"
  24. #include "apgtsregconnect.h"
  25. //////////////////////////////////////////////////////////////////////
  26. // CLocalTopicInfo
  27. //////////////////////////////////////////////////////////////////////
  28. bool CLocalTopicInfo::Init(CString & strResourcePath, vector<CString> & vecstrWords)
  29. {
  30. for (vector<CString>::iterator i = vecstrWords.begin(); i != vecstrWords.end(); i++)
  31. {
  32. CString str_extension = CString(_T(".")) + CAbstractFileReader::GetJustExtension(*i);
  33. str_extension.MakeLower();
  34. if (str_extension == m_TopicFileExtension)
  35. {
  36. m_DscFilePath = ::FormFullPath(strResourcePath, *i);
  37. m_DscFilePath.MakeLower();
  38. if (! m_NetworkName.GetLength())
  39. {
  40. m_NetworkName = *i;
  41. int len = m_NetworkName.GetLength()-(m_TopicFileExtension.GetLength());
  42. m_NetworkName = m_NetworkName.Left(len);
  43. m_NetworkName.MakeLower();
  44. }
  45. }
  46. }
  47. return CTopicInfo::Init(strResourcePath, vecstrWords);
  48. }
  49. //////////////////////////////////////////////////////////////////////
  50. // CLocalLSTReader
  51. //////////////////////////////////////////////////////////////////////
  52. CLocalLSTReader::CLocalLSTReader(CPhysicalFileReader* pPhysicalFileReader, const CString& strTopicName)
  53. : CAPGTSLSTReader(pPhysicalFileReader),
  54. m_strTopicName(strTopicName)
  55. {
  56. CAPGTSRegConnector APGTSRegConnector(m_strTopicName);
  57. int stub1 =0, stub2 =0;
  58. if (!APGTSRegConnector.Read(stub1, stub2) ||
  59. !APGTSRegConnector.GetStringInfo(CAPGTSRegConnector::eTopicFileExtension, m_strTopicFileExtension))
  60. {
  61. m_strTopicFileExtension = APGTSLSTREAD_DSC;
  62. }
  63. else
  64. {
  65. m_strTopicFileExtension.MakeLower();
  66. }
  67. }
  68. void CLocalLSTReader::Open()
  69. {
  70. }
  71. void CLocalLSTReader::ReadData(LPTSTR * ppBuf)
  72. {
  73. CString data;
  74. data += CFG_HEADER;
  75. data += _T("\r\n");
  76. data += m_strTopicName + m_strTopicFileExtension;
  77. data += _T(",");
  78. data += m_strTopicName + APGTSLSTREAD_HTI;
  79. data += _T(",");
  80. data += m_strTopicName + APGTSLSTREAD_TSC;
  81. data += _T(",");
  82. data += m_strTopicName;
  83. *ppBuf = new TCHAR[data.GetLength() + 1];
  84. //[BC-03022001] - added check for NULL ptr to satisfy MS code analysis tool.
  85. if(*ppBuf)
  86. {
  87. memcpy(*ppBuf, (LPCTSTR)data, data.GetLength());
  88. (*ppBuf)[data.GetLength()] = 0;
  89. }
  90. }
  91. void CLocalLSTReader::Close()
  92. {
  93. }
  94. CTopicInfo* CLocalLSTReader::GenerateTopicInfo()
  95. {
  96. return new CLocalTopicInfo(m_strTopicFileExtension);
  97. }