NeroCOM - How does one Read/Write Packets?

vbimport

#1

I have written onto a blank DVD+RW a few files using the NERO_BURN_OPTIONS.NERO_BURN_OPTION_CREATE_UDF_FS option. Nero Burning Rom recognises the CD as an UDF cd, so it’s fine there.

I am using C# and NeroCOM, and would like to be able to read and write packets. At this moment, this is the code I’m trying out:

Nero DVDBurners = new NeroClass();
try
{
	NeroDrives DVDWRoms = DVDBurners.GetDrives(NERO_MEDIA_TYPE.NERO_MEDIA_DVD_P_RW);
	NeroDrive DVDBurner = (NeroDrive) DVDWRoms.Item(0);
	//INeroFileSystemBlockWriter BlkWrt = DVDBurner.CreateBlockWriter(AccessMode.ePacketWriting);
	INeroFileSystemBlockReader BlkRd = DVDBurner.CreateBlockReader(AccessMode.eNoWriting);
	NeroFSSecNo startSec = new NeroFSSecNoClass();
	startSec.LoPart = 1;
	startSec.HiPart = 1;
	NeroFSSecNo secWritten = new NeroFSSecNoClass();
	secWritten.LoPart = 2;
	secWritten.HiPart = 2;
	NeroFSSecNo sec2Write = new NeroFSSecNoClass();
	sec2Write.LoPart = 0;
	sec2Write.HiPart = 0;
	Object pvarBuffer = new object();
	BlkRd.ReadSectorsBuffered(ref pvarBuffer, startSec, secWritten, ref sec2Write);
	//BlkWrt.WriteSectorsBuffered( pvarBuffer,
}
catch (System.Exception ee)
{
	System.Windows.Forms.MessageBox.Show("Nero Exception: " + ee.Message + ee.StackTrace);
}

At the indigo line, It throws an error: “Nero Exception: The parameter is incorrect.” What is the correct usage of the Read/WriteSectorsBuffered so that I can read as well as write to an UDF formatted DVD+RW?


#2

HiPart and LoPart should be treated as 64-bit integers. Try assigning zero to HiPart instead of 1 or 2. The way you wrote it startSec is 0x100000001 and secWritten is 0x200000002.

Other than this, [color=black]pvarBuffer[/color] should be a VARIANT.


#3

In vb.net in case of absence of any specific variable type, it will be declared as object type. Whereas in Vb it is considered as Variant data Type

http://www.dotnetspider.com/Technology/QA/ViewQuestion.aspx?QuestionId=222
So, I think I did no wrong by declaring it as an Object.
C# & VB.NET have a System.Int64 object, so it didn’t occour to me that HiPart & LoPart might be of a 64-bit integer.

Ok, despite setting the high bits to 0 and low bits appropriately, I am not able to read anything. It still returns the error

Nero Exception : The parameter is incorrect. at NEROLib.NeroFileSystemBlockClass.ReadSectorsBuffered(Object& pvarBuffer, NeroFSSecNo pStartSector, NeroFSSecNo pNoSectors, NeroFSSecNo& ppNoSectorsRead)