当前位置:网站首页>刻录光盘的程序步骤
刻录光盘的程序步骤
2022-06-26 18:03:00 【顺其自然~】
规范的刻录程序架构流程以及msdn的刻录步骤。
Data burning:
- Detect proper drive (IDiscMaster2 => IDiscRecorder2)
- Create image IFileSystemImage & fill it:
- Import old multisessions (if any on media) IDiscFormat2Data::get_MultisessionInterfaces => IFileSystemImage::put_MultisessionInterfaces
- Import old image (if media is not blank): IFileSystemImage::ImportFileSystem
- Set up target filesystems & restrictions
- Fill IFileSystemImage with data (dirs, files & streams), delete unnecessary imported data
- Set up appropriate properties for each file/dir/stream/image itself
- Configure burner IDiscFormat2Data & write your image
- Set up the drive IDiscFormat2Data::put_Recorder
- Set up required properties (ForceMediaToBeClosed/write speed/buffer underrun/force overwrite, etc)
- Prepare & write the stream: IFileSystemImage::CreateResultImage => IFileSystemImageResolt::get_ImageStream => IDiscFormat2Data::Write
翻译过来:
1、检测是否有设备,接口IDiscMaster2检测有多少个设备,获取设备数量以及设备的标识符uniqueID,然后利用设备的标识符(uniqueID),接口IDiscRecorder2初始化到一个刻录机对象。
2、创建文件系统,并且将你要刻录的文件或文件夹给这个接口对象IFileSystemImage。这里需要注意一个问题,使用多重区段刻录时,空白磁盘直接,直接创建文件系统即可,然后刻录。(重要的事情说三遍:不要将put_ForceMediaToBeClosed函数的参数设为TRUE,不要将put_ForceMediaToBeClosed函数的参数设为TRUE,不要将put_ForceMediaToBeClosed函数的参数设为TRUE。因为这会对那些一次写入多次读的磁盘进行完成标识,以后不管磁盘空间剩余多少,都不可以再次刻录啦。我都毁了好多张才学会的道理。微软的说明:
Set to VARIANT_TRUE to mark the disc as closed to prohibit additional writes when the next write session ends.
Set to VARIANT_FALSE to keep the disc open for subsequent write sessions. The default is VARIANT_FALSE
其中,在光盘是空的时候,就要创建文件系统,IFileSystemImage中的put_FileSystemToCreate,参数有这些,用其他函数查询出来,然后再传给这个参数也行,直接指定这些参数也行,毕竟这些参数表示的市场上流行的。FsiFileSystems(None、ISO9660、Joliet、UDF、UNknown),括号里的和前面拼接就行。如果光盘不为空,千万不要在用这个函数创建了。根据我的只读的、追加写的CD\DVD,如果非空盘,第二次还创建,会导致盘不可读。
我追加写是用get_MultisessionInterfaces这个获取SAFEARRAY类型的multiSession,调用put_MultisessionInterfaces这个函数设置多区段写,实现追加写。
3、这时候就要准备文件数据啦。IFileSystemImage中的get_Root初始化一个类似与根目录的对象,然后将这个对象与将要刻录的文件数据建立关系。期间也会出现一些问题,比如文件名不合格,文件名冲突、目录名太长。
IFileSystemImage中的CreateResultImage函数必须在文件数据准备完全下调用。输出参数类型是IFileSystemImageResult。
IFileSystemImageResult中的get_ImageStream函数会有一个输出参数,这个参数将上面的文件数据准备到了刻录的缓冲区中,
接着调用IDiscFormat2Data的write函数就可以简单刻录啦。
菜鸟的菜思路,纪念一下。
只看API是不行的,因为就像给你四字成语一样,让你写作文,随便排列是不成作文的。msdn上也有写出刻录光盘的步骤,但是只看别人的不自己思考的话,会记不牢固的。所以就自己写一写吧(不委屈)。
1、IMaster(具体名字都记得不太清楚)接口获取有多少个设备连接到这个系统,可以获取个数并枚举每个设备。
2、Recorder接口(具体名字都记得不太清楚),可以根据1中枚举出的设备来创建一个刻录机,可以获取到刻录机所支持的刻录盘的类型。
3、discFormatData接口,涉及到CD或DVD的文件格式。CD和DVD也是一个类似与硬盘的,保存各种文件就需要各种文件系统,最简单的就是目录和文件名的保存需要按照什么样的格式,这样索引文件才方便嘛。这个接口可以获取到CD和DVD支持的文件格式。
4、image(这个名字就是不正确的,这是我理解的方式,可直接跳过我自己理解的部分) 是文件镜像,根据3获取到文件格式,就能创建出一个文件操作管理器。俗称的镜像。获取到想要刻录的文件的路径,将其转化成要刻录的数据流。
5、ISTREAM(这个我可以肯定)刻录数据流,刻录机调用write函数刻录,真正执行刻录。msdn上说,刻录时最好不要暂停,特别是刻录时间长的话,系统会中断,导致CD或DVD不可用。有两个原因(1、power transitions 2、user to log off 用户注销)
6、写完了,关闭所有需要关闭的,如果想再次追加刻录的话,不要将这个函数 put_ForceMediaToBeClosed设为TRUE。
边栏推荐
- Lm06 the mystery of constructing the bottom and top trading strategy only by trading volume
- 背包问题求方案数
- 【NPOI】C#跨工作薄复制Sheet模板导出Excel
- Comp281 explanation
- How does Guosen Securities open an account? Is it safe to open a stock account through the link
- Detailed explanation of dos and attack methods
- next(iter(dataloader))的一点点体会
- 比较两个对象的大小关系原来可以如此花里胡哨
- mysql Add column 失败 因为之前有数据,不是默认null 不行
- Get and set settings in 26class
猜你喜欢

Concept and working principle of data encryption standard (DES)

Connected to surface test questions
![[ten thousand words summary] starting from the end, analyze in detail how to fill in the college entrance examination volunteers](/img/77/715454c8203d722e246ed70e1fe0d8.png)
[ten thousand words summary] starting from the end, analyze in detail how to fill in the college entrance examination volunteers

MySQL add column failed because there was data before, not null by default

Detailed explanation of dos and attack methods

14 MySQL tutorial insert insert data

vutils. make_ A little experience of grid () in relation to black and white images

halcon之区域:多种区域(Region)特征(5)

背包问题求方案数

二分查找-2
随机推荐
Plt How to keep show() not closed
[npoi] C copy sheet template across workbooks to export Excel
深入理解MySQL锁与事务隔离级别
Detailed explanation of dos and attack methods
RSA概念详解及工具推荐大全 - lmn
贝叶斯网络详解
mysql Add column 失败 因为之前有数据,不是默认null 不行
在国金证券开户怎么样?保障安全吗?
行锁分析和死锁
解决pycharm里面每个字母占一格空格的问题
Bayesian network explanation
Let torch cuda. is_ Experience of available() changing from false to true
Li Kou daily question - day 28 -566 Reshape matrix
wechat_微信小程序中解决navigator进行页面跳转并传递参数问题
9、智慧交通项目(2)
同花顺开户怎么样安全吗?怎么炒股开户
Binary search-2
How about opening an account at Guojin securities? Is it safe to open an account?
Row lock analysis and deadlock
The king of Internet of things protocol: mqtt