mirror of
https://github.com/open-simh/simh.git
synced 2026-01-25 11:55:43 +00:00
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:
@@ -2583,6 +2583,12 @@ if (ReadFile ((HANDLE)(uptr->fileref), buf, sects * ctx->sector_size, (LPDWORD)s
|
||||
*sectsread /= ctx->sector_size;
|
||||
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 ());
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user