1 // LockedStream.h 2 3 #ifndef __LOCKEDSTREAM_H 4 #define __LOCKEDSTREAM_H 5 6 #include "../../Windows/Synchronization.h" 7 #include "../../Common/MyCom.h" 8 #include "../IStream.h" 9 10 class CLockedInStream 11 { 12 CMyComPtr<IInStream> _stream; 13 NWindows::NSynchronization::CCriticalSection _criticalSection; 14 public: Init(IInStream * stream)15 void Init(IInStream *stream) 16 { _stream = stream; } 17 HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize); 18 }; 19 20 class CLockedSequentialInStreamImp: 21 public ISequentialInStream, 22 public CMyUnknownImp 23 { 24 CLockedInStream *_lockedInStream; 25 UInt64 _pos; 26 public: Init(CLockedInStream * lockedInStream,UInt64 startPos)27 void Init(CLockedInStream *lockedInStream, UInt64 startPos) 28 { 29 _lockedInStream = lockedInStream; 30 _pos = startPos; 31 } 32 33 MY_UNKNOWN_IMP 34 35 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 36 }; 37 38 #endif 39