Reading and mounting ISO image programatically

Hello

I was wounding if the Nero SDK offers any support in reading (and mounting) ISO images?

For example using the ImageDrive components.

Any sample snippet our API link would be greatly appriciated.

Thanks.

Hi,

I’m also wondering how I could read iso images from disk
and burn them directly to cd using nero api.

Do you have any ideas how to achieve this?

Is there a way to use the nero image drive?
How could I specify the image filename by code?

Thanks for reply.

Hi tkunert.
You can read the iso image from media with NeroImportDataTrack function.
And you can get root’s NERO_ISO_ITEM pointer.
Good luck.bye

Hi neohop,

thanks for your reply.

You’re right in case that you are aiming to read and write an iso image from cd-rom.
But what do you do if you have already the iso image on hard disk and you want to burn the image on a cd-recordable?

In the meantime, I came across the following solution:

  • use NeroBurnImage function
  • use NERO_BURN_IMAGE_MEDIA as second argument
  • use NERO_WRITE_IMAGE structure for third argument pWriteCD (instead of NERO_WRITE_CD)

That way, I could successfully burn iso image on to cd-r.

neohop, sorry for the confusion. bye.

Try this function:

// This function is responsible for burning an ISO image.
CExitCode CBurnContext::WriteImage (const PARAMETERS & params)
{
// Make sure that an image file name has been provided by the user

_ASSERTE (NULL != params.GetImageFileName());

NERO_WRITE_IMAGE writeCD;

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

// Fill in the image file name
writeCD.nwiLongImageFileName = params.GetImageFileName();

// Set DVD as media type if the user requested so
if (params.GetUseDVD())
{
	writeCD.nwiMediaType = MEDIA_DVD_ANY;
}
else
{	
	writeCD.nwiMediaType = (NERO_MEDIA_TYPE) params.GetMediaType ();
}

// Try to set layer break for this burning.
if(((writeCD.nwiMediaType & MEDIA_DVD_P_R9) != 0) && (params.GetOptionLayerBreak() > 0))
{
	DWORD dwLBA = params.GetOptionLayerBreak();
	NeroSetDeviceOption(m_NeroDeviceHandle, NERO_DEVICEOPTION_LAYERSWITCH, &dwLBA);
}

// Modify spare area settings on BD
if(((writeCD.nwiMediaType & MEDIA_BD) != 0) && (params.GetSpareArea() != SAS_UNDEFINED))
{
	NERO_SPARE_AREA_SETTINGS nSA = params.GetSpareArea();
	NeroSetDeviceOption(m_NeroDeviceHandle, NERO_DEVICEOPTION_SPARE_AREA, &nSA);
}

NEROAPI_BURN_ERROR err;
CBurnContextProgress m_NeroProgress;

// Burn the image
err = NeroBurn (m_NeroDeviceHandle,
				NERO_BURN_IMAGE_MEDIA,
				&writeCD,
				GetBurnFlags (params),
				params.GetSpeedToNeroBurn (),
				m_NeroProgress);

return TranslateNeroToExitCode (err);

}

What about just reading the contents of an iso and either extracting them or having the ability to show them inside Explorer? Can someone supply a sample in C# by any chance?

You can use the NeroAPI method:

NeroCreateBlockAccessFromImage(const char *szFilename,
ImageAccessMode eAccessMode);

With this function you obtain an INeroFileSystemBlockAccess Interface whith which you can read on the image. Just have a look at the NeroAPI dokumentation in the NeroSDK. In Chapter 12.2 the File System Block Access Interface is explained in detail.

Have fun :slight_smile: