DISK: Handle Windows RAW disk reads at EOF as success reading 0's

This was the root cause of the problem reported in #696
This commit is contained in:
Mark Pizzolato 2019-05-01 18:30:34 -07:00
parent 6c7da6c68b
commit 52fab988e3

View file

@ -2583,6 +2583,12 @@ if (ReadFile ((HANDLE)(uptr->fileref), buf, sects * ctx->sector_size, (LPDWORD)s
*sectsread /= ctx->sector_size; *sectsread /= ctx->sector_size;
return SCPE_OK; return SCPE_OK;
} }
if (ERROR_HANDLE_EOF == GetLastError ()) { /* Return 0's for reads past EOF */
memset (buf, 0, sects * ctx->sector_size);
if (sectsread)
*sectsread = sects;
return SCPE_OK;
}
_set_errno_from_status (GetLastError ()); _set_errno_from_status (GetLastError ());
return SCPE_IOERR; return SCPE_IOERR;
} }