CascLib API Reference



  bool WINAPI CascReadFile(
      HANDLE hFile,                           // Handle to an open file
      void * lpBuffer,                        // Buffer where to read the file data
      DWORD dwToRead,                         // Number of bytes to be read
      DWORD pdwRead                           // Optional pointer to store number of bytes that were actually read

Function CascReadFile reads data from a CASC file.


hFile [in]
Handle to an opened file. Use CascOpenFile to retrieve such handle.
lpBuffer [out]
A pointer to the buffer that receives the data read from a file.
dwToRead [in]
The maximum number of bytes to be read.
pdwRead [in]
A pointer to the variable that receives the number of bytes read. See the remarks section for more information.

Return Value

On success, the function returns true.
On failure, the function returns false and GetLastError() returns the error code.


If there were at least some bytes read (even when less than requested), the function still returns success. This can be used for example when reading a partially encrypted file. The function reads as much as it can and returns number of bytes actually read.