NeroEstimateTrackSize crashes

vbimport

#1

Hi, :slight_smile:

I want to estimate the size of the isoTrack I will burn to test if the space on the CD is sufficient or not…
I have problem wit the function NeroEstimateTrackSize that crashes
Her is my code :
Please could you tell what do I wrong… ?


NERO_FILESYSTEMTRACK_OPTIONS pTrackOptions;
memset(&pTrackOptions, 0, sizeof(NERO_FILESYSTEMTRACK_OPTIONS));
pTrackOptions.netsStructureSize =sizeof (NERO_FILESYSTEMTRACK_OPTIONS);
pTrackOptions.netspCDStamp = NULL;
pTrackOptions.netsMediaType = MEDIA_CD;
pTrackOptions.netsDeviceHandle = m_NeroDeviceHandle;
pTrackOptions.netsFlags = NBF_WRITE | NBF_DISABLE_ABORT | NBF_BUF_UNDERRUN_PROT | NBF_DETECT_NON_EMPTY_CDRW | NBF_CD_TEXT | NBF_VERIFY;;
pTrackOptions.netsFSContainer = NULL;
pTrackOptions.netsFSContainerFlags = 0;



int v_NecessarySize = 0;
try{
    v_NecessarySize = NeroEstimateTrackSize(m_IsoTrack,NETS_EXACT_SIZE,&pTrackOptions);
}catch(...){
    char * NeroResult = NeroGetErrorLog();
    sprintf(vMsg,"%s 
 Nero error: <%s>",vMsg,NeroResult);
    NeroFreeMem(NeroResult);
    SetBurnStatus(vMsg);
    return ESTIM_TRACK_SIZE_ERROR;
}

The error is : Access violation ntdll.dll. I suppose that my object pTrackOption is not corredtly initialized… but what is wrong ?

Thanks in advance for your help :bow:

Fpa2


#2

Just a wild guess: Is the ISO track and all items + referenced strings in the ISO track valid? Is the code located right before NeroBurn, which would succeed if you omitted the NeroEstimateTrackSize?

And a sidenote: NeroEstimateTrackSize returns an unsigned int.


#3

PS: The posted code snipped works for me, so the bug must be located somewhere else.


#4

Hi Oliver,

The code posted has been taken from this forum and the person who posted this code said it was working…
But, my program works fine if I do not estimate the size…
I can burn in multisession with my NeroIsoTrack…

Strange isn’t it ?

Fpa2


#5

Really, it is.
Please double-check it: Have you really placed the code directly before the NeroBurn command, just to be on the safe side?
Are you really using the correct variables?


#6

Oliver,

Sorry, you’re totally right!
This is not the function that is in cause…
If I delete its call, the programm crashes again…

It is crashing when I call NeroBurn, and the thing i don’t understand is that the error is done on the Callback, on the first line! (creation on a CString!)


void NERO_CALLBACK_ATTR CTestNeroAPI_InterfaceDlg::SetPhaseCallback(void *pUserData, const char *text)
{
  // display the current phase the burn process is currently going through
  CString csTemp(text);
  ((CTestNeroAPI_InterfaceDlg*)pUserData)->AppendString("Phase: " + csTemp);
  return;
}

Do you have an idea of the origin of this error… ?
If needed, I can put my code in attach…

thanks for your help

Fpa2


#7

Can you put a breakpoint on CString csTemp(text); and see
(a) where text is pointing to and
(b) whether the memory text is pointing to contains considerably valid string data
© whether the string data is correctly null-terminated (ANSI->1 byte)

[Edit]
I just peeked into my code: For whatever reason, I check the passed string pointer against NULL. Maybe it was just defensive programming…