/**********************************************************************/ /** Microsoft Windows/NT **/ /** Copyright(c) Microsoft Corporation, 1997 - 1997 **/ /**********************************************************************/ /* sapstrm.cpp FILE HISTORY: */ #include "stdafx.h" #include "sapstrm.h" #include "xstream.h" /*!-------------------------------------------------------------------------- SapConfigStream::SapConfigStream - Author: KennT ---------------------------------------------------------------------------*/ SapConfigStream::SapConfigStream() { m_nVersionAdmin = 0x00020000; m_nVersion = 0x00020000; } /*!-------------------------------------------------------------------------- SapConfigStream::InitNew - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::InitNew() { // Setup the appropriate defaults // m_nVersionAdmin = 0x00020000; // m_nVersion = 0x00020000; // m_stName.Empty(); return hrOK; } /*!-------------------------------------------------------------------------- SapConfigStream::SaveTo - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::SaveTo(IStream *pstm) { return XferVersion0(pstm, XferStream::MODE_WRITE, NULL); } /*!-------------------------------------------------------------------------- SapConfigStream::SaveAs - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::SaveAs(UINT nVersion, IStream *pstm) { return XferVersion0(pstm, XferStream::MODE_WRITE, NULL); } /*!-------------------------------------------------------------------------- SapConfigStream::LoadFrom - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::LoadFrom(IStream *pstm) { return XferVersion0(pstm, XferStream::MODE_READ, NULL); } /*!-------------------------------------------------------------------------- SapConfigStream::GetSize - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::GetSize(ULONG *pcbSize) { return XferVersion0(NULL, XferStream::MODE_SIZE, NULL); } /*!-------------------------------------------------------------------------- SapConfigStream::GetVersionInfo - Author: KennT ---------------------------------------------------------------------------*/ HRESULT SapConfigStream::GetVersionInfo(DWORD *pdwVersion, DWORD *pdwAdminVersion) { if (pdwVersion) *pdwVersion = m_nVersion; if (pdwAdminVersion) *pdwAdminVersion = m_nVersionAdmin; return hrOK; } /*!-------------------------------------------------------------------------- SapConfigStream::XferVersion0 - Author: KennT ---------------------------------------------------------------------------*/ struct _ViewInfoEntry { ULONG m_ulId; ULONG m_idSort; ULONG m_idAscending; ULONG m_idColumns; ULONG m_idPos; }; static const _ViewInfoEntry s_rgSAPAdminViewInfo[] = { { SAPSTRM_STATS_SAPPARAMS, SAPSTRM_TAG_STATS_SAPPARAMS_SORT, SAPSTRM_TAG_STATS_SAPPARAMS_ASCENDING, SAPSTRM_TAG_STATS_SAPPARAMS_COLUMNS, SAPSTRM_TAG_STATS_SAPPARAMS_POSITION }, }; HRESULT SapConfigStream::XferVersion0(IStream *pstm, XferStream::Mode mode, ULONG *pcbSize) { XferStream xstm(pstm, mode); HRESULT hr = hrOK; int i; CORg( xstm.XferDWORD( SAPSTRM_TAG_VERSION, &m_nVersion ) ); CORg( xstm.XferDWORD( SAPSTRM_TAG_VERSIONADMIN, &m_nVersionAdmin ) ); for ( i=0; i