From 6a27983f179695c263ebc95f52b8ef81008fb4bb Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 8 May 2019 21:49:47 +0100 Subject: [PATCH] In Windows IOCTL CD-ROM code, only try reading via SPTI if ReadFile returned success but didn't read all requested data. Fixes Red Alert 2 installer. --- src/cdrom-ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdrom-ioctl.c b/src/cdrom-ioctl.c index 3ae7a23..8c8eb2b 100644 --- a/src/cdrom-ioctl.c +++ b/src/cdrom-ioctl.c @@ -451,8 +451,8 @@ static int ioctl_readsector(uint8_t *b, int sector, int count) status = ReadFile(hIOCTL, b, count*2048, (LPDWORD)&size, NULL); ioctl_close(); - /*If the read failed, try again using SPTI*/ - if (!status || size != count*2048) + /*If the read 'succeeded' but didn't read all required data, try again using SPTI*/ + if (status && size != count*2048) { uint8_t cmd[12] = { 0xbe, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }; SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER swb;