Thanks for your reply.
For the 3rd point in your reply I'm trying to obtain an answer
At the moment I can send to you the code I've used for the burning function.
But before, about the 2nd point, I don't know how to use the UDF filesystem, because in the sample code I've used (the databurner), the structure FILE_TREE
has only two type: ISO9660 and Joliet.
Furthermore, if I would use the UDF filesystem, there are a lot of functions that are not translated for a Dllimport. So I need for an help in that sense.
Back to the burning function
Arguments:
int DeviceNum : number of the device selected
string[] FileNames : an array of files to burn
uint MultiSession : 1 to activate the multisession.
In our case MultiSession=0 (single session) and FileNames is an array of one single file of 45GB (It was just a test).
The code used is completely based on the DataBurner example.
The burning process takes 5 hours.
public uint Burn(int DeviceNum, string[] FileNames, uint MultiSession)
{
if (FileNames.Length < 0)
throw new Exception("\nBurn: cannot use empty file list");
if (DeviceNum >= Devices.Count)
throw new Exception("\nBurn: device number not valid");
if (!TestDevice(DeviceNum))
throw new Exception("\nBurn: device not ready");
GetDiscInsertedType(DeviceNum);
CDDVDINFO Info = DevicesInfo[DeviceNum];
if (Info.mediainfo == "Empty")
throw new Exception("\nBurn: device empty");
//these two function save into the apposite field of DevicesInfo[DeviceNum] the infos about the space
GetDiscUsedSpace(DeviceNum);
GetDiscFreeSpace(DeviceNum);
Info = DevicesInfo[DeviceNum];
Marshal.WriteByte(ExceptionText, 0);
byte IsBUPEnabled;
byte IsBUPSupported;
ExceptionNum = StarBurn_CdvdBurnerGrabber_GetBUP(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
out IsBUPEnabled,
out IsBUPSupported
);
if (EXCEPTION_NUMBER.EN_SUCCESS != ExceptionNum)
{
OutMessage = String.Format("\nBurn: GetBUP failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
if (IsBUPSupported != 0)
{
ExceptionNum =
StarBurn_CdvdBurnerGrabber_SetBUP(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
1
);
if (EXCEPTION_NUMBER.EN_SUCCESS != ExceptionNum)
{
OutMessage = String.Format("\nBurn: SetBUP failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
}
int maxSpeed = GetMaxWriteSpeed(DeviceNum);
ExceptionNum =
StarBurn_CdvdBurnerGrabber_SetSpeeds(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
MAX_POSSIBLE_SPEED,
maxSpeed
);
if (EXCEPTION_NUMBER.EN_SUCCESS != ExceptionNum)
{
OutMessage = String.Format("\nBurn: SetSpeeds failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
ExceptionNum =
StarBurn_CdvdBurnerGrabber_SendOPC(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo
);
if (EXCEPTION_NUMBER.EN_SUCCESS != ExceptionNum)
{
OutMessage = String.Format("\nBurn: SendOPC failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
int lastTrack;
ExceptionNum = StarBurn_CdvdBurnerGrabber_GetLastTrack(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
out lastTrack
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: GetLastTrack failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
FILE_TREE MyFileTreeType = FILE_TREE.FILE_TREE_JOLIET;
byte IsLevel = 0;
DISC_INFORMATION DiscInfo = new DISC_INFORMATION();
GetDiscInfo(Info, ref DiscInfo, DeviceNum);
if (DiscInfo.m__UCHAR__DiscStatus != (byte)DISC_STATUS.EMPTY)
{
DISC_FILESYSTEM DiscFileSystem;
ExceptionNum =
StarBurn_CdvdBurnerGrabber_GetDiscFileSystem(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
out DiscFileSystem);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: GetDiscFileSystem failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
if (DiscFileSystem.m__BOOLEAN__ISO9660Present == 1 && DiscFileSystem.m__BOOLEAN__UDFPresent == 0)
{
if (DiscFileSystem.m__BOOLEAN__JolietPresent == 1)
{
MyFileTreeType = FILE_TREE.FILE_TREE_JOLIET;
}
else
{
MyFileTreeType = FILE_TREE.FILE_TREE_ISO9660;
IsLevel = 1;
}
}
}
uint ISOFileTree;
ExceptionNum =
StarBurn_ISO9660JolietFileTree_Create(
out ISOFileTree,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
EmptyCallbackDelegate,
IntPtr.Zero,
1,
0,
IsLevel,
MyFileTreeType
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: JolietFileTree_Create failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
STARBURN_TRACK_INFORMATION InfoTracks = TracksInfo[DeviceNum];
if (lastTrack != 0)
{
ExceptionNum =
StarBurn_ISO9660JolietFileTree_ImportTrack(
Info.CdvdBurnerGrabber,
ISOFileTree,
lastTrack,
0,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: ISO9660JolietFileTree_ImportTrack failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
}
uint ParentNode = 0;
uint StarBurnNewNode = 0;
ParentNode = StarBurn_ISO9660JolietFileTree_GetRoot(ISOFileTree);
for (int i = 0; i < FileNames.Length; ++i)
{
ExceptionNum =
StarBurn_ISO9660JolietFileTree_Add(
ISOFileTree,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
FileNames[i],
null,
FILE_TIME.FILE_TIME_LAST_WRITE,
ref ParentNode,
out StarBurnNewNode
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: ISO9660JolietFileTree_GetRoot failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
}
uint tree_level = StarBurn_ISO9660JolietFileTree_GetLevel(ISOFileTree);
if (tree_level >
{
Console.WriteLine("Device " + DeviceNum + " level failed");
}
ExceptionNum =
StarBurn_ISO9660JolietFileTree_BuildImage(
ISOFileTree,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
InfoTracks.m__LONG__NextWritableAddress,
0,
1,
"Data backup",
"Data backup",
"Data backup"
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: ISO9660JolietFileTree_BuildImage failed, exception {0}, status {1}, text '{2}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
uint ImageSizeLowPart;
uint ImageSizeHighPart;
ImageSizeLowPart =
StarBurn_ISO9660JolietFileTree_GetSizeInUCHARs(
ISOFileTree,
out ImageSizeHighPart
);
ulong ImageSize = ImageSizeHighPart;
ImageSize <<= 4 * 8;
ImageSize += ImageSizeLowPart;
//20MB of leadin e leadout for each session
ulong LeadInOut = 20 * 1024 * 1024;
if (Info.freesizeInBytes <= (ImageSize + LeadInOut))
throw new Exception("\nBurn: not enough space - image size: " + ImageSize + " - free space: " + Info.freesizeInBytes + "\n");
Console.WriteLine("Device " + DeviceNum + " image size " + ImageSize);
Console.WriteLine("Burning process started....." + DateTime.Now);
ExceptionNum =
StarBurn_CdvdBurnerGrabber_TrackAtOnceFromTree(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
ISOFileTree,
0,
0,//test
(byte)MultiSession,
WRITE_REPORT_DELAY_IN_SECONDS,
BUFFER_STATUS_REPORT_DELAY_IN_SECONDS
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: CdvdBurnerGrabber_TrackAtOnceFromTree failed, exception {0}, status {1}, text '{3}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
Console.WriteLine("Burning process complete....." + DateTime.Now);
ExceptionNum =
StarBurn_CdvdBurnerGrabber_CloseSession(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: CloseSession failed, exception {0}, status {1}, text '{3}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
Console.WriteLine("Session closed....." + DateTime.Now);
uint FailedLBA;
ExceptionNum = StarBurn_CdvdBurnerGrabber_VerifyTree(
Info.CdvdBurnerGrabber,
ExceptionText,
EXCEPTION_TEXT_SIZE,
out SystemError,
out CDBFailureInfo,
ISOFileTree,
InfoTracks.m__LONG__NextWritableAddress,
out FailedLBA,
1000
);
if (ExceptionNum != EXCEPTION_NUMBER.EN_SUCCESS)
{
OutMessage = String.Format("\nBurn: VerifyTree failed, exception {0}, status {1}, text '{3}'\n",
ExceptionNum,
SystemError,
Marshal.PtrToStringAnsi(ExceptionText)
);
throw new Exception(OutMessage);
}
Console.WriteLine("Burning process verified....." + DateTime.Now);
if (FailedLBA != 0)
Console.WriteLine("Failed LB: " + FailedLBA);
StarBurn_Destroy(ref ISOFileTree);
Console.WriteLine("Memory and resources released....." + DateTime.Now);
return FailedLBA;
}
Unfortunately I don't know the value returned by this function for an error in its use.
Anyway the problem here is not about the failed verify but about the strange burning process.
Analyzing the Blu-Ray after the burning process with an ISO analyzer tool gives this result.
On the disc there are two files with these properties:
1 - VD Address = 16
VD Size = 1 Block
Type = ISO9660
2 - VD Address = 17
VD Size = 1 Block
Type = Joliet