I'm trying to run the code below and I keep getting this error:
// >Unhandled exception at 0x005a8ddd in CppBurnerTest.exe:
// >0xC0000005: Access violation reading location 0xffffffff.
When StarBurn_ISO9660JolietFileTree_Add is called.
What is wrong? It seems like I'm doing exactly then same as in the c++ "DataBurmer" sample.
#include "stdafx.h"
#include "DeviceFinder.h"
#include "StarBurnKey.h"
// DEFINES ////////////////////////////////////////////////////////////////////////////////////////
#define STORE_PACKET_SIZE_IN_UCHARS 65536
// GLOBALS ////////////////////////////////////////////////////////////////////////////////////////
LONG g_treeNodes = 0;
LARGE_INTEGER g_LARGE_INTEGER_LastWrittenPercent;
LARGE_INTEGER g_LARGE_INTEGER_FileSizeInLBs;
LARGE_INTEGER g_LARGE_INTEGER_FileSizeInUCHARs;
LARGE_INTEGER g_LARGE_INTEGER_LBsWritten;
LARGE_INTEGER g_LARGE_INTEGER_CurrentPercent;
ULONG g_waitTimeInMs = 0;
PNAME_COLLISION_INFO g_PNAME_COLLISION_INFO = NULL;
ULONG g_trackPaddingSizeInLBs = 0;
ULONG g_trackPaddingLeftInLBs = 0;
LONG g_treeLevel = 0;
PVOID g_ISO9660JolietFileTree = NULL;
PVOID g_burnerGrabber = NULL;
ULONG g_status = ERROR_GEN_FAILURE;
CHAR g_exceptionText[1024];
EXCEPTION_NUMBER g_EXCEPTION_NUMBER = EN_SUCCESS;
CDB_FAILURE_INFORMATION g_CDB_FAILURE_INFORMATION;
STARBURN_TRACK_INFORMATION g_STARBURN_TRACK_INFORMATION;
STARBURN_DISC_INFORMATION g_STARBURN_DISC_INFORMATION;
CHAR g_vendorID[1024];
CHAR g_productID[1024];
CHAR g_productRevisionLevel[1024];
ULONG g_bufferSizeInUCHARs = 0;
BOOLEAN g_isBUPEnabled = FALSE;
BOOLEAN g_isBUPSupported = FALSE;
ULONG g_currentReadSpeed = 0;
ULONG g_maximumReadSpeed = 0;
ULONG g_currentWriteSpeed = 0;
ULONG g_maximumWriteSpeed = 0;
BOOLEAN g_isSendOPCSuccessful = FALSE;
CHAR g_newRootName[MAX_PATH];
INT g_iNT_ScanIndex = 0;
DISC_TYPE g_DISC_TYPE = DISC_TYPE_UNKNOWN;
PVOID g_rootNode = NULL;
PVOID g_newNode = NULL;
BOOLEAN g_isTrackAtOnce = FALSE;
BOOLEAN g_isSessionAtOnce = FALSE;
BOOLEAN g_isDiscAtOncePQ = FALSE;
BOOLEAN g_isDiscAtOnceRawPW = FALSE;
UCHAR g_trackNumber = 0;
UCHAR g_lastTrack = 0;
BOOL g_findAspi;
CArray<CDDVDINFO, CDDVDINFO&>* g_aspiDevicesFound = NULL;
CArray<CDDVDINFO, CDDVDINFO&>* g_sptiDevicesFound = NULL;
CDeviceFinder g_aspiDeviceFinder;
CDeviceFinder g_sptiDeviceFinder;
// CALLBACKS //////////////////////////////////////////////////////////////////////////////////////
VOID _cdecl Callback(IN CALLBACK_NUMBER p_CALLBACK_NUMBER, IN PVOID p_CallbackContext, IN PVOID p_CallbackSpecial1, IN PVOID p_CallbackSpecial2)
{
}
// INTERNAL METHODS ///////////////////////////////////////////////////////////////////////////////
bool Initialize()
{
g_EXCEPTION_NUMBER = StarBurn_UpStartEx((PVOID)(&g__UCHAR__RegistrationKey), sizeof(g__UCHAR__RegistrationKey));
return (g_EXCEPTION_NUMBER == EN_SUCCESS);
}
bool AddFile(const char* sourcefilepath, const char* destinationfilepath)
{
g_EXCEPTION_NUMBER = StarBurn_ISO9660JolietFileTree_Add(g_ISO9660JolietFileTree,
( PCHAR )( &g_exceptionText ), sizeof( g_exceptionText ),
&g_status, (PCHAR)sourcefilepath, (PCHAR)destinationfilepath,
FILE_TIME_LAST_WRITE, &g_rootNode, &g_newNode);
// >Unhandled exception at 0x005a8ddd in CppBurnerTest.exe:
// >0xC0000005: Access violation reading location 0xffffffff.
if (g_EXCEPTION_NUMBER != EN_SUCCESS)
{
return false;
}
g_EXCEPTION_NUMBER = StarBurn_ISO9660JolietFileTree_Add(g_ISO9660JolietFileTree, (PCHAR)(&g_exceptionText), sizeof(g_exceptionText), &g_status, (PCHAR)sourcefilepath, (PCHAR)destinationfilepath, FILE_TIME_LAST_WRITE, &g_rootNode, NULL);
return (g_EXCEPTION_NUMBER == EN_SUCCESS);
}
bool CreateRootNode(bool isnewdisc, const char* rootfoldername)
{
if (g_ISO9660JolietFileTree != NULL)
{
StarBurn_Destroy(&g_ISO9660JolietFileTree);
g_ISO9660JolietFileTree = NULL;
}
g_EXCEPTION_NUMBER = StarBurn_ISO9660JolietFileTree_Create(
&g_ISO9660JolietFileTree, (PCHAR)(&g_exceptionText), sizeof(g_exceptionText),
&g_status, (PCALLBACK)(Callback), (PVOID)(&g_treeNodes),
TRUE, FALSE, TRUE, FILE_TREE_JOLIET);
if (g_EXCEPTION_NUMBER != EN_SUCCESS)
{
return false;
}
if (isnewdisc)
{
AddFile(NULL, rootfoldername);
}
else
{
g_EXCEPTION_NUMBER = StarBurn_ISO9660JolietFileTree_ImportTrack(g_burnerGrabber, g_rootNode, 1, FALSE, (PCHAR)(&g_exceptionText), sizeof(g_exceptionText), &g_status);
if (g_EXCEPTION_NUMBER != EN_SUCCESS)
{
return false;
}
}
g_rootNode = StarBurn_ISO9660JolietFileTree_GetRoot(g_ISO9660JolietFileTree);
if (g_rootNode == NULL)
{
return false;
}
return true;
}
int _tmain(int argc, _TCHAR* argv[])
{
bool initOk = Initialize();
bool createRootNodeOk = CreateRootNode(true, "RootFolder");
return 0;
}
|