Windows burning Programming

Source: Internet
Author: User

I. Use the built-in burning function of Windows XP

Reference
Http://msdn.microsoft.com/msdnmag/issues/04/04/CQA/

1. Simple file burning

Use the icdburn interface of Shell, The method is as follows:
Hasrecordabledrive scans the system. If a writable CD drive is found, true is returned.
Getrecorderdriveletter returns a writable drive.
Burn executes the burning action and writes data from the staging area to the CD-R.

Before burning, you must copy the files to be burned to the assembly area, which is a temporary directory, located in the user directory "% USERPROFILE % \ Local Settings \ Application Data \ Microsoft \ CD burning", you can also get it through the following Shell API:
Shgetfolderpath (csidl_cdburn_area)

Note that the method here can only be used for a single optical drive, if you have multiple optical drives, it will not work.

 

2, music CD, CD-RW and other more complex burning

HereImapi (Image Mastering API ),It is also supported by Windows XP and later versions. Imapi can be used to query recorders, write data, and some advanced functions that do not have a name.
Create an msdiscmasterobj object, which has the following interfaces:
-O idiscmaster
-O iredbookdiscmaster
-O ijolietdiscmaster
CD is generally divided into two types: audio CD and Data CD, the former follows the Redbook specification, the latter is the ISO-9660 specification (there are other data specifications, joliet is an extension of the ISO-9660 .)

First, obtain the idiscmaster interface, call enumdiscmasterformats to list the media formats (Redbook, joliet, etc.) supported by the drive, and obtain corresponding interfaces such as iredbookdiscmaster according to the format. If the requirement is higher, you can call get/setactivediscmasterformat for dynamic update.

Then call enumdiscrecorders to list all the burning devices, corresponding to the idiscrecorder interface, which provides features such as the device path, properties, pop-up, erase CD-RW, but does not include writing data.

The specific data to be written varies according to different formats. For Data CD, that is, Joliet format, the adddata (istorage *) method is called to add files and directories. For audio CD, in the Redbook format, addaudiotrackblocks is called to add audio tracks. These methods copy data to the assembly area, rather than writing data immediately.
When the data is ready, call the recorddisc method of idiscmaster. This method has a bsimulate parameter used to simulate writing, but you may never use it.

This article introduces imapi. Although it is relatively simple, it is almost enough for VB programmers to rely on Windows XP.

Ii. mcdb-magic CD/DVD burner (C/C ++ Library)

Mcdb is a commercial CD/DVD component developed by binary magic. It is easy to use and has several versions of different media, including VCL and ActiveX, audio, CD, DVD, and VCD, it can be used in development languages such as Delphi, C ++ builder, C #, VB.net, VB, and C ++. Mcdb supports the UDF interface, Unicode Character Set, and a variety of recorder interfaces to easily create mpeg vcd and enable CD,Its core uses the ASPI interface (Advanced SCSI programming interface, which can also be used to access the IDE interface ).

Writing a mcdb application is very simple, basically similar to imapi.
First, create the mcdburner object. The attribute devicecount and devicename [] are used to check the burner list.
You can call insertfile/insertdir to write the files and directories to, and then execute the write operations. There are several different writing methods:
Buildisoimage (filename) writes to the ISO Image File
Burniso (isofile) writes the ISO image file to the CD
Prepare/burn writes data directly to the CD (that is, the famous on-the-fly Writing Technology)
Other common methods include:
Erasedisc erased CD-RW Disc
Discis determines the media type
Maxwritespeed/writespeed
Load medium/ejectmedium

The 120 m trial version of mcdb can be downloaded on www.binarymagics.com. The retail price is between 2000 and USD, and the source code is available for sale. The price is about USD.

Iii. hpcde

Hpcde is a high-performance CD/DVD burning component developed by primo software. The current version is 1.78. It can be seen from the feature list that it supports a lot of hardware, supports multiple modes such as DVD Dao/incremental, Tao, Sao, Dao, raw, and CD-plus in writing, and supports UDF and HFS file systems, it can be used to burn CDs for Mac OS, and supports advanced features such as flying disk protection, such as justlink, safeburn, and smartburn.

Compared with the previous two, hpcde is obviously complicated, and there is no way ~ Powerful things are always complicated.

Starting from CD replication, the factory class hpcde provides the Construction Method for other classes. The general process is as follows:

Initialization:
Hpcde: createengine get engine object
Iengine: Initialize initialization engine, where Win 95/98 must use ASPI, While NT does not.
Iengine: getdevices to get the drive list
-Idevicecollection: getitem enumeration drive
-Idevice: getwritepossible: determines whether the device can be written and ignores devices that cannot be written.
-Idevice: getdriveletter
-Idevice: getdescription
-Idevice: getmediafreespace determines whether the disk is available
-Idevice: getmediaisblank: determines whether the disk is empty.
-Idevice: getmaxwritespeed: Maximum write speed
-Idevice: whether the getrewritepossible recorder supports Erasure
-Idevice: whether the getmediaisrewritable disc can be erased

If you want CD replication to be performed in parallel, you need to create two threads for reading/writing respectively. hpcde supports multi-threaded models. Hpcde supports SAO/TAO/Dao. Here, Dao is used for CD replication. For multi-segment writing, each segment corresponds to an isession. A session can contain multiple tracks.

Write process:
Idevice: setcurrentspeeds
Idevice: Eject


Reference
Http://www.hpcde.com/documentation/index.html

Iv. cdrdao and cdrtools

Refer:
Http://cdrdao.sourceforge.net/
Http://freshmeat.net/projects/cdrecord/
Http://linuxcommand.org/man_pages/cdrecord1.html

Cdrdao is an open-source DAO mode recording software, which has two versions: Linux and Windows.

Cdrdao only supports one mode of Dao, that is, writing a disk at a time. This mode can implement interesting features of pre-gaps. For anti-copy discs, ECC checks can be implemented. Because it is specially designed for Dao, I am afraid that it is not a professional and cannot read its source code.

Cdrtools is also open source, but it is fully functional, including IDE/atapi/SCSI, audio/data/hybrid CD, multi-clip burning, CD-RW, TAO/Dao/raw and so on, it also supports many operating systems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.