IOCTL_IS_DISK_WRITABLE Problem with CD's

so build your driver against the XP DDK. Check the system version when
you load and send a direct CDB rather than the I/O control.

or if your really want a 2k only driver, just duplicate the command code
and the command structure into your own headers.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Handal, Thomas
Sent: Friday, February 11, 2005 2:31 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IOCTL_IS_DISK_WRITABLE Problem with CD’s

Hi All, Again,

Ok, as you know, I have the IOCTL_CDROM_GET_CONFIGURATION
working for XP in the kernel. Now I need to get it working for 2000.
Please help.

Here is some of the code that I pulled from the DDK regarding
the GET_CONFIGURATION. I tried compiling this, but the
SCSIOP_GET_CONFIGURATION is not known in the W2K DDK. This apparently
was added in XP. What I don’t understand is that the SCSI commands I
thought were all supported by the drives, so can’t I just use the XP
definition of this to use in my W2K driver?

Also, the GET_CONFIGURATION part of the cdb structure also
does NOT exist on W2K. So, I am at a loss here. Is there anyway I can
implement the following code on W2K, so I can get the same results as
with calling IOCTL_CDROM_GET_CONFIGURATION on XP?

Any help would be greatly appreciated. I am at a deadline here
that I need to finish, so any help and/or code snippets are appreciated.

Thanks

Tom

P.S. The following code was partially taken from the XP DDK.

PCHAR Buffer;

SCSI_REQUEST_BLOCK srb =
{0};

PCDB cdb;

ULONG_PTR returned;

NTSTATUS status;

BOOLEAN CdRomReadOnly =
TRUE;

USHORT BufferSize = 256;

ULONG ValidBytes = 0;

PAGED_CODE();

returned = 0;

Buffer =
(PCHAR)ExAllocatePool(NonPagedPool, BufferSize);

if ( ! Buffer )

return
CdRomReadOnly;

RtlZeroMemory(&srb,
sizeof(SCSI_REQUEST_BLOCK));

RtlZeroMemory(Buffer,
BufferSize);

srb.TimeOutValue = 0x4; //
This was found to be 4 in the XP SCSI.H

srb.CdbLength = 10;

cdb = (PCDB)srb.Cdb;

cdb->GET_CONFIGURATION.OperationCode = SCSIOP_GET_CONFIGURATION;

cdb->GET_CONFIGURATION.RequestType = (UCHAR)0x0; // Get all
configurations

cdb->GET_CONFIGURATION.StartingFeature[0] = (UCHAR)(0x0); // Get profile
type stuff

cdb->GET_CONFIGURATION.StartingFeature[1] = (UCHAR)(0x0);

cdb->GET_CONFIGURATION.AllocationLength[0] = (UCHAR)(BufferSize >> 8);

cdb->GET_CONFIGURATION.AllocationLength[1] = (UCHAR)(BufferSize & 0xff);

status =
ClassSendSrbSynchronous(diskDeviceObject, &srb, Buffer,

BufferSize,
FALSE);

returned =
srb.DataTransferLength;

KdPrint((“***
CdromGetConfiguration: Status was %x\n”, status));

if (NT_SUCCESS(status) ||
status == STATUS_BUFFER_OVERFLOW)

{

KdPrint((“*** We
are GOOD …\n”));

//

// if returned
more than can be stored in a ULONG, return false

//

if (returned >
(ULONG)(-1)) {

return STATUS_UNSUCCESSFUL;

}

ValidBytes =
(ULONG)returned;

return
STATUS_SUCCESS;

}

else

{

KdPrint((“***
CdromGetConfiguration: failed %x\n”, status));

return status;

}

return STATUS_UNSUCCESSFUL;


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to
xxxxx@lists.osr.com