当前位置:网站首页>刻录光盘的程序步骤
刻录光盘的程序步骤
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。
边栏推荐
- [dynamic planning] Jianzhi offer II 091 Paint the house
- Please advise tonghuashun which securities firm to choose for opening an account? Is it safe to open an account online now?
- Regular match same character
- QPushButton 样式使用示例(以及按钮setmenu添加下拉菜单的方法)
- 让torch.cuda.is_available()从false变成true的一点经验
- mysql Add column 失败 因为之前有数据,不是默认null 不行
- How sparksql returns a specific day of the week by date -dayofweek function
- Solve the problem that each letter occupies a space in pycharm
- 物联网协议的王者:MQTT
- Synchronized description of concurrency
猜你喜欢

Bayesian network explanation
![[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

行锁与隔离级别案例分析

接水面试题
![[uniapp] the uniapp mobile terminal uses uni Troubleshooting of navigateback failure](/img/26/da00e70d0955bcdef3362474bc5fc7.png)
[uniapp] the uniapp mobile terminal uses uni Troubleshooting of navigateback failure

贝叶斯网络详解

LeetCode——226. 翻轉二叉樹(BFS)

Case study of row lock and isolation level

Ethereum技术架构介绍

Get and set settings in 26class
随机推荐
Preparing for the Blue Bridge Cup and ccf-csp
判断某个序列是否为栈的弹出序列
[code Capriccio - dynamic planning] t583. Deleting two strings
陈强:阿里千亿级大规模数字商业知识图谱助力业务增长
Binary search-2
Rich professional product lines, and Jiangling Ford Lingrui · Jijing version is listed
properties文件乱码
将字符串B插入字符串A,有多少种插入办法可以使新串是一个回文串
js强制转换
The difference between round and truncate in SQL (round or truncate)
Decision tree and random forest
LeetCode——226. Flip binary tree (BFS)
How to add an application to the deviceidle whitelist?
数字签名论述及生成与优点分析
Solve the problem that each letter occupies a space in pycharm
Prometeus 2.34.0 新特性
接水面试题
Concept and working principle of data encryption standard (DES)
14 MySQL tutorial insert insert data
力扣每日一题-第28天-566.重塑矩阵