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.

191 lines
3.0 KiB

  1. //
  2. // MODULE: DNLDIST.CPP
  3. //
  4. // PURPOSE: Downloads and installs the latest trouble shooters.
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  9. //
  10. // AUTHOR: Roman Mach
  11. //
  12. // ORIGINAL DATE: 6/4/96
  13. //
  14. // NOTES:
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V0.1 - RM Original
  19. // V0.3 04/09/98 JM/OK+ Local Version for NT5
  20. //
  21. #include "stdafx.h"
  22. #include "apgts.h"
  23. #include "dnldlist.h"
  24. //--------------------------------------------------------------------
  25. //
  26. CDnldObj::CDnldObj(CString &sType,
  27. CString &sFilename,
  28. DWORD dwVersion,
  29. CString &sFriendlyName,
  30. CString &sKeyName)
  31. {
  32. m_sType = sType;
  33. m_sFilename = sFilename;
  34. m_sKeyname = sKeyName;
  35. m_dwVersion = dwVersion;
  36. m_sFriendlyName = sFriendlyName;
  37. // force all ext entries to .DSZ
  38. m_sExt = DSC_COMPRESSED;
  39. // int pos = sFilename.Find(_T('.'));
  40. // if (pos != -1)
  41. // m_sExt = sFilename.Right(sFilename.GetLength() - pos);
  42. };
  43. //
  44. //
  45. CDnldObj::~CDnldObj()
  46. {
  47. }
  48. //--------------------------------------------------------------------
  49. //
  50. CDnldObjList::CDnldObjList()
  51. {
  52. m_pos = NULL;
  53. m_pDnld = NULL;
  54. }
  55. //
  56. //
  57. CDnldObjList::~CDnldObjList()
  58. {
  59. RemoveAll();
  60. }
  61. //
  62. //
  63. void CDnldObjList::RemoveHead()
  64. {
  65. if (this->IsEmpty())
  66. return;
  67. CDnldObj *pDnld = (CDnldObj *)CObList::RemoveHead();
  68. if (pDnld)
  69. delete pDnld;
  70. }
  71. //
  72. //
  73. void CDnldObjList::AddTail(CDnldObj *pDnld)
  74. {
  75. if (!pDnld)
  76. return;
  77. CObList::AddTail(pDnld);
  78. }
  79. //
  80. //
  81. void CDnldObjList::RemoveAll()
  82. {
  83. CDnldObj *pDnld;
  84. POSITION pos;
  85. if(!this->IsEmpty())
  86. {
  87. pos = this->GetHeadPosition();
  88. while(pos != NULL)
  89. {
  90. pDnld = (CDnldObj *)this->GetNext(pos);
  91. delete pDnld;
  92. }
  93. }
  94. CObList::RemoveAll();
  95. }
  96. //
  97. //
  98. VOID CDnldObjList::SetFirstItem()
  99. {
  100. m_pDnld = NULL;
  101. m_pos = this->GetHeadPosition();
  102. }
  103. //
  104. //
  105. BOOL CDnldObjList::FindNextItem()
  106. {
  107. if(this->IsEmpty())
  108. return FALSE;
  109. if (m_pos == NULL)
  110. return FALSE;
  111. m_pDnld = (CDnldObj *)this->GetNext(m_pos);
  112. return (m_pDnld != NULL);
  113. }
  114. //
  115. //
  116. const CString CDnldObjList::GetCurrFile()
  117. {
  118. if (m_pDnld == NULL)
  119. return _T("");
  120. return m_pDnld->m_sFilename;
  121. }
  122. //
  123. //
  124. const CString CDnldObjList::GetCurrFileKey()
  125. {
  126. if (m_pDnld == NULL)
  127. return _T("");
  128. return m_pDnld->m_sKeyname;
  129. }
  130. //
  131. //
  132. const CString CDnldObjList::GetCurrFriendly()
  133. {
  134. if (m_pDnld == NULL)
  135. return _T("");
  136. return m_pDnld->m_sFriendlyName;
  137. }
  138. //
  139. //
  140. const CString CDnldObjList::GetCurrType()
  141. {
  142. if (m_pDnld == NULL)
  143. return _T("");
  144. return m_pDnld->m_sType;
  145. }
  146. //
  147. //
  148. const CString CDnldObjList::GetCurrExt()
  149. {
  150. if (m_pDnld == NULL)
  151. return _T("");
  152. return m_pDnld->m_sExt;
  153. }
  154. //
  155. //
  156. DWORD CDnldObjList::GetCurrVersion()
  157. {
  158. if (m_pDnld == NULL)
  159. return 0;
  160. return m_pDnld->m_dwVersion;
  161. }