Skip to main content

 none
CD-RW works ok but CD-R wont do multi session. RRS feed

  • Question

  • I have managed to burn and re-burn CD-RW.

    However on the second burn to a CD-R it corrupts the disc and it becomes unreadable.

    Any suggestions would be appreciated.

            //mode 0 = blank cd 1=used/formatted cd
            void burn(int mode)
            {
     
                toolStripStatusLabel1.Text = ("----- Burning files -----");
                statusStrip1.Update();
                // This script burns data files to disc in a single session 
                // using files from a single directory tree.
                // Copyright (C) Microsoft Corp. 2006
    
    
    
                dynamic Index;              // Index to recording drive.
                dynamic recorder;            // Recorder object
                dynamic path;             // Directory of files to burn
                dynamic Stream;              // Data stream for burning device
    
                Index = 0;            // First drive on the system
    
                // Files to transfer to disc
                path = @"c:\0_cdcopy\source";
    
                // Create a DiscMaster2 object to connect to optical drives.
                dynamic g_DiscMaster;
                g_DiscMaster = new IMAPI2.Interop.MsftDiscMaster2();
    
                // Create a DiscRecorder object for the specified burning device.
                dynamic uniqueId;
                recorder = new IMAPI2.Interop.MsftDiscRecorder2();
                uniqueId = g_DiscMaster.Item(Index);
                recorder.InitializeDiscRecorder(uniqueId);
    
                // Create an image stream for a specified directory.
                dynamic FSI;                 // Disc file system
                dynamic Dir;                 // Root directory of the disc file system
                dynamic dataWriter;
    
                // Create a new file system image and retrieve root directory
                FSI = new IMAPI2.Interop.MsftFileSystemImage();
                Dir = FSI.Root;
                
    
    
                //Create the new disc format and set the recorder
                dataWriter = new IMAPI2.Interop.MsftDiscFormat2Data();
                dataWriter.Recorder = recorder;
                dataWriter.ClientName = "IMAPIv2 TEST";
                dataWriter.ForceOverWrite = true;
    
    
                FSI.ChooseImageDefaults(recorder);
    
                if (!dataWriter.MediaHeuristicallyBlank)
                {
                    FSI.MultisessionInterfaces = dataWriter.MultisessionInterfaces;
                }
    
                //
                FSI.FileSystemsToCreate =
                FsiFileSystems.FsiFileSystemJoliet | FsiFileSystems.FsiFileSystemISO9660;
    
    
    
                // Add the directory and its contents to the file system 
    
                try
                {
                    Dir.AddTree(path, false);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(path + " Cant find path.  " + Convert.ToString(ex));
                    return;
                }
    
                
                
                
                // Create an image from the file system
                dynamic result;            
                result = FSI.CreateResultImage();
                Stream = result.ImageStream;
                
    
    
                // Write stream to disc using the specified recorder.
                toolStripStatusLabel1.Text = ("Writing content to disc...");
                statusStrip1.Update();
                try
                {
                    dataWriter.Write(Stream);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(Convert.ToString(ex));
                    return;
                }
    
                toolStripStatusLabel1.Text = ("----- Finished writing content -----");
                statusStrip1.Update();
            }
    
    
    
    
    


    n.Wright

    Tuesday, January 9, 2018 5:43 PM

Answers