michael@0: // LockedStream.cpp michael@0: michael@0: #include "StdAfx.h" michael@0: michael@0: #include "LockedStream.h" michael@0: michael@0: HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size, michael@0: UInt32 *processedSize) michael@0: { michael@0: NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); michael@0: RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL)); michael@0: return _stream->Read(data, size, processedSize); michael@0: } michael@0: michael@0: STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize) michael@0: { michael@0: UInt32 realProcessedSize = 0; michael@0: HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize); michael@0: _pos += realProcessedSize; michael@0: if (processedSize != NULL) michael@0: *processedSize = realProcessedSize; michael@0: return result; michael@0: }