StarBurn SDK (Software Development Kit)
ContentsIndexHome
Example

This example allocates Joliet file tree from the directory, builds file system image, reads some data from it and destroys the file tree after it's not needed any more. 

 

// Somewhere in the data region
PVOID l__PVOID__FileTree;
EXCEPTION_NUMBER l__EXCEPTION_NUMBER;
ULONG l__ULONG__TreeNodes;
ULONG l__ULONG__SystemError;
CHAR l__CHAR__ExceptionText[ 1024 ];
UCHAR l__UCHAR__DataBuffer[ 4096 ];
LARGE_INTEGER l__LARGE_INTEGER__NumberOfUCHARs;

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

// Try to create Joliet file tree
l__EXCEPTION_NUMBER =
StarBurn_ISO9660JolietFileTree_Create(
    &l__PVOID__FileTree,
    ( PCHAR )( &l__CHAR__ExceptionText ),
    sizeof( l__CHAR__ExceptionText ),
    &l__ULONG__Status,
    ( PCALLBACK )( StarBurn_Callback ),
    ( PVOID )( &l__LONG__TreeNodes ),
    TRUE,
    FALSE,
    FILE_TREE_JOLIET
    );

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

// Try to build the image, start with LBA 0 and include up to 8 levels into the image 
l__EXCEPTION_NUMBER =
StarBurn_ISO9660JolietFileTree_BuildImage(
    l__PVOID__FileTree,
    ( PCHAR )( &l__CHAR__ExceptionText ),
    sizeof( l__CHAR__ExceptionText ),
    &l__ULONG__SystemError,
    0,
    8
    FALSE,
    "Volume",
    "Publisher",
    "Application"
    );

// Prepare data buffer
RtlZeroMemory(
    &l__UCHAR__DataBuffer,
    sizeof( l__UCHAR__DataBuffer )
    );

// Set transfer size
l__LARGE_INTEGER__NumberOfUCHARs.QuadPart = sizeof( l__UCHAR__DataBuffer );

// Try to read
l__EXCEPTION_NUMBER =
StarBurn_ISO9660JolietFileTree_Read(
    l__PVOID__FileTree,
    ( PCHAR )( &l__CHAR__ExceptionText ),
    sizeof( l__CHAR__ExceptionText ),
    &l__ULONG__SystemError,
    l__LARGE_INTEGER__NumberOfUCHARs.LowPart,
    ( PUCHAR )( &l__UCHAR__DataBuffer )
    );

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

// Do something with data buffer here...        

// Perform actions with Joliet tree here...

// Destroy the Joliet file tree
StarBurn_Destroy( &l__PVOID__FileTree );

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