<?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>All about Windows Media SDKs</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/allaboutwmsdks/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/feed.xml</link>
    <description>A place of random tidbits for Windows multimedia application developers</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:12:59 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Challenge with maximum allowed size of WAVEFORMATEXTENSIBLE structure in Media Foundation</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/challenge-with-maximum-allowed-size-of-waveformatextensible-structure-in-media-foundation</link>
      <pubDate>Sun, 01 Dec 2013 01:00:57 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2013/12/01/challenge-with-maximum-allowed-size-of-waveformatextensible-structure-in-media-foundation/</guid>
      <description><![CDATA[You might consider to extend the extensible format to store custom data for your MFT, but wait, you...]]></description>
      <content:encoded><![CDATA[<p>You might consider to extend the extensible format to store custom data for your MFT, but wait, you have size limitation here. I am not going to share the exact size, this is something I am leaving for you to figure out <img class="wlEmoticon wlEmoticon-smile" style="style" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/1682.wlEmoticon-smile_177170DE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/1682.wlEmoticon_2D00_smile_5F00_177170DE.png" />. By the way, on Windows 8.1 we have reduced this size further. The good news is in near future we will eliminate this restriction from Windows 8.1. I don’t know about Windows 7 though. Anyway, keep an eye on this blog for further update.</p>  <p>So, what can you do to workaround this?</p>  <p>I would suggest you to use a different subtype for your custom format and register your decryptor to handle that format.&#160;&#160; This may require you to decrypt and decode in the same MFT. </p>]]></content:encoded>
    </item>
    <item>
      <title>How to use inbox Dolby Audio Decoder MFT on Windows 7 or Vista?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/how-to-use-inbox-dolby-audio-decoder-mft-on-windows-7-or-vista</link>
      <pubDate>Thu, 19 Sep 2013 17:40:09 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2013/09/19/how-to-use-inbox-dolby-audio-decoder-mft-on-windows-7-or-vista/</guid>
      <description><![CDATA[Dolby Audio Decoder Media Foundation Transform (MFT) is restricted under terms of the Dolby Digital...]]></description>
      <content:encoded><![CDATA[<p><em>Dolby Audio Decoder</em> Media Foundation Transform (MFT) is restricted under terms of the Dolby Digital licensing program to use by Microsoft applications for versions of Windows prior to Windows 8. You have to contact Dolby Digital directly for licensing if you want to have this decoder support in your own application. You can also consider to check for some third party solutions.</p>  <p>Third party applications are open to use both <em>Dolby Audio Decoder</em> MFT and<em> Dolby Digital Audio Encoder</em> MFT on Windows 8. Our MSDN documentation had some confusion about uses of these two MFTs, but recently we have updated it to clarify the confusion.</p>]]></content:encoded>
    </item>
    <item>
      <title>The mysterious WASAPI lock on Windows 7</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/the-mysterious-wasapi-lock-on-windows-7</link>
      <pubDate>Fri, 06 Sep 2013 18:48:02 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2013/09/06/the-mysterious-wasapi-lock-on-windows-7/</guid>
      <description><![CDATA[CaptureExclusiveEventDriven.zip Problem: On Windows 7, if a stream is initialized to be timer...]]></description>
      <content:encoded><![CDATA[<p>   <div id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:4e458a12-7783-4f75-a47c-8b4a0e5ae78c" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"><p> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/7103.CaptureExclusiveEventDriven_01E41FCE.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/7103.CaptureExclusiveEventDriven_5F00_01E41FCE.zip" target="_blank">CaptureExclusiveEventDriven.zip</a></p></div> Problem: On Windows 7, if a stream is initialized to be timer driven and in exclusive mode, the WASAPI <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd940435(v=vs.85).aspx">release</a> of the capture audio client (<a href="https://msdn.microsoft.com/en-us/library/dd370858(v=vs.85).aspx">IAudioCaptureClient</a>) will lock if the release is called when a USB audio device is disconnected.&#160; </p>  <p>Workaround: The problem is actually in the <a href="https://blogs.msdn.com/b/larryosterman/archive/2007/01/31/what-is-audiodg-exe.aspx">audiodg.exe</a>. When someone pull the plug of a USB audio capture device in the middle of the audio capture session, it releases the audio driver handle without waiting for the recording application to finish all of its cleanup job. This behavior doesn’t exist on Windows 8. </p>  <p>You can bypass this problem by using WASAPI in event driven mode. It is actually far better than timer mode and highly recommended for the applications those require low latency. I have attached a sample application to demonstrate this workaround. </p>]]></content:encoded>
    </item>
    <item>
      <title>How to use mmioDescend and mmioRead APIs with CreateFile API?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/how-to-use-mmiodescend-and-mmioread-apis-with-createfile-api</link>
      <pubDate>Fri, 06 Sep 2013 17:45:01 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2013/09/06/how-to-use-mmiodescend-and-mmioread-apis-with-createfile-api/</guid>
      <description><![CDATA[You want to use the mmioOpen function in order to obtain a file handle to read a .WAV file.&#160;...]]></description>
      <content:encoded><![CDATA[<p>You want to use the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd757331(v=vs.85).aspx">mmioOpen</a> function in order to obtain a file handle to read a .WAV file.&#160; However, the MSDN documentation indicates that this is a deprecated function.&#160; The suggested replacement API <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx">CreateFile</a> does not provide a multimedia file handle, which you need.&#160; </p>  <p>Your questions: </p>  <p><em>How to use mmioDescend(), mmioRead() with CreateFile()? or h</em><em>ow to pass the regular FILE hander created by CreateFile() to mmioRead()?</em></p>  <p>Answer:</p>  <p>You cannot use the handle returned by the CreateFile API with any of the mmio* APIs. Here is the code snippet that will show you how to open a wave file (RIFF format) and parse the file header without using mmio* APIs.</p>  <div id="codeSnippetWrapper">   <pre id="codeSnippet" style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(0, 128, 0);"><div id="codeSnippetWrapper"><pre id="codeSnippet" style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(0, 128, 0);">// FileHeader will receive all the information in the file header and</span><br /><span style="color: rgb(0, 128, 0);">// in the header of the format chunk.</span><br /><br /><span style="color: rgb(0, 0, 255);">typedef</span> <span style="color: rgb(0, 0, 255);">struct</span><br />{<br />    ULONG Riff4CC;      <span style="color: rgb(0, 128, 0);">// &quot;RIFF&quot; 4-character code</span><br />    ULONG FileSize;     <span style="color: rgb(0, 128, 0);">// total file size in bytes</span><br />    ULONG Wave4CC;      <span style="color: rgb(0, 128, 0);">// &quot;WAVE&quot; 4-character code</span><br />    ULONG Fmt4CC;       <span style="color: rgb(0, 128, 0);">// &quot;fmt &quot; 4-character code</span><br />    ULONG FormatSize;   <span style="color: rgb(0, 128, 0);">// wave format size in bytes</span><br />} FileHeader;<br /><br /><span style="color: rgb(0, 128, 0);">// ChunkHeader will receive the information in the headers for the data</span><br /><span style="color: rgb(0, 128, 0);">// chunks, and, if the file contains additional chunks, the headers for </span><br /><span style="color: rgb(0, 128, 0);">// those chunks as well.</span><br /><br /><span style="color: rgb(0, 0, 255);">typedef</span> <span style="color: rgb(0, 0, 255);">struct</span><br />{<br />    ULONG ChunkType;<br />    ULONG ChunkSize;<br />} ChunkHeader;<br /></pre></div><div id="codeSnippetWrapper"><pre id="codeSnippet" style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(0, 128, 0);">// Any file smaller than this cannot possibly contain wave data.</span><br /><span style="color: rgb(204, 102, 51);">#define</span> MIN_WAVE_FILE_SIZE (<span style="color: rgb(0, 0, 255);">sizeof</span>(FileHeader)+<span style="color: rgb(0, 0, 255);">sizeof</span>(PCMWAVEFORMAT)+<span style="color: rgb(0, 0, 255);">sizeof</span>(ChunkHeader)+1)<br /><br /><span style="color: rgb(0, 128, 0);">// Macro to build FOURCC from first four characters in ASCII string</span><br /><span style="color: rgb(204, 102, 51);">#define</span> FOURCC(s)  ((ULONG)(s[0] | (s[1]&lt;&lt;8) | (s[2]&lt;&lt;16) | (s[3]&lt;&lt;24)))</pre></div></span><p><span style="color: rgb(0, 128, 0);">//<br />//-- Open wave file and parse file header.<br /> <br /></span><span style="color: rgb(0, 128, 0);">//</span><br /><span style="color: rgb(0, 0, 255);">void</span> WaveFileReader(LPCWSTR pszFileName, BOOL repeat)<br />{<br />    FILE pFile = NULL;<br />    HRESULT hrStreamStatus = S_OK;<br />    fpos_t dataChunkPosition = 0;<br />    ULONG totalDataBytes = 0;<br />    ULONG dataBytesRemaining = 0;<br />    WAVEFORMATEXTENSIBLE wfx;<br />    BOOL repeatMode = repeat;<br /><br />    ZeroMemory(&amp;wfx, <span style="color: rgb(0, 0, 255);">sizeof</span>(wfx));<br /><br />    <span style="color: rgb(0, 128, 0);">// Try to open the wave file.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (_wfopen_s(&amp;pFile, pszFileName, L<span style="color: rgb(0, 96, 128);">&quot;rb&quot;</span>) != 0)<br />    {<br />        _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[ERROR] Failed to open file!...Exiting\n\n&quot;</span>);<br />        <span style="color: rgb(0, 0, 255);">return</span>;<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// Copy header from wave file.</span><br />    FileHeader fileHdr;<br /><br />   <span style="color: rgb(0, 0, 255);">if</span> (fread(&amp;fileHdr, <span style="color: rgb(0, 0, 255);">sizeof</span>(fileHdr), 1, pFile) != 1)<br />    {<br />        _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[ERROR] Not a valid wave file!...Exiting\n\n&quot;</span>);<br />        <span style="color: rgb(0, 0, 255);">return</span>;<br />    }<br /><br />       <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.Riff4CC != FOURCC(<span style="color: rgb(0, 96, 128);">&quot;RIFF&quot;</span>)) <br />       {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] RIFF signature: Not Found\n&quot;</span>);<br />       } <span style="color: rgb(0, 0, 255);">else</span> {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;RIFF signature: Found\n&quot;</span>);<br />       }<br /><br />       <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.Wave4CC != FOURCC(<span style="color: rgb(0, 96, 128);">&quot;WAVE&quot;</span>))<br />       {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] WAVE signature: Not Found\n&quot;</span>);           <br />       } <span style="color: rgb(0, 0, 255);">else</span> {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;WAVE signature: Found\n&quot;</span>);           <br />       }<br /><br />       <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.Fmt4CC != FOURCC(<span style="color: rgb(0, 96, 128);">&quot;fmt &quot;</span>))<br />       {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] fmt  signature: Not Found\n&quot;</span>);           <br />       } <span style="color: rgb(0, 0, 255);">else</span> {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;fmt  signature: Found\n&quot;</span>);           <br />       }<br /><br />       <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.FileSize &lt; MIN_WAVE_FILE_SIZE)<br />       {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] File size: %d (Minimum WAV file size supported is %d)\n&quot;</span>, fileHdr.FileSize, MIN_WAVE_FILE_SIZE);          <br />       <br />       } <span style="color: rgb(0, 0, 255);">else</span> {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;File size: %d\n&quot;</span>, fileHdr.FileSize);        <br />       }<br /><br /><br />       <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.FormatSize &lt; <span style="color: rgb(0, 0, 255);">sizeof</span>(PCMWAVEFORMAT))<br />       {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] Format size: %d (Smaller than size of PCMWAVEFORMAT %d)\n&quot;</span>, fileHdr.FormatSize, <span style="color: rgb(0, 0, 255);">sizeof</span>(PCMWAVEFORMAT));            <br /><br />       } <span style="color: rgb(0, 0, 255);">else</span> {<br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;Format size: %d\n&quot;</span>, fileHdr.FormatSize);                  <br />       }<br /><br />    <span style="color: rgb(0, 128, 0);">// Copy wave format descriptor from file.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (fread(&amp;wfx, min(fileHdr.FormatSize,<span style="color: rgb(0, 0, 255);">sizeof</span>(wfx)), 1, pFile) != 1)<br />    {<br />        _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[ERROR] Failed to copy wave format descriptor from the file!...Exiting\n\n&quot;</span>);<br />        <span style="color: rgb(0, 0, 255);">return</span>;<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// Skip over any padding at the end of the format in the format chunk.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (fileHdr.FormatSize &gt; <span style="color: rgb(0, 0, 255);">sizeof</span>(wfx))<br />    {<br />        <span style="color: rgb(0, 0, 255);">if</span> (fseek(pFile, fileHdr.FormatSize-<span style="color: rgb(0, 0, 255);">sizeof</span>(wfx), SEEK_CUR) != 0)<br />        {<br />            _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[ERROR] Failed to skip over any padding at the end of the format in the format chunk!...Exiting\n\n&quot;</span>);<br />            <span style="color: rgb(0, 0, 255);">return</span>;  <span style="color: rgb(0, 128, 0);">// not a valid wave file</span><br />        }<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// If format type is PCMWAVEFORMAT, convert to valid WAVEFORMATEX structure.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.wFormatTag == WAVE_FORMAT_PCM)<br />    {<br />        wfx.Format.cbSize = 0;<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// If format type is PCMWAVEFORMAT, convert to valid WAVEFORMATEX structure.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.wFormatTag == WAVE_FORMAT_IEEE_FLOAT)<br />    {<br />        wfx.Format.cbSize = 0;<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// If format type is WAVEFORMATEX, convert to WAVEFORMATEXTENSIBLE.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.wFormatTag == WAVE_FORMAT_PCM ||<br />        wfx.Format.wFormatTag == WAVE_FORMAT_IEEE_FLOAT)<br />    {<br />        <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.wFormatTag == WAVE_FORMAT_PCM)<br />        {<br />             wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;<br />        }<br />        <span style="color: rgb(0, 0, 255);">else</span><br />        {<br />             wfx.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;<br />        }<br />        <br /><br />        wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;<br /><br />            <br />        <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.nChannels == 1)<br />        {<br />             wfx.dwChannelMask = SPEAKER_FRONT_CENTER;<br />        }<br />        <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.nChannels == 2)<br />        {<br />             wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;<br />        }<br />        <span style="color: rgb(0, 0, 255);">else</span><br />        {<br />            _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] WAVEFORMATEX structure is valid for representing wave formats with only 1 or 2 channels!...Exiting\n\n&quot;</span>);    <br />            <span style="color: rgb(0, 0, 255);">return</span>;<br />        }<br />        <br />              wfx.Format.cbSize = <span style="color: rgb(0, 0, 255);">sizeof</span>(WAVEFORMATEXTENSIBLE) - <span style="color: rgb(0, 0, 255);">sizeof</span>(WAVEFORMATEX);<br />              <br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;cbSize (Format.cbSize): %d\n&quot;</span>, wfx.Format.cbSize);            <br />              <br />              _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;Valid bits per sample (Samples.wValidBitsPerSample): %d\n&quot;</span>, wfx.Format.wBitsPerSample);            <br /><br />              wfx.Samples.wValidBitsPerSample = wfx.Format.wBitsPerSample;<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// This wave file reader understands only PCM and IEEE float formats.</span><br />    <span style="color: rgb(0, 0, 255);">if</span> (wfx.Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE ||<br />        wfx.SubFormat != KSDATAFORMAT_SUBTYPE_PCM &amp;&amp;<br />        wfx.SubFormat != KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)<br />    {<br />  <br />        _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[WARNING] Not a format that we can handle...Exiting\n\n&quot;</span>);    <br />        <span style="color: rgb(0, 0, 255);">return</span>;<br />    }<br />       <br /><br />    _tprintf (L<span style="color: rgb(0, 96, 128);">&quot;\tTrying to read wave data chunk header...\n&quot;</span>);<br />    <br />    <br />    ChunkHeader chunkHdr;   <span style="color: rgb(0, 128, 0);">// buffer for chunk header</span><br />    <span style="color: rgb(0, 0, 255);">for</span> (;;)<br />    {<br />    <br />        <span style="color: rgb(0, 0, 255);">if</span> (fgetpos(pFile, &amp;dataChunkPosition) != 0)<br />        {<br />            _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;\t[ERROR] Failed to retrive data chunk position!...Exiting\n\n&quot;</span>);<br />            <span style="color: rgb(0, 0, 255);">return</span>;<br />        }<br /><br />        <span style="color: rgb(0, 128, 0);">// Read header at start of next chunk of file.</span><br />        <span style="color: rgb(0, 0, 255);">if</span> (fread(&amp;chunkHdr, <span style="color: rgb(0, 0, 255);">sizeof</span>(ChunkHeader), 1, pFile) != 1)<br />        {<br />            _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;\t[ERROR] Failed to read header!...Exiting\n\n&quot;</span>);<br />             <span style="color: rgb(0, 0, 255);">return</span>;<br />        }<br />        <br />        <span style="color: rgb(0, 0, 255);">if</span> (chunkHdr.ChunkType == FOURCC(<span style="color: rgb(0, 96, 128);">&quot;data&quot;</span>))<br />        {<br />            _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;\tFound start of the data chunk\n&quot;</span>);<br />             <span style="color: rgb(0, 0, 255);">break</span>;  <span style="color: rgb(0, 128, 0);">// found start of data chunk</span><br />        }<br />        <br />        _tprintf (L<span style="color: rgb(0, 96, 128);">&quot;\tVerifying data chunk...&quot;</span>);<br /><br />              <span style="color: rgb(0, 128, 0);">// This is not a data chunk. Skip this chunk and go to the next chunk.</span><br />        <span style="color: rgb(0, 0, 255);">if</span> (fseek(pFile, chunkHdr.ChunkSize, SEEK_CUR) != 0)<br />        {<br />            _tprintf (L<span style="color: rgb(0, 96, 128);">&quot;\t[ERROR] Invalid data chunk!...Exiting\n\n&quot;</span>);    <br />            <span style="color: rgb(0, 0, 255);">return</span>;<br />        } <span style="color: rgb(0, 0, 255);">else</span> {<br />           _tprintf (L<span style="color: rgb(0, 96, 128);">&quot;done!\n&quot;</span>);<br />        }<br />    }<br /><br />    <span style="color: rgb(0, 128, 0);">// We've found the start of the data chunk.    </span><br />    totalDataBytes = chunkHdr.ChunkSize;<br />    dataBytesRemaining = totalDataBytes;<br /><br />    _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;Total data bytes: %d\n&quot;</span>, totalDataBytes);<br /><br />    <span style="color: rgb(0, 0, 255);">if</span> (totalDataBytes == 0)<br />    {<br />        _tprintf(L<span style="color: rgb(0, 96, 128);">&quot;[ERROR] Invalid data bytes size!...Exiting\n\n&quot;</span>);<br />        <span style="color: rgb(0, 0, 255);">return</span>;<br />    }<br />       <br />}<br />  </p></pre>

  <br /></div>]]></content:encoded>
    </item>
    <item>
      <title>How to enable all the elements of the DCOM Config (DCOMCNFG.EXE) security tab on Windows Server 2008 R2?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/how-to-enable-all-the-elements-of-the-dcom-config-dcomcnfg-exe-security-tab-on-windows-server-2008-r2</link>
      <pubDate>Fri, 23 Aug 2013 16:59:49 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2013/08/23/how-to-enable-all-the-elements-of-the-dcom-config-dcomcnfg-exe-security-tab-on-windows-server-2008-r2/</guid>
      <description><![CDATA[Problem: You have a .NET web application that access the Windows Media Services COM object. Under...]]></description>
      <content:encoded><![CDATA[<p>Problem: You have a .NET web application that access the Windows Media Services COM object. Under Server 2008 R2, you are getting access denied errors. As with early servers, you attempted to use DCOM Config to give additional permissions to the WMS COM object. But on Server 2008 R2, all the elements of the Security tab of the DCOM Config&#160; are grayed out. Here is an example:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/3005.clip_image001_5486ACAF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/3005.clip_5F00_image001_5F00_5486ACAF.png"><img title="clip_image001" style="display: inline; background-image: none;" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/0247.clip_image001_thumb_6301A8D4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/0247.clip_5F00_image001_5F00_thumb_5F00_6301A8D4.png" width="613" height="456" /></a></p>  <p>Resolution:</p>  <p>You have to give additional permissions to the WMS COM object using <i>DCOM Config</i> (DCOMCNFG.EXE) to fix the issue. You can enable all the elements of the security tab of the DCOM Config following the steps below:</p>  <blockquote>   <p>1. Open the <i>Component Services Management</i> tool </p> </blockquote>  <blockquote>   <p>2. Go to &quot;<i>Console Root</i>&quot;-&gt;&quot;<i>Component Services</i>&quot;-&gt;&quot;<i>Computers</i>&quot;-&gt;&quot;<i>My Computers</i>&quot;-&gt;&quot;<i>DCOM Config</i>&quot;</p> </blockquote>  <blockquote>   <p>3. Now right click on the &quot;<i>Windows Media Services</i>&quot; and select &quot;<i>Properties</i>&quot;</p> </blockquote>  <blockquote>   <p>4. From the &quot;<i>General</i>&quot; tab copy the &quot;<i>Application ID</i>&quot;</p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/7462.clip_image002_66BF4DA4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/7462.clip_5F00_image002_5F00_66BF4DA4.jpg"><img title="clip_image002" style="display: inline; background-image: none;" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/6862.clip_image002_thumb_045128A4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/6862.clip_5F00_image002_5F00_thumb_5F00_045128A4.jpg" width="401" height="508" /></a></p> </blockquote>  <blockquote>   <p>5. Open &quot;<i>Registry Editor</i>&quot; as an administrator and search for the copied &quot;<i>Application ID</i>&quot;</p> </blockquote>  <blockquote>   <p>It should be something similar to this: <i>HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{A2EFA5CB-3B0E-11D2-9EFD-006097D2D7CF}</i></p> </blockquote>  <blockquote>   <p>6. Right click on the <i>Registry Key</i> and select &quot;<i>Permissions...</i>&quot; from the pop-up menu</p> </blockquote>  <blockquote>   <p>7. Go to &quot;Advanced&quot; button</p> </blockquote>  <blockquote>   <p>8. Select &quot;<i>Owner</i>&quot; tab and change owner to &quot;<i>Administrator</i>&quot; - click the &quot;Apply&quot; button to save the changes. </p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/2047.clip_image003_6FEB6318.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/2047.clip_5F00_image003_5F00_6FEB6318.png"><img title="clip_image003" style="display: inline; background-image: none;" border="0" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/1778.clip_image003_thumb_2CBFE4EB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/1778.clip_5F00_image003_5F00_thumb_5F00_2CBFE4EB.png" width="544" height="422" /></a></p> </blockquote>  <blockquote>   <p>9. Click &quot;<i>OK</i>&quot; to close the dialog</p> </blockquote>  <blockquote>   <p>10. Now select the &quot;<i>Administrators</i>&quot; from the list of &quot;<i>Groups or User Names</i>&quot;</p> </blockquote>  <blockquote>   <p>11. Give &quot;<i>Administrators</i>&quot; <i>Full Control</i> in the “Permissions for the Administrators” list and leave “<i>TrustedInstaller”</i> with <i>Full Control</i> as well.</p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/4722.clip_image004_1B8C0748.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/4722.clip_5F00_image004_5F00_1B8C0748.png"><img title="clip_image004" style="display: inline; background-image: none;" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/47/metablogapi/3247.clip_image004_thumb_05E1A8DE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-47-metablogapi/3247.clip_5F00_image004_5F00_thumb_5F00_05E1A8DE.png" width="405" height="476" /></a></p> </blockquote>  <blockquote>   <p>12. Click “<i>OK</i>” to close the dialog.</p> </blockquote>  <p>Now you should be able to use DCOM Config security tab. </p>]]></content:encoded>
    </item>
    <item>
      <title>How to control "Listen to this Device" feature of Windows 7 programmatically?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/how-to-control-listen-to-this-device-feature-of-windows-7-programmatically</link>
      <pubDate>Sun, 20 May 2012 00:50:22 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2012/05/20/how-to-control-listen-to-this-device-feature-of-windows-7-programmatically/</guid>
      <description><![CDATA[This is not possible - there is no public API available to control “Listen to this Device” feature....]]></description>
      <content:encoded><![CDATA[<p>This is not possible - there is no public API available to control “Listen to this Device” feature. The feature can only be controlled by the user in the Sound control panel.</p>]]></content:encoded>
    </item>
    <item>
      <title>Disclaimer</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/disclaimer</link>
      <pubDate>Sat, 19 May 2012 13:26:00 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2012/05/19/disclaimer/</guid>
      <description><![CDATA[This is a personal weblog. The opinions expressed here represent my own and not those of my...]]></description>
      <content:encoded><![CDATA[<p>This is a personal weblog. The opinions expressed here represent my own and not those of my employer.</p>
<p>All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.</p>]]></content:encoded>
    </item>
    <item>
      <title>Why does the NdrClientCall2() API call takes more then 4-5 milliseconds to complete?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/why-does-the-ndrclientcall2-api-call-takes-more-then-4-5-milliseconds-to-complete</link>
      <pubDate>Sat, 19 May 2012 13:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2012/05/19/why-does-the-ndrclientcall2-api-call-takes-more-then-4-5-milliseconds-to-complete/</guid>
      <description><![CDATA[Question:
Why does the NdrClientCall2() API call takes more then 4-5 milliseconds to complete in my...]]></description>
      <content:encoded><![CDATA[<p><i>Question:</i></p>
<p>Why does the NdrClientCall2() API call takes more then 4-5 milliseconds to complete in my application? In rare cases&nbsp;I even see hundreds of milliseconds (57 millisecond at one time) just for the NdrClientCall2() API call to complete.</p>
<p>In my application no server side processing is involved. My client and server both are running on the same machine. In either case it is a <i>ncacn_np</i> operation, both sides are already connected, all the calls should complete with the same (or about same) delays.</p>
<p>Is it possible to explain what kinds of things might be involved in this delay?</p>
<p><i>Answer:</i></p>
<p>For local RPC calls, it is highly recommend that users to use ncalrpc and not ncacn_np. Ncacn_np is primarily for backwards compatibility and new applications should be using ncacn_ip_tcp for remote traffic. If you are using Vista or later,&nbsp;it is recommended to switch to the lower latency fast binding handle path for LRPC. This removes some significant sources of lock contention in the client path, potentially leading to a reduction in delays.</p>
<p>Please check the links below to know more about the fast RPC binding handle.</p>
<blockquote>
<p><i>RpcBindingCreate <br /></i><a href="https://msdn.microsoft.com/en-us/library/aa375587(VS.85).aspx">https://msdn.microsoft.com/en-us/library/aa375587(VS.85).aspx</a></p>
</blockquote>
<blockquote>
<p><i>RpcBindingBind <br /></i><a href="https://msdn.microsoft.com/en-us/library/aa375583(VS.85).aspx">https://msdn.microsoft.com/en-us/library/aa375583(VS.85).aspx</a></p>
</blockquote>
<blockquote>
<p><i>RpcBindingUnbind <br /></i><a href="https://msdn.microsoft.com/en-us/library/aa375613(VS.85).aspx">https://msdn.microsoft.com/en-us/library/aa375613(VS.85).aspx</a></p>
</blockquote>
<blockquote>
<p><i>RpcBindingFree <br /></i><a href="https://msdn.microsoft.com/en-us/library/aa375588(VS.85).aspx">https://msdn.microsoft.com/en-us/library/aa375588(VS.85).aspx</a></p>
</blockquote>
<p>On the other hand, the occasional delay is not all that odd. A DPC firing, while the test is executing, can easily cause a 3-4ms delay.</p>
<p>Also please remember, Windows is not a real time operating system and there is no way to give any upper bound guarantee for NdrClientCall2() API call.</p>]]></content:encoded>
    </item>
    <item>
      <title>Why does the TCP three way handshake never tag with DSCP value on Windows XP and Server 2003?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/why-does-the-tcp-three-way-handshake-never-tag-with-dscp-value-on-windows-xp-and-server-2003</link>
      <pubDate>Sat, 19 May 2012 13:19:00 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2012/05/19/why-does-the-tcp-three-way-handshake-never-tag-with-dscp-value-on-windows-xp-and-server-2003/</guid>
      <description><![CDATA[Question:
We are trying to introduce QoS into our VOIP services. While working on this we have...]]></description>
      <content:encoded><![CDATA[<p>Question:</p>
<p>We are trying to introduce QoS into our VOIP services. While working on this we have observed that TCP three way handshake never tag with DSCP value. We have reproduced the issue both in Windows XP and Windows Server 2003 operating systems. My question is why TCP three way handshake never tag with DSCP value? I don&rsquo;t think this is an expected behavior, RFC 2474 mentioned nothing about this.</p>
<p>Answer:</p>
<p>On Windows XP and Server 2003, QoS DSCP tagging is applied when a data packet is being sent; depending on the DSCP value supplied by the application or the system-wide setting. During the TCP Handshake, since no data is being sent, DSCP marking is not done. This is an issue in the QoS stack of Windows XP and Server 2003.</p>
<p>Please note: This issue is fixed in Windows Vista and Windows 7.</p>]]></content:encoded>
    </item>
    <item>
      <title>Why does regedit.exe (or any other Microsoft program) crash when I try to create a remote thread into it using the CreateRemoteThread API?</title>
      <link>https://docs.microsoft.com/archive/blogs/allaboutwmsdks/why-does-regedit-exe-or-any-other-microsoft-program-crash-when-i-try-to-create-a-remote-thread-into-it-using-the-createremotethread-api</link>
      <pubDate>Sat, 19 May 2012 13:18:00 GMT</pubDate>
      <dc:creator><![CDATA[Mahatab Ur Rashid]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/allaboutwmsdks/2012/05/19/why-does-regedit-exe-or-any-other-microsoft-program-crash-when-i-try-to-create-a-remote-thread-into-it-using-the-createremotethread-api/</guid>
      <description><![CDATA[Question:
On Windows XP, I am starting regedit.exe in suspended mode and forcing it to call the...]]></description>
      <content:encoded><![CDATA[<p>Question:</p>
<p>On Windows XP, I am starting regedit.exe in suspended mode and forcing it to call the <i>LoadLibrary</i>() API to load an external DLL by using the <i>CreateRemoteThread</i> API. After loading the DLL, when I try to resume the suspended thread, the application terminates. Is this a known issue?</p>
<p>Answer:</p>
<p>Creating a remote thread into another process is a poor way to build extensibility into an application. Extendable applications should have some form of an API, a scripting language, plug-in DLL support, etc.</p>
<p>Regedit.exe was not meant to be extended by any means&mdash;it has no API and no plug-in interface and therefore does not expect to run any code or threads which are not built into it. Therefore, it also is not designed to run properly when another process calls the CreateRemoteThread to start a new thread within it. It may run or it may not. If it runs without a problem, it is only by coincidence.</p>
<p>In fact, Microsoft strongly discourages using CreateRemoteThread/CreateRemoteThreadEx to start a thread in any process. Its original purpose is to write debuggers and profilers. Even with these tools, creating a thread in another process has a risk that the target process can fail. Although the APIs themselves are documented and they will create a thread in another process (as documented), the effects the new thread has on the target process completely depend on what the target process and the new thread do &ndash; how they interact. It&rsquo;s the latter that causes the all the problems.</p>
<p>When you create a new thread in a process that doesn&rsquo;t expect it, there are many interactions which can occur. Here are some things that can happen:</p>
<p style="padding-left: 30px;">a. The new thread requires a stack in the application&rsquo;s address space. The application may want that memory for something else. Perhaps the application will fail to make an allocation and then crash because it can&rsquo;t recover from something that should &ldquo;never&rdquo; happen.</p>
<p style="padding-left: 30px;">b. It causes all the DllMain() functions of all the DLLs to get called for DLL_THREAD_ATTACH. One of these could call an API which shouldn&rsquo;t be called from DllMain(), causing a deadlock.</p>
<p style="padding-left: 30px;">c. It causes an extra DLL to get loaded somewhere in the process&rsquo;s address space. It could be that the DLL is loaded into a place where the app wants to allocate memory. The DLL may load at its preferred address space or it may not&mdash;it depends on what is already in the process&rsquo;s memory.</p>
<p style="padding-left: 30px;">d. The application may use the single-threaded CRT (C runtime library) which now could have multiple threads calling it. Since the single-threaded CRT doesn&rsquo;t set up the necessary data structures and locks to handle multiple threads, the CRT can crash.</p>
<p style="padding-left: 30px;">e. The injected code could simply have a bug and cause the application to crash.</p>
<p style="padding-left: 30px;">f. The thread could cause a deadlock if it uses any synchronization objects that other parts of the application use.</p>
<p style="padding-left: 30px;">g. Anti-malware and anti-virus programs may get triggered and kill the target process, especially if it is a known administrative tool that should be prevented from being hacked.</p>
<p>Microsoft&rsquo;s efforts to make the platform more secure means we invest in technologies like DEP (data execution prevention) which happen to do more than simply prevent someone from executing data. DEP also prevent exception handlers from executing in dynamically allocated code (because malware uses this technique), they may mark portions of the address space as no-access so that a DLL can&rsquo;t be injected, address space layout randomization, required executable signing for kernel-mode modules, etc. Microsoft will continue to improve the security of its products by similar technical means, so there is a greater chance in the future these techniques such as creating remote threads will fail more frequently. (At the same time, a provision is made to allow debuggers to do what they need to do to be useful.)</p>]]></content:encoded>
    </item>
  </channel>
</rss>