Does it also happen with an ISO image mounted as virtual CD/DVD drive (built-in functionality provided by Win10)? I can't reproduce the issue so far, and don't have any CD with me.
My first hunch would be that this is a driver issue, and maybe you have some special drivers installed?
Does it happen with other CDs/DVDs as well? Or is it a Blue-Ray, or maybe copy protected?
It does not happen with ISO image. Your post gave me the idea to try different types of discs and discover the problem is with audio CDs. It seems like the type of disc shouldn't matter when reading raw sectors from the drive. I am trying to verify that a WAV file is written to disk precisely without offset.
Windows reports the driver is C:\Windows\system32\drivers\cdrom.sys, version 10.0.19041.1266 dated 6/21/2006.
I don't have any audio CD available right now. But as far as I remember audio CDs cannot be read like data CDs under WinNT.
So the likely reason is that determining the size of the CD fails.
Ripping audio CDs usually requires special software, as they are usually not sector based. Well they are, but as far as I know, you cannot seek to any random sector, just to tracks.
Thank you. I am not trying to rip. In fact, I am trying to see if what I've written to CD matches the original CD on a sector level. In theory I can just rip the burned CD and compare, but I want to make sure that there's no offset correction or other "trickery" afoot and would like to compare each disk directly at the sector level.
As far as I know you can't read audio CDs by random access (which is necessary for HxD), at least not by seeking to individual sectors, you can only directly jump to the start of a track.
So to add support for this HxD, would first have to read an entire track and cache it somewhere, before it could render it. This is what I mean with ripping, compared to read just one sector or a few at a time.
Another issue with audio CDs is that there are several corrections applied to them, such as jitter correction, and other error correction applied automatically, which can vary from drive to drive. As opposed to data CDs it's hard to get an exact copy of the raw data on the disk.
I think, but I am not entirely sure, you'd have to test it out and experiment a bit. There should be a method to determine that size with a function, possibly: IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX, but that likely returns only the logical sector size, not the one for audio CDs. In the doc for IOCTL_CDROM_RAW_READ they mention RAW_SECTOR_SIZE, which is equal to 2352. Since there is only one type of audio CD, I suppose hardcoding/using RAW_SECTOR_SIZE would be acceptable.
The raw sector sizes are defined in the WinSDK: https://github.com/tpn/winsdk-10/blob/m ... drm.h#L558
As mentioned all the documentation (1, 2) and code hint at using those constants directly, instead of querying them using functions.
There are programs, and I use them. The problem is that with no way to read the physical disk there is no way to verify that the data is unmodified. That's my conundrum.
I would have to extend HxD to read audio CDs in raw mode, and what I was suggesting is that there should be programs that do just that.
Afterwards you could use file compare or any other tool, to compare the results.
Be aware though that reading audio CDs raw and WAV files are not exactly the same, and even the method suggested above would still not read the table of contents or other data (such as CD text). There is no simple way to read all that data from start to end, like for data CDs.
You could try CD imaging programs (which should include all relevant data), and compare the generated images.