hi friends,

I want to query the BCA information from the DVD that is BCA enabled.
This is the following code i did, please tell me whether this is correct or
not.


DWORD dwReturned = 0;
HANDLE hfile = NULL;
SetDlgItemText( IDC_EDIT_BCA_VALUE, NULL);

hfile = CreateFile("\\\\.\\E:",GENERIC_READ,
FILE_SHARE_READ,NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_READONLY,NULL);
TRACE("Load disk File handle Value %d\n", hfile);
if( hfile == INVALID_HANDLE_VALUE )
return;
DeviceIoControl(hfile, IOCTL_DISK_LOAD_MEDIA, NULL, 0,
NULL, 0, &dwReturned, 0); ///*DVD_

Sleep(3000);

DVD_READ_STRUCTURE read_struct;
DVD_BCA_DESCRIPTOR bcaDesc;
//DVD_COPYRIGHT_DESCRIPTOR copyright;
DVD_LAYER_DESCRIPTOR layer;
//DVD_MANUFACTURER_DESCRIPTOR manufacturer;
DWORD bytes_read, err;
HRESULT hr = S_OK;

((long*) &read_struct.BlockByteOffset)[0] = 0;
((long*) &read_struct.BlockByteOffset)[1] = 0;
long session = 0;
hr = DeviceIoControl (hfile, IOCTL_DVD_START_SESSION, 0, 0, &session,
sizeof (session), &bytes_read, 0);
if( FAILED( hr ))
return;
read_struct.SessionId = session;
read_struct.LayerNumber = 0;

//layer.BCAFlag =0;
//layer.BookVersion = 0;

read_struct.Format = DvdPhysicalDescriptor;
hr = DeviceIoControl (hfile, IOCTL_DVD_READ_STRUCTURE, &read_struct,
sizeof (read_struct),
&layer, sizeof (layer), &bytes_read, 0);
if( FAILED( hr ))
{
err = GetLastError();
//exit (1);
}

TRACE("Disk Layer BCAFlag %d\n", layer.BCAFlag );

if( layer.BCAFlag != 0 )
{
read_struct.Format = DvdBCADescriptor;
hr = DeviceIoControl (hfile, IOCTL_DVD_READ_STRUCTURE, &read_struct,
sizeof (read_struct),
&bcaDesc, sizeof (bcaDesc), &bytes_read, 0);
if( FAILED( hr ))
{
err = GetLastError();
//exit (1);
}


TRACE("BCA Data %s\n", bcaDesc.BCAInformation);

if( size_t(bcaDesc.BCAInformation) > 0 )
SetDlgItemText( IDC_EDIT_BCA_VALUE, (LPCTSTR)bcaDesc.BCAInformation );
}

hr = DeviceIoControl (hfile, IOCTL_DVD_END_SESSION, &session, sizeof
(session),
0, 0, &bytes_read, 0);
if( FAILED( hr ))
{
//exit (1);
}

////DeviceIoControl(hfile, IOCTL_DISK_EJECT_MEDIA, NULL, 0,
//// NULL, 0, &dwReturned, 0);

CloseHandle( hfile );



--
thnaks
iyappan