michael@0: // LockedStream.h michael@0: michael@0: #ifndef __LOCKEDSTREAM_H michael@0: #define __LOCKEDSTREAM_H michael@0: michael@0: #include "../../Windows/Synchronization.h" michael@0: #include "../../Common/MyCom.h" michael@0: #include "../IStream.h" michael@0: michael@0: class CLockedInStream michael@0: { michael@0: CMyComPtr _stream; michael@0: NWindows::NSynchronization::CCriticalSection _criticalSection; michael@0: public: michael@0: void Init(IInStream *stream) michael@0: { _stream = stream; } michael@0: HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize); michael@0: }; michael@0: michael@0: class CLockedSequentialInStreamImp: michael@0: public ISequentialInStream, michael@0: public CMyUnknownImp michael@0: { michael@0: CLockedInStream *_lockedInStream; michael@0: UInt64 _pos; michael@0: public: michael@0: void Init(CLockedInStream *lockedInStream, UInt64 startPos) michael@0: { michael@0: _lockedInStream = lockedInStream; michael@0: _pos = startPos; michael@0: } michael@0: michael@0: MY_UNKNOWN_IMP michael@0: michael@0: STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); michael@0: }; michael@0: michael@0: #endif