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.

187 lines
5.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1997 **/
  4. /**********************************************************************/
  5. /*
  6. ATLKSTRM.cpp
  7. FILE HISTORY:
  8. */
  9. #include "stdafx.h"
  10. #include "ATLKstrm.h"
  11. #include "xstream.h"
  12. /*!--------------------------------------------------------------------------
  13. ATLKConfigStream::ATLKConfigStream
  14. -
  15. Author: KennT
  16. ---------------------------------------------------------------------------*/
  17. ATLKConfigStream::ATLKConfigStream()
  18. {
  19. m_nVersionAdmin = 0x00020000;
  20. m_nVersion = 0x00020000;
  21. }
  22. /*!--------------------------------------------------------------------------
  23. ATLKConfigStream::InitNew
  24. -
  25. Author: KennT
  26. ---------------------------------------------------------------------------*/
  27. HRESULT ATLKConfigStream::InitNew()
  28. {
  29. // Setup the appropriate defaults
  30. // m_nVersionAdmin = 0x00020000;
  31. // m_nVersion = 0x00020000;
  32. // m_stName.Empty();
  33. return hrOK;
  34. }
  35. /*!--------------------------------------------------------------------------
  36. ATLKConfigStream::SaveTo
  37. -
  38. Author: KennT
  39. ---------------------------------------------------------------------------*/
  40. HRESULT ATLKConfigStream::SaveTo(IStream *pstm)
  41. {
  42. return XferVersion0(pstm, XferStream::MODE_WRITE, NULL);
  43. }
  44. /*!--------------------------------------------------------------------------
  45. ATLKConfigStream::SaveAs
  46. -
  47. Author: KennT
  48. ---------------------------------------------------------------------------*/
  49. HRESULT ATLKConfigStream::SaveAs(UINT nVersion, IStream *pstm)
  50. {
  51. return XferVersion0(pstm, XferStream::MODE_WRITE, NULL);
  52. }
  53. /*!--------------------------------------------------------------------------
  54. ATLKConfigStream::LoadFrom
  55. -
  56. Author: KennT
  57. ---------------------------------------------------------------------------*/
  58. HRESULT ATLKConfigStream::LoadFrom(IStream *pstm)
  59. {
  60. return XferVersion0(pstm, XferStream::MODE_READ, NULL);
  61. }
  62. /*!--------------------------------------------------------------------------
  63. ATLKConfigStream::GetSize
  64. -
  65. Author: KennT
  66. ---------------------------------------------------------------------------*/
  67. HRESULT ATLKConfigStream::GetSize(ULONG *pcbSize)
  68. {
  69. return XferVersion0(NULL, XferStream::MODE_SIZE, NULL);
  70. }
  71. /*!--------------------------------------------------------------------------
  72. ATLKConfigStream::GetVersionInfo
  73. -
  74. Author: KennT
  75. ---------------------------------------------------------------------------*/
  76. HRESULT ATLKConfigStream::GetVersionInfo(DWORD *pdwVersion, DWORD *pdwAdminVersion)
  77. {
  78. if (pdwVersion)
  79. *pdwVersion = m_nVersion;
  80. if (pdwAdminVersion)
  81. *pdwAdminVersion = m_nVersionAdmin;
  82. return hrOK;
  83. }
  84. /*!--------------------------------------------------------------------------
  85. ATLKConfigStream::XferVersion0
  86. -
  87. Author: KennT
  88. ---------------------------------------------------------------------------*/
  89. struct _ViewInfoEntry
  90. {
  91. ULONG m_ulId;
  92. ULONG m_idSort;
  93. ULONG m_idAscending;
  94. ULONG m_idColumns;
  95. ULONG m_idPos;
  96. };
  97. //static const _ViewInfoEntry s_rgATLKAdminViewInfo[]
  98. //={
  99. // { ATLKSTRM_STATS_ATLKNBR,
  100. // ATLKSTRM_TAG_STATS_ATLKNBR_SORT, ATLKSTRM_TAG_STATS_ATLKNBR_ASCENDING,
  101. // ATLKSTRM_TAG_STATS_ATLKNBR_COLUMNS, ATLKSTRM_TAG_STATS_ATLKNBR_POSITION },
  102. // { ATLKSTRM_IFSTATS_ATLKNBR,
  103. // ATLKSTRM_TAG_IFSTATS_ATLKNBR_SORT, ATLKSTRM_TAG_IFSTATS_ATLKNBR_ASCENDING,
  104. // ATLKSTRM_TAG_IFSTATS_ATLKNBR_COLUMNS, ATLKSTRM_TAG_IFSTATS_ATLKNBR_POSITION },
  105. //};
  106. HRESULT ATLKConfigStream::XferVersion0(IStream *pstm, XferStream::Mode mode, ULONG *pcbSize)
  107. {
  108. /*
  109. XferStream xstm(pstm, mode);
  110. HRESULT hr = hrOK;
  111. int i;
  112. CORg( xstm.XferDWORD( ATLKSTRM_TAG_VERSION, &m_nVersion ) );
  113. CORg( xstm.XferDWORD( ATLKSTRM_TAG_VERSIONADMIN, &m_nVersionAdmin ) );
  114. for ( i=0; i<DimensionOf(s_rgATLKAdminViewInfo); i++)
  115. {
  116. CORg( m_rgViewInfo[s_rgATLKAdminViewInfo[i].m_ulId].Xfer(&xstm,
  117. s_rgATLKAdminViewInfo[i].m_idSort,
  118. s_rgATLKAdminViewInfo[i].m_idAscending,
  119. s_rgATLKAdminViewInfo[i].m_idColumns) );
  120. CORg( xstm.XferRect( s_rgATLKAdminViewInfo[i].m_idPos,
  121. &m_prgrc[s_rgATLKAdminViewInfo[i].m_ulId]) );
  122. }
  123. if (pcbSize)
  124. *pcbSize = xstm.GetSize();
  125. Error:
  126. */
  127. return hrOK;
  128. }
  129. /*---------------------------------------------------------------------------
  130. ATLKComponentConfigStream implementation
  131. ---------------------------------------------------------------------------*/
  132. enum ATLKCOMPSTRM_TAG
  133. {
  134. ATLKCOMPSTRM_TAG_VERSION = XFER_TAG(1, XFER_DWORD),
  135. ATLKCOMPSTRM_TAG_VERSIONADMIN = XFER_TAG(2, XFER_DWORD),
  136. ATLKCOMPSTRM_TAG_SUMMARY_COLUMNS = XFER_TAG(3, XFER_COLUMNDATA_ARRAY),
  137. ATLKCOMPSTRM_TAG_SUMMARY_SORT_COLUMN = XFER_TAG(4, XFER_DWORD),
  138. ATLKCOMPSTRM_TAG_SUMMARY_SORT_ASCENDING = XFER_TAG(5, XFER_DWORD),
  139. };
  140. HRESULT ATLKComponentConfigStream::XferVersion0(IStream *pstm, XferStream::Mode mode, ULONG *pcbSize)
  141. {
  142. XferStream xstm(pstm, mode);
  143. HRESULT hr = hrOK;
  144. CORg( xstm.XferDWORD( ATLKCOMPSTRM_TAG_VERSION, &m_nVersion ) );
  145. CORg( xstm.XferDWORD( ATLKCOMPSTRM_TAG_VERSIONADMIN, &m_nVersionAdmin ) );
  146. CORg( m_rgViewInfo[ATLK_COLUMNS].Xfer(&xstm,
  147. ATLKCOMPSTRM_TAG_SUMMARY_SORT_COLUMN,
  148. ATLKCOMPSTRM_TAG_SUMMARY_SORT_ASCENDING,
  149. ATLKCOMPSTRM_TAG_SUMMARY_COLUMNS) );
  150. if (pcbSize)
  151. *pcbSize = xstm.GetSize();
  152. Error:
  153. return hr;
  154. }