C/C++ Source: DBStream.h

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - Digital Signatures

C/C++ Source: DBStream.h

The following is the header file for the DBStream class used in the setDebugOutput project.

#include <windows.h>
#import <msxml5.dll>
using namespace MSXML2;


/////////////////////////////////////////////////
//  An IStream object to receive debug info:
//
class DBStream : public IStream
{
protected:
    int      _nCount;
    DWORD    _nState;

private:    
    long   _refcount;
   IXMLDOMDocument3Ptr _xmldbg;
   BSTR   *bstrBuf;

public:

   ///////////////////////
   // Constructor and destructor:
   //
    DBStream(void); 
    ~DBStream();

   ////////////////////////
   // IUnknown interface:
   //
    HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, 
                                  void ** ppvObject);
    ULONG STDMETHODCALLTYPE AddRef( void);
    ULONG STDMETHODCALLTYPE DBStream::Release( void);

    ///////////////////////////////////////////////////////////
    // IStream Interface:
    //
    HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags);
    HRESULT STDMETHODCALLTYPE Write(void const* pv, 
                           ULONG cb, 
                           ULONG * pcbWritten);

    HRESULT STDMETHODCALLTYPE Read(void * pv, 
                           ULONG cb, 
                           ULONG * pcbRead);

    HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, 
                           DWORD dwOrigin, 
                           ULARGE_INTEGER * plibNewPosition);

    HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize);

    HRESULT STDMETHODCALLTYPE CopyTo(IStream * pstm, 
                            ULARGE_INTEGER cb, 
                            ULARGE_INTEGER * pcbRead, 
                            ULARGE_INTEGER * pcbWritten);
     
    HRESULT STDMETHODCALLTYPE Revert(void);

    HRESULT STDMETHODCALLTYPE LockRegion( ULARGE_INTEGER libOffset, 
                                ULARGE_INTEGER cb, 
                                DWORD dwLockType);

    HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, 
                                 ULARGE_INTEGER cb, 
                                 DWORD dwLockType);

    HRESULT STDMETHODCALLTYPE Stat(STATSTG * pstatstg, 
                           DWORD grfStatFlag);

    HRESULT STDMETHODCALLTYPE Clone(IStream ** ppstm);

private:
   void STDMETHODCALLTYPE dprintf( char * format, ...);

};