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:
parent
6c7da6c68b
commit
52fab988e3
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue