<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Microsoft Open Specifications Support Team Blog</title><link>http://blogs.msdn.com/b/openspecification/</link><description>The official blog of the Engineers supporting the Microsoft Open Specifications Documentation</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>RDPESC parser modification</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/05/30/rdpesc-parser-modification.aspx</link><pubDate>Thu, 30 May 2013 19:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10422470</guid><dc:creator>Sebastian Canevari</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello world!&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve decided to write this entry to talk about two&lt;br /&gt;intertwined subjects:&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;The published RDPESC parser needs a little tweak&lt;br /&gt;in order to function properly&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;That tweak is a real life example of how to&lt;br /&gt;modify an existing Netmon Parser&lt;/p&gt;
&lt;p&gt;My goal is not to rewrite the &lt;a href="http://msdn.microsoft.com/en-us/library/cc242596.aspx"&gt;[MS-RDPESC]&lt;/a&gt;&lt;br /&gt;document in this publication so I&amp;rsquo;ll be assuming that you are familiar with it&lt;br /&gt;and will touch the protocol details just tangentially.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve recently worked on a case where a customer was&lt;br /&gt;observing that &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=4865"&gt;Netmon 3.4&lt;/a&gt;&lt;br /&gt;was not being able to decode some of the RDPESC packets correctly. The parser&lt;br /&gt;was only going as far as the TLS layer and was taking the rest of the data as a&lt;br /&gt;simple Blob.&lt;/p&gt;
&lt;p&gt;This is pretty much what it looked like:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/2816.rdpescPic1.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/2816.rdpescPic1.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Easy case&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The first thing that came to my mind was obviously that the&lt;br /&gt;parser version the customer was using was stale so, I provided the link to the&lt;br /&gt;latest and greatest version of Netmon parsers: &lt;a href="https://connect.microsoft.com/site216/Network%20Monitor%20Parsers"&gt;03.04.2978.0001&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hold your horses!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Although customer was happy with the way the newer version&lt;br /&gt;of the parsers was handling the RDPESC structures&amp;hellip; there was something not&lt;br /&gt;working&amp;hellip;&lt;/p&gt;
&lt;p&gt;This is what the same frame looked like with the plain&lt;br /&gt;vanilla new parsers:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/8037.rdpescPic2.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/8037.rdpescPic2.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As we can see, this is day and night compared with not&lt;br /&gt;having anything parsed below TLS.&lt;/p&gt;
&lt;p&gt;But&amp;hellip; and there&amp;rsquo;s always a &amp;ldquo;but&amp;rdquo;, look at the RDPESC packet&lt;br /&gt;itself. There&amp;rsquo;s something wrong&amp;hellip;&lt;/p&gt;
&lt;p&gt;This is what other RDPESC packets look like (other control&lt;br /&gt;codes that is):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/1538.rdpescPic3.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/1538.rdpescPic3.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Don&amp;rsquo;t lose your headER!!!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Different calls and returns contain different data (duh!)&amp;hellip; Even&lt;br /&gt;different headers sometimes! (hmmm)&lt;/p&gt;
&lt;p&gt;But, shouldn&amp;rsquo;t packets ALWAYS have a header?!?!&lt;/p&gt;
&lt;p&gt;(What? What red pill? Oh&amp;hellip;. Ok&amp;hellip; lots of water? Ok, here it&lt;br /&gt;goes&amp;hellip;)&lt;/p&gt;
&lt;p&gt;Sorry, my friend Morpheus was talking to me.&lt;/p&gt;
&lt;p&gt;As I was saying, even though there might be protocols that&lt;br /&gt;do not have a properly design header structure, RDPESC is not one of those and&lt;br /&gt;its packets do indeed possess a header.&lt;/p&gt;
&lt;p&gt;So, what could possibly go wrong with the parser that it is&lt;br /&gt;treating one return call differently from another return call?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Welcome to "The Parserix"&amp;hellip;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If we right click on the RDPESC call return and&lt;br /&gt;select &amp;ldquo;Go To Data Type Definition&amp;rdquo;, the RDPESC parser file opens up and the&lt;br /&gt;first thing we can see is this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7633.rdpescPic4.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7633.rdpescPic4.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At first sight, having a &amp;ldquo;switch&amp;rdquo; clause is a good sign. It&lt;br /&gt;wouldn&amp;rsquo;t be the first time someone misses a case in a switch clause&amp;hellip; would it?&lt;/p&gt;
&lt;p&gt;Although the above mentioned is a very common scenario, it&lt;br /&gt;was not the EXACT case this time around.&lt;/p&gt;
&lt;p&gt;Because of the way the RDPESC parser works, we need to look&lt;br /&gt;at the initial call&amp;rsquo;s control code in order to figure out which of the&lt;br /&gt;scenarios it is that we are dealing with.&lt;/p&gt;
&lt;p&gt;I present you with the control code for SCARD_IOCTL_ACCESSSTARTEDEVENT:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/6675.rdpescPic5.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/6675.rdpescPic5.png" alt="" width="284" height="200" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once the control code has been identified, we can then see&lt;br /&gt;that 0x900E0 is a special case on the RDPESC parser world:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7853.rdpescPic6.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7853.rdpescPic6.png" alt="" width="375" height="165" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All fine and dandy but, what&amp;rsquo;s wrong?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Well, basically the document specifies in section 3.1.4&lt;br /&gt;that:&lt;/p&gt;
&lt;p class="NumberedList1"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;em&gt;&amp;ldquo;6. Otherwise,&lt;br /&gt;DR_DEVICE_IOCOMPLETION.IOStatus MUST be set to 0 (STATUS_SUCCESS) and&lt;br /&gt;DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBuffer MUST contain an&lt;br /&gt;encoding of the structure (as specified in the preceding Message Processing&lt;br /&gt;Events and Sequencing Rules IOCTL Table) as specified in &lt;/em&gt;&lt;a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/%5bMS-RPCE%5d.pdf"&gt;&lt;em&gt;[MS-RPCE]&lt;/em&gt;&lt;/a&gt;&lt;em&gt; section 2.2.6. DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBufferLength&lt;br /&gt;is the length of the data.&amp;rdquo;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;That means that the return call is to be parsed WITH an&lt;br /&gt;MSRPCHeader.&lt;/p&gt;
&lt;p&gt;So, we need to modify the parser.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MUST&amp;hellip; MODIFY&amp;hellip; PARSER&amp;hellip;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So in order to make this change to the parser, we can follow&lt;br /&gt;either of the two main ways we know we can use to modify parsers:&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;We can either add a personalized copy of the&lt;br /&gt;parser to some &amp;ldquo;myparsers&amp;rdquo; folder and then set that folder as the first option&lt;br /&gt;in the list of precedence in the current profile OR&lt;/p&gt;
&lt;p&gt;- We can replace the existing RDPESC parser from&lt;br /&gt;the Windows profile in Network Monitor with an updated version of it.&lt;/p&gt;
&lt;p&gt;In this case, we&amp;rsquo;ll use the second approach.&lt;/p&gt;
&lt;p&gt;These are the steps:&lt;/p&gt;
&lt;p&gt;1) Navigate to &amp;ldquo;C:\ProgramData\Microsoft\Network&lt;br /&gt;Monitor 3\NPL\NetworkMonitor Parsers\Windows&amp;rdquo;&lt;/p&gt;
&lt;p&gt;2) Save a copy of rdpesc.npl to a safe location&lt;/p&gt;
&lt;p&gt;3) Open the original file with a text editor&lt;/p&gt;
&lt;p&gt;4) Replace:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SmartCardCall W/O MSRPCHeader&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x000900E0:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch(property.RDPEFSPacketId)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x4952:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UINT32 Unused;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x4943:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RDPESCLongReturn LongReturn;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;5) With:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SmartCardCall (Special case, see below)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x000900E0:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch(property.RDPEFSPacketId)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x4952:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //The "Call" does NOT have a RPCHeader&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UINT32 Unused;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x4943:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Whereas, the "Return" does (so, handle the same way as all the other&lt;br /&gt;IOCTLs)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _struct RDPESCSmartCardCallWithMSRPCHeader&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RPCECommonTypeHeader CommonTypeHeader;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RPCEPrivateTypeHeader PrivateTypeHeader;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RDPESCLongReturn LongReturn;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;6)&amp;nbsp;Save the file back to its original place&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Once the modification has been made, reopen the&lt;br /&gt;capture in Network Monitor and look at the results. The return call should now&lt;br /&gt;look like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7651.rdpescPic7.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7651.rdpescPic7.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;It is done!&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;em&gt;&lt;span style="text-decoration: underline;"&gt;PS:&lt;/span&gt;&lt;/em&gt; I was going to be more wordy for the conclusion of this entry but I figured out that&lt;br /&gt;the post was pretty much self-explanatory.&lt;br /&gt;&lt;br /&gt;BTW, if you want to learn some more details regarding parser modifications, you&lt;br /&gt;can take a peek at my co-worker&amp;rsquo;s entry from some time ago: &lt;a href="http://blogs.msdn.com/b/openspecification/archive/2011/08/08/customizing-in-box-netmon-parsers-how-to-edit-and-deploy-updated-netmon-parsers.aspx"&gt;http://blogs.msdn.com/b/openspecification/archive/2011/08/08/customizing-in-box-netmon-parsers-how-to-edit-and-deploy-updated-netmon-parsers.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10422470" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/RDPESC+RDPBCGR+Parsers+Netmon+Network+Monitor+3-4+update/">RDPESC RDPBCGR Parsers Netmon Network Monitor 3.4 update</category></item><item><title>PowerShell script for finding Microsoft Office legacy files</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/04/08/powershell-script-for-finding-microsoft-office-legacy-files.aspx</link><pubDate>Mon, 08 Apr 2013 21:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10409472</guid><dc:creator>Vilmos Foltenyi MSFT</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Referenced documents:&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd942138.aspx"&gt;&lt;span style="color: #0000ff;"&gt;[MS-CFB]&lt;/span&gt;&lt;/a&gt;: Compound File Binary File Format&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd942421.aspx"&gt;&lt;span style="color: #0000ff;"&gt;[MS-OLEPS]&lt;/span&gt;&lt;/a&gt;: Object Linking and Embedding (OLE) Property Set Data Structures&lt;br /&gt;Windows PowerShell Cookbook, 3&lt;sup&gt;rd&lt;/sup&gt; edition, by Lee Holmes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Questions and comments are welcome. However, please DO NOT post a comment using the comment tool at the end of this post. Instead, post a new thread in the Open Specifications Forum: Office File Formats at&lt;br /&gt; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/os_binaryfile/threads"&gt;&lt;span style="color: #0000ff;"&gt;http://social.msdn.microsoft.com/Forums/en-US/os_binaryfile/threads&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;#########################&lt;br /&gt;# WHAT THE SCRIPT DOES&lt;br /&gt;#########################&lt;/p&gt;
&lt;p&gt;This blog is complementary to the blog &amp;ldquo;&lt;a href="http://blogs.msdn.com/b/openspecification/archive/2013/01/16/determining-office-binary-file-format-types.aspx"&gt;&lt;span style="color: #0000ff;"&gt;Determining Office Binary File Format Types&lt;/span&gt;&lt;/a&gt;&amp;rdquo;, by JCurry (Josh). That blog describes in details how to find PIDSI_APPNAME, i.e. the name of the application&lt;span style="text-decoration: line-through;"&gt;,&lt;/span&gt; which created the file. For the Office legacy files it can be: &amp;ldquo;Microsoft Office Word&amp;rdquo;, &amp;ldquo;Microsoft Excel&amp;rdquo;, or &amp;ldquo;Microsoft Office PowerPoint&amp;rdquo;. The PowerShell (PS) script in this blog prints more information, some information from the header, and the properties from the &amp;ldquo;Summary Information sector&amp;rdquo;. This looks adequate to meet the requests of recent cases on the Open Specifications Forum / Office File Formats, but, of course, more annotation can be added if there is demand for it.&lt;/p&gt;
&lt;p&gt;The OfficeLegacyFilter.ps1 PS script, see attached file, starts with a comment block, which contains the disclaimer and the name, version, and usage of the script. The script has one parameter, which can be a directory or file name. If the parameter is a directory, then all the files in this directory and in the subdirectories are recursively checked.&lt;/p&gt;
&lt;p&gt;All checks are made on the content of the file; the file name extension (sometime called file type) is not used. If a check fails the file is just skipped. Which means if no Office Legacy file is in scope, the script returns nothing. This makes easier to use the script in pipe.&lt;/p&gt;
&lt;p&gt;The checks start with the Header Signature, Minor and Major versions, etc. until the First Directory Sector Location is reached. Currently we are interested only in one directory sector, which has the name &amp;ldquo;Summary Information&amp;rdquo;. At offset 0x74 of that directory sector is the Starting Sector Location, see [MS-CFB] v20130118 / 2.6.1 Compound File Directory Entry, from that value we can navigate to [MS-OLEPS] &amp;mdash; v20130118 / 2.21 PropertySetStream and to 2.20 PropertySet, where you&amp;rsquo;ll find NumProperties; all the properties with their values are printed out. All these steps can be easily followed in the script.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;#########################&lt;br /&gt;# HOW TO RUN THE SCRIPT&lt;br /&gt;#########################&lt;/p&gt;
&lt;p&gt;If your machine is not set up for running a PowerShell script, the OfficeLegacyFilter.ps1 script&amp;nbsp;will not run, because scripting support is disabled by default. To see your current execution policy setting run the:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;Get-ExecutionPolicy&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;cmdlet. If you have some kind of restriction, it can be lifted by running the&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;Set-ExecutionPolicy Unrestricted&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;cmdlet. If you try to run the script now, probably you will be prompted for permission and the script will run.&lt;/p&gt;
&lt;p&gt;If you want to run the script in a more secure way, set the execution policy to the desired level. If you already have a code-signing certificate, you can use it. To check whether you have a code-signing certificate do the next:&lt;br /&gt; You can go to the cert: driver and look around the certificates&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;cd cert:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Go to the cert driver and look around&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;You can find all code-signing certificates&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;dir cert: &amp;ndash;Recurse &amp;ndash;CodeSigningCert&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you have at least one, use, e.g., the first one&lt;br /&gt;&lt;br /&gt; &lt;span style="font-family: courier new,courier; font-size: small;"&gt;$cert = @(dir cert: -Recurse &amp;ndash;CodeSigningCert)[0]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;Set-AuthenticodeSignature &amp;lt;ps1 file&amp;gt; $cert&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;At the end of the &amp;lt;ps1 file&amp;gt; you should see a comment block with the next structure:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;# SIG # Begin signature block&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;# &amp;lt;64 base64 digits&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;.......................&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;# &amp;lt;64 base64 digits&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;# &amp;lt;base64 digits&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;# SIG # End signature block&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and running the script should not be a problem.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t have code-signing certificate, then you can make one. The steps how to create a self-signed certificate are described in many places. First you need the utility for making certificate, makecert.exe. You can read about it here:&lt;br /&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx"&gt;&lt;span style="color: #0000ff;"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First you have to generate a local certificate authority and after to create a self-signed certificate by using the local certification authority.&lt;br /&gt;You can read about this, e.g., at&lt;br /&gt; Program: Create a Self-Signed Certificate&lt;br /&gt;Holmes, Lee (2012-12-21). Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft's Command Shell (p. 522). O'Reilly Media. Kindle Edition.&lt;/p&gt;
&lt;p&gt;You should be able to see the properties of the newly created signing certificate by running:&lt;br /&gt;&lt;br /&gt; &lt;span style="font-family: courier new,courier; font-size: small;"&gt;dir cert: -Recurse &amp;ndash;CodeSigningCert | Format-List *&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;#########################&lt;br /&gt;# EXAMPLE&lt;br /&gt;#########################&lt;/p&gt;
&lt;p&gt;After creating two of the three test files I changed their extension to txt. It can be anything, it is not used in the script.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;PS C:\Projects\PS\scripts&amp;gt; C:\Projects\PS\scripts\OfficeLegacyFilter.ps1 'C:\Test\a'&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;C:\Test\a\x\Autonumbering.txt&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000000 Header Signature&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : D0 CF 11 E0 A1 B1 1A E1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000018 MinorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 62&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001A MajorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009E94 01 CODEPAGE_PROPERTY_IDENTIFIER: 1252&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009E9C 02 PIDSI_TITLE&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : PowerPoint Presentation &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009EBC 04 PIDSI_AUTHOR .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Vilmos Foltenyi &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009EBC 0A PIDSI_EDITTIME&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 00:02:53.4790000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009ED4 08 PIDSI_LASTAUTHOR&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Vilmos Foltenyi &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009EEC 09 PIDSI_REVNUMBER .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 1&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009EF8 12 PIDSI_APPNAME&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Microsoft Office PowerPoint &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009F28 0C PIDSI_CREATE_DTM&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Tuesday, 12/20/2011 3:33:05 PM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009F34 0D PIDSI_LASTSAVE_DTM .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Thursday, 1/24/2013 12:05:04 AM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009F40 0F PIDSI_WORDCOUNT .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009F48 11 PIDSI_THUMBNAIL size format : 57736 FFFFFFFF&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;C:\Test\a\x\glow test.txt&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000000 Header Signature&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : D0 CF 11 E0 A1 B1 1A E1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000018 MinorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 62&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001A MajorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118A4 01 CODEPAGE_PROPERTY_IDENTIFIER: 1252&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118AC 04 PIDSI_AUTHOR .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Tim &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118AC 0A PIDSI_EDITTIME&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 00:00:00&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118B8 07 PIDSI_TEMPLATE&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Normal.dotm &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118CC 08 PIDSI_LASTAUTHOR&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Tim &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118D8 09 PIDSI_REVNUMBER .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 2&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0118E4 12 PIDSI_APPNAME&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Microsoft Office Word&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 011910 0C PIDSI_CREATE_DTM&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Wednesday, 1/16/2013 8:33:00 AM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01191C 0D PIDSI_LASTSAVE_DTM .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Wednesday, 1/16/2013 8:33:00 AM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 011928 0E PIDSI_PAGECOUNT .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 011930 0F PIDSI_WORDCOUNT .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 24&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 011938 10 PIDSI_CHARCOUNT .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 137&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 011940 13 PIDSI_DOC_SECURITY .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;C:\Test\a\y\Acronyms.xls&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000000 Header Signature&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : D0 CF 11 E0 A1 B1 1A E1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 000018 MinorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 62&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001A MajorVersion .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009474 01 CODEPAGE_PROPERTY_IDENTIFIER: 1252&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00947C 04 PIDSI_AUTHOR .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009488 08 PIDSI_LASTAUTHOR&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 009494 12 PIDSI_APPNAME&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Microsoft Excel &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0094AC 0C PIDSI_CREATE_DTM&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Friday, 9/15/2006 5:00:00 PM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0094B8 0D PIDSI_LASTSAVE_DTM .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : Thursday, 2/14/2013 11:49:09 AM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0094C4 13 PIDSI_DOC_SECURITY .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; : 0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10409472" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-40-94-72/OfficeLegacyFilter.ps1" length="21798" type="application/octet-stream" /><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Office+Binary+File+Specifications/">Office Binary File Specifications</category></item><item><title>SMB 2.x and SMB 3.0 Timeouts in Windows</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/03/27/smb-2-x-and-smb-3-0-timeouts-in-windows.aspx</link><pubDate>Wed, 27 Mar 2013 20:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10405846</guid><dc:creator>Edgar A Olougouna</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span style="font-size: small;"&gt;This blog talks about common timeouts for SMB dialects 2.x and 3.0 [MS-SMB2] in Windows. It also covers continuous availability timeout, witness keep alive [MS-SWN], and some SMB-Direct timers [MS-SMBD]. The behaviors are generally version-specific and therefore may change in future Windows releases or fixes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;A previous blog discusses &amp;ldquo;CIFS and SMB Timeouts in Windows&amp;rdquo;:&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx"&gt;http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;NOTE: For questions on MS-SMB2, MS-SWN, MS-SMBD documents, please post in the Open Specifications Forum: Windows Protocols at &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols"&gt;http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Given a SMB2 file sharing scenario, these are frequent troubleshooting questions on timeouts:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- What timeouts are involved?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- What are the related Windows behaviors?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- What timers are configurable and what are their settings in Windows?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Just as a refresher, the following are the Windows SKUs where SMB dialects 2.x and 3.0 were introduced.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Dialect 2.002, Windows Vista and Windows Server 2008.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Dialect 2.1, Windows 7 and Windows Server 2008 R2.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Dialect 3.0, Windows 8 and Windows Server 2012.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;All these SMB 2.x and 3.0 dialects share the same core SMB2 Packet format [MS-SMB2].&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Request Expiration Timer [MS-SMB2]&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;This is the amount of time the client waits for the server to respond to an outstanding request. This timeout value can be adjusted through the following registry setting:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: SessTimeout&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 60 seconds (Windows Vista)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;When the client does not receive the response to a request before the Request Expiration Timer expires, it will reset the connection because the operation is considered blocked.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;In Windows 8, the request expiration timer for the SMB 2 Negotiate is set to a smaller value, typically under 20 seconds, so that if a node of a continuously available (CA) cluster server is not responding, the SMB 3.0 client can expedite failover to the other node.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;If a request is being processed asynchronously, i.e. the server sends an interim response with STATUS_PENDING, Windows clients extend the time-out as follows:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;&amp;bull; If the asynchronous operation is SMB2 Directory Change Notification, the client will not enforce a timeout.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Otherwise, if the client is running at least Windows 7 and ExtendedSessTimeout is configured, the timeout is extended to the value of ExtendedSessTimeout: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: ExtendedSessTimeout &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Otherwise, if the client is running at least Windows 7 and ExtendedSessTimeout is not configured, the timeout is extended to four times the value of SessTimeout (4 * SessTimeout). By default, ExtendedSessTimeout is not configured.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;For example, it is typical that an asynchronous write operation expires if a backend Windows 2008 R2-based storage server is taking over 4 minutes (4 * 60 sec default SessTimeout plus the scanning time to detect that the request expired) to complete the operation. Increasing SessTimeout would effectively extend the time for asynchronous operations.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;The client does not enforce this timer for the following commands:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Named Pipe Read&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Named Pipe Write&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Asynchronous Directory Change Notifications&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; Blocking byte range lock requests&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;bull; FSCTLs: FSCTL_PIPE_PEEK, FSCTL_PIPE_TRANSCEIVE, FSCTL_PIPE_WAIT&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;Note that SessTimeout and ExtendedSessTimeout also apply to Windows-based CIFS/SMB as well, see &lt;a href="http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx"&gt;previous blog&lt;/a&gt;. However, the use of ExtendedSessTimeout in SMB is controlled by client configuration of ServersWithExtendedSessTimeout rather a server response.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Session Expiration Timer [MS-SMB2]&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;This timer is used as a frequency to scan and mark sessions as expired when their specific expiration time is reached. This timer value is 45 seconds in Windows-based servers.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;If a session is in expired state and a request is received, the server should return STATUS_NETWORK_SESSION_EXPIRED and the client must re-authenticate. However, while a session is in expired state, the server processes requests in the following cases:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- LOGOFF, CLOSE, and LOCK (unlock) which would allow to gracefully teardown. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- SESSION_SETUP for re-authentication. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- Windows releases prior to Windows 8 do not fail a signed request, i.e. the SMB2 header has SMB2_FLAGS_SIGNED set in the Flags field, and the request is not an SMB2 LOCK. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Authentication-specific expiration is driven by the authentication package. See &lt;a href="http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx"&gt;previous blog&lt;/a&gt; on &amp;ldquo;CIFS and SMB Timeouts in Windows&amp;rdquo; for more details. Session.ExpirationTime is set to the value returned by SSPI AcceptSecurityContext. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Note that for a given connection object, if the SessionTable remains empty between two cycles of session expiration timer, Windows-based servers will scavenge and disconnect the connection.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Resilient Open Scavenger Timer [MS-SMB2]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This feature was introduced with SMB 2.1 in Windows 7.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This timer is started when the transport connection associated with a resilient handle is lost. It controls the amount of time the server keeps a resilient handle active after the transport connection to the client is lost.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;A resilient handle/open is meant to survive temporary transport network disruption. If the client re-establishes connection in a reasonable time after the connection was lost, the client can reconnect to the handle. A client marks a handle resilient via SMB2 IOCTL with CtlCode FSCTL_LMR_REQUEST_RESILIENCY. Note that Windows does not check the negotiated dialect when processing this FSCTL.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The Open.ResiliencyTimeout is set as follows:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- Either a non-zero value is supplied in the Timeout field of the NETWORK_RESILIENCY_REQUEST request. If the requested timeout is greater than MaxResiliencyTimeout, the server returns STATUS_INVALID_PARAMETER.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- Otherwise, an implementation-specific value is used for resiliency timeout. Windows 7 and Windows Server 2008 R2 servers keep the resilient handle open indefinitely when the Timeout value (requested in NETWORK_RESILIENCY_REQUEST) is equal to zero. Windows 8 and Windows Server 2012 set a default value of 120 seconds. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The MaxResiliencyTimeout value can be configured through:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: ResilientTimeout&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 300 seconds (Windows 7, Server 2008 R2, 8, Server 2012)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Durable Open Scavenger Timer [MS-SMB2]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This feature was introduced with SMB 2.1 in Windows 7.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This timer is started when the transport connection associated with a durable handle is lost. It controls the amount of time the server keeps a durable handle active after the transport connection to the client is lost.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;A durable handle/open allows the client to attempt to preserve and reestablish a file handle after a network disconnection. A client requests an open to be durable through one of the create contexts SMB2_CREATE_DURABLE_HANDLE_REQUEST or SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 (v2 requires SMB 3.0 dialect).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The durability timeout is set as follows:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- For SMB2_CREATE_DURABLE_HANDLE_REQUEST, Windows 7 and Windows 2008 R2 set this timeout to 16 minutes, Windows 8 and Windows Server 2012 set the value to 2 minutes.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- For SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2, the timeout is set in the following order:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; a) A non-zero value is supplied in the Timeout field of the durable v2 create context request.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; b) A non-zero value is configured on the share&amp;rsquo;s CATimeout property.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; c) the server&amp;rsquo;s implementation specific value; Windows-based servers use the value of the registry setting:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value name: DurableHandleV2TimeoutInSecond&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 60 seconds (Windows 8, Windows Server 2012)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Maximum: 300 seconds&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Continuous Availability Timeout&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This feature was introduced with SMB 3.0 in Windows 8.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;With SMB 3.0, each share has a CATimeout property which defines the minimum time the server should hold a persistent handle on a continuously available share before closing the handle if it is un-reclaimed. By default, Windows 8 and Windows Server 2012 set CATimeout to zero.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;CATimeout can be set or retrieved using PowerShell command Set-SmbShare or Get-SmbShare.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Each share&amp;rsquo;s CATimeout needs to be configured to a sensible value to enable the SMB 3 client to perform transparent file handle recovery during server failovers.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In the event of server failover, the persistent handle may have timed out before the client reconnects to the clustered server and attempts to reclaim the handle. If that occurs, the client may replay an outstanding Read, Write, or IOCTL operation by using a stale handle which no longer exists on the server side.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Ideally, if a persistent handle times out, the client should abandon the outstanding operation and return an error to the application.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Witness keep-alive interval [MS-SWN]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This functionality was introduced for SMB 3.0 in Windows 8.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The witness protocol is used to explicitly notify a client of resource changes that have occurred on a highly available cluster server. This enables faster recovery from unplanned failures, so that the client does not need to wait for TCP timeouts.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The server advertises the support of witness protocol monitoring through the SMB2 TREE_CONNECT response capability flag SMB2_SHARE_CAP_CLUSTER. The client instructs its witness client to register for asynchronous notifications for desired resources on the cluster node it is not connected to. The witness (server) service listens and reports cluster events related to the clustered file server that the client is connected to.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;When the client registers (i.e. WintnessrRegister), the server assigns a registration key &amp;ndash; a unique UID &amp;ndash; that is used for subsequent requests on that context handle. A normal client shutdown (e.g. LanmanWorkstation) would trigger WintnessrUnregister and clear the associated state information on both sides.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;However, if the client crashes or gets disconnected, the witness service gets notified by RPC runtime for the disconnection. The witness service uses a default RPC keep-alive interval that can be configured via the following registry setting:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\SYSTEM\CurrentControlSet\Services\SMBWitness\Parameters\&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: KeepAliveInterval&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 minutes (Windows 8, Windows Server 2012)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Upon receipt of disconnection notification, the witness service will implicitly unregister the client.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;When the client comes back online after it crashed, it will register again since it has lost its state information.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;If the client simply lost the connection, and reconnected before the server noticed, the client cancels any outstanding WitnessrAsyncNotify just in case RPC runtime is still holding its state and then re-issues a new RPC call.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;SMB-Direct timers [MS-SMBD]&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;SMB-Direct is a new transport supported in Windows 8. It is designed to carry SMB2 over Remote Direct Memory Access (RDMA) Transport Protocol.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Negotiation Timer&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This timer is per-connection. It controls the amount of time to:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- Establish a connection and complete negotiation. ConnectTimeoutInMs is the deadline for the remote peer to accept the connection request and complete SMB Direct negotiation. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- Accept negotiation: The SMB Direct Negotiate request should be received before AcceptTimeoutInMs expires. The servers starts this timer as soon as it accepted the connection. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\System\CurrentControlSet\Services\SmbDirect\Parameters&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: ConnectTimeoutInMs &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default: 120 seconds (Windows 8)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: AcceptTimeoutInMs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default: 5 seconds (Windows 8)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Idle Connection Timer&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This timer is per-connection. It is the amount of time the connection can be idle without receiving a message from the remote peer. Before the local peer terminates the connection, it sends a keep alive request to the remote peer and applies a keep alive timer.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\System\CurrentControlSet\Services\SmbDirect\Parameters&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: IdleConnectionTimeoutInMs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default: 120 seconds (Windows 8)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Keep alive interval&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This attribute is per-connection. It defines the timeout to wait for the peer response for a keep-alive message on an idle RDMA connection.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\System\CurrentControlSet\Services\SmbDirect\Parameters&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: KeepaliveResponseTimeoutInMs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default: 5 seconds (Windows 8)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;Send Credit Grant Timer&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This timer is per-connection.&amp;nbsp; It regulates the amount of time that the local peer waits for the remote peer to grant Send credits before disconnecting the connection. This timer is started when the local peer runs out of Send credits.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;\HKLM\System\CurrentControlSet\Services\SmbDirect\Parameters&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value type: Dword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Value name: CreditGrantTimeoutInMs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Default: 5 seconds (Windows 8)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;"&gt;If any of these SMB-Direct timers expires, the local peer terminates the connection, then signals the connection loss to the RDMA provider.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;References&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;[MS-SMB2]: Server Message Block (SMB) Protocol Versions 2 and 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc246482.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc246482.aspx&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;[MS-SWN]: Service Witness Protocol&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh536748.aspx"&gt;http://msdn.microsoft.com/en-us/library/hh536748.aspx&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;[MS-SMBD]: SMB2 Remote Direct Memory Access (RDMA) Transport Protocol&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh536346.aspx"&gt;http://msdn.microsoft.com/en-us/library/hh536346.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10405846" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Windows+Protocol+Specification+Posts/">Windows Protocol Specification Posts</category><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/File+Sharing/">File Sharing</category></item><item><title>NTLM and Channel Binding Hash (aka Extended Protection for Authentication)</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/03/26/ntlm-and-channel-binding-hash-aka-exteneded-protection-for-authentication.aspx</link><pubDate>Tue, 26 Mar 2013 23:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10405558</guid><dc:creator>Obaid Farooqi</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Extended Protection for Authnetication (EPA) was introduced in Windows 7/WS2008R2 to thwart reflection attacks. This blog describes the changes in the implementation of NTLM Authentication that are needed to successfully authenticate to servers that have EPA enabled. Windows 7/WS 2008R2 and Windows 8/ WS2012 have EPA enabled out of the box.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;You can read the details about EPA here &lt;a href="http://technet.microsoft.com/en-us/security/advisory/973811"&gt;http://technet.microsoft.com/en-us/security/advisory/973811&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The concept in EPA is that authentication packets should be bound to the secure channel on which they are transmitted. This concept is not new and is known as channel binding (&lt;a title="http://www.faqs.org/rfcs/rfc5056.html" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/RFC 5056"&gt;RFC 5056&lt;/a&gt;). &lt;a title="http://www.faqs.org/rfcs/rfc5929.html" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/RFC 5929"&gt;RFC 5929&lt;/a&gt; describes channel bindings for TLS that Winodws uses to bind the secure channel to authentication. Please note that EPA also uses Service Pricipal Name (SPN) but it is not used for TLS and we will not discuss it here.&lt;/p&gt;
&lt;p&gt;Let's take an example of &lt;a href="http://tools.ietf.org/html/rfc2818"&gt;HTTPS&lt;/a&gt;, a protocol that uses &lt;a href="http://tools.ietf.org/html/rfc5246"&gt;TLS&lt;/a&gt;.&amp;nbsp;&amp;nbsp;Once a secure channel is established and cipher change has happened, &lt;a href="http://tools.ietf.org/html/rfc2616"&gt;HTTP&lt;/a&gt; traffic starts flowing. In this example, we are only considering services that require authentication. NTLM or Kerberos will be used if you are using Windows authentication. You are most likely to use NTLM since the whole point of using HTTP and TLS is to allow clients to connect over internet (In Windows 8, Kerberos can be used on the internet but we will concentrate on NTLM here). In case of Windows client, these are the steps that are taken to incorporate channel binding in the authentication process after secure channel has been established:&lt;/p&gt;
&lt;p&gt;1. The hashing algorithm for the signature in the certificate is identified, if present.&lt;/p&gt;
&lt;p&gt;2. SSPI calculates a hash (almost always &lt;a href="http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf"&gt;SHA256&lt;/a&gt; hash, see below for details/exceptions) of the certificate, appends other data relevent to the type of channel bindings and returns it to the application.&lt;/p&gt;
&lt;p&gt;3. The application, at the receipt of channel bindings, calls Initialize security context (ISC)&amp;nbsp;and passes channel bindings as a parameter to the method call.&lt;/p&gt;
&lt;p&gt;4. SSPI calculates the MD5 hash of channel bindings and uses it in&amp;nbsp; the calculation of &lt;a href="http://msdn.microsoft.com/en-us/library/cc236621.aspx"&gt;NTLM version 2&lt;/a&gt;&amp;nbsp;response.&lt;/p&gt;
&lt;p&gt;5. When server recives authenticate message, it queries SSPI for channel bindings. SSPI does exactly the same thing as&amp;nbsp;on the client side and returns the data to the service. The service includes it in the call to method Accept Security Context (ASC)&lt;/p&gt;
&lt;p&gt;6. In the process of verifying authenticate message, SSPI also takes into account the channel bindings. It calculates the MD5 hash of the channel bindings that were provided by the application (service)&amp;nbsp;and compares it to the one sent by the client. If they match and rest of the authentication requirements are met, authentication is successful.&lt;/p&gt;
&lt;p&gt;I'll now elaborate on each of the step listed above with a concrete example of RPC-over-HTTP traffic. The TLS network traffic is encrypted and I used Network Monitor expert Network Monitor Decryption Expert (&lt;a title="http://nmdecrypt.codeplex.com/" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/NmDecrypt"&gt;NmDecrypt&lt;/a&gt;) to decrypt it. The decrypted network trace is attached to this blog.&lt;/p&gt;
&lt;p&gt;If you open the network trace in Network Monitor, you'll see that in frame 16 server sends a certificate to client, as below (copied and pasted from the trace):&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c13e0&amp;nbsp; 30 82 02 09 30 82 01 76-a0 03 02 01 02 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;02 10 cb&amp;nbsp; 0...0..v........&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c13f0&amp;nbsp; 69 79 cd 51 75 c5 b7 4b-67 30 83 6c 78 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;44 27 30&amp;nbsp; iy.Qu..Kg0.lxD'0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1400&amp;nbsp; 09 06 05 2b 0e 03 02 1d-05 00 30 16 31 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;14 30 12&amp;nbsp; ...+......0.1.0.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1410&amp;nbsp; 06 03 55 04 03 13 0b 44-43 2d 57 53 32 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;30 30 38&amp;nbsp; ..U....DC-WS2008&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1420&amp;nbsp; 52 32 30 1e 17 0d 31 32-31 31 31 37 30 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;30 35 39&amp;nbsp; R20...1211170059&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1430&amp;nbsp; 32 31 5a 17 0d 33 39 31-32 33 31 32 33 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;35 39 35&amp;nbsp; 21Z..39123123595&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1440&amp;nbsp; 39 5a 30 16 31 14 30 12-06 03 55 04 03 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;13 0b 44&amp;nbsp; 9Z0.1.0...U....D&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1450&amp;nbsp; 43 2d 57 53 32 30 30 38-52 32 30 81 9f &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;30 0d 06&amp;nbsp; C-WS2008R20..0..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1460&amp;nbsp; 09 2a 86 48 86 f7 0d 01-01 01 05 00 03 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;81 8d 00&amp;nbsp; .*.H............&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1470&amp;nbsp; 30 81 89 02 81 81 00 9b-00 f8 1a 2d 37 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;c6 8d a1&amp;nbsp; 0..........-7...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1480&amp;nbsp; 39 91 46 f3 6a 1b f9 60-6c b3 6c a0 ac &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;ed 85 e0&amp;nbsp; 9.F.j..`l.l.....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1490&amp;nbsp; 3f dc 92 86 36 bd 64 bf-36 51 db 57 3a &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;8a 82 6b&amp;nbsp; ?...6.d.6Q.W:..k&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14a0&amp;nbsp; d8 94 17 7b d3 91 11 98-ef 19 06 52 30 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;03 73 67&amp;nbsp; ...{.......R0.sg&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14b0&amp;nbsp; c8 ed 8e fa 0b 3d 4c c9-10 63 9f cf b4 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;cf 39 d8&amp;nbsp; .....=L..c....9.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14c0&amp;nbsp; fe 99 eb 5b 11 f2 fc fa-86 24 d9 ff d9 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;19 f5 69&amp;nbsp; ...[.....$.....i&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14d0&amp;nbsp; b4 df 5a 5a c4 94 b4 b0-07 25 97 13 ad &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;7e 38 14&amp;nbsp; ..ZZ.....%...~8.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14e0&amp;nbsp; fb d6 33 65 6f e6 f7 48-4b 2d b3 51 2e &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;6d c7 ea&amp;nbsp; ..3eo..HK-.Q.m..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c14f0&amp;nbsp; 11 76 9a 2b f0 00 4d 02-03 01 00 01 a3 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;60 30 5e&amp;nbsp; .v.+..M......`0^&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1500&amp;nbsp; 30 13 06 03 55 1d 25 04-0c 30 0a 06 08 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;2b 06 01&amp;nbsp; 0...U.%..0...+..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1510&amp;nbsp; 05 05 07 03 01 30 47 06-03 55 1d 01 04 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;40 30 3e&amp;nbsp; &lt;a href="mailto:.....0G..U...@0"&gt;.....0G..U...@0&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1520&amp;nbsp; 80 10 eb 65 26 03 95 4b-d6 c0 54 75 78 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;7c b6 2a&amp;nbsp; ...e&amp;amp;..K..Tux|.*&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1530&amp;nbsp; a1 bb a1 18 30 16 31 14-30 12 06 03 55 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;04 03 13&amp;nbsp; ....0.1.0...U...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1540&amp;nbsp; 0b 44 43 2d 57 53 32 30-30 38 52 32 82 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;10 cb 69&amp;nbsp; .DC-WS2008R2...i&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1550&amp;nbsp; 79 cd 51 75 c5 b7 4b 67-30 83 6c 78 44 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;27 30 09&amp;nbsp; y.Qu..Kg0.lxD'0.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1560&amp;nbsp; 06 05 2b 0e 03 02 1d 05-00 03 81 81 00 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;7b fa fe&amp;nbsp; ..+..........{..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1570&amp;nbsp; ee 74 05 ac bb 79 e9 da-ca 00 44 96 94 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;71 92 b1&amp;nbsp; .t...y....D..q..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1580&amp;nbsp; db c9 9b 71 29 c0 e4 28-5e 6a 50 99 cd &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;a8 17 e4&amp;nbsp; ...q)..(^jP.....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c1590&amp;nbsp; 56 b9 ef 7f 02 7d 96 a3-48 14 72 75 2f &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;b0 b5 87&amp;nbsp; V....}..H.ru/...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c15a0&amp;nbsp; ee 55 e9 6a 6d 28 3c c1-fd 00 e4 76 e3 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;80 88 78&amp;nbsp; .U.jm(&amp;lt;....v...x&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c15b0&amp;nbsp; 26 0d 6c 8c b8 64 61 63-b7 13 3a ab c7 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;dd 1d 0a&amp;nbsp; &amp;amp;.l..dac..:.....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c15c0&amp;nbsp; d7 15 45 a1 d6 d9 34 c7-21 48 fb 43 87 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;38 da 1f&amp;nbsp; ..E...4.!H.C.8..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c15d0&amp;nbsp; 50 47 b1 a5 5c 47 ed 04-44 97 d3 ac 74 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;2d eb 09&amp;nbsp; PG..\G..D...t-..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: courier new,courier;"&gt;00000000`095c15e0&amp;nbsp; 77 59 bf a3 54 5b de 42-d5 23 5a 71 &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;9f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wY..T[.B.#Zq..&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After secure channel is established and cipher change has taken place, HTTP traffic starts flowing.&lt;/p&gt;
&lt;p&gt;In this example, HTTP is being used as a transport for RPC and RPC server requires authentication. For authentication, the client application first calculates the channel binding by using the following process(in Windows this is done by SSPI but that is not important in this discussion&amp;nbsp;). This process is based on RFC 5929.&lt;/p&gt;
&lt;p&gt;1. The channel binding type for this example is "tls-server-end-point" since a certificate is used in handshake (RFC5929).&lt;/p&gt;
&lt;p&gt;2. The client calculates a hash of the certificate. The hashing algorithm is SHA-256, unless all of the following conditions are met, in which case the signature algorithm in the certificate will be used.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A certificate signature algorithm exist&lt;/li&gt;
&lt;li&gt;The algorithm is only implemented in &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa376210(v=vs.85).aspx"&gt;CNG&lt;/a&gt; (&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa375549(v=vs.85).aspx"&gt;ALG_ID&lt;/a&gt; is CALG_OID_INFO_CNG_ONLY)&lt;/li&gt;
&lt;li&gt;The algorithm has a corresponding CNG algorithm identifier string (&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa381435(v=vs.85).aspx"&gt;pwszCNGAlgid&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;The algorithm is not &lt;a href="http://tools.ietf.org/html/rfc3174"&gt;SHA1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The algorithm is not &lt;a href="http://tools.ietf.org/html/rfc1321"&gt;MD5&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;3. The SHA-256 hash of the above certificate is: ea 05 fe fe cc 6b 0b d5 71 db bc 5b aa 3e d4 53 86 d0 44 68 35 f7 b7 4c 85 62 1b 99 83 47 5f 95&lt;/p&gt;
&lt;p&gt;4. The Channel binding unique prefix (RFC5929) "tls-server-end-point" is prefixed to the&amp;nbsp;hash above (with a colon), resulting in &amp;nbsp;&lt;/p&gt;
&lt;p&gt;74 6c 73 2d 73 65 72 76 65 72 2d 65 6e 64 2d 70 6f 69 6e 74 3a ea 05 fe fe cc 6b 0b d5 71 db bc 5b aa 3e d4 53 86 d0 44 68 35 f7 b7 4c 85 62 1b 99 83 47 5f 95&lt;/p&gt;
&lt;p&gt;5. The above value is inserted as the value of application_data field of gss_channel_bindings_struct structure, as pointed out by &lt;a href="http://msdn.microsoft.com/en-us/library/cc236621.aspx"&gt;MS-NLMP&lt;/a&gt; section 2.2.2.1&lt;/p&gt;
&lt;p&gt;6. Windows always sets the other fields of gss_channel_bindings_struct as zeros (&lt;span style="line-height: 115%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd919963(v=vs.85).aspx"&gt;SEC_CHANNEL_BINDINGS&lt;br /&gt;structure&lt;/a&gt;&lt;/span&gt;). The resulting gss_channel_bindings_struct is as follows (little endian format):&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00 //initiator_addtype&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00 //initiator_address length&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00 //initiator_address pointer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00&amp;nbsp;//acceptor_addrtype&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00&amp;nbsp;//acceptor_address length&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 00 00 00 //acceptor_address pointer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;35 00 00 00 //application_data length (53 bytes)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;20 00 00 00&amp;nbsp;//application_data pointer (32 bytes from start of this structure)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;74 6c 73 2d //application data, as calculated above&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;73 65 72 76&lt;br /&gt;65 72 2d 65 &lt;br /&gt;6e 64 2d 70&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;6f 69 6e 74 &lt;br /&gt;3a ea 05 fe&lt;br /&gt;fe cc 6b 0b &lt;br /&gt;d5 71 db bc&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;5b aa 3e d4 &lt;br /&gt;53 86 d0 44&lt;br /&gt;68 35 f7 b7 &lt;br /&gt;4c 85 62 1b&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;99 83 47 5f &lt;br /&gt;95&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After calculating channel binding, the client application starts authentication and include channel binding as part of authentication. In case of NTLM, the gss_channel_bindings_struct&amp;nbsp; is called ClientChannelBindingUnhashed (MS-NLMP section 3.1.1.2). As explained in MS-NLMP section 3.1.5.1.2, the client adds an AV_PAIR structure and set the &lt;strong&gt;AvId&lt;/strong&gt; field to MsvAvChannelBindings and the &lt;strong&gt;Value&lt;/strong&gt; field to MD5(ClientChannelBindingsUnhashed). The MD5 hash of the above gss_channel_bindings_struct&amp;nbsp; turns out to be:&lt;/p&gt;
&lt;p&gt;65 86 E9 9D 81 C2 FC 98 4E 47 17 2F D4 DD 03 10&lt;/p&gt;
&lt;p&gt;This value is part of the AUTHENTICATE_MESSAGE in frame 27 in the network trace attached (in the network trace it is shown in Base64 encoding as 45 41 42 6C 68 75 6D 64 67 63 4C 38 6D 45 35 48 46 79 2F 55 33 51 4D 51 with AvLen) .&lt;/p&gt;
&lt;p&gt;When server receives the AUTHENTICATE_MESSAGE, in addition to the regular authentication processing, it also verifies the channel binding hash by calculating it the same way the client did. If the channel binding hash does not match, the authentication will not be successful. The subsequent behavior is server dependent. In this example (IIS), the server will stop communication on unsuccessful authentication.&lt;/p&gt;
&lt;p&gt;Please note that two step hashing is being employed here. First the application creates a hash of the certificate which becomes a part of gss_channel_bindings_struct structure. This structure is MD5 hashed again to be included in AUTHENTICATE_MESSAGE.&lt;/p&gt;
&lt;p&gt;There are configurations on both Windows client and server side to disable the EPA. For the server side, please consult the server specific documentation. As for the server in this example, IIS, please consult&amp;nbsp; &lt;a href="http://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/extendedprotection"&gt;http://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/extendedprotection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the client side, there is a registry setting that is described in KB976918 (&lt;a href="http://support.microsoft.com/kb/976918"&gt;http://support.microsoft.com/kb/976918&lt;/a&gt;) that can be used to configure EPA.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10405558" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-40-55-58/ChannelBindingTraceDecrypted.cap" length="593938" type="application/octet-stream" /></item><item><title>CIFS and SMB Timeouts in Windows</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx</link><pubDate>Tue, 19 Mar 2013 19:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10403623</guid><dc:creator>Edgar A Olougouna</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This blog gives a consolidated overview of the most common SMB timeouts in Windows and their behaviors. Some of these legacy timeouts or timers are optional, implementation specific, not defined or not required by the protocol specifications. Let&amp;rsquo;s recall that MS-CIFS documents the protocol implemented in Windows NT and Windows 98, whereas MS-SMB describes the extensions added in Windows 2000 and beyond.&lt;/p&gt;
&lt;p&gt;A subsequent blog discusses &amp;ldquo;SMB 2.x and SMB 3.0 Timeouts in Windows&amp;rdquo;:&amp;nbsp; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/openspecification/archive/2013/03/27/smb-2-x-and-smb-3-0-timeouts-in-windows.aspx"&gt;http://blogs.msdn.com/b/openspecification/archive/2013/03/27/smb-2-x-and-smb-3-0-timeouts-in-windows.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;NOTE: For questions on MS-CIFS and MS-SMB documents, please post in the Open Specifications Forum: Windows Protocols at &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols"&gt;http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SMB exchange timeout&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here, I am using the term &amp;ldquo;exchange timeout&amp;rdquo;. There is no such definition in the specifications. &lt;br /&gt;The exchange timeout can be defined as the maximum amount of time that the client redirector waits for a server to respond to a timed SMB message. There are three variants of SMB exchange timeout that are observed commonly in Windows: client session timeout, extended session timeout, offline file timeout.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Client session timeout&lt;/strong&gt; &lt;br /&gt;It is the most common exchange timeout. This is defined in [MS-CIFS] as a system-wide parameter Client.SessionTimeoutValue. This value can be configured through the SessTimeout registry key [KB102067]. &lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: SessTimeout&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 45 seconds (Windows NT)&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 60 seconds (Windows 2000)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Extended session timeout&lt;/strong&gt;&lt;br /&gt;This optional timeout may be useful in high latency networks. It applies to a timed exchange with a server listed in ServersWithExtendedSessTimeout. &lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: ExtendedSessTimeout&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000 (seconds)&lt;br /&gt;Value type: Multi-string&lt;br /&gt;Value name: ServersWithExtendedSessTimeout&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;null&amp;gt;&lt;br /&gt;These were introduced in Windows XP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Offline file timeout&lt;/strong&gt;&lt;br /&gt;The client uses this optional timeout for a timed operation on an offline file, normally indicated by the FILE_ATTRIBUTE_OFFLINE attribute. This timeout can be configured with the registry parameter&lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: OffLineFileTimeoutIntervalInSeconds&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000&lt;br /&gt;This was introduced in Windows 2000.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Request Expiration Timer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This optional timer controls the scanning interval of outstanding commands. It is used as a scavenger cycle for outstanding commands that met their exchange timeout deadlines. Windows NT and Windows 98 CIFS clients implement a default value of 30 seconds for the Request Expiration Timer.&lt;br /&gt;When an outstanding command has passed the exchange timeout, the client should close the connection if this remains idle. The time the client effectively closes the connection will vary, but bounded to a minimum of Client.SessionTimeoutValue.&lt;br /&gt;For example, let&amp;rsquo;s assume that at a 30 seconds scanning interval, an outstanding command has a 60 seconds session timeout due to expire in 5 seconds, the redirector will close the connection at the next scavenger cycle. The effective connection closing time would be around: &lt;br /&gt;Session timeout (60 sec) &amp;ndash; time due at the scavenger timer (5 sec) + next scavenger time (30 sec) = 85 sec. &lt;br /&gt;Commands exempt from the Request Expiration Timer &lt;br /&gt;The list of exempt commands is defined in MS-CIFS 3.2.6.1 Request Expiration Timer Event.&lt;br /&gt;&amp;bull; The NT_TRANSACT_NOTIFY_CHANGE subcommand&lt;br /&gt;&amp;bull; Read and write commands issued on an Open to a named pipe via the following commands:&lt;br /&gt;&amp;bull; SMB_COM_READ &lt;br /&gt;&amp;bull; SMB_COM_WRITE &lt;br /&gt;&amp;bull; SMB_COM_READ_ANDX &lt;br /&gt;&amp;bull; SMB_COM_WRITE_ANDX &lt;br /&gt;&amp;bull; SMB_COM_WRITE_AND_CLOSE &lt;br /&gt;&amp;bull; TRANS_READ_NMPIPE&lt;br /&gt;&amp;bull; TRANS_WRITE_NMPIPE&lt;br /&gt;&amp;bull; TRANS_RAW_READ_NMPIPE&lt;br /&gt;&amp;bull; TRANS_TRANSACT_NMPIPE&lt;br /&gt;&amp;bull; TRANS_RAW_WRITE_NMPIPE&lt;br /&gt;&amp;bull; TRANS_CALL_NMPIPE&lt;br /&gt;&amp;bull; TRANS_WAIT_NMPIPE &lt;br /&gt;&amp;bull; SMB_COM_LOCKING_ANDX Request with the Timeout field set to a nonzero value&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Echo behavior&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An Echo request is sent to determine whether or not an idle connection has been lost. For an outstanding timed network operation, the connection would be closed upon the expiration of the exchange timer. The Echo mechanism does not prevent the connection from being closed if there is no response to any outstanding command beyond the exchange timeout. This way, the client avoids continuing Echo-probing a known dead connection. If the server is responding to Echo requests, the client will wait until the exchange times out, and the client will not send any interim response to the calling application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;OpLock Break Acknowledgment Timer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This timer controls the time the server waits for a client to acknowledge an OpLock break request, if an acknowledgement is required. If an OpLock break acknowledgment is not received before the timer elapses, the server locally breaks the lock. This is controlled through the OplockBreakWait registry [KB129202]. &lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: OplockBreakWait&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 35 (seconds)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Idle Connection Timer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is the amount of time that a connection can be idle before being disconnected. An idle connection is defined as a connection which has no existing open handles (no open files, directories, search contexts, etc.), and no pending operation. The Idle Connection Timer is implementation-specific. &lt;br /&gt;When the server receives a message, Server.Connection.IdleTime is set to the current time plus Server.AutoDisconnectTimeout [MS-CIFS].&lt;br /&gt;On Windows servers it can be configured through the Autodisconnect registry key [KB297684]. &lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: Autodisconnect&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 15 (minutes)&lt;br /&gt;The Autodisconnect can also be configured through group policy: &lt;br /&gt;Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options&lt;br /&gt;"Microsoft network server: Amount of idle time required before suspending session"&lt;/p&gt;
&lt;p&gt;In older Windows clients (e.g. Windows 2000, Windows 2003), the client closes an idle connection based on the KeepConn workstation parameter [KB819108]. &lt;br /&gt;HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: KeepConn&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp;&amp;nbsp; 600 (seconds)&lt;br /&gt;KeepConn is no longer used, except in Installable File System Kit (IFSKIT).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unused Open Search Timer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This optional timer that controls the amount of time that an open search can stay unused before the server closes the search context. It is used as maximum age to scavenge open searches, see Server.SrvSearchMaxTimeout [MS-CIFS].&lt;br /&gt;On Windows, the unused search timer can be configured as&lt;br /&gt;\HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\&lt;br /&gt;Value type: Dword&lt;br /&gt;Value name: MaxKeepSearch&lt;br /&gt;Default:&amp;nbsp;&amp;nbsp; 3600 (seconds)&lt;br /&gt;Range: 10 &amp;ndash; 10,000&lt;/p&gt;
&lt;p&gt;This legacy timer was for MS DOS applications which did not have the capability to issue a &amp;ldquo;close search&amp;rdquo; primitive, such as Win32 FindClose, to explicitly close a search.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Authentication Expiration Timer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This timer was introduced in MS-SMB. It is used to periodically scan and mark authenticated sessions as expired when their specific expiration time is reached. If a session is expired, SMB operations will receive STATUS_NETWORK_SESSION_EXPIRED and the client must re-authenticate. Note that the server does not enforce session expiration on the following commands while the authentication state of a session is expired:&lt;br /&gt;- SMB_COM_SESSION_SETUP_ANDX for session renewal,&lt;br /&gt;- SMB_COM_CLOSE,&lt;br /&gt;- SMB_COM_LOGOFF_ANDX,&lt;br /&gt;- SMB_COM_FLUSH (see KB 943459) ,&lt;br /&gt;- SMB_COM_LOCKING_ANDX as an oplock break acknowledgement (see KB 943459),&lt;br /&gt;- SMB_COM_TREE_DISCONNECT.&lt;/p&gt;
&lt;p&gt;Note that KB 943459 does not apply to SMB 2. The fix was done on srv.sys (SMB server) and mitigates older SMB clients that are not capable of re-authenticating upon receiving a STATUS_SESSION_EXPIRED error in response to an oplock break acknowledgment.&lt;br /&gt;More details are discussed later on session expiration and dynamic re-authentication.&lt;/p&gt;
&lt;p&gt;Authentication-specific expiration is driven by the authentication package. For instance, NTLM authentication has no explicit expiration time; authentications done with NTLM do not explicitly expire. &lt;br /&gt;For Kerberos authentication package, the service ticket&amp;rsquo;s endtime is derived from the MaxServiceTicketAge when the ticket is issued, as documented in [MS-KILE]. The default MaxServiceTicketAge is 10 hours and can be adjusted though Group Policy Management Console under Default Domain Policy/ Account Policies / Kerberos Policy.&lt;br /&gt;In addition, even if a session did not explicitly expire, the server may forcibly disconnect the user SMB session based upon a group policy setting and user&amp;rsquo;s logonHours [MS-ADA1]. &lt;br /&gt;The group policy setting is:&lt;br /&gt;Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options&lt;br /&gt;"Microsoft network server: Disconnect clients when logon hours expire"&lt;br /&gt;This policy sets the registry key: &lt;br /&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters\enableforcedlogoff&lt;br /&gt;When this policy is enabled, the SMB session is disconnected when the user's logon hours expire. &lt;br /&gt;When this policy is disabled, the session remains valid as long as it stays connected, even after logon hours expire, provided the session did not expire.&lt;br /&gt;This policy may be configured on the Default Domain Policy and propagated through group policy to the computers.&amp;nbsp; &lt;br /&gt;As an example, let&amp;rsquo;s assume contoso\user1 has logonHours configured to &amp;ldquo;Logon Denied&amp;rdquo; between 5:00 PM and 9:00 AM.&amp;nbsp; An SMB share &lt;a href="file://\\server2008r2\Share"&gt;\\server2008r2\Share&lt;/a&gt; is accessed from a Windows XP SP3 client at 4:59:30 PM where enableforcedlogoff is enabled. Once the clock ticks 5:00 PM, the client falls in logonHours expiry and the session is dropped. At 5:05 PM, when user1 attempts to access the share, a similar error is observed:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;br /&gt;&lt;em&gt;&lt;a href="file://\\server2008r2\Share"&gt;\\server2008r2\Share&lt;/a&gt; is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Logon failure: account logon time restriction violation.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Session expiration and dynamic re-authentication&lt;/strong&gt;&lt;br /&gt;In Windows implementation, SMB session expiration is enforced based upon the client&amp;rsquo;s support of dynamic re-authentication capability [MS-SMB].&lt;br /&gt;If the client enables the CAP_DYNAMIC_REAUTH capability bit, the server will enforce session expiration. If a client does not set CAP_DYNAMIC_REAUTH, the Windows server does not return STATUS_NETWORK_SESSION_EXPIRED.&amp;nbsp; &lt;br /&gt;The SMB dynamic re-authentication feature was introduced in Windows XP. From there, Windows-based clients set the CAP_DYNAMIC_REAUTH capability bit to indicate to the server that the client supports re-authentication when the Kerberos service ticket for the session expires. &lt;br /&gt;Windows servers do check CAP_DYNAMIC_REAUTH:&lt;br /&gt;&amp;bull; If clientCapabilities sets CAP_DYNAMIC_REAUTH, the server will set Server.Session.AuthenticationExpirationTime to the expiry time returned by AcceptSecuirtyContext. &lt;br /&gt;&amp;bull; If clientCapabilities does not set CAP_DYNAMIC_REAUTH, the server will not set Server.Session.AuthenticationExpirationTime, basically a CAP_DYNAMIC_REAUTH capability bit not set by the client means the session will not expire on the server side.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;[MS-CIFS]: Common Internet File System (CIFS) Protocol&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee442092.aspx"&gt;http://msdn.microsoft.com/en-us/library/ee442092.aspx&lt;/a&gt;&lt;br /&gt;[MS-SMB]: Server Message Block (SMB) Protocol&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc246231.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc246231.aspx&lt;/a&gt;&lt;br /&gt;[MS-WKST]: Workstation Service Remote Protocol&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc250262.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc250262.aspx&lt;/a&gt;&lt;br /&gt;When the Kerberos ticket expires for a Kerberos-authenticated SMB connection that is created to a Windows Server 2003-based server, the oplock on a file cannot be broken in a timely manner&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/943459"&gt;http://support.microsoft.com/kb/943459&lt;/a&gt;&lt;br /&gt;LanmanWorkstation Parameters: SessTimeout&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc938292.aspx"&gt;http://technet.microsoft.com/en-us/library/cc938292.aspx&lt;/a&gt;&lt;br /&gt;LanmanServer Parameters: MaxKeepSearch&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc957456.aspx"&gt;http://technet.microsoft.com/en-us/library/cc957456.aspx&lt;/a&gt;&lt;br /&gt;Remote Storage and Windows 2000&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc938445.aspx"&gt;http://technet.microsoft.com/en-us/library/cc938445.aspx&lt;/a&gt;&lt;br /&gt;How to Troubleshoot Event ID 2009 Errors&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/165815"&gt;http://support.microsoft.com/kb/165815&lt;/a&gt;&lt;br /&gt;&amp;ldquo;Microsoft network server: Disconnect clients when logon hours expire&amp;rdquo;&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc758192.aspx"&gt;http://technet.microsoft.com/en-us/library/cc758192.aspx&lt;/a&gt;&lt;br /&gt;HOW TO: Limit User Logon Time in a Domain in Windows Server 2003&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/816666"&gt;http://support.microsoft.com/kb/816666&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10403623" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Windows+Protocol+Specification+Posts/">Windows Protocol Specification Posts</category><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/File+Sharing/">File Sharing</category></item><item><title>Rich Text Format (RTF) and Watermarks</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/02/04/rich-text-format-rtf-and-watermarks.aspx</link><pubDate>Mon, 04 Feb 2013 20:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10390994</guid><dc:creator>Mark Miller_DSC</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;Seldom is the question asked, &lt;em&gt;"Is there an RTF directive that can be used to add watermarks in RTF documents?&lt;/em&gt;"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;One day recently this question found me, and after delving into the world of the &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=10725"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span lang=""&gt;Rich Text Format (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=10725"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span lang=""&gt;RTF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=10725"&gt;&lt;span lang=""&gt;) specification&lt;/span&gt;&lt;/a&gt;&lt;span lang=""&gt; you may in turn be interested in what I found, which includes a new appreciation for RTF.&amp;nbsp; At risk of repeating what is stated in many blogs in many similar ways, the RTF format affords fluidity of fidelity over time.&amp;nbsp; What this essentially means is that RTF format provides a significant hedge against ever changing specifications.&amp;nbsp; Thus, RTF is kind of a time capsule document format that can be opened in the future, with the same fidelity potential encoded at the time it was created.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;Of course, RTF implementations do differ from application to application.&amp;nbsp; However, since applications SHOULD ignore control words they do not implement they will only lack the ability to render the RTF at the same fidelity encoded in the original document.&amp;nbsp; And, since RTF is a Rich "Text" Format, the encoding is in plain text and not encoded in a more abstruse Binary File Format.&amp;nbsp; So reading the format and implementing the format is far more accessible by comparison.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;To delve the RTF specification, refer to this &lt;a href="http://blogs.office.com/b/microsoft-word/archive/2008/04/17/new-version-of-the-rich-text-format-rtf-specification.aspx"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span lang=""&gt;blog&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span lang=""&gt;, which references the &lt;/span&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=10725"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span lang=""&gt;Word 2007: Rich Text Format (RTF) Specification, version 1.9.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span lang=""&gt; (the latest version at the time of this writing).&amp;nbsp; This is &lt;strong&gt;the&lt;/strong&gt; essential reference for implementing the RTF specification.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;Now that I&amp;rsquo;ve provided a little background and the necessary references, I&amp;rsquo;ll restate the purpose of this blog, which is to answer the question, "&lt;em&gt;Is there an RTF directive that can be used to add watermarks in RTF documents?&lt;/em&gt;"&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;The answer is derived from the RTF specification.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;First, nowhere in the RFT specification will you find the word "Watermark" or an explanation for it.&amp;nbsp; That&amp;rsquo;s because there is no Watermark control code or object in the RTF specification per-se.&amp;nbsp; Watermarking is implemented in RFT by various control codes that compose a Watermark, and in this case also includes a special Word Watermark object that of course is not part of the RTF specification (see below).&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;An easy way to discover the control codes for implementing a Watermark in RTF (among other things) is to create a Watermark in Word and save the file as an RTF document.&amp;nbsp; A Watermark in Word is a Shape (i.e. a Drawing Object).&amp;nbsp; In RTF the shape that composes the Watermark begins with the control word "\shp".&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;In the RTF specification reference, refer to the section titled, "&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;Word 97 Through Word 2007 RTF for Drawing Objects (Shapes)&lt;/span&gt;&lt;/span&gt;", which details the meaning of the highlighted keywords below as they relate to "\shp". &lt;em&gt;The first destination (&lt;strong&gt;\shp&lt;/strong&gt;) is always present. This control word groups everything related to a shape together. Following the destination change is basic information regarding the shape. The following keywords with values can appear in any order after the "{&lt;strong&gt;\shp&lt;/strong&gt;" control word.&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;The basic syntax for drawing objects in RTF is as follows:&lt;/span&gt;&lt;/p&gt;
&lt;table style="width: 643px;" dir="LTR" border="0" cellspacing="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;shape&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{' &lt;strong&gt;\shp&lt;/strong&gt; &amp;lt;shpinfo&amp;gt; &amp;lt;shpinst&amp;gt; &amp;lt;shprslt&amp;gt; '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;shpinfo&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;\shpleft&lt;em&gt;N&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;? &lt;strong&gt;\shptop&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpbottom&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpright&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shplid&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpz&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpfhdr&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpbxpage &lt;/strong&gt;? &lt;strong&gt;\shpbxmargin &lt;/strong&gt;? &lt;strong&gt;\shpbxcolumn&lt;/strong&gt;? &lt;strong&gt;\shpbxignore&lt;/strong&gt;? &lt;strong&gt;\shpbypage &lt;/strong&gt;? &lt;strong&gt;\shpbymargin &lt;/strong&gt;? &lt;strong&gt;\shpbypara&lt;/strong&gt;? &lt;strong&gt;\shpbyignore&lt;/strong&gt;? &lt;strong&gt;\shpwr&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpwrk&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shpfblwtxt&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;? &lt;strong&gt;\shplockanchor&lt;/strong&gt;? &lt;strong&gt;\shptxt&lt;/strong&gt;?&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;shpinst&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{\*' &lt;strong&gt;\shpinst&lt;/strong&gt; &amp;lt;sp&amp;gt;+ '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;sp&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{' &lt;strong&gt;\sp&lt;/strong&gt; &amp;lt;sn&amp;gt; &amp;lt;sv&amp;gt; &amp;lt;hsv&amp;gt;? '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;sn&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{' &lt;strong&gt;\sn&lt;/strong&gt; ... '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;sv&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{' &lt;strong&gt;\sv&lt;/strong&gt; ... '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;shprslt&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{\*' &lt;strong&gt;\shprslt&lt;/strong&gt; ... '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;hsv&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{\*' &lt;strong&gt;\hsv&lt;/strong&gt; &amp;lt;accent&amp;gt; &amp;amp; &lt;strong&gt;\ctint&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt; &amp;amp; &lt;strong&gt;\cshade&lt;em&gt;N&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt; '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;accent&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;\caccentone&lt;/span&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;| &lt;strong&gt;\caccenttwo&lt;/strong&gt; | &lt;strong&gt;\caccentthree&lt;/strong&gt; | &lt;strong&gt;\caccentfour&lt;/strong&gt; | &lt;strong&gt;\caccentfive&lt;/strong&gt; | &lt;strong&gt;\caccentsix&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;I won&amp;rsquo;t go into every control word definition, you can surely follow every control word definition in the RTF specification, but I will point out the control words germane to answering the question at hand.&amp;nbsp; The following is a snippet from a test RTF document I used by saving a Microsoft Word document with a Watermark as RTF.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: x-small;"&gt;{\shp{&lt;span style="background-color: #ffff99;"&gt;\*&lt;/span&gt;\shpinst\shpleft0\shptop0\shpright10557\shpbottom2639\shpfhdr0\shpbxmargin\shpbxignore\shpbymargin\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz0\shplid2049{\sp{\sn&lt;strong&gt;shapeType&lt;/strong&gt;}{\sv &lt;strong&gt;136&lt;/strong&gt;}}{\sp{\sn &lt;strong&gt;fFlipH&lt;/strong&gt;}{\sv 0}}{\sp{\sn &lt;strong&gt;fFlipV&lt;/strong&gt;}{\sv 0}}&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: x-small;"&gt;{\sp{\sn &lt;strong&gt;gtextUNICODE&lt;/strong&gt;}{\sv &lt;strong&gt;CONFIDENTIAL&lt;/strong&gt;}}{\sp{\sn gtextSize}{\sv 65536}}{\sp{\sn gtextFont}{\sv Calibri}}{\sp{\sn fGtext}{\sv 1}}{\sp{\sn gtextFStretch}{\sv 1}}{\sp{\sn&lt;strong&gt;fillColor&lt;/strong&gt;}{\sv 12632256}}&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: x-small;"&gt;{\sp{\sn&lt;strong&gt;fillOpacity&lt;/strong&gt;}{\sv 32768}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn &lt;strong&gt;wzName&lt;/strong&gt;}{\&lt;strong&gt;svPowerPlusWaterMarkObject&lt;/strong&gt;357476642}}{\&lt;strong&gt;sp&lt;/strong&gt;{\sn &lt;strong&gt;posh&lt;/strong&gt;}{\&lt;strong&gt;sv&lt;/strong&gt; 2}}{\sp{\sn&lt;strong&gt;posrelh&lt;/strong&gt;}{\sv 0}}{\sp{\sn &lt;strong&gt;posv&lt;/strong&gt;}{\sv 2}}{\sp{\sn &lt;strong&gt;posrelv&lt;/strong&gt;}{\sv 0}}{\sp{\sn dhgt}{\sv 251659264}}&amp;hellip;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;The first thing to point out is the control symbol "&lt;span style="background-color: #ffff99;"&gt;\*&lt;/span&gt;".&amp;nbsp; I&amp;rsquo;ve alluded to this before, and per the RTF specification, "&lt;em&gt;Destinations added after the&amp;nbsp;&lt;/em&gt;&lt;a href="file:///E:/Users/glueShoe/AppData/Local/Microsoft/Windows/Temporary%20Internet%20Files/Temporary%20Internet%20Files/Content.IE5/GZY35SKC/Word2007RTFSpec9.doc"&gt;&lt;em&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span style="color: #0072c6;"&gt;&lt;span lang=""&gt;1987 RTF Specification&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span lang=""&gt; may be preceded by the control symbol &lt;strong&gt;\*&lt;/strong&gt; (backslash asterisk).&lt;strong&gt;This control symbol identifies destinations whose related text should be ignored if the RTF reader does not recognize the destination control word.&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;"&amp;nbsp; This means the shape will be ignored by an RTF reader that does not implement the control word.&amp;nbsp; You can test out a quick example of this by creating an RTF document in Word that contains a Watermark then open the document in WordPad and you&amp;rsquo;ll notice the Watermark will not be rendered since WordPad does not support Watermarks.&amp;nbsp; Open the same RTF file in Word and of course you see the Watermark.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;In my example file above, I used a "CONFIDENTIAL" Watermark which refers to the Shape (control word "\shp") and the Drawing Object "PowerPlusWaterMarkObject").&amp;nbsp; The Drawing Object is a special object identifier specifically for Word.&amp;nbsp; You&amp;rsquo;ll find references to this object in API calls, macros, etc. (i.e. wherever you are dealing with a Word Watermark).&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;You can refer to the RTF specification and note the definitions for the shape (position, text font/size, left, top, right, bottom, etc).&amp;nbsp; Just follow the nested open/close braces "{ }" (the &lt;em&gt;Group&lt;/em&gt; symbol), which indicates the beginning and end of each Group (and Groups can and will be nested).&amp;nbsp; Essentially, the entire RTF file is in a Group.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;An RTF file has the following syntax:&lt;/span&gt;&lt;/p&gt;
&lt;table style="width: 643px;" dir="LTR" border="0" cellspacing="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td bgcolor="#ffffff" width="18%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&amp;lt;File&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td bgcolor="#ffffff" width="82%" height="0"&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;'{' &amp;lt;header&amp;gt; &amp;lt;document&amp;gt; '}'&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;Note, the important takeaway point in this example is that there is no "Watermark" per-se in RTF, but rather the "\shp" control words compose the Watermark feature for the RTF reader.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;If there is another feature you&amp;rsquo;d like to examine to see how it is composed/represented in RTF, just open Word and save your example as RTF and open in your editor of choice.&amp;nbsp; It&amp;rsquo;s an easy way to understand RTF and how various features are implemented in the RTF format.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"&gt;&lt;span style="color: #1f497d;"&gt;NOTE: Questions and comments are welcome.&amp;nbsp; However, please DO NOT post a comment using the comment tool at the end of this post.&amp;nbsp; Instead, post a new thread in the Open Specifications Forum at &lt;a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/redir.aspx?C=Qgp1_VJQRE6dVF74G1qiVJPG6KVx1s8I7HPJueJilUmocAuLJVkEVsrB6BE72XYOrE2DRfW18ls.&amp;amp;URL=http%3a%2f%2fsocial.msdn.microsoft.com%2fForums%2fen-US%2fos_windowsprotocols" target="_blank"&gt;http://social.msdn.microsoft.com/Forums/en-US/&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="RIGHT"&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10390994" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/MBD+Specification+Posts/">MBD Specification Posts</category><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Open+Specifications/">Open Specifications</category><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Rich+Text+Format/">Rich Text Format</category></item><item><title>How to manually decode an ActiveSync WBXML stream</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/02/04/how-to-manually-decode-an-activesync-wbxml-stream.aspx</link><pubDate>Mon, 04 Feb 2013 18:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10390956</guid><dc:creator>JCurry</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span style="font-size: large;"&gt;Overview&lt;/span&gt;&lt;br /&gt;ActiveSync requests and responses are sent as HTTP messages. In order to reduce the size of the messages, the body is encoded in a format known as WAP Binary XML. The information about Microsoft's implementation of this protocol that is used by ActiveSync is detailed in the &lt;a href="http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx"&gt;MS-ASWBXML&lt;/a&gt;&amp;nbsp;document which is based in the &lt;a href="http://www.w3.org/1999/06/NOTE-wbxml-19990624/"&gt;WAP Binary XML Content Format version 1.2&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;Resources:&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; - MS-ASWBXML&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; - WAP Binary XML Content Format version 1.2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.w3.org/1999/06/NOTE-wbxml-19990624/"&gt;http://www.w3.org/1999/06/NOTE-wbxml-19990624/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; - IANA Character Sets&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.iana.org/assignments/character-sets/character-sets.xml"&gt;http://www.iana.org/assignments/character-sets/character-sets.xml&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Why do you need to know how to do this?&lt;/span&gt;&lt;br /&gt;If you are troubleshooting an application that uses ActiveSync you will probably collect some type of network trace that contains request and/or response messages. However, when you try to look at the message contents it will just appear as a stream of bytes. Unless you have a utility that can interpret these bytes for you, you will need to know how to decode them manually. Once you know how to do this you might decide to write a utility that can do the work for you next time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;How does it work?&lt;/span&gt;&lt;br /&gt;WBXML is NOT an encryption method, it is an encoding method. The XML elements in a message are replaced with single byte tokens. MS-ASWBXML contains a list of these tokens and maps them to an XML element. Simple enough right?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Lets get started!&lt;/span&gt;&lt;br /&gt;The following streams of bytes are a request and response from an ActiveSync mobile device to an Exchange Server.&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Request:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;03 01 6A 00 45 5C 4F 4B 03 30 00 01 52 03 32 00 &lt;br /&gt;01 57 00 11 45 46 03 31 00 01 47 03 33 32 37 36 &lt;br /&gt;38 00 01 01 01 01 01 01&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Response:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;03 01 6A 00 45 5C 4F 4B 03 31 39 39 37 34 33 33 &lt;br /&gt;30 37 34 00 01 52 03 32 00 01 4E 03 31 00 01 01 &lt;br /&gt;01 01&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Each message is divided into 3 parts:&lt;br /&gt;&amp;nbsp;&amp;nbsp; - Header&lt;br /&gt;&amp;nbsp;&amp;nbsp; - String Table&lt;br /&gt;&amp;nbsp;&amp;nbsp; - Token List&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Header&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;The Header consists of the first 3 bytes of the stream and contains the Version Number, the Document Public Identifier, and the Character Set. Lets take a look at these.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;03 01 6A&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first byte represents the Version Number and tells us that the message is encoded using the WBXML 1.3 format. You may have noticed that MS-ASWBXML references the WBXML 1.2 format. However, we will not encounter any issues because the message is encoded with the 1.3 format. The second byte represents the Document Public Identifier. In this case it means that the public identifier is unknown or missing. The last byte specifies the Character Set that is being used. The possible values that you might find here are defined in the &lt;a href="http://www.iana.org/assignments/character-sets/character-sets.xml"&gt;IANA Character Sets&lt;/a&gt; specification. In this case, 6A (106) is UTF-8. The first line of the request might look something like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can find more information about the Version Number, Document Public Identifier, and the Character Set in the &lt;a href="http://www.w3.org/1999/06/NOTE-wbxml-19990624/"&gt;WAP Binary XML Format version 1.2&lt;/a&gt; and &lt;a href="http://www.iana.org/assignments/character-sets/character-sets.xml"&gt;IANA Character Sets&lt;/a&gt; specifications.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;String Table&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;The 4th byte of the message specifies the length of the String Table. In this case, the String Table is 0 bytes in length and no other work is necessary.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Token List&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Following the String Table is the Token List. This is where the real work/fun starts! If you haven't already downloaded the latest version of the &lt;a href="http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx"&gt;MS-ASWBXML&lt;/a&gt;&amp;nbsp;document, now would be a good time. To get the most out of this blog I suggest you follow along in the document. You'll be glad you did if you ever have to do this again on your own.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;45 5C 4F 4B 03 30 00 01 52 03 32 00 01 57 00 11 &lt;br /&gt;45 46 03 31 00 01 47 03 33 32 37 36 38 00 01 01 &lt;br /&gt;01 01 01 01&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For the remainder of the stream it's a simple matter of looking up the token value in MS-ASWBXML and constructing the XML message. Lets take a look at the first token, 0x45. Go look it up in MS-ASWBXML and then come back here to see if you are correct.&lt;br /&gt;&lt;br /&gt;What do you mean you can't find it? Here's a hint, it's in section &lt;a href="http://msdn.microsoft.com/en-us/library/ee218904(EXCHG.80).aspx"&gt;2.1.2.1.1&lt;/a&gt;. Go look again.&lt;br /&gt;&lt;br /&gt;You still can't find it? OK, sorry, that was a trick question. The truth is that it really is in section &lt;a href="http://msdn.microsoft.com/en-us/library/ee218904(EXCHG.80).aspx"&gt;2.1.2.1.1&lt;/a&gt;, but you have to take a closer look at the individual bits in the token first. This is the only real hurdle in understanding WBXML encoding. Once you understand the Tag Format the rest is easy.&lt;br /&gt;&lt;br /&gt;The Tag Format looks like this.&lt;/p&gt;
&lt;div&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Bits&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; 8&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; If set, the element contains attributes&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;lt;element attr="1"&amp;gt;&amp;lt;/element&amp;gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; 7&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; If set, the element contains content&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;lt;element&amp;gt;test&amp;lt;/element&amp;gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; 6-1&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; The tag identity&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note: If you are using Windows 7 or newer, I have found that using the built in Calculator in Programmer mode makes this much easier. You can simply click on the individual bits in the display to toggle them on/off.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The tag 0x45 in binary is 01000101. We can clearly see that the 7th bit is set which means that the element will contain content of some sort. This could be a string or it could be other elements, we don't know yet. If we ignore the 7th bit and just examine the first 6 bits (see my note above about using the Windows Calculator for this) we can see that the actual value is 5. Now, go look at &lt;a href="http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx"&gt;MS-ASWBXML&lt;/a&gt;&amp;nbsp;section &lt;a href="http://msdn.microsoft.com/en-us/library/ee218904(EXCHG.80).aspx"&gt;2.1.2.1.1&lt;/a&gt;&amp;nbsp;and find the element with a token value of 0x05. See, I told you it was there, it's the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync&amp;gt;&lt;/span&gt; element!&lt;br /&gt;&lt;br /&gt;More information about the Tag Format can be found in the &lt;a href="http://www.w3.org/1999/06/NOTE-wbxml-19990624/"&gt;WAP Binary XML Content Format version 1.2&lt;/a&gt; in the section titled Tag Code Space.&lt;br /&gt;&lt;br /&gt;Follow the same process to decode the next 2 tokens 5C and 4F. Each one of these also has the 7th bit set. The actual token values are 1C and 0F. The next 2 elements are &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Collections&amp;gt;&lt;/span&gt; and &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Collection&amp;gt;&lt;/span&gt;. So far, our completed XML looks like this.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync xmlns="AirSync"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Collections&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Collection&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You might be wondering where the &lt;span style="font-family: courier new,courier;"&gt;xmlns="AirSync"&lt;/span&gt; part came from. Every ActiveSync element is defined in a code page, or namespace. In order for the server to be able to interpret the XML, it needs to know what code page the elements belong to. AirSync is the default code page (or namespace) for ActiveSync requests and responses. Unless you see an explicit code page switch (see SWITCH_PAGE below) after the String Table, this namespace definition is implied even though its not encoded into the byte stream. It's not necessary to provide an alias for the namespace. Any elements that are not prefixed with an alias will be assumed to be part of the AirSync namespace.&lt;br /&gt;&lt;br /&gt;Decode the next token in the same fashion. 0x4B is 0x0B when you flip the 7th bit. This is the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;SyncKey&amp;gt;&lt;/span&gt; element.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;4B&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;SyncKey&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The next token is 0x03, which you won't find in any of the code pages. This is because 0x03 is a global token. Global tokens are listed in &lt;a href="http://msdn.microsoft.com/en-us/library/dd299442(EXCHG.80).aspx"&gt;MS-ASWBXML&lt;/a&gt;&amp;nbsp;section &lt;a href="http://msdn.microsoft.com/en-us/library/ee159495(EXCHG.80).aspx"&gt;1.6&lt;/a&gt;&amp;nbsp;and described in more detail in the &lt;a href="http://www.w3.org/1999/06/NOTE-wbxml-19990624/"&gt;WAP Binary XML Content Format version 1.2&lt;/a&gt; specification. The token 0x03 represents an inline string with a terminator (0x00). In this case the string is very short and only consists of a single value, 0x30, followed by the terminator 0x00. The string is encoded using the Character Set specified in the header, which is UTF-8. UTF-8 is very similar to the ANSI character set and in this case you can look up the character value in either. 0x30 is the character '0'.&lt;br /&gt;&lt;br /&gt;The following token, 0x01, is another global token, END. This token is generic in that it represents a closing tag for whatever the currently 'open' tag is, which is the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;SyncKey&amp;gt;&lt;/span&gt; element. So, this 0x01 token represents &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;/SyncKey&amp;gt;&lt;/span&gt;. The following is the entire sequence of bytes for the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;SyncKey&amp;gt;&lt;/span&gt; element. Once you get used to looking at WBXML you'll start to notice small patterns like this.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;4B 03 30 00 01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;SyncKey&amp;gt;0&amp;lt;/SyncKey&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Do you see the next pattern? Bytes 9-13 look like this: 52 03 32 00 01. If you've been following along you might assume that the next chunk of XML is going to look something like this &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;element&amp;gt;string&amp;lt;/element&amp;gt;&lt;/span&gt;, and you would be right. 0x52 is actually 0x12 when you flip the 7th bit, which is the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;CollectionId&amp;gt;&lt;/span&gt; element. We know that 0x03 means the next bytes represent an inline string followed by a terminator. Again, it&amp;rsquo;s only a single character, 0x32, which is the value '2' followed by the terminator 0x00, and the END token, 0x01. These bytes represent the following XML segment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;52 03 32 00 01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;CollectionId&amp;gt;2&amp;lt;/CollectionId&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You now have almost everything you need to decode the rest of the stream with 1 exception so let's keep going. The next token is 0x57, which is 0x17 without the 7th bit set, which is the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Options&amp;gt;&lt;/span&gt; element. The token right after this is 0x00. What does that mean? It's another global token, SWITCH_PAGE. You might have been wondering why all of the tokens we have looked up so far have been in section &lt;a href="http://msdn.microsoft.com/en-us/library/ee218904(EXCHG.80).aspx"&gt;2.1.2.1.1&lt;/a&gt;&amp;nbsp;"Code Page 0: AirSync". This is the default code page. When we encounter the token 0x00 when not in the context of an inline string this tells us that we are switching to a different code page and that any elements that follow this switch should reference that code page. The byte that follows the switch is 0x11. The list of Code Pages can be found in section &lt;a href="http://msdn.microsoft.com/en-us/library/ee219143(EXCHG.80).aspx"&gt;2.1.2.1&lt;/a&gt;. However, remember that the token is a hexidecimal value and the code pages are base 10 integers. This is important because the switch is telling us to look at code page 17, not code page 11.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;00 11&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;SWITCH_PAGE to Code Page 17&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The next token is 0x45, but remember that because of the code page switch that we need to look at code page 17, AirSyncBase, which can be found in section &lt;a href="http://msdn.microsoft.com/en-us/library/ee202595(v=exchg.80).aspx"&gt;2.1.2.1.18&lt;/a&gt;. Flipping the 7th bit gives us 0x05 which is &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;BodyPreference&amp;gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;45&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;airsyncbase:BodyPreference xmlns:airsyncbase="AirSyncBase"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There it is again! I snuck in something that isn't actually in the byte stream. Here again, defining the alias for the xml namespace is implied, but not actually present in the byte stream. It actually doesn't matter if we put it here or after the AirSync namespace in the Sync element, however it MUST exist in one of these two places. Without the &lt;span style="font-family: courier new,courier;"&gt;xmlns:airsyncbase="AirSyncBase"&lt;/span&gt; definition we cannot use the &lt;span style="font-family: courier new,courier;"&gt;airsyncbase:&lt;/span&gt; prefix. We MUST prefix any elements contained in the AirSyncBase namespace with the alias that we provided in the definition. If you don&amp;rsquo;t, the server will look in the default namespace, which in this case is AirSync and it will think the 0x45 token is a &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync&amp;gt;&lt;/span&gt; element and you will get an error.&lt;br /&gt;&lt;br /&gt;The next token 0x46 would be 0x06, &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Type&amp;gt;&lt;/span&gt;, which is then followed by an inline string as indicated by the 0x03 token. The string consists of a single character 0x31, '1' followed by the terminator and 0x01 token indicating the closing tag for the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Type&amp;gt;&lt;/span&gt; element.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;46 03 31 00 01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;airsyncbase:Type&amp;gt;1&amp;lt;/airsyncbase:Type&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The next pattern of bytes is very similar. 0x47, which is 0x07, or &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;TruncationSize&amp;gt;&lt;/span&gt;, followed by 0x03 indicating&amp;nbsp; an inline string, "32768", the string terminator, and the closing element.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;47 03 33 32 37 36 38 00 01&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;airsyncbase:TruncationSize&amp;gt;32768&amp;lt;/airsyncbase:TruncationSize&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here we are at the home stretch and all we see is a few 0x01 tokens. If we examine the complete XML that we have built so far those last 0x01 tokens will make sense.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync xmlns:"AirSync"&amp;gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&amp;lt;Collections&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;Collection&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;SyncKey&amp;gt;0&amp;lt;/SyncKey&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;CollectionID&amp;gt;2&amp;lt;/CollectionID&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;Options&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;airsyncbase:BodyPreference xmlns:airsyncbase="AirSyncBase"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;airsyncbase:Type&amp;gt;1&amp;lt;/airsyncbase:Type&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;airsyncbase:TruncationSize&amp;gt;32768&amp;lt;/airsyncbase:TruncationSize&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;All that is missing is a series of closing elements for BodyPreference, Options, Collection, Collections, and Sync. Notice that there are exactly (5) 0x01 tokens remaining in the stream. That is exactly what those are, closing tags in that order. And you're done! The complete XML request should look like this. I've tried to highlight some key areas so you can associate those with the bytes from the stream.&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Decoded Request&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="background-color: #ffff00;"&gt;03 01 6A&lt;/span&gt; 00 45 5C 4F &lt;span style="background-color: #00ff00;"&gt;4B 03 30 00 01&lt;/span&gt; &lt;span style="background-color: #00ccff;"&gt;52 03 32 00&lt;/span&gt; &lt;br /&gt;&lt;span&gt;01&lt;/span&gt; 57 00 11 45 &lt;span style="background-color: #ffcc00;"&gt;46 03 31 00 01&lt;/span&gt; &lt;span style="background-color: #ff99cc;"&gt;47 03 33 32 37 36&lt;/span&gt; &lt;br /&gt;&lt;span style="background-color: #ff99cc;"&gt;38 00 01&lt;/span&gt; &lt;span style="background-color: #ff0000;"&gt;01 01 01 01 01&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; background-color: #ffff00;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync xmlns:"AirSync"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Collections&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Collection&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&lt;span style="background-color: #00ff00;"&gt;&amp;lt;SyncKey&amp;gt;0&amp;lt;/SyncKey&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="background-color: #00ccff;"&gt;&amp;lt;CollectionID&amp;gt;2&amp;lt;/CollectionID&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;Options&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;airsyncbase:BodyPreference xmlns:airsyncbase="AirSyncBase"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ffcc00;"&gt;&amp;lt;airsyncbase:Type&amp;gt;1&amp;lt;/airsyncbase:Type&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff99cc;"&gt;&amp;lt;airsyncbase:TruncationSize&amp;gt;32768&amp;lt;/airsyncbase:TruncationSize&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff0000;"&gt;&amp;lt;/airsyncbase:BodyPreference&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff0000;"&gt;&amp;lt;/Options&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff0000;"&gt;&amp;lt;/Collection&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: courier new,courier; background-color: #ff0000;"&gt;&amp;lt;/Collections&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; background-color: #ff0000;"&gt;&amp;lt;/Sync&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You should now have enough information to be able to decode the response on your own. Try to decode it on your own. Check what you get against the answer below.&lt;br /&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Decoded Response&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="background-color: #ffff00;"&gt;03 01 6A&lt;/span&gt; 00 45 5C 4F &lt;span style="background-color: #00ff00;"&gt;4B 03 31 39 39 37 34 33 33&lt;/span&gt; &lt;br /&gt;&lt;span style="background-color: #00ff00;"&gt;30 37 34 00 01&lt;/span&gt; &lt;span style="background-color: #00ccff;"&gt;52 03 32 00 01&lt;/span&gt; &lt;span style="background-color: #ffcc00;"&gt;4E 03 31 00 &lt;/span&gt;&lt;span&gt;&lt;span style="background-color: #ffcc00;"&gt;01&lt;/span&gt; &lt;span style="background-color: #ff0000;"&gt;01&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="background-color: #ff0000;"&gt;01 01&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; background-color: #ffff00;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;lt;Sync xmlns:"AirSync"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;Collections&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;Collection&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #00ff00;"&gt;&amp;lt;SyncKey&amp;gt;1997433074&amp;lt;/SyncKey&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #00ccff;"&gt;&amp;lt;CollectionID&amp;gt;2&amp;lt;/CollectionID&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ffcc00;"&gt;&amp;lt;Status&amp;gt;1&amp;lt;/Status&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff0000;"&gt;&amp;lt;/Collection&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background-color: #ff0000;"&gt;&amp;lt;/Collections&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; background-color: #ff0000;"&gt;&amp;lt;/Sync&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10390956" width="1" height="1"&gt;</description></item><item><title>Determining Office Binary File Format Types</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/01/16/determining-office-binary-file-format-types.aspx</link><pubDate>Wed, 16 Jan 2013 16:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10385576</guid><dc:creator>JCurry</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Referenced Documents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd942138.aspx"&gt;MS-CFB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd942421.aspx"&gt;MS-OLEPS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you need to programmatically determine the office file type for a file and cannot rely on the file extension you can use the following method. These files are based on the &lt;a href="http://msdn.microsoft.com/en-us/library/dd942138.aspx"&gt;MS-CFB&lt;/a&gt; specification and you will have to parse the file accordingly. Here is the method that you will need to follow to locate the name of the application that created the file. I am using a .xls file that was created with Microsoft Excel 2010 and saved in the Excel 97-2003 Workbook format for this example. The same method can be used for .doc and .ppt files.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;1. Examine the file header (&lt;a href="http://msdn.microsoft.com/en-us/library/dd941946.aspx"&gt;section 2.2&lt;/a&gt;) and check the values of the &lt;strong&gt;Major Version&lt;/strong&gt; and the &lt;strong&gt;Sector Shift&lt;/strong&gt;. These will most likely be &lt;strong&gt;0x0003&lt;/strong&gt; and &lt;strong&gt;0x0009&lt;/strong&gt; respectively which means that the sector size is &lt;strong&gt;512 bytes&lt;/strong&gt;. If the Major Version is 0x0004 and the Sector Shift is 0x000C the sector size will be 4096 bytes and you will need to adjust your file offset calculations accordingly. I am going to assume that the sector size is 512 bytes for the purposes of this explanation.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;2. At offset &lt;strong&gt;0x30&lt;/strong&gt; you will find the &lt;strong&gt;First Directory Sector Location&lt;/strong&gt;. This value is 4 bytes in length. In my example file the value is &lt;strong&gt;0x0000002B&lt;/strong&gt;. One very important thing to understand is that this is NOT a file offset location, it's an index. In order to locate the First Directory Sector you take that value, add 1 to account for the file header, and multiple that by the sector size (see step 1). This will give you the actual file offset location of the First Directory Sector. For my example file I use the following math to find it. &lt;strong&gt;(0x2B + 0x01) * 0x200 (512 bytes) = 0x5800&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/5270.Untitled-picture1.png" alt="" border="0" /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Figure 1: The CFB Header&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;3. Locate the 512 byte block at the file location from step 2. This will contain one or more &lt;strong&gt;Compound File Directory Entry&lt;/strong&gt; structures (&lt;a href="http://msdn.microsoft.com/en-us/library/dd941946.aspx"&gt;section 2.6.1&lt;/a&gt;), each of which is &lt;strong&gt;128 bytes&lt;/strong&gt; in length. Examine the &lt;strong&gt;Directory Entry Name&lt;/strong&gt; of each entry until you find one that contains 0x0005 + "Summary Information".&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;4. Once you have located the Summary Information entry you need to locate and make note of the &lt;strong&gt;Starting Sector Location&lt;/strong&gt; and &lt;strong&gt;Stream Size&lt;/strong&gt; properties. In my test file these values are &lt;strong&gt;0x0000001A&lt;/strong&gt; and &lt;strong&gt;0x0000000000001000&lt;/strong&gt; respectively. Similar to how you located the First Directory Sector Location (step 2), you need to find the location of the Summary Information sector using the same type of calculation. In my test file it looks like this.&amp;nbsp; &lt;strong&gt;(0x1A + 0x01) * 0x200 (512 bytes) = 0x3600&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/3681.Untitled-picture.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/3681.Untitled-picture.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Figure 2: The First Directory Sector&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;5. Go to the location that was calculated in step 4 and read the number of bytes as specified by the Stream Size. In my case, I am going to file offset 0x3600 and reading 0x1000 (4096) bytes. The contents of that sector are contained in a &lt;strong&gt;PropertySetStream&lt;/strong&gt; as specified in the &lt;a href="http://msdn.microsoft.com/en-us/library/dd942421.aspx"&gt;MS-OLEPS&lt;/a&gt; specification &lt;a href="http://msdn.microsoft.com/en-us/library/dd942207.aspx"&gt;section 2.21&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;6. Locate the &lt;strong&gt;Offset0&lt;/strong&gt; value and jump to that offset in the sector. In my test file, the Offset0 value is &lt;strong&gt;0x30&lt;/strong&gt;. When I add this to the file offset of the current sector I get &lt;strong&gt;0x3630&lt;/strong&gt;. This location contains a &lt;strong&gt;PropertySet&lt;/strong&gt; structure (&lt;a href="http://msdn.microsoft.com/en-us/library/dd942379.aspx"&gt;section 2.20&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;7. Skip over the next 8 bytes and you'll get to the list of &lt;strong&gt;PropertyIdentifierAndOffset&lt;/strong&gt; structures (&lt;a href="http://msdn.microsoft.com/en-us/library/dd942543.aspx"&gt;section 2.19&lt;/a&gt;).&amp;nbsp; Each PropertyIdentifierAndOffset is 8 bytes in length and contains the &lt;strong&gt;PropertyIdentifier&lt;/strong&gt; and &lt;strong&gt;Offset&lt;/strong&gt; value. You want to find the one with a PropertyIdentifier of &lt;strong&gt;0x00000012&lt;/strong&gt; and make note of it's Offset value. In my test file this is &lt;strong&gt;0x00000070&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/span&gt; Property 0x00000012 is the &lt;strong&gt;PIDSI_APPNAME&lt;/strong&gt; identifier, which contains the name of the application that created the file. The complete list of possible SummaryInformation values can be found in section &lt;a href="http://msdn.microsoft.com/en-us/library/dd942545.aspx"&gt;2.25.1&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;8. The Offset value from step 7 must be added to the Offset0 value from step 6 to correctly locate the Property. In my case, the property will be located at &lt;strong&gt;0x3630 + 0x70 = 0x36A0&lt;/strong&gt;. The contents at that location are stored in a &lt;strong&gt;TypedPropertyValue&lt;/strong&gt; structure (&lt;a href="http://msdn.microsoft.com/en-us/library/dd942532.aspx"&gt;section 2.15&lt;/a&gt;). The &lt;strong&gt;Type&lt;/strong&gt; should be &lt;strong&gt;0x001E&lt;/strong&gt; which indicates that the Value will be stored as a &lt;strong&gt;CodePageString&lt;/strong&gt;. You can ignore the Padding bytes.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;9. The &lt;strong&gt;Value&lt;/strong&gt; is stored as a &lt;strong&gt;CodePageString&lt;/strong&gt; (&lt;a href="http://msdn.microsoft.com/en-us/library/dd942354.aspx"&gt;section 2.5&lt;/a&gt;). The first 4 bytes indicate the length of the string, followed by the actual string. In my example file the &lt;strong&gt;Size&lt;/strong&gt; is &lt;strong&gt;0x10&lt;/strong&gt; (16 bytes) and the &lt;strong&gt;Characters&lt;/strong&gt; value is &lt;strong&gt;"Microsoft Excel" + 0x00&lt;/strong&gt;. The 0x00 at the end is the standard string terminator.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/span&gt; For .doc files the Size should be &lt;strong&gt;0x18&lt;/strong&gt; (24 bytes) and the Characters value should be &lt;strong&gt;"Microsoft Office Word"+ 0x00&lt;/strong&gt; plus 2 extra bytes of padding. For .ppt files the Size should be &lt;strong&gt;0x1C&lt;/strong&gt; (28 bytes) and the Characters value should be &lt;strong&gt;"Microsoft Office PowerPoint" + 0x00&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/0456.Untitled-picture.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/0456.Untitled-picture.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Figure 3: The Summary Information Sector&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10385576" width="1" height="1"&gt;</description></item><item><title>Unencrypted MS-EVEN6 Traffic</title><link>http://blogs.msdn.com/b/openspecification/archive/2013/01/14/unencrypted-ms-even6-traffic.aspx</link><pubDate>Mon, 14 Jan 2013 04:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10384628</guid><dc:creator>Tarun Chopra - MSFT</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;strong&gt;This blog entry is intended for readers interested in generating unencrypted MS-EVEN6 (&lt;/strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc231282(v=PROT.13).aspx"&gt;&lt;strong&gt;http://msdn.microsoft.com/en-us/library/cc231282(v=PROT.13).aspx&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; ) protocol traffic. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE: Questions and comments are welcome. However, please DO NOT post a comment using the comment tool at the end of this post. Instead, post a new thread in the Open Specifications Forum: Windows Protocols at &lt;/strong&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols"&gt;&lt;strong&gt;http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Can windows inbox tools be configured to generate unencrypted traffic?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;No, Windows inbox tools eventviewer and wevtutil generates encrypted MS-EVEN6 traffic and there is NO registry setting to alter this behavior. These tools invokes RPC bind with authentication-level set to RPC_C_AUTHN_LEVEL_PKT_PRIVACY which ensures encrypting the argument value of each remote procedure call. Refer below screenshot highlighting authentication-level field.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/0741.First.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/0741.First.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;strong&gt;What does MS-EVEN6 specification say about authentication-level?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;MS-EVEN6 specification, &lt;a href="http://msdn.microsoft.com/en-us/library/cc231303(v=prot.13)"&gt;http://msdn.microsoft.com/en-us/library/cc231303(v=prot.13)&lt;/a&gt;, does not impose any such constraint on authentication-level and we confirmed that windows server does accept RPC bind with authentication-level set to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY. Benefit of using RPC_C_AUTHN_LEVEL_PKT_INTEGRITY authentication-level over RPC_C_AUTHN_LEVEL_PKT_PRIVACY --- MS-EVEN6 traffic will be unencrypted.&lt;/p&gt;
&lt;p&gt;This is a&amp;nbsp;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;good news&lt;/strong&gt;&lt;/span&gt; for the implementers interested in analyzing unencrypted EVEN6 packet. But it requires some work as we have to write a custom client with authentication-level set to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY during RPC bind and then use that binding handle to invoke EVEN6 methods&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A feasible option to generate unencrypted MS-EVEN6 traffic&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I recently wrote a sample application in C++ to generate unencrypted protocol traffic and detail steps are as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;1. Install visual studio 2008/2010 Ultimate/professional on a development machine.&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;2. Copy and paste the IDL given in EVEN6 [MS_EVEN6] specification to a notepad and save file as even6.idl&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;3. Since it&amp;rsquo;s an RPC based protocol, copy and paste IDL given in MS-RPCE specification to notepad and save file as ms-rpce.idl&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;4. Place both the above files in same folder and use MIDL compiler to generate stub and header files. For this, go to start, type &amp;ldquo;visual studio&amp;rdquo;, launch &amp;ldquo;Visual Studio Command Prompt&amp;rdquo; and issue below command:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;midl even6.idl&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;5. Step 4 will generate even6.h, ms-rpce.h, even6_c.c which you need to include in your project. Choose VC++, Win32 console application as project type.&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;6. In the file that has &amp;ldquo;_tmain&amp;rdquo; function, include header files and create binding handle (IfHandle) that has to be passed to EVEN6 methods. Following snippet shows how to create a binding handle:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;int bindStatus, bStatStringBnd;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;RPC_BINDING_HANDLE IfHandle = NULL;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;RPC_WSTR&amp;nbsp;pszStringBinding;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;TCHAR&amp;nbsp;*pszEven6UUID = TEXT("F6BEAFF7-1E19-4FBB-9F8F-B89E2018337C");&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;TCHAR&amp;nbsp;*pszEndpoint&amp;nbsp; = TEXT("");&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;TCHAR&amp;nbsp;*protoSeq = TEXT("ncacn_ip_tcp");&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;wchar_t&amp;nbsp;exceptionString[512];&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;ULONG_PTR&amp;nbsp;lpArguments = (ULONG_PTR)exceptionString;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;pszStringBinding = (RPC_WSTR)MIDL_user_allocate(512);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;bindStatus = RpcStringBindingCompose( (RPC_WSTR)pszEven6UUID, (RPC_WSTR)protoSeq, (RPC_WSTR)pszServer, NULL, NULL, (RPC_WSTR*)&amp;amp;pszStringBinding);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;if (RPC_S_OK == bindStatus){ printf ("The call succeeded. RpcStringBindingCompose\n");&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;if (RPC_S_INVALID_STRING_UUID == bindStatus) {&amp;nbsp; sprintf((char *)exceptionString, "The string representation of the UUID: , %s , is not valid.\n", pszEven6UUID);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;RaiseException( bindStatus, 0, 1, &amp;amp;lpArguments );&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;bStatStringBnd = RpcBindingFromStringBinding( (RPC_WSTR)pszStringBinding, &amp;amp;IfHandle);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;bStatStringBnd = RpcBindingSetAuthInfo( IfHandle, (RPC_WSTR)pszServer, RPC_C_AUTHN_LEVEL_PKT_INTEGRITY, RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;7. Pass this IfHandle to various EVEN6 calls, I tested EvtRpcOpenLogHandle, and you should be able to generate unencrypted traffic.&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;If (RPC_S_OK == bStatStringBnd) {&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;hEven6Binding = IfHandle;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;RpcInfo error2;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;error_status_t error = EvtRpcOpenLogHandle(L"Application", 1, (PCONTEXT_HANDLE_LOG_HANDLE*)&amp;amp;hEven6Binding, &amp;amp;error2);&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;Bind Request Packet with authentication-level as RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/3513.Second.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/3513.Second.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;Bind Response Packet with authentication-level as RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/1030.Third.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/1030.Third.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;Unencrypted EvtRpcOpenLogHandle request packet:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7271.Fourth.jpg"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/7271.Fourth.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;Unencrypted EvtRpcOpenLogHandle response packet:&lt;/p&gt;
&lt;p style="padding-left: 90px;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/5635.Fifth.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-22-05/5635.Fifth.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;Open Specifications Support Team Blog: &lt;a href="http://blogs.msdn.com/b/openspecification/"&gt;http://blogs.msdn.com/b/openspecification/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Open Specifications Forums: &lt;a href="http://blogs.msdn.com/b/openspecification/"&gt;http://blogs.msdn.com/b/openspecification/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Open Specifications Forum/Windows Protocols: &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols/threads"&gt;http://social.msdn.microsoft.com/Forums/en-US/os_windowsprotocols/threads&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Network Monitor Blog: &lt;a href="http://blogs.technet.com/b/netmon/"&gt;http://blogs.technet.com/b/netmon/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10384628" width="1" height="1"&gt;</description></item><item><title>Encryption in SMB 3.0: A protocol perspective</title><link>http://blogs.msdn.com/b/openspecification/archive/2012/10/05/encryption-in-smb-3-0-a-protocol-perspective.aspx</link><pubDate>Fri, 05 Oct 2012 20:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10356796</guid><dc:creator>Edgar A Olougouna</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;Encryption is one of the new SMB 3.0 security enhancements in Windows Server 2012 RTM. It can be enabled on a per-share basis, or enforced for all shares on the server. SMB 3.0 uses AES-CCM [RFC5084]&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;as encryption algorithm, and this also provides data integrity (signing). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;This blog takes a protocol walk on the topic through [MS-SMB2], and provides a sample test vector. [MS-SMB2] describes SMB 2.x and SMB 3.0 dialects. Throughout this blog, I use the terms SMB2 and SMB3 interchangeably because both share the core SMB2 Packet format. Details on encryption configuration aspects can be found in the blogs listed in references.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Capability activation &lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;The client and server advertise encryption support via the SMB2_GLOBAL_CAP_ENCRYPTION capability flag during SMB 3.0 dialect negotiation. Then at least one of the following two options must be happen: &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;For enabling encryption for a whole session, SessionFlags of SessionSetup response includes SMB2_SESSION_FLAG_ENCRYPT_DATA. This is the case where encryption is enforced on the whole server.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;For a per-share enabled encryption, ShareFlags of TreeConnect response includes SMB2_SHAREFLAG_ENCRYPT_DATA.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;When encryption is active for a given exchange, it is applied before submission to the transport. An exchange could consist of a single request or response, or a series of compounded chain operations. The sender performs encryption as an outer layer after the SMB2 messages in a given submission have been assembled. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Cryptographic keys&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Ko = SMB3KDF (Ki, Label, Context)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;SMB3KDF() is defined as the KDF algorithm in Counter Mode, as specified in [SP800-108] section 5.1, with 'r' value of 32 and 'L' value of 128, and HMAC-SHA256 as the PRF.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Ki &amp;ndash; Key derivation key, used as an input to the KDF. For SMB 3.0, Ki is the SessionKey.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Label &amp;ndash; the purpose of this derived key, encoded as string and length for SMB 3.0.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Context &amp;ndash; the context information of this derived key, encoded as string and length for SMB 3.0.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;L &amp;ndash; An integer that specifies the length of the derived keying material Ko, L is 128 bits for SMB 3.0 cryptographic keys. Note that L is a constant since all SMB 3.0 keys are 16 bytes in length (SigningKey, EncryptionKey, DecryptionKey, and ApplicationKey).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Ko &amp;ndash; Keying material output from the KDF, a binary string of length L, where Ko is the leftmost L bits of KDF result.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;ServerInKey&amp;nbsp; (ClientToServer) =&amp;nbsp; SMB3KDF (SessionKey, "SMB2AESCCM\0", "ServerIn \0")&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;EncryptionKey (Client) = DecryptionKey (Server) = ServerInKey (ClientToServer) &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;ServerOutKey (ServerToClient) = SMB3KDF ( SessionKey, "SMB2AESCCM\0", "ServerOut\0")&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;EncryptionKey (Server) = DecryptionKey (Client) = ServerOutKey (ServerToClient)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri" size="3"&gt;&lt;span style="line-height: 115%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The server and client generate the encryption keys upon session establishment of the primary channel. If the server is configured for encryption (i.e. SmbServerConfiguration.EncryptData) and the Connection.ClientCapabilities includes the SMB2_GLOBAL_CAP_ENCRYPTION, the server generates the EncryptionKey and DecryptionKey and sets SMB2_SESSION_FLAG_ENCRYPT_DATA flag in the SessionFlags field of the SessionSetup response; the client must also generate its encryption and decryption keys.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Upon successful TreeConnect, if Session.EncryptData is FALSE and Share.EncryptData (e.g. the share is configured to require encryption), the server generates its EncryptionKey and DecryptionKey and sets the SMB2_SHAREFLAG_ENCRYPT_DATA bit in the ShareFlags field of the TreeConnect response; the client must also generate its encryption and decryption keys.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Note: These cryptographic keys are all derived from the SessionKey. As a result, SMB 3.0 signing and encryption is as secure as the session key. Not only must this key be unique and very random, but also it needs be kept secret. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Transformed message&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;A transformed message consists of a transform_header followed by its encrypted SMB2 message.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The transform_header has the following fields:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;ProtocolId (4 bytes):&amp;nbsp; 0xFD, 'S', 'M', and 'B' (in network order).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Signature (16 bytes):&amp;nbsp; Signature of the encrypted message.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Nonce (16 bytes):&amp;nbsp; An implementation-specific value that is unique for every encrypted message within a session. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;OriginalMessageSize (4 bytes):&amp;nbsp; The size in bytes of the SMB2 message.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Reserved (2 bytes):&amp;nbsp; Set to zeros and ignored. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;EncryptionAlgorithm (2 bytes):&amp;nbsp; the value 0x0001 is for SMB2_ENCRYPTION_AES128_CCM.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;SessionId (8 bytes):&amp;nbsp; Uniquely identifies the established session for the command.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;With the SMB2_ENCRYPTION_AES128_CCM algorithm, SMB 3.0 encryption implementation uses the leftmost 11 bytes of the Nonce field in the transform_header, let&amp;rsquo;s call this Aes128Nonce. Per [RFC3610], the nonce passed to AES-CCM can be between 7 and 13 bytes. Windows SMB 3.0 made the trade-off choice of 11 bytes. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Note that it would almost be impossible that all possible nonce values can be consumed on a channel, because it would take over several centuries before a sender could recycle a nonce on a given channel.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Encrypting the message&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;The sender builds the transformed message with these specifics. AES-CCM &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=229742"&gt;&lt;span style="font-family: Verdana; font-size: small;" face="Verdana" size="3"&gt;[RFC5084]&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt; is called with the following inputs:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;AES key: Session.EncryptionKey.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Aes-nonce: Aes128Nonce must be used.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Plaintext: The SMB2 message including the header and the payload.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The optional authenticated data (AAD):&amp;nbsp; The SMB2 transform_header excluding the ProtocolId and Signature fields; these are the 32 bytes starting from the Nonce field. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The AES-CCM outputs are: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Ciphertext: the encrypted SMB2 message&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Message authentication code: the Signature field of the transform_header.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The sender appends the encrypted SMB2 message to the transform_header and sends it to the receiver.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Decrypting the message&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The message is decrypted using: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The EncryptionAlgorithm in the transform_header.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The Session.DecryptionKey of the Session that corresponds to the SessionId in the transform_header.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The AAD passed to AES-CCM is the transform_header excluding the ProtocolId and Signature fields.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;-&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The nonce passed to AES-CCM is the Aes128Nonce; that is the first 11 bytes of the Nonce field.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The signature returned by the decryption algorithm is then verified against the Signature in the transform_header.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Encryption clauses&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The sender encrypts the message if any of the following conditions is satisfied:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the sender is sending a response to an encrypted request.&lt;/li&gt;
&lt;li&gt;If Session.EncryptData is TRUE and the request or response being sent is not NEGOTIATE.&lt;/li&gt;
&lt;li&gt;If Session.EncryptData is FALSE, the request or response being sent is not NEGOTIATE or SESSION_SETUP or TREE_CONNECT, and &amp;lt;TreeConnect|Share&amp;gt;.EncryptData is TRUE.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="BulletedList1"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="BulletedList1"&gt;Note: TreeConnect.EncryptData is on the client side. Share.EncryptData is on the server side.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Review of encryption clauses&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;All clauses exclude any operation which does use a SessionId. A SessionId is needed to find the Session object and derive the encryption and decryption keys from its session key. For example, if the client sends a non-encrypted ECHO, Windows 8 server will respond with a non-encrypted response. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;Clause &amp;ldquo;response to an encrypted request&amp;rdquo;: if the sender encrypts the request, the receiver will respond in the same way by encrypting the response. There is however a prerequisite that encryption is active, i.e. encryption keys have been generated. For example, if the client encrypts an ECHO, Windows 8 server responds in-kind by encrypting the response.&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;Clause "Session.EncryptData is TRUE": This excludes encryption of the initial SESSION_SETUP. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;This means SESSION_SETUP for re-authentication or session binding will be encrypted. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Clause &amp;ldquo;Session.EncryptData is FALSE&amp;nbsp; and &amp;lt;TreeConnect|Share&amp;gt;.EncryptData is TRUE&amp;rdquo;: &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;If the client performs TREE_DISCONNECT before a LOGOFF, the logoff will not be encrypted. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Compounded messages&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;It is expected that all operations in an encrypted message belong to the SessionId in the transform_header. The encrypted message is sent as a single submission to the underlying transport, there is no provision for a next transformed message in the transform_header.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Related compounded messages&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;In case of related compounded requests, all the requests/responses belong to the same SessionId. The sender indicates to the receiver that it is using the SessionId, TreeId, and FileId of the previous operation or resulted from the receiver processing that previous operation.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Unrelated compounded messages&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;From a broader scope, the expected protocol behaviors for sending an encrypted message can be summarized as follows, be it for compounded requests/responses or not.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The sender should not send an encrypted request separately or as part of a compounded chain (related or unrelated) that contains a SessionId different from the session used for encryption. In other words, the sender should not use a SessionId to convoy the encrypted traffic of other authenticated sessions.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The receiver should not send an encrypted response separately or as part of a compounded chain (related or unrelated) that contains a SessionId different from the session used for encryption.&amp;nbsp;&amp;nbsp; Windows-based servers will respond in-kind to what the client sends. If the client violates the above statement regarding the SessionId, a Windows 8-based server will currently send the response as such.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Oplock and Lease Breaks&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Oplock break notifications/acknowledgments/responses must be encrypted when encryption is active. For an Oplock, the FileID is used to derive the SessionId which is set in the notification/acknowledgement/response. See more details in MS-SMB2. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Lease break notifications - sent by the server - do not have a SessionId, and as a result, are neither signed nor encrypted.&amp;nbsp; Lease keys are not tied to a particular session from the client.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;However, Lease break acknowledgements sent by the client - and their responses sent by the server - must be encrypted when encryption is active. The client is responsible for selecting a session associated with one of the existing opens associated with that Lease Key. The response is sent on the session that receives the acknowledgment. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-size: medium;" size="4"&gt;&lt;span style="color: #4f81bd;" color="#4f81bd"&gt;Test vector&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;This sample data should be considered &amp;ldquo;as-is&amp;rdquo;. It should also be noted that examples do not replace normative protocol specifications. The reference must be [MS-SMB2]. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The test program running on a Windows 8 client negotiates SMB3 and communicates with a Windows 2012 server. It opens a file and WRITEs the following content. It then READs back the file. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;This is the content written and read:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Smb3 encryption testing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Hex value:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;536D623320656E6372797074696F6E2074657374696E67&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;These outputs show the encryption and decryption of the WRITE and READ commands.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;The decrypted content is verified to be same at the end of the SMB2 READ response.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;SessionId 0x8e40014000011&lt;br /&gt;SessionKey 0xB4546771B515F766A86735532DD6C4F0&lt;br /&gt;SigningKey 0xF773CD23C18FD1E08EE510CADA7CF852&lt;br /&gt;EncryptionKey (Client) 0x261B72350558F2E9DCF613070383EDBF&lt;br /&gt;DecryptionKey (Client) 0x8FE2B57EC34D2DB5B1A9727F526BBDB5&lt;br /&gt;ApplicationKey 0x77432F808CE99156B5BC6A3676D730D1&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Header.Command 0x0009 WRITE&lt;br /&gt;Encryption of the request ---&lt;br /&gt;Key 0x261B72350558F2E9DCF613070383EDBF&lt;br /&gt;AES-128-CCM nonce 0x66E69A111892584FB5ED52&lt;br /&gt;AAD &lt;br /&gt;0x&lt;br /&gt;66E69A111892584FB5ED524A744DA3EE87000000000001001100001400E40800&lt;br /&gt;SMB2 packet &lt;br /&gt;0x&lt;br /&gt;FE534D4240000100000000000900400008000000000000000400000000000000&lt;br /&gt;FFFE0000010000001100001400E4080000000000000000000000000000000000&lt;br /&gt;3100700017000000000000000000000015010000390000020100000039020000&lt;br /&gt;00000000000000007000000000000000536D623320656E6372797074696F6E20&lt;br /&gt;74657374696E67&lt;br /&gt;transform_header.Signature 0x81A286535415445DAE393921E44FA42E&lt;br /&gt;transform_header.Nonce 0x66E69A111892584FB5ED524A744DA3EE&lt;br /&gt;transform_header.OriginalMessageSize 0x87 &lt;br /&gt;transform_header.SessionId 0x8e40014000011 &lt;br /&gt;Encrypted message &lt;br /&gt;0x&lt;br /&gt;25C8FEE16605A437832D1CD52DA9F4645333482A175FE5384563F45FCDAFAEF3&lt;br /&gt;8BC62BA4D5C62897996625A44C29BE5658DE2E6117585779E7B59FFD971278D0&lt;br /&gt;8580D7FA899E410E910EABF5AA1DB43050B33B49182637759AC15D84BFCDF5B6&lt;br /&gt;B238993C0F4CF4D6012023F6C627297075D84B7803912D0A9639634453595EF3&lt;br /&gt;E33FFE4E7AC2AB&lt;br /&gt;Transformed message &lt;br /&gt;0x&lt;br /&gt;FD534D4281A286535415445DAE393921E44FA42E66E69A111892584FB5ED524A&lt;br /&gt;744DA3EE87000000000001001100001400E4080025C8FEE16605A437832D1CD5&lt;br /&gt;2DA9F4645333482A175FE5384563F45FCDAFAEF38BC62BA4D5C62897996625A4&lt;br /&gt;4C29BE5658DE2E6117585779E7B59FFD971278D08580D7FA899E410E910EABF5&lt;br /&gt;AA1DB43050B33B49182637759AC15D84BFCDF5B6B238993C0F4CF4D6012023F6&lt;br /&gt;C627297075D84B7803912D0A9639634453595EF3E33FFE4E7AC2AB&lt;br /&gt;Decryption of the response ---&lt;br /&gt;Key 0x8FE2B57EC34D2DB5B1A9727F526BBDB5&lt;br /&gt;Transformed message &lt;br /&gt;0x&lt;br /&gt;FD534D42A6015530A18F6D9AFFE22AFAE8E66484860000000000000011000014&lt;br /&gt;00E4080050000000000001001100001400E40800DBF46435C5F14169293CE079&lt;br /&gt;E344479BF670227E49873F458672C3098DAC467DD5809F369D67409166515787&lt;br /&gt;1483E01F7BECD02064EAC3E235F913668BBC2F097980D4B378F1993EFF6E60D1&lt;br /&gt;77309E5B&lt;br /&gt;transform_header.Signature 0xA6015530A18F6D9AFFE22AFAE8E66484&lt;br /&gt;transform_header.Nonce 0x86000000000000001100001400E40800&lt;br /&gt;transform_header.OriginalMessageSize 0x50 &lt;br /&gt;transform_header.SessionId 0x8e40014000011 &lt;br /&gt;AES-128-CCM nonce 0x8600000000000000110000 &lt;br /&gt;AAD &lt;br /&gt;0x&lt;br /&gt;86000000000000001100001400E4080050000000000001001100001400E40800&lt;br /&gt;Decrypted SMB2 packet &lt;br /&gt;0x&lt;br /&gt;FE534D4240000100000000000900210009000000000000000400000000000000&lt;br /&gt;FFFE0000010000001100001400E4080000000000000000000000000000000000&lt;br /&gt;11000000170000000000000000000000&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Header.Command 0x0008 READ&lt;br /&gt;Encryption of the request ---&lt;br /&gt;Key 0x261B72350558F2E9DCF613070383EDBF&lt;br /&gt;AES-128-CCM nonce 0xA5123A25F983E245983F41&lt;br /&gt;AAD &lt;br /&gt;0x&lt;br /&gt;A5123A25F983E245983F413B8B429AF271000000000001001100001400E40800&lt;br /&gt;SMB2 packet &lt;br /&gt;0x&lt;br /&gt;FE534D4240000100000000000800400008000000000000000500000000000000&lt;br /&gt;FFFE0000010000001100001400E4080000000000000000000000000000000000&lt;br /&gt;3100000017000000000000000000000015010000390000020100000039020000&lt;br /&gt;0000000000000000000000000000000000&lt;br /&gt;transform_header.Signature 0xE93601498B76D6F7A72D5EF9B6C79FAF&lt;br /&gt;transform_header.Nonce 0xA5123A25F983E245983F413B8B429AF2&lt;br /&gt;transform_header.OriginalMessageSize 0x71 &lt;br /&gt;transform_header.SessionId 0x8e40014000011 &lt;br /&gt;Encrypted message &lt;br /&gt;0x&lt;br /&gt;9A464F709AA663F8C2FC3907D63CBF6F98B1E3DD649ED366009FD0B40A365224&lt;br /&gt;718E5440E053F6E01AE462FDB721BF91C3A6E52E14F9EFF005F445761289FF12&lt;br /&gt;72908B52754C8FCB949F228AC104A66204289A205BCBC47509D04AF9A907002B&lt;br /&gt;96863358B3B7CBA5E377930074FCDF3550&lt;br /&gt;Transformed message &lt;br /&gt;0x&lt;br /&gt;FD534D42E93601498B76D6F7A72D5EF9B6C79FAFA5123A25F983E245983F413B&lt;br /&gt;8B429AF271000000000001001100001400E408009A464F709AA663F8C2FC3907&lt;br /&gt;D63CBF6F98B1E3DD649ED366009FD0B40A365224718E5440E053F6E01AE462FD&lt;br /&gt;B721BF91C3A6E52E14F9EFF005F445761289FF1272908B52754C8FCB949F228A&lt;br /&gt;C104A66204289A205BCBC47509D04AF9A907002B96863358B3B7CBA5E3779300&lt;br /&gt;74FCDF3550&lt;br /&gt;Decryption of the response ---&lt;br /&gt;Key 0x8FE2B57EC34D2DB5B1A9727F526BBDB5&lt;br /&gt;Transformed message &lt;br /&gt;0x&lt;br /&gt;FD534D42ABD518B68C2F04D7879F482B689EB83F870000000000000011000014&lt;br /&gt;00E4080067000000000001001100001400E40800493D6FE2BDBEB435CF5F5469&lt;br /&gt;70C7BB57BF20E713C75A3D045507E0D68E5C0346659D6FFB8AC1504A786CA2BB&lt;br /&gt;89C9E7FE4F313E910A04180D2D0EA7DF636329E5A3285984500EF86FE9D55DA4&lt;br /&gt;FAB9531CFDD4C551D47F3C73124BB4590A45052B694048B991CCF5&lt;br /&gt;transform_header.Signature 0xABD518B68C2F04D7879F482B689EB83F&lt;br /&gt;transform_header.Nonce 0x87000000000000001100001400E40800&lt;br /&gt;transform_header.OriginalMessageSize 0x67 &lt;br /&gt;transform_header.SessionId 0x8e40014000011 &lt;br /&gt;AES-128-CCM nonce&amp;nbsp; 0x8700000000000000110000&lt;br /&gt;AAD &lt;br /&gt;0x&lt;br /&gt;87000000000000001100001400E4080067000000000001001100001400E40800 &lt;br /&gt;Decrypted SMB2 packet &lt;br /&gt;0x&lt;br /&gt;FE534D4240000100000000000800210009000000000000000500000000000000&lt;br /&gt;FFFE0000010000001100001400E4080000000000000000000000000000000000&lt;br /&gt;11005000170000000000000000000000536D623320656E6372797074696F6E20&lt;br /&gt;74657374696E67&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;References:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;[MS-SMB2]: Server Message Block (SMB) Protocol Versions 2 and 3 Specification&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;[SP800-108] National Institute of Standards and Technology. "Special Publication 800-108, Recommendation for Key Derivation Using Pseudorandom Functions", October 2009, &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=186039"&gt;&lt;span style="font-family: Verdana;" face="Verdana"&gt;http://csrc.nist.gov/publications/nistpubs/800-108/sp800-108.pdf&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[RFC5084] Housley, R., "Using AES-CCM and AES-GCM Authenticated Encryption in the Cryptographic Message Syntax (CMS)", RFC 5084, November 2007, &lt;a href="http://go.microsoft.com/fwlink/?LinkId=229742"&gt;http://www.ietf.org/rfc/rfc5084.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;SMB 3 Security Enhancements in Windows Server 2012&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/b/filecab/archive/2012/05/03/smb-3-security-enhancements-in-windows-server-2012.aspx"&gt;&lt;span style="font-family: Verdana;" face="Verdana"&gt;http://blogs.technet.com/b/filecab/archive/2012/05/03/smb-3-security-enhancements-in-windows-server-2012.aspx&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Encryption in SMB3&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/openspecification/archive/2012/06/08/encryption-in-smb3.aspx"&gt;&lt;span style="font-family: Verdana;" face="Verdana"&gt;http://blogs.msdn.com/b/openspecification/archive/2012/06/08/encryption-in-smb3.aspx&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10356796" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/Windows+Protocol+Specification+Posts/">Windows Protocol Specification Posts</category><category domain="http://blogs.msdn.com/b/openspecification/archive/tags/File+Sharing/">File Sharing</category></item></channel></rss>