Application becomes unstable after getting list of drives with Nero API

We created an ATL DLL using the sample Nero API code. After a burn, the application that uses the DLL becomes unstable (will crash in very strange places).

Are there any known issues with the API, or certain points where I might be messing up the allocation?

Looking in the sample code, here is the malloc:

int size = sizeof (NERO_WRITE_CD) + (num_files - 1) * sizeof (NERO_AUDIO_TRACK);

NERO_WRITE_CD *pWriteCD = (NERO_WRITE_CD *)malloc (size);

The options I use cause num_files to be zero, so in my code I use:

NERO_WRITE_CD *pWriteCD = new NERO_WRITE_CD;

Could this be a problem?

Also, I’m using NeroISODemo.h and declaring:

CDemoIsoTrack m_IsoTrack;

in my object. Is that wrong?

Has anyone done anything like this or seen unstable behavior? I’m certainly a newbie–please help!

Thanx,
Brett

It turns out if the nero header files are not in the right order, bad things happen!

So what is the correct order for the .h files? I have mysterious crashes during NeroBurn which I cannot solve.

#include “NeroAPIGlue.h”
#include “NeroISODemo.h”

I have this now and all seems well.