466 DWORD dwStartPointer = 0;
467 DWORD dwFilePointer = 0;
468 DWORD dwEndPointer = 0;
514 dwEndPointer = dwStartPointer + dwBytesToRead;
519 while(dwFilePointer < dwEndPointer)
540 if(pbFrameData ==
NULL)
561 dwFrameSize = (
DWORD)(StreamSize - FileOffset);
564 if(FileOffset < StreamSize && dwFrameSize < pFrame->CompressedSize)
566 memset(pbFrameData + dwFrameSize, 0, (pFrame->
CompressedSize - dwFrameSize));
597 if(dwFrameEnd > dwEndPointer)
598 dwFrameEnd = dwEndPointer;
599 memcpy(pbBuffer, hf->
pbFileCache + (dwFilePointer - dwFrameStart), (dwFrameEnd - dwFilePointer));
600 pbBuffer += (dwFrameEnd - dwFilePointer);
603 dwFilePointer = dwFrameEnd;
611 if(pdwBytesRead !=
NULL)
612 *pdwBytesRead = (dwFilePointer - dwStartPointer);
DWORD CacheEnd
Definition: CascCommon.h:249
DWORD FrameSize
Definition: CascCommon.h:131
#define CASC_ALLOC(type, count)
Definition: CascCommon.h:302
unsigned long long ULONGLONG
Definition: CascPort.h:144
bool IsValidMD5(LPBYTE pbMd5)
Definition: Common.cpp:484
bool FileStream_Read(TFileStream *pStream, ULONGLONG *pByteOffset, void *pvBuffer, DWORD dwBytesToRead)
Definition: FileStream.cpp:2551
#define ERROR_NOT_ENOUGH_MEMORY
Definition: CascPort.h:208
bool FileStream_GetSize(TFileStream *pStream, ULONGLONG *pFileSize)
Definition: FileStream.cpp:2595
#define ERROR_FILE_CORRUPT
Definition: CascPort.h:218
arena_t NULL
Definition: jemalloc_internal.h:624
DWORD FileSize
Definition: CascCommon.h:240
static int EnsureFrameHeadersLoaded(TCascFile *hf)
Definition: CascReadFile.cpp:202
BYTE * LPBYTE
Definition: CascPort.h:152
LPBYTE pbFileCache
Definition: CascCommon.h:246
static int ProcessFileFrame(LPBYTE pbOutBuffer, DWORD cbOutBuffer, LPBYTE pbInBuffer, DWORD cbInBuffer, DWORD dwFrameIndex)
Definition: CascReadFile.cpp:268
#define CASC_FREE(ptr)
Definition: CascCommon.h:303
#define ERROR_INVALID_HANDLE
Definition: CascPort.h:207
bool VerifyDataBlockHash(void *pvDataBlock, DWORD cbDataBlock, LPBYTE expected_md5)
Definition: Common.cpp:494
void SetLastError(int nError)
Definition: Common.cpp:75
PCASC_FILE_FRAME pFrames
Definition: CascCommon.h:243
DWORD cbFileCache
Definition: CascCommon.h:247
BYTE md5[MD5_HASH_SIZE]
Definition: CascCommon.h:132
unsigned int DWORD
Definition: CascPort.h:139
int GetLastError()
Definition: Common.cpp:70
DWORD CacheStart
Definition: CascCommon.h:248
static PCASC_FILE_FRAME FindFileFrame(TCascFile *hf, DWORD FilePointer)
Definition: CascReadFile.cpp:244
DWORD FrameArchiveOffset
Definition: CascCommon.h:128
TCascFile * IsValidFileHandle(HANDLE hFile)
Definition: CascOpenFile.cpp:18
Definition: CascCommon.h:126
DWORD FrameFileOffset
Definition: CascCommon.h:129
#define ERROR_INVALID_PARAMETER
Definition: CascPort.h:210
#define ERROR_HANDLE_EOF
Definition: CascPort.h:216
unsigned char BYTE
Definition: CascPort.h:136
Definition: CascCommon.h:227
DWORD FilePointer
Definition: CascCommon.h:233
TFileStream * pStream
Definition: CascCommon.h:230
#define ERROR_SUCCESS
Definition: CascPort.h:204
DWORD CompressedSize
Definition: CascCommon.h:130