#1 Burning Software

It is currently Sat Dec 21, 2024 3:11 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: FileTree_Add Problem
PostPosted: Fri Jan 28, 2005 7:20 pm 
I have just started working with the StarBurn SDK. I am trying to create a simple windows console app that just runs through all the functions to burn a directory to a cd.

Everything goes fine until I call StarBurn_ISO9660JolietFileTree_Add which gives me an access voilation. (Unhandled exception at 0x027e5a49 in StarBurnTest.exe: 0xC0000005: Access violation writing location 0x00000001.) I have tried it both in Visual C++ 6 and Visual Studio .NET.

The callback for FileTree_Add gets called once and runs through with no problems.

Here is my sample code:

EXCEPTION_NUMBER en = EN_SUCCESS;
long lDeviceCount = 0;
long lWriterCount = 0;
STARBURN_DEVICE_INFO* pWriterInfo = NULL;
void* pCDGrabber = NULL;
void* pFileTree = NULL;
void* pTreeRoot = NULL;
char szException[1024] = {0};
unsigned long ulSysError = 0;
CDB_FAILURE_INFORMATION cdbFailInfo = {0};
char szNewRoot[MAX_PATH] = {0};

g_pDevices = new fdList();

en = StarBurn_UpStartEx(g_StarBurn_Reg_Key,sizeof(g_StarBurn_Reg_Key));
SB_EXIT_FAIL(en);

lDeviceCount = StarBurn_FindDevice(SCSI_DEVICE_RO_DIRECT_ACCESS,FALSE,(PCALLBACK)SBFindDeviceCB,(void*) &lWriterCount);
SB_EXIT_FAIL(en);

fdNode* pNode = g_pDevices->Head();

OutputDebugString("Writers Found:\n");

while(pNode){
pWriterInfo = (STARBURN_DEVICE_INFO*) pNode->Data();
OutputDebugString(pWriterInfo->VendorID);
OutputDebugString(pWriterInfo->ProductID);
OutputDebugString("\n");
pNode = pNode->GetNext();
}

if(pWriterInfo){
// create burnergrabber object

en = StarBurn_CdvdBurnerGrabber_Create(&pCDGrabber,szException,sizeof(szException),&ulSysError,&cdbFailInfo,
(PCALLBACK) SBBurningCB,NULL,pWriterInfo->PortID,pWriterInfo->BusID,
pWriterInfo->TargetID, pWriterInfo->LUN,0);

// test for disk

while(StarBurn_CdvdBurnerGrabber_GetInsertedDiscType(pCDGrabber) == DISC_TYPE_NO_MEDIA){
if(MessageBox(::GetDesktopWindow(),"Please insert Media","NO Disc",MB_OKCANCEL | MB_ICONHAND) == IDCANCEL)
break;
}

// create the file tree

en = StarBurn_ISO9660JolietFileTree_Create(&pFileTree,szException,sizeof(szException),&ulSysError,
(PCALLBACK) SBBurningCB,&g_TreeNodes,TRUE,FALSE,TRUE,FILE_TREE_JOLIET);

SB_EXIT_FAIL(en);

// get the root

pTreeRoot = StarBurn_ISO9660JolietFileTree_GetRoot(pFileTree);

ZeroMemory(szNewRoot,sizeof(szNewRoot));

time_t t = time(0);

sprintf(szNewRoot,"%s",ctime(&t));

for(int i = 0; i < strlen(szNewRoot); i++){
if( (szNewRoot[i] == ':') || (szNewRoot[i] == ' ')){
szNewRoot[i] = '_';
}

if(szNewRoot[i] == '\r\n'){
szNewRoot[i] = 0;
break;
}
}

// add a file

en = StarBurn_ISO9660JolietFileTree_Add(pFileTree,szException,sizeof(szException),&ulSysError,
g_CopyDir,szNewRoot,FILE_TIME_LAST_WRITE,&pTreeRoot);

SB_EXIT_FAIL(en);


Top
  
 
 Post subject:
PostPosted: Fri Jan 28, 2005 11:41 pm 
found the problem. left __stdcall off the Callback function. Its always the little things that get you :)


Top
  
 
 Post subject:
PostPosted: Sun Jan 30, 2005 1:07 pm 
Offline

Joined: Mon May 31, 2004 6:22 am
Posts: 134
Anonymous wrote:
found the problem. left __stdcall off the Callback function. Its always the little things that get you :)


Nice to hear that all bugs were solved. ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group