#1 Burning Software

It is currently Thu Dec 19, 2024 7:51 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: DiscAtOnceFromFile in C#
PostPosted: Sun Sep 03, 2006 10:26 pm 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
Hello,

I'm having some trouble getting the DiscAtOnceFromFile example to work in C# / .NET 2.0. It will burn an ISO image perfectly, however it doesn't work with audio.

I tried installing the Windows Media Library redistributable kit, but the same thing happened.

I recompiled the C example in VS05 and it works for both ISO/audio. I'm thinking there's something wrong with a struct declaration or API call/declaration, specifically one of the following:

StarBurn_CdvdBurnerGrabber_DiscAtOnceRawPWFromFile
StarBurn_CdvdBurnerGrabber_DiscAtOncePQFromFile
DAO_DISC_LAYOUT
DAO_DISC_LAYOUT_ENTRY

But, I've been staring at those 4 declarations for two days now - maybe it's something else?

Hopefully one of you experts can help me out :)

C# project (works with ISO, not with audio): http://cdtag.com/daoff/DiscAtOnceFromFile_CS.zip
C project (works with ISO/audio): http://cdtag.com/daoff/DAO_C2.zip

C# log file (not working): http://cdtag.com/daoff/notworking_cs_example.zip
C log file (working): http://cdtag.com/daoff/working_c_example.zip

The log files start showing a difference around line 400.

Any help is appreciated. Thank you!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 12:27 am 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
Small update: I believe this has to do with how 'CHAR m__CHAR__TrackName[ MAX_PATH ];' is marshalled in DAO_DISC_LAYOUT_ENTRY. I noticed that if I passed a normal 'String' to StarBurn_IsAudioFileSupported it would come back EN_UNSUPPORTED_AUDIO, but when I changed the parameter type to a StringBuilder it worked! Unfortunately you cannot have a StringBuilder in a struct that goes to an API call. So, I'm thinking something along the lines of:

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public String TrackName;

but of course this didn't work, or I'd just post that it's resolved :) Maybe an IntPtr?

Any help is appreciated. Thank you!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 11:34 am 
Hi!

This was a problem of COM appartments with .NET. We already fixed it, please drop a mail to support@rocketdivision.com, we'll send you the updated DLL before the official release.

Regards,
Alexander Orlovsky


Top
  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 5:05 pm 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
Thanks Alex, it worked great.

For reference, here are the declarations I used:

Code:
[DllImport("StarBurn.dll", CharSet = CharSet.Ansi)]
private static extern EXCEPTION_NUMBER StarBurn_CdvdBurnerGrabber_DiscAtOnceRawPWFromFile(int CdvdBurnerGrabber, StringBuilder pExceptionText,
    int ExceptionTextSize, ref int SystemError, ref CDB_FAILURE_INFORMATION PCDB_Failure_Information, ref DAO_DISC_LAYOUT PDAO_DISC_LAYOUT, bool IsXA,
    bool IsTestWrite, bool IsNextSessionAllowed, bool IsSubChannelRepairRequired, int WriteReportDelayInSeconds, int BufferStatusReportDelayInSeconds);

[DllImport("StarBurn.dll", CharSet = CharSet.Ansi)]
private static extern EXCEPTION_NUMBER StarBurn_CdvdBurnerGrabber_DiscAtOncePQFromFile(int CdvdBurnerGrabber, StringBuilder pExceptionText,
    int ExceptionTextSize, ref int SystemError, ref CDB_FAILURE_INFORMATION PCDB_Failure_Information, ref DAO_DISC_LAYOUT PDAO_DISC_LAYOUT, bool IsXA,
    bool IsTestWrite, bool IsNextSessionAllowed, bool IsSubChannelRepairRequired, int WriteReportDelayInSeconds, int BufferStatusReportDelayInSeconds);

[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct DAO_DISC_LAYOUT
{
    public int NumberOfEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.AsAny)]
    public DAO_DISC_LAYOUT_ENTRY[] PDAO_DISC_LAYOUT_ENTRY;
}

[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct DAO_DISC_LAYOUT_ENTRY
{
    public int TrackSizeInLBs;
    public int TrackStartingLBA;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
    public String TrackName;
    public UInt32 File;
    public byte IsDataTrack;
    public byte IsRawTrack;
    public byte IsAudioTrack;
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 04, 2006 10:25 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Excellent! New StarBurn release planned for next couple of days. Including this fix of course. Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 1:35 pm 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
Hi again,

I'm working on converting the C examples to C#. So far I've successfully converted 6 of them but now I'm stuck on an API call.

When I call StarBurn_CdvdBurnerGrabber_GetTOCInformation I get an Exception that either says "Attempted to read or write protected memory" or "Stack overflow" (I get both exceptions somewhat randomly). I've tried on two different drives with the same results.

Here's the example solution which includes Blank, BuildImage, CloseSession, DAO From File, DAO From Tree, GrabTrack, and LockUnlock. The one I'm having problems with is GrabTrack.

http://www.cdtag.com/starburn/StarBurnCS_20060907.rar

PS: Please forgive the code it is very much in rough draft :)

Also, if you look at the struct TOC_INFORMATION, the 'right' way is commented out however the 'safe' way is inserted to ensure the problem was not with marshalling.

Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 10:59 pm 
Hi!

If I understood correctly the problem, in the update we sent to you there is already the fix for it in StarBurn.h. Size of unsorted entries array should be larger to make room for all maintenance tracks (points A0, A1, A2 etc.), so you need just to increase that size.
This bug happened only on CDs with great number of sessions. The fix will be included in the upcoming release.

Regards,
Alexander Orlovsky


Top
  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 2:50 am 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
(edit: no longer applies)


Last edited by Jud on Fri Sep 08, 2006 4:25 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 4:20 am 
Offline

Joined: Fri Sep 01, 2006 4:11 pm
Posts: 7
Location: US
Woops, my apologies. I misread your reply the first time. I changed the struct to match the definition in the new StarBurn.h (401 elements in FULL_TOC_ENTRY_RAW__Unsorted) and it works perfectly. Thank you!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 09, 2006 5:08 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Perfect! :)

Jud wrote:
Woops, my apologies. I misread your reply the first time. I changed the struct to match the definition in the new StarBurn.h (401 elements in FULL_TOC_ENTRY_RAW__Unsorted) and it works perfectly. Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group