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.

79 lines
1.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: MemSer.hxx
  7. //
  8. // History: 29-Jul-94 KyleP Created
  9. //
  10. //--------------------------------------------------------------------------
  11. #if !defined( __MEMSER_HXX__ )
  12. #define __MEMSER_HXX__
  13. #include <restrict.hxx>
  14. #include <SStream.hxx>
  15. class CMemSerStream : public PSerStream
  16. {
  17. public:
  18. CMemSerStream( unsigned cb );
  19. CMemSerStream(BYTE * pb, ULONG cb);
  20. virtual ~CMemSerStream();
  21. inline BYTE *AcqBuf();
  22. virtual void PutByte( BYTE b );
  23. virtual void PutChar( char const * pc, ULONG cc );
  24. virtual void PutWChar( WCHAR const * pwc, ULONG cc );
  25. virtual void PutUShort( USHORT us );
  26. virtual void PutULong( ULONG ul );
  27. virtual void PutLong( long l );
  28. virtual void PutFloat( float f );
  29. virtual void PutDouble( double d );
  30. virtual void PutString( char const * psz );
  31. virtual void PutWString( WCHAR const * pwsz );
  32. virtual void PutBlob( BYTE const * pb, ULONG cb );
  33. virtual void PutGUID( GUID const & guid );
  34. inline unsigned Size() { return _cb; }
  35. protected:
  36. unsigned _cb;
  37. BYTE * _pb;
  38. BYTE * _pbCurrent;
  39. BYTE * _pbEnd;
  40. };
  41. inline BYTE * CMemSerStream::AcqBuf()
  42. {
  43. BYTE * pb;
  44. if ( _cb > 0 )
  45. {
  46. pb = _pb;
  47. _pb = 0;
  48. _cb = 0;
  49. }
  50. else
  51. pb = 0;
  52. return( pb );
  53. }
  54. #endif // __MEMSER_HXX__