StarBurn SDK (Software Development Kit)
ContentsIndexHome
Example

This example finds first first CD/DVD/Blu-Ray/HD-DVD device, allocates CdvdBurnerGrabber object, and destroys the device object after it's not needed any more. 

 

VOID
__stdcall
Find_Callback(
    IN CALLBACK_NUMBER p__CALLBACK_NUMBER,
    IN PVOID p__PVOID__CallbackContext,
    IN PVOID p__PVOID__CallbackSpecial1,
    IN PVOID p__PVOID__CallbackSpecial2
    )
{

PVOID l__PVOID__CdvdBurnerGrabber;
EXCEPTION_NUMBER l__EXCEPTION_NUMBER;
ULONG l__ULONG__SystemError;
CHAR l__CHAR__ExceptionText[ 1024 ];
CDB_FAILURE_INFORMATION l__CDB_FAILURE_INFORMATION;

// Prepare exception text buffer
RtlZeroMemory(
    &l__CHAR__ExceptionText,
    sizeof( l__CHAR__ExceptionText )
    );

// Prepare CDB failure information
RtlZeroMemory(
    &l__CDB_FAILURE_INFORMATION,
    sizeof( l__CDB_FAILURE_INFORMATION )
    );

// Try to create CdvdBurnerGrabber on passed address (bus ID is always 0 in case of ASPI and LUN cannot be probed so 
// always 0 as well) with 32MB of cache)
l__EXCEPTION_NUMBER =
StarBurn_CdvdBurnerGrabber_Create(
    &l__PVOID__CdvdBurnerGrabber,
    ( PCHAR )( &l__CHAR__ExceptionText ),
    sizeof( l__CHAR__ExceptionText ),
    &l__ULONG__SystemError,
    &l__CDB_FAILURE_INFORMATION,
    ( PCALLBACK )( StarBurn_Callback ),
    ( UCHAR )( p__PVOID__CallbackSpecial1) ,
    0,
    ( UCHAR )( p__PVOID__CallbackSpecial2) ,
    0,
    32
    );

// Check for correct reply
if (  l__EXCEPTION_NUMBER != EN_SUCCESS )
{
// Handle error here...
}

// Do something with CdvdBurnerGrabber device object here...        

// Destroy the CdvdBurnerGrabber
StarBurn_Destroy( &l__PVOID__CdvdBurnerGrabber );

// Just check for pointer (paranoid?)
if ( l__PVOID__CdvdBurnerGrabber != NULL )
{
// Handle error here...
}

}

// Somewhere in the code

// Try to find device
if (
StarBurn_FindDevice(
    SCSI_DEVICE_RO_DIRECT_ACCESS,
    TRUE,
    ( PCALLBACK )( Find_Callback ),
    NULL
    ) == 0
)
{
// Handle error here...
}
else
{
// All actions are in the callback function...
}