[ntdev]About miniport driver cdrom read error in x64 XP

Hi all,

First, my driver work good in 32bits OS.
But in x64 XP, there's a strange condition when inserting a CD into CD-Rom.

Before insert media, I can check which command OS issued.
Always repeat TEST UNIT READY(0x00), REQUEST_SENSE(0x03)
Just like following log


mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
MapError: Error register is 0x20
mvInterrupt: Srb complete with status 0x4

mvStartIo: Id 05, LUN 00, Func 00 , CDB:03 00 00 00 12 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:03 00 00 00 12 00 00 00 00 00
00 00
: DataBuffer = 82E8E1E0, DataTransferLength = 00000012
AtapiSendCommand: status = 51
AtapiSendCommand: Srb->DataBuffer = 0x82E8E1E0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
MapError: Error register is 0x20
mvInterrupt: Srb complete with status 0x4

mvStartIo: Id 05, LUN 00, Func 00 , CDB:03 00 00 00 12 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:03 00 00 00 12 00 00 00 00 00
00 00
: DataBuffer = 82E8E1E0, DataTransferLength = 00000012
AtapiSendCommand: status = 51
AtapiSendCommand: Srb->DataBuffer = 0x82E8E1E0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

After I insert the CD, there's one command TEST_UNIT_READY
Return sense key is UNIT_ATTENTION


mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
MapError: Error register is 0x68
mvInterrupt: Srb complete with status 0x4

After this command, OS should issue READ_TOC/PMA
But in x64 OS, I can not find it. OS only issue the following command
And OS recognize the data CD as a blank CD.

The same driver is workable in WinXP, 2003


mvStartIo: Id 05, LUN 00, Func 00 , CDB:03 00 00 00 12 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:03 00 00 00 12 00 00 00 00 00
00 00
: DataBuffer = EBBFB480, DataTransferLength = 00000012
AtapiSendCommand: status = 51
AtapiSendCommand: Srb->DataBuffer = 0xEBBFB480
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:25 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:25 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = EBBFED80, DataTransferLength = 00000008
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0xEBBFED80
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1
ModLoad: fffffadfe701e000 fffffadfe703f000 Cdfs.SYS

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:25 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:25 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = EBA98940, DataTransferLength = 00000008
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0xEBA98940
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:25 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:25 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = EBA99940, DataTransferLength = 00000008
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0xEBA99940
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_PIO_DATA_IN
mvInterrupt: CommandPhase IDE_CMD_PHASE_PIO_DATA_IN
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1

mvStartIo: Id 05, LUN 00, Func 00 , CDB:00 00 00 00 00 00 00 00 00 00 00 00
AtapiSendCommand: Id 05, Lun 0, Func 00, CDB:00 00 00 00 00 00 00 00 00 00
00 00
: DataBuffer = 00000000, DataTransferLength = 00000000
AtapiSendCommand: status = 50
AtapiSendCommand: Srb->DataBuffer = 0x0
AtapiSendCommand: Send Packet command
AtapiSendCommand: return SRB_STATUS_PENDING
Enter mvInterrupt
mvInterrupt: TargetId = 0x5, Current PIO, Legacy Interrupt= 0x1
mvInterrupt: ATAPI INT reason= IDE_CMD_PHASE_COMPLETE
mvInterrupt: CommandPhase IDE_CMD_PHASE_COMPLETE
mvInterrupt: Srb complete with status 0x1