From 6657aa4a2347054a13f72d78fc151c303deef3dd Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 20 Jul 2018 15:23:44 +0300 Subject: [PATCH] Read one extra block in CHS imager mode. Workaround for some bad USB adapters/drives that unexpectedly have random corrupted data in last read block. --- od-win32/hardfile_win32.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 563914fe..399ef3a8 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -3685,9 +3685,12 @@ int harddrive_to_hdf (HWND hDlg, struct uae_prefs *p, int idx) int seccnt = 0; uae_u8 *p = (uae_u8*)cache; while (seccnt < secs) { + int extrablock = 1; if (seccnt + readsize > secs) readsize = secs - seccnt; - do_scsi_read10_chs(h, -1, cyl, head, seccnt + 1, p, readsize, &specialaccessmode, false); + if (head == heads - 1 && cyl == cyls - 1) + extrablock = 0; + do_scsi_read10_chs(h, -1, cyl, head, seccnt + extrablock, p, readsize, &specialaccessmode, false); get = 512 * readsize; got = 512 * readsize; p += 512 * readsize; -- 2.47.3