<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>OpticalStorage</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/opticalstorage/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/opticalstorage/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:50:15 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>IMAPI2: Data, Audio (Track At Once) and Audio (Disc At Once)</title>
      <link>https://docs.microsoft.com/archive/blogs/opticalstorage/imapi2-data-audio-track-at-once-and-audio-disc-at-once</link>
      <pubDate>Fri, 13 Aug 2010 16:46:59 GMT</pubDate>
      <dc:creator><![CDATA[Mikhail Pranovich]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/opticalstorage/2010/08/13/imapi2-data-audio-track-at-once-and-audio-disc-at-once/</guid>
      <description><![CDATA[Data burning:

Detect proper drive (IDiscMaster2 =&gt; IDiscRecorder2)
Create image...]]></description>
      <content:encoded><![CDATA[<div>
<h1>
  Data burning:</h1>
<ol>
<li>Detect proper drive (<a href="https://msdn.microsoft.com/en-us/library/aa365380(VS.85).aspx">IDiscMaster2</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa365407(VS.85).aspx">IDiscRecorder2</a>)</li>
<li>Create image <a href="https://msdn.microsoft.com/en-us/library/aa365634(VS.85).aspx">IFileSystemImage</a> &amp; fill it:
    
<ul>
<li>Import old multisessions (if any on media) <a href="https://msdn.microsoft.com/en-us/library/aa364872(VS.85).aspx">IDiscFormat2Data::get_MultisessionInterfaces</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa365752(VS.85).aspx">IFileSystemImage::put_MultisessionInterfaces</a> </li>
<li>Import old image (if media is not blank): <a href="https://msdn.microsoft.com/en-us/library/aa365679(VS.85).aspx">IFileSystemImage::ImportFileSystem</a> </li>
<li>Set up target filesystems &amp; restrictions </li>
<li>Fill <a href="https://msdn.microsoft.com/en-us/library/aa365634(VS.85).aspx">IFileSystemImage</a> with data (dirs, files &amp; streams), delete unnecessary imported data </li>
<li>Set up appropriate properties for each file/dir/stream/image itself </li>
</ul>
</li>
<li>Configure burner <a href="https://msdn.microsoft.com/en-us/library/aa364854(VS.85).aspx">IDiscFormat2Data</a> &amp; write your image
    
<ul>
<li>Set up the drive <a href="https://msdn.microsoft.com/en-us/library/aa364890(VS.85).aspx">IDiscFormat2Data::put_Recorder</a></li>
<li>Set up required properties (ForceMediaToBeClosed/write speed/buffer underrun/force overwrite, etc)</li>
<li>Prepare &amp; write the stream: <a href="https://msdn.microsoft.com/en-us/library/aa365646(VS.85).aspx">IFileSystemImage::CreateResultImage</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa365638(VS.85).aspx">IFileSystemImageResolt::get_ImageStream</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa364892(VS.85).aspx">IDiscFormat2Data::Write</a></li>
</ul>
</li>
</ol>
<h1>
  Audio burning (TrackAtOnce):</h1>
<ol>
<li>Detect proper drive (<a href="https://msdn.microsoft.com/en-us/library/aa365380(VS.85).aspx">IDiscMaster2</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa365407(VS.85).aspx">IDiscRecorder2</a>)</li>
<li>Create <a href="https://msdn.microsoft.com/en-us/library/aa365116(VS.85).aspx">IDiscFormat2TrackAtOnce</a> &amp; Burn tracks (there is no image):
    
<ul>
<li>Lock the drive <a href="https://msdn.microsoft.com/en-us/library/aa365177(VS.85).aspx">IDiscFormat2TrackAtOnce::PrepareMedia</a></li>
<li>Burn tracks one by one <a href="https://msdn.microsoft.com/en-us/library/aa365129(VS.85).aspx">IDiscFormat2TrackAtOnce::AddAudioTrack</a></li>
<li>Release the drive <a href="https://msdn.microsoft.com/en-us/library/aa365372(VS.85).aspx">IDiscFormat2TrackAtOnce::ReleaseMedia</a></li>
</ul>
</li>
</ol>
<h1>
  Audio burning (DiscAtOnce)</h1>
<ol>
<li>Detect proper drive (<a href="https://msdn.microsoft.com/en-us/library/aa365380(VS.85).aspx">IDiscMaster2</a> =&gt; <a href="https://msdn.microsoft.com/en-us/library/aa365407(VS.85).aspx">IDiscRecorder2</a>)</li>
<li>Create Image <a href="https://msdn.microsoft.com/en-us/library/cc507551(VS.85).aspx">IRawCDImageCreator</a>
    
<ul>
<li>Configure the image </li>
<li>Add tracks <a href="https://msdn.microsoft.com/en-us/library/cc507559(VS.85).aspx">IRawCDImageCreator::AddTrack </a> </li>
</ul>
</li>
<li>Configure burner <a href="https://msdn.microsoft.com/en-us/library/aa364905(VS.85).aspx">IDiscFormat2RawCD</a> &amp; burn your image
    
<ul>
<li>Set up the drive <a href="https://msdn.microsoft.com/en-us/library/aa365083(VS.85).aspx">IDiscFormat2RawCD::put_Recorder</a></li>
<li>Set up required properties </li>
<li>Prepare &amp; write stream: <a href="https://msdn.microsoft.com/en-us/library/aa832658(VS.85).aspx">IDiscFormat2RawCD::WriteMedia</a></li>
</ul>
</li>
</ol>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Writing optical discs using IMAPI 2 in powershell</title>
      <link>https://docs.microsoft.com/archive/blogs/opticalstorage/writing-optical-discs-using-imapi-2-in-powershell</link>
      <pubDate>Fri, 13 Aug 2010 15:28:00 GMT</pubDate>
      <dc:creator><![CDATA[Mikhail Pranovich]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/opticalstorage/2010/08/13/writing-optical-discs-using-imapi-2-in-powershell/</guid>
      <description><![CDATA[Hello,

Today I&rsquo;m going to show how to use Image Mastering API (IMAPI2) in powershell....]]></description>
      <content:encoded><![CDATA[<p>Hello,</p>
<p>
Today I&rsquo;m going to show how to use Image Mastering API (IMAPI2) in powershell. I&rsquo;m using that technique when need quickly to burn some data, in format, which is not exposed by default in Explorer. This also can be useful if you are developing some code on IMAPI2 and need some proof of concept, if that can be done using build-in windows image mastering API.
</p>
<p>
IMAPI2 is written using COM, so no additional wrappers/interops required in order to get it working in powershell. The advantage of IMAPI is the possibility to write to different medias, for example to CDRW So, let&rsquo;s begin:
</p>
<p>
First of all you'll need to build in memory file system image, which will contain your files. There are few steps to achieve that:
</p>
<ol>
<li>Create file system object
    
<ul>
<li>PS C:\Temp&gt; $fsi = New-Object -ComObject IMAPI2FS.MsftFileSystemImage</li>
<li>Select appropriate settings like File System type, revision and so on</li>
<li>To view current state of any object you can just type its name in PowerShell:<br />
        PS C:\Temp&gt; $fsi</li>
<li>PS C:\Temp&gt; $fsi.FileSystemsToCreate = 7</li>
<li>PS C:\Temp&gt; $fsi.VolumeName = "MyImage"</li>
</ul>
</li>
<li>Add files to your file system:
    
<ul>
<li>PS C:\Temp&gt; $fsi.Root.AddTreeWithNamedStreams("C:\test\imt\data\2tracks")</li>
</ul>
</li>
<li>Create result stream, that will contain your data in required format:
    
<ul>
<li>PS C:\Temp&gt; $resultimage = $fsi.CreateResultImage()</li>
<li>PS C:\Temp&gt; $resultStream = $resultimage.ImageStream</li>
</ul>
</li>
</ol>
<p>Actually at this step you can stop and save resulted image to the local hard disc, this will be a pure iso image.</p>
<p>To perform writing  disc recorder needs to be initialized:</p>
<ol start="4">
<li>Enumerate available recorders through MsftDiscMaster2
<ul>
<li>PS C:\Temp&gt; $dm = New-Object -ComObject IMAPI2.MsftDiscMaster2</li>
</ul>
</li>
<li>Create DiscRecorder object
<ul>
<li>PS C:\Temp&gt; $recorder = New-Object -ComObject IMAPI2.MsftDiscRecorder2</li>
</ul>
</li>
<li>Initialize recorder with unique id from discmaster2
<ul>
<li>PS C:\Temp&gt; $recorder.InitializeDiscRecorder($dm.Item(0))</li>
</ul>
</li>
</ol>
<p>And Formatter, which will be used to format you filesystem image in appropriate way for recording onto your media and write data using your recorder:</p>
<ol start="7">
<li>Create object
<ul>
<li>$df2d = New-Object -ComObject IMAPI2.MsftDiscFormat2Data</li>
</ul>
</li>
<li>Set up recorder
<ul>
<li>PS C:\Temp&gt; $df2d.Recorder = $recorder</li>
</ul>
</li>
<li>Put client name, which will be shown for other applications, once you'll start writing
<ul>
<li>PS C:\Temp&gt; $df2d.ClientName = "MyScriptBurner" Now you set up everything needed, and can start burning, just call Write from DiscFormat2Data:</li>
</ul>
</li>
<li>$df2d.Write($resultStream)</li>
</ol>
<p>That's it! You can write data using full capabilities of IMAPI, and not even write a line of C++ code in realtime. For me it seems really useful, when you just need to write couple media, and see no way to perform to do it through standard explorer interface, and is not willing to write whole application just to perform that!</p>
<p>Hope this helps in Windows Image Mastering API exploring.</p>
<p>Mikhail</p>]]></content:encoded>
    </item>
  </channel>
</rss>