Rocket Division Software
http://www.starburnsoftware.com/forum/

StarBurn_UDF_Create freeze
http://www.starburnsoftware.com/forum/starburn-sdk-f3/starburn-udf-create-freeze-t23.html
Page 1 of 1

Author:  jcsston [ Mon Jun 28, 2004 9:46 pm ]
Post subject:  StarBurn_UDF_Create freeze

Hi,
I using the StarBurn SDK to create a program to burn DVD-Video (which if it works out will be purchasing a StarBurn license).

I'm basing my code off the DVDVideoTrackAtOnceFromTree.c sample with the exception that I've adding a few more .ifo and .vob's (in the correct order) files.

The run along fine until it hits
Code:
      exceptionNo =
          StarBurn_UDF_Create(m_FileSystemHead, sizeof(m_FileSystemHead),
              m_FileSystemTail, sizeof(m_FileSystemTail),
              m_FileSystemStructures,
              &l__UDF_TREE_ITEM__Directory[ 1 ], // This is ROOT
              &l__UDF_TREE_ITEM__Directory[ 2 ], // This is VIDEO_TS and not ROOT, for VIDEO_TS listing
              &l__UDF_TREE_ITEM__Directory[ 3 ], // This is AUDIO_TS and not ROOT, for AUDIO_TS listing
              &l__UDF_CONTROL_BLOCK,
              ExceptionText, sizeof(ExceptionText),
              &Status,
              "VolumeLabel");

Then it hits 100% cpu, I have let it run for about 10mins and repeated the run with the same results.

Breaking into the debugger I can see it looping in a function call 3 levels into the StarBurn.dll.
Code:
   StarBurn.dll!1003b618()    
   StarBurn.dll!1003b696()    
   StarBurn.dll!1003ce1c()    
>   My Code

Reading the dissassembly I believe it is stuck in a
while (something != NULL) loop.

Thank you,
Jory Stone

Author:  alexey (staff) [ Tue Jun 29, 2004 12:56 pm ]
Post subject:  your sources

Hello,

It looks like you did not initialize heads of the list in the right way, can we have more source code of yours?

Please, give us your initialization code and your call-back handler.

Thanks,
Alexey.

Author:  jcsston [ Tue Jun 29, 2004 5:42 pm ]
Post subject: 

Here's the init code, the callback function isn't yet referenced.

Code:
LONG m_TreeNodes;
LARGE_INTEGER m_LastWrittenPercent;
unsigned char m_FileSystemHead[UDF_HEAD_SIZE_IN_LOGICAL_BLOCKS * UDF_LOGICAL_BLOCK_SIZE_IN_UCHARS];
unsigned char m_FileSystemTail[UDF_TAIL_SIZE_IN_LOGICAL_BLOCKS * UDF_LOGICAL_BLOCK_SIZE_IN_UCHARS];
unsigned char m_FileSystemStructures[1024 * UDF_LOGICAL_BLOCK_SIZE_IN_UCHARS];
//unsigned char m_IsIfoPatch = 0x00; // 0x01; // Assume IFO patch present by default
unsigned char m_Buffer[UDF_LOGICAL_BLOCK_SIZE_IN_UCHARS];
LARGE_INTEGER m_FileSizeInUCHARs;

CString video_ts = "D:\\...\\VIDEO_TS\\";
HRESULT hr = S_OK;

CString filename;
bool bTestBurn = false;
void *CdvdBurnerGrabber = NULL;
ULONG Status = ERROR_GEN_FAILURE;
char ExceptionText[1024];
EXCEPTION_NUMBER exceptionNo = EN_SUCCESS; // Assume success by default
CDB_FAILURE_INFORMATION CDBFailureInfo;
TRACK_INFORMATION l__TRACK_INFORMATION;
DISC_INFORMATION l__DISC_INFORMATION;
BOOLEAN IsBUPEnabled;
BOOLEAN IsBUPSupported;
ULONG CurrentReadSpeed;
ULONG MaximumReadSpeed;
ULONG CurrentWriteSpeed;
ULONG MaximumWriteSpeed;
BOOLEAN IsSendOPCSuccessful = FALSE;
DISC_TYPE l__DISC_TYPE = DISC_TYPE_UNKNOWN;
BOOLEAN IsTrackAtOnce = FALSE;
BOOLEAN IsSessionAtOnce = FALSE;
BOOLEAN IsDiscAtOncePQ = FALSE;
BOOLEAN IsDiscAtOnceRawPW = FALSE;
UDF_TREE_ITEM l__UDF_TREE_ITEM__Directory[20]; // Directory[ 0 ] is not used
UDF_TREE_ITEM UDF_File;
CArray<UDF_TREE_ITEM> UDF_Files;
ULONG GUID = 0; // Start assigning GUIDs with zero
UDF_CONTROL_BLOCK l__UDF_CONTROL_BLOCK;

// Prepare memory buffers
memset(m_FileSystemHead, 0, sizeof(m_FileSystemHead));
memset(m_FileSystemTail, 0, sizeof(m_FileSystemTail));
memset(m_FileSystemStructures, 0, sizeof(m_FileSystemStructures));         
memset(l__UDF_TREE_ITEM__Directory, 0, sizeof(l__UDF_TREE_ITEM__Directory));
memset(&UDF_File, 0, sizeof(UDF_File));
memset(&l__UDF_CONTROL_BLOCK, 0, sizeof(UDF_CONTROL_BLOCK));

// Prepare the buffer for exception text
memset(ExceptionText, 0, sizeof(ExceptionText));

//
// Start processing cleanup
//
try
{
   TRACE("DVDVideoTrackAtOnceFromTree:main(): Formatting directories...\n" );

   //
   // Format Directory[ 1 ] as root
   //
   StarBurn_UDF_FormatTreeItemAsDirectory(
      &l__UDF_TREE_ITEM__Directory[ 1 ],
      ( ++GUID ),
      "",
      NULL
      );

   //
   // Format VIDEO_TS directory
   //
   StarBurn_UDF_FormatTreeItemAsDirectory(
      &l__UDF_TREE_ITEM__Directory[ 2 ],
      ( ++GUID ),
      "VIDEO_TS",
      &l__UDF_TREE_ITEM__Directory[ 1 ]
      );

      //
      // Format AUDIO_TS directory
      //
      StarBurn_UDF_FormatTreeItemAsDirectory(
         &l__UDF_TREE_ITEM__Directory[ 3 ],
         ( ++GUID ),
         "AUDIO_TS",
         &l__UDF_TREE_ITEM__Directory[ 1 ]
         );


         TRACE("DVDVideoTrackAtOnceFromTree:main(): Formatting files...\n" );


         //
         // Format files (begin)
         //


         /*

         Files must be aligned like this:

         /VIDEO_TS/VIDEO_TS.IFO   
         /VIDEO_TS/VIDEO_TS.VOB   
         /VIDEO_TS/VIDEO_TS.BUP   
         /VIDEO_TS/VTS_01_0.IFO   
         /VIDEO_TS/VTS_01_0.VOB   
         :               :
         /VIDEO_TS/VTS_01_9.VOB   
         /VIDEO_TS/VTS_01_0.BUP   
         :               :
         /VIDEO_TS/VTS_99_0.BUP   

         */


         filename = video_ts + "video_ts.ifo";
         Status =
            StarBurn_UDF_FormatTreeItemAsFile(
            &UDF_File,
            ( ++GUID ),
            "video_ts.ifo",
            (char *)(const char *)filename,
            &l__UDF_TREE_ITEM__Directory[ 2 ]
            );

            //
            // Check for success
            //
            if (Status != 0)
            {
               TRACE("DVDVideoTrackAtOnceFromTree:main(): EXITing with failure, StarBurn_UDF_FormatTreeItemAsFile( %p, %ld, '%s', '%s', %p ) failed, status %ld ( 0x%X )\n",
                  &UDF_File,
                  GUID,
                  "video_ts.ifo",
                  (char *)(const char *)filename,
                  &l__UDF_TREE_ITEM__Directory[ 2 ],
                  Status,
                  Status
                  );

               //
               // Get out of here
               //
               throw Status;
            }
            UDF_Files.Add(UDF_File);

            filename = video_ts + "video_ts.bup";
            Status =
               StarBurn_UDF_FormatTreeItemAsFile(
               &UDF_File,
               ( ++GUID ),
               "video_ts.bup",
               (char *)(const char *)filename,
               &l__UDF_TREE_ITEM__Directory[ 2 ]
               );

               //
               // Check for success
               //
               if ( Status != 0 )
               {
                  TRACE("DVDVideoTrackAtOnceFromTree:main(): EXITing with failure, StarBurn_UDF_FormatTreeItemAsFile( %p, %ld, '%s', '%s', %p ) failed, status %ld ( 0x%X )\n",
                     &UDF_File,
                     GUID,
                     "video_ts.bup",
                     (char *)(const char *)filename,
                     &l__UDF_TREE_ITEM__Directory[ 2 ],
                     Status,
                     Status
                     );

                  //
                  // Get out of here
                  //
                  throw Status;
               }
               UDF_Files.Add(UDF_File);

               // Ok, now we loop to add all the files we can
               CString localFilename;
               CString udfFilename;
               int index = 1;
               int part = 0;
               while (Status == 0) {
                  // Starting from part 0
                  part = 0;

                  udfFilename.Format("vts_%02i_%i.ifo", index, part);
                  localFilename = video_ts + udfFilename;

                  // No more files?
                  if (!PathFileExists(localFilename))
                     break;

                  Status = StarBurn_UDF_FormatTreeItemAsFile(
                     &UDF_File,
                     ( ++GUID ),
                     (char *)(LPCSTR)udfFilename,
                     (char *)(LPCSTR)localFilename,
                     &l__UDF_TREE_ITEM__Directory[ 2 ]
                     );

                     //
                     // Check for success
                     //
                     if ( Status != 0 )
                     {
                        TRACE("DVDVideoTrackAtOnceFromTree:main(): EXITing with failure, StarBurn_UDF_FormatTreeItemAsFile( %p, %ld, '%s', '%s', %p ) failed, status %ld ( 0x%X )\n",
                           &UDF_File,
                           GUID,
                           (LPCSTR)udfFilename,
                           (LPCSTR)localFilename,
                           &l__UDF_TREE_ITEM__Directory[ 2 ],
                           Status,
                           Status
                           );

                        //
                        // Get out of here
                        //
                        break;
                     }
                     UDF_Files.Add(UDF_File);

                     udfFilename.Format("vts_%02i_%i.buf", index, part);
                     localFilename = video_ts + udfFilename;

                     if (PathFileExists(localFilename)) {
                        Status = StarBurn_UDF_FormatTreeItemAsFile(
                           &UDF_File,
                           ( ++GUID ),
                           (char *)(LPCSTR)udfFilename,
                           (char *)(LPCSTR)localFilename,
                           &l__UDF_TREE_ITEM__Directory[ 2 ]
                           );

                           // Check for success
                           if ( Status != 0 )
                           {
                              TRACE("DVDVideoTrackAtOnceFromTree:main(): EXITing with failure, StarBurn_UDF_FormatTreeItemAsFile( %p, %ld, '%s', '%s', %p ) failed, status %ld ( 0x%X )\n",
                                 &UDF_File,
                                 GUID,
                                 udfFilename,
                                 localFilename,
                                 &l__UDF_TREE_ITEM__Directory[ 2 ],
                                 Status,
                                 Status
                                 );

                              //
                              // Get out of here
                              //
                              continue;
                           }
                           UDF_Files.Add(UDF_File);
                     }



                     while (part < 10) {
                        udfFilename.Format("vts_%02i_%i.vob", index, part);
                        localFilename = video_ts + udfFilename;

                        if (!PathFileExists(localFilename))
                           break;

                        Status = StarBurn_UDF_FormatTreeItemAsFile(
                           &UDF_File,
                           ( ++GUID ),
                           (char *)(LPCSTR)udfFilename,
                           (char *)(LPCSTR)localFilename,
                           &l__UDF_TREE_ITEM__Directory[ 2 ]
                           );

                           //
                           // Check for success
                           //
                           if ( Status != 0 )
                           {       
                              TRACE("DVDVideoTrackAtOnceFromTree:main(): EXITing with failure, StarBurn_UDF_FormatTreeItemAsFile( %p, %ld, '%s', '%s', %p ) failed, status %ld ( 0x%X )\n",
                                 &UDF_File,
                                 GUID,
                                 "vts_01_1.vob",
                                 "e:\\VOB\\vts_01_1.vob",
                                 &l__UDF_TREE_ITEM__Directory[ 2 ],
                                 Status,
                                 Status
                                 );

                              //
                              // Get out of here
                              //
                              throw Status;
                           }
                           UDF_Files.Add(UDF_File);

                           // We'll get the next part of the next pass
                           part++;
                     }

                     // Next ifo/vob index
                     index++;
               }
               //
               // Format files (end)
               //

               //
               // Try to create UDF
               //
               exceptionNo =
                  StarBurn_UDF_Create(m_FileSystemHead, sizeof(m_FileSystemHead),
                  m_FileSystemTail, sizeof(m_FileSystemTail),
                  m_FileSystemStructures,
                  &l__UDF_TREE_ITEM__Directory[ 1 ], // This is ROOT
                  &l__UDF_TREE_ITEM__Directory[ 2 ], // This is VIDEO_TS and not ROOT, for VIDEO_TS listing
                  &l__UDF_TREE_ITEM__Directory[ 3 ], // This is AUDIO_TS and not ROOT, for AUDIO_TS listing
                  &l__UDF_CONTROL_BLOCK,
                  ExceptionText, sizeof(ExceptionText),
                  &Status,
                  "VolumeLabel");

               //
               // Check for success
               //
               if ( exceptionNo != EN_SUCCESS )
               {
                  TRACE("DVDVideoTrackAtOnceFromTree:main(): StarBurn_UDF_Create() failed, exception %ld, status %ld, text '%s'\n",
                     exceptionNo,
                     Status,
                     ExceptionText
                     );

                  //
                  // Get out of here
                  //
                  throw Status;
               }
} catch (...) {

}

Author:  alexey (staff) [ Wed Jun 30, 2004 10:44 am ]
Post subject:  Errors in your last sources

Hello,

I think, i have found the problem in your last sources...

You have:
UDF_TREE_ITEM l__UDF_TREE_ITEM__Directory[20]; // Directory[ 0 ] is not used
UDF_TREE_ITEM UDF_Files[32];


But you are adding more then 32 files (35 files) . that is why you
have l__UDF_TREE_ITEM__Directory[1] rewritten with wrong info...

I have found in your log:
Run-Time Check Failure #2 - Stack around the variable 'UDF_Files' was
corrupted.

Best wishes,
Alexey Popov.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/