Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Creating a Multisession Disc
In this articleThe Image Mastering API (IMAPI) supports the addition and removal of files to, or from, the following multisession disc types:
Creation of a multisession disc using IMAPI consists of the following steps. Each of these documented steps contains the relevant portion of the complete Visual Basic script example provided in the final section. Initializing the Disc RecorderPrior to device initialization, the MsftDiscMaster2 object provides an enumeration of the optical devices on the system. The IDiscMaster2 interface provides access to this device enumeration to facilitate the location of the appropriate recording device. The MsftDiscMaster2 object also provides event notifications when optical devices are added to or removed from a machine. After locating an optical recorder and retrieving the ID assigned to it, create a new MsftDiscMaster2 object and initialize the recorder using the specific device ID. The IDiscRecorder2 interface provides access to basic device information such as vendor ID, product ID, product revision, as well as the methods to eject media or close the tray. Note The additional constants and dimensions declared in the following sample are used later in the complete sample script located in the final section of this document. These elements are not required for the act of initializing a disc recorder.
Creating a Data WriterThe MsftDiscFormat2Data object provides the writing method, its properties, as well as the media-specific properties. The IDiscFormat2Data interface provides access to this object. The disc recorder binds to the format writer using the IDiscFormat2Data::put_Recorder property. After the recorder is bound to the format writer, media and write-specific property queries can be performed prior to writing the result image to disc using the IDiscFormat2Data::Write method. Note The client name string specified in the sample code below should be adjusted as appropriate for the specific application.
Creating the File System ObjectIn order to record a new session, a burn image must be generated for it first. A burn image for ISO9660, Joliet and UDF formats consist of file systems of individual files and directories. The MsftFileSystemImage object is the file system object that contains the files and directories to be placed on the optical media. The IFileSystemImage interface provides access to the file system object and settings.
Importing a File SystemBefore proceeding, ensure that the disc is not blank by checking the IDiscFormat2::get_MediaHeuristicallyBlank property. After creating the MsftFileSystemImage object, the IFileSystemImage::put_MultisessionInterfaces property should be initialized prior to a call to either the IFileSystemImage::ImportFileSystem or IFileSystemImage::ImportSpecificFileSystem method to import the file system from the last recorded session. These methods will automatically populate the MsftFileSystemImage object with information describing the previously recorded files and directories. Attempts to set the IFileSystemImage::put_MultisessionInterfaces property will fail if IMAPI does not support multisession for the currently inserted media or the media cannot be appended for some other reason (e.g. because it is closed). If the previous burn session contained more than one file system type, the IFileSystemImage::ImportFileSystem method will import information from the most advanced file system type present. For example, in the example provided in this topic, UDF is the imported file system. However, use of the IFileSystemImage::ImportSpecificFileSystem method allows the specific selection of the file system to import.
Adding or Removing Files to the File SystemAfter creating the file system object and importing the file system from the previous session, call the IFileSystemImage::CreateFileItem and IFileSystemImage::CreateDirectoryItem methods to create new file and directory objects, respectively. The file and directory objects provide specific details about the files and directories. Alternatively, the IFsiDirectoryItem::AddTree method of a directory object, represented via the IFsiDirectoryItem interface, can be used to add existing files and directories from another storage device (i.e. a hard drive). The event handler update method available for IFileSystemImage identifies the current file being added to the file system image, the number of sectors already copied, and the total number of sectors to be copied. To remove existing files and directories from the file system, use the IFsiDirectoryItem::Remove and IFsiDirectoryItem::RemoveTree methods of the directory objects represented via the IFsiDirectoryItem interface. The IFileSystemImage::get_Root property is used to get a pointer to the root directory of the file system and the IFsiDirectoryItem interface to traverse through the directory tree.
Constructing a File System ImageThe final step is to call IFileSystemImage::CreateResultImage to create a data stream for the burn image and provide access to it through the IFileSystemImageResult interface. This data stream can either be provided directly to the IDiscFormat2Data::Write method or be saved to a file for later use.
Example SummaryThe following Visual Basic script example shows how to use IMAPI objects to create multisession discs. The example creates a new session and adds a directory to the disc. For the sake of simplicity, the code does not perform extensive error checking, and assumes the following:
Additional functionality such as extensive error checking, device and media compatibility, event notification, and calculation of free space on the disc can be added to the script.
Using IMAPI IStream IDiscMaster2 IDiscFormat2Data IFileSystemImage
Additional resourcesAdditional resourcesIn this articleWhich file system is used for optical media?The Universal Disk Format (UDF) File System
The UDF file system is the industry-standard format for storing information on the DVD (Digital Versatile Disc or Digital Video Disc) optical media.
Which file system is a proprietary file system developed exclusively for use with Windows?The New Technology File System (NTFS) is a proprietary file system developed exclusively for use with Windows.
What function of an operating system is performed by the shell?The shell manages the interaction between you and the operating system by prompting you for input, interpreting that input for the operating system, and then handling any resulting output from the operating system. Shells provide a way for you to communicate with the operating system.
Which of the following refers to capturing and reading data packets as they move over the network?Packet Capture refers to the action of capturing Internet Protocol (IP) packets for review or analysis. The term can also be used to describe the files that packet capture tools output, which are often saved in the .
|