Audio CDs cannot be read (as a stream of raw sectors)

Bug reports concerning HxD.
Post Reply
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Audio CDs cannot be read (as a stream of raw sectors)

Post by Roninla »

HxD 2.5, Windows 10 x64. When I try to use Tools -> Open Disk (both physical and logical) to access an optical disk I get an error like this:

Image

If I dismiss it more pop up as I scroll. All sectors are displayed as 0x00.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

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?
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Re: Can't open CD even as administrator

Post by Roninla »

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.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

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.
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Re: Can't open CD even as administrator

Post by Roninla »

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.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

If you are a programmer, you can try this:
https://www.codeproject.com/Articles/15 ... -Audio-CDs
https://www.codeproject.com/Articles/54 ... arp-Ripper

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.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

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.
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Re: Can't open CD even as administrator

Post by Roninla »

Are they suggesting the error is caused by assuming 2048 byte sectors when audio CDs are 2352 bytes per sector?
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

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.

A couple more links:
https://stackoverflow.com/questions/499 ... ction-data
https://stackoverflow.com/questions/298 ... in-windows
https://books.google.fr/books?id=76HVAw ... ty&f=false

As a final note: There should be programs that rip the digital audio data unmodified, somewhere.
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Re: Can't open CD even as administrator

Post by Roninla »

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.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Can't open CD even as administrator

Post by Maël »

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.
Roninla
Posts: 6
Joined: 04 Feb 2022 15:53

Re: Can't open CD even as administrator

Post by Roninla »

Thank you. It seems it may be impossible to do the way I'm attempting.

I do strip off the WAV headers to get the RAW PCM data for comparison.
Post Reply