}
if (hfd->physsize) {
if (offset >= hfd->physsize - hfd->virtual_size) {
+ if (hfd->virtual_rdb)
+ return -1;
gui_message (_T("hd: tried to seek out of bounds! (%I64X >= %I64X - %I64X)\n"), offset, hfd->physsize, hfd->virtual_size);
abort ();
}
hfd->cache_offset = offset;
if (offset + CACHE_SIZE > hfd->offset + (hfd->physsize - hfd->virtual_size))
hfd->cache_offset = hfd->offset + (hfd->physsize - hfd->virtual_size) - CACHE_SIZE;
- hdf_seek (hfd, hfd->cache_offset);
+ if (hdf_seek(hfd, hfd->cache_offset))
+ return 0;
poscheck (hfd, CACHE_SIZE);
if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) {
ReadFile(hfd->handle->h, hfd->cache, CACHE_SIZE, &outlen, NULL);
DWORD ret;
if (hfd->physsize < CACHE_SIZE) {
hfd->cache_valid = 0;
- hdf_seek (hfd, offset);
+ if (hdf_seek(hfd, offset))
+ return got;
if (hfd->physsize)
poscheck (hfd, len);
if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) {
return 0;
hfd->cache_valid = 0;
- hdf_seek (hfd, offset);
+ if (hdf_seek(hfd, offset))
+ return 0;
poscheck (hfd, len);
memcpy (hfd->cache, buffer, len);
if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) {