Image Recorder with NERO API

Hi,

I tried to create an image of a disc using NERO API , the function NeroBurn return NEROAPI_BURN_OK but the file .nrg is not created.
version NeroAPI 6.6.1.15.

the file log :

Initialisation API Nero
Retrouver les information de la version NeroAPI.
version NeroAPI 6.6.1.15
Remplir la structure NERO_SETTINGS
Initialisation de NeroAPI avec succès.
HL-DT-ST DVDRAM_GSA-H10N
Log line:Analyzing disc
Phase: Reading track info
Log line:The CD is copyrighted
Log line:Analyzing disc
Phase: Reading track info
Log line:The CD is copyrighted
1A20-0203-0000-1286-0947-7030*

Windows XP 5.2

IA32

WinAspi: -

ahead WinASPI: File ‘C:\Program Files\Ahead\Nero\Wnaspi32.dll’: Ver=2.0.1.74, size=164112 bytes, created 02/11/2004 12:54:32

NT-SPTI used

Nero API version: 6.6.1.15

Using interface version: 6.6.0.1

Installed in: C:\Program Files\Ahead\Nero\

Application: nero\Nero - Burning Rom
Internal Version: 6, 6, 1, 15

Recorder: <HL-DT-ST DVDRAM_GSA-H10N>Version: JX04 - HA 1 TA 0 - 6.6.1.15

Adapter driver: <IDE> HA 1

Drive buffer : 2048kB

Bus Type : default (0) -> ATAPI, detected: ?

=== Scsi-Device-Map ===

DiskPeripheral : Maxtor 33073H3 atapi Port 0 ID 0 DMA: On

CdRomPeripheral : HL-DT-ST DVDRAM_GSA-H10N atapi Port 1 ID 1 DMA: Off

=== CDRom-Device-Map ===

HL-DT-ST DVDRAM_GSA-H10N E: CDRom0

=======================

AutoRun : 1

Excluded drive IDs:

WriteBufferSize: 40894464 (0) Byte

ShowDrvBufStat : 0

BUFE : 0

Physical memory : 255MB (261588kB)

Free physical memory: 68MB (70220kB)

Memory in use : 73 %

Uncached PFiles: 0x0

Use Inquiry : 1

Global Bus Type: default (0)

Check supported media : Disabled (0)

3.11.2007

NeroAPI

11:20:51 #1 Text 0 File SCSIPTICommands.cpp, Line 403

LockMCN - completed sucessfully for IOCTL_STORAGE_MCN_CONTROL

11:20:52 #2 Text 0 File SCSIPTICommands.cpp, Line 208

SPTILockVolume - completed successfully for FCTL_LOCK_VOLUME

11:20:52 #3 Phase 48 File APIProgress.cpp, Line 275

Analyzing disc

11:20:52 #4 CDCOPY -1 File CDCopy.cpp, Line 1915

The CD is copyrighted

11:20:54 #5 Text 0 File CDCopy.cpp, Line 840

Copy options:	copy on-the-fly:  ON

	read ISRC/MCN:  ON

	use jitter correction: OFF

	data options

		ignore read error:  ON   write defekt blocks  ON

		read raw data: OFF   read r-w subchannel data: OFF

	audio options

		ignore read error:  ON

		read indexes: OFF    read r-w subchannel data: OFF

source disc does not look like CD Extra

01.      0 - 229024 = 229024, data (TRM_DATA_MODE1, block size 2048)

02. 240424 - 246808 =   6384, data (TRM_DATA_MODE1, block size 2048)

03. 253708 - 260092 =   6384, data (TRM_DATA_MODE1, block size 2048)

04. 266992 - 273376 =   6384, data (TRM_DATA_MODE1, block size 2048)

05. 280276 - 286660 =   6384, data (TRM_DATA_MODE1, block size 2048)

06. 293560 - 334648 =  41088, data (TRM_DATA_MODE1, block size 2048)

11:20:54 #6 Text 0 File SCSIPTICommands.cpp, Line 253

SPTIDismountVolume - completed successfully for FSCTL_DISMOUNT_VOLUME

11:20:54 #7 Text 0 File Cdrdrv.cpp, Line 9945

DriveLocker: UnLockVolume completed

11:20:54 #8 Text 0 File SCSIPTICommands.cpp, Line 403

UnLockMCN - completed sucessfully for IOCTL_STORAGE_MCN_CONTROL

Existing drivers:

Registry Keys:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\AllocateCDROMs : 0 (Security Option)

BurnCD() : user aborted
Initialisation API Nero
Retrouver les information de la version NeroAPI.
version NeroAPI 6.6.1.15
Remplir la structure NERO_SETTINGS
Initialisation de NeroAPI avec succès.
HL-DT-ST DVDRAM_GSA-H10N
Log line:Analyzing disc
Phase: Reading track info
Log line:The CD is copyrighted
Log line:Analyzing disc
Phase: Reading track info
Log line:The CD is copyrighted

My source is:

//Burning a copy of a disc
BOOL CCopieCDDVD::WriteDiscCopy ()
{

// Initialisation Nero API
mFileLog-&gt;WriteString ("Initialisation API Nero");
NeroAPIInit();

Reprise:

ndhDeviceHandle = NeroOpenDevice(nsdiDevice);
int iRes = FALSE;
if (!ndhDeviceHandle)
{
	CString m_Tmp;
	m_Tmp.Format("%s",nsdiDevice-&gt;nsdiDeviceName);
	mFileLog-&gt;WriteString("Device could not be opened: " + m_Tmp);
	NeroAPIFree();
	return FALSE;
}
else
{

	NERO_IMPORT_DATA_TRACK_INFO nidtInfo;
	NERO_IMPORT_DATA_TRACK_RESULT nidtResult;

	// IMPORT DES SESSIONS PRECEDENTES : Prepare the struct
	CString csUserMsg		= "";
	memset(&nidtInfo, 0, sizeof(nidtInfo));
	nidtInfo.nidtiSize		= sizeof(nidtInfo);
	void* pCDStamp			= NULL;
	NERO_ISO_ITEM* pniiItem	= NULL;
	NERO_MEDIA_TYPE			m_MediaType;
	NERO_CD_INFO* pnciInfo	= NeroGetCDInfo(ndhDeviceHandle, NGCDI_READ_CD_TEXT | NGCDI_READ_ISRC);
	CString m_NomVolume;

	//DWORD m_TailleVolume = 0;
	//DWORD m_TotalCapacity = 0;
	//DWORD m_FreeCapacityInBlocks = 0;
	//DWORD m_CapacityRequis = 0;
	
	if(pnciInfo != NULL)
	{
		m_MediaType = pnciInfo-&gt;ncdiMediaType ;
		//m_TotalCapacity	= pnciInfo-&gt;ncdiTotalCapacity * pnciInfo-&gt;ncdiTrackInfos[0].ntiBlockSize;
		//m_FreeCapacityInBlocks = pnciInfo-&gt;ncdiFreeCapacityInBlocks * pnciInfo-&gt;ncdiTrackInfos[0].ntiBlockSize;
		
		//m_CapacityRequis = m_TotalCapacity - m_FreeCapacityInBlocks;

		//pniiItem = NeroImportDataTrack(ndhDeviceHandle, pnciInfo-&gt;ncdiNumTracks - 1, &pCDStamp, &nidtInfo, NIITEF_IMPORT_VMS_SESSION, &nidtResult, NULL);
		//pniiItem = NeroImportDataTrack(ndhDeviceHandle, pnciInfo-&gt;ncdiNumTracks - 1, &pCDStamp, &nidtInfo, 0, &nidtResult, NULL);
		//NeroFreeMem(pnciInfo);
	}
	else
	{
		if (AfxMessageBox ("		Copie du CD/DVD 

Veuillez insérer dans le Graveur ‘" + m_TypeGarvureA + "’ le CD/DVD à copier",MB_OKCANCEL|MB_ICONQUESTION) == IDCANCEL)
{
return FALSE;
}
else
{
NeroCloseDevice(ndhDeviceHandle);
goto Reprise;
}
}

	// If there is a volume name after import, print it out. : NOM DU CD/DVD
	/*if(nidtInfo.nidtipVolumeName != NULL)
	{
		m_NomVolume = nidtInfo.nidtipVolumeName;
		//m_TailleVolume = nidtInfo.nidtiSize; // Must contain the size of the structure
		
		
		csUserMsg.Format("Imported volume name: %s", nidtInfo.nidtipVolumeName);
		mFileLog-&gt;WriteString(csUserMsg);
		NeroFreeMem (nidtInfo.nidtipVolumeName);
	}
	
	//CString Taille;
	//Taille.Format("%d", m_CapacityRequis);
	m_NomCD.SetWindowText(m_NomVolume);
	*/

	NERO_CD_COPY writeCD;

	memset (&writeCD, 0, sizeof (writeCD));

	// Now fill in all the required parameters.
	// 
	CString sImageFilePath = m_PathTMP + "\\IMG01.nrg";
	writeCD.sourceDrive = NeroOpenDevice (nsdiDevice) ;// The drive to read the data from
	writeCD.onTheFly = FALSE; // copy on-the-fly (without storing an image on the harddrive first)
	writeCD.imageFilePath = sImageFilePath; // should the temporary image deleted after burning or not
	writeCD.deleteImage = FALSE;// should the temporary image deleted after burning or not
	
	writeCD.readSpeed = 0; // Read speed in KB/s, 0 for maximum speed
	
	writeCD.tryNr = 2; // number of tries, if read error appeared
	writeCD.readErrOption = 1; // for data tracks: 1: ignore read errors and continue; 0: abort on read errors
	
	writeCD.readRawMode1 = FALSE; // read raw mode
	writeCD.readRawMode2 = FALSE; // read raw mode
	
	writeCD.ignoreDAErr = TRUE; // for audio tracks: ignore read errors and continue 
	writeCD.readIsrcAndMediaCatalogNo = TRUE; // NeroAPI 5.5 and NeroAPI &gt;= 6.3.1.24: TRUE if media catalog number and ISRC should be read and copied
	writeCD.ignoreBadTOCType = true;

	// Set DVD as media type if the user requested so.
	// 
	/*if (params.GetUseDVD())
	{
		writeCD.mediaType = MEDIA_DVD_ANY;
	}
	else
	{	
		writeCD.mediaType = (NERO_MEDIA_TYPE) params.GetMediaType ();
	}*/
	
	writeCD.mediaType = m_MediaType;
	
	// Modify spare area settings on BD
	/*if(((writeCD.mediaType & MEDIA_BD) != 0) && (SAS_UNDEFINED != SAS_UNDEFINED))
	{
		NERO_SPARE_AREA_SETTINGS nSA = params.GetSpareArea();
		NeroSetDeviceOption(ndhDeviceHandle, NERO_DEVICEOPTION_SPARE_AREA, &nSA);
	}*/
	

	theApp.IconCloseDoc = FALSE;
	m_Progression.SetPos(0);
	m_Progression.SetRange(0,100);
	m_Pourcent.SetWindowText("0 %");
	
	/*err = NeroBurn (m_NeroDeviceHandle,
						NERO_CD_COPY_TYPE,
						&writeCD,
						GetBurnFlags (params),
						params.GetSpeedToNeroBurn (),
						m_NeroProgress);*/
	
	// Burn the image
	iRes = NeroBurn(ndhDeviceHandle, NERO_CD_COPY_TYPE, &writeCD, NBF_WRITE|NBF_DAO, 0, &npProgress);
		
	NeroCloseDevice(ndhDeviceHandle);
		
	mbAborted = false;

	char* Log = NeroGetErrorLog();

	mFileLog-&gt;WriteString(Log);
	NeroFreeMem(Log);
	//NeroFreeIsoItemTree(pItemIso);

	switch(iRes)
	{
		case NEROAPI_BURN_OK:
		  mFileLog-&gt;WriteString("BurnCD() : burn successful");
		  break;
		case NEROAPI_BURN_UNKNOWN_CD_FORMAT:
		  mFileLog-&gt;WriteString("BurnCD() : unknown CD format");
		  break;
		case NEROAPI_BURN_INVALID_DRIVE:
		  mFileLog-&gt;WriteString("BurnCD() : invalid drive");
		  break;
		case NEROAPI_BURN_FAILED:
		  mFileLog-&gt;WriteString("BurnCD() : burn failed");
		  break;
		case NEROAPI_BURN_FUNCTION_NOT_ALLOWED:
		  mFileLog-&gt;WriteString("BurnCD() : function not allowed");
		  break;
		case NEROAPI_BURN_DRIVE_NOT_ALLOWED:
		  mFileLog-&gt;WriteString("BurnCD() : drive not allowed");
		  break;
		case NEROAPI_BURN_USER_ABORT:
		  mFileLog-&gt;WriteString("BurnCD() : user aborted");
		  break;
		case NEROAPI_BURN_BAD_MESSAGE_FILE:
		  mFileLog-&gt;WriteString("BurnCD() : bad message file");
		  break;
		default:
		  mFileLog-&gt;WriteString("BurnCD() : unknown error");
		  break;
	}
	if ( iRes == NEROAPI_BURN_OK)
	{
		m_Resultat.SetWindowText("Création de l'image du CD/DVD " + m_NomVolume + " Succès");
		mFileLog-&gt;WriteString("Création de l'image " + m_NomVolume + " Succès");
	}
	else
	{
		//AppendString("Copie du CD/DVD " + vNumeroCd,"Echec",2);
		mFileLog-&gt;WriteString("Création de l'image " + m_NomVolume + " Echec");
	}
}
NeroAPIFree();
theApp.IconCloseDoc = TRUE;	

if ( iRes == NEROAPI_BURN_OK)
	return TRUE;
else
	return FALSE;

}