<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Saving the world, one bug at a time</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/asklar/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/asklar/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:18:56 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Switch between registry hives in Windows 10</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/switch-between-registry-hives-in-windows-10</link>
      <pubDate>Wed, 20 May 2015 04:41:27 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2015/05/20/switch-between-registry-hives-in-windows-10/</guid>
      <description><![CDATA[When working on a product like Windows, it’s hard please everybody – a feature that will be well...]]></description>
      <content:encoded><![CDATA[<p>When working on a product like Windows, it’s hard please everybody – a feature that will be well received by a certain consumer segment might be completely lost on or ignored by enterprises, etc. and the reality is that Microsoft despite being the software behemoth that it is, we end up having to make choices about what to invest on, that’s just the name of the game.</p>  <p>I’m pleased to say that it looks like one of the features I worked on in the past few months was recently “unearthed” by <a href="http://www.neowin.net/news/windows-10-registry-editor-update-makes-it-a-breeze-to-switch-between-hives" target="_blank">Neowin</a>. People (and by that I mean power users, enthusiasts, IT admins, and…me) spend too much time trying to navigate around in regedit, jumping around hives. Was that key in HKEY_LOCAL_MACHINE? oh, no, it was in HKEY_CURRENT_USER. Dang it.</p>  <p>So I went and implemented this little nugget that lets you just toggle between these two. Not a huge deal, but it’s definitely nice to hear others might find it useful as well!</p>  <p><img src="https://www.neowin.net/images/uploaded/2015/04/snag-000.jpg" /></p>  <p>Image from NeoWin. I figured since they’re using my feature, I’ll give them a nod and use their screenshot <img class="wlEmoticon wlEmoticon-smile" style="style" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/1205.wlEmoticon-smile_6308DC90.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/1205.wlEmoticon_2D00_smile_5F00_6308DC90.png" />.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 10 and File Explorer</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/windows-10-and-file-explorer</link>
      <pubDate>Thu, 13 Nov 2014 06:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2014/11/13/windows-10-and-file-explorer/</guid>
      <description><![CDATA[It&rsquo;s been a while since I posted anything so I figured I&rsquo;d give you all, my good-looking...]]></description>
      <content:encoded><![CDATA[<p>It&rsquo;s been a while since I posted anything so I figured I&rsquo;d give you all, my good-looking audience, an update. My team and I have been pretty busy with File Explorer in Windows 10, and we are very excited about where we are headed and I personally am thrilled with the fact that we get a lot of really passionate users&rsquo; feedback. It&rsquo;s a great feeling when you work on a feature that millions of people use and feel this passionately about!</p>
<p>Some of our features have been started to get picked up by various tech blogs, including our own Windows 10 blog. One of the features I wrote myself was the new Share integration from File Explorer. This lets you share files through any Store app that participates in the so called &ldquo;sharing contract&rdquo;.</p>
<p><a title="http://blogs.windows.com/bloggingwindows/2014/10/13/share-from-file-explorer-in-the-windows-10-technical-preview/" href="http://blogs.windows.com/bloggingwindows/2014/10/13/share-from-file-explorer-in-the-windows-10-technical-preview/">http://blogs.windows.com/bloggingwindows/2014/10/13/share-from-file-explorer-in-the-windows-10-technical-preview/</a></p>
<p><img src="http://az648995.vo.msecnd.net/win/2014/10/share.png" alt="share" /></p>
<p>&nbsp;</p>
<p>One of the other features my team has been hard at work on is the new landing page for File Explorer, called &ldquo;Home&rdquo; in the Technical Preview. This is a new node in File Explorer where we show you your most recently used files, and your most frequently used folders. Pretty nifty!</p>
<p>There are many more features and exciting changes coming! What is your favorite feature so far and what are you most looking forward to?</p>]]></content:encoded>
    </item>
    <item>
      <title>Your app will crash if you try to invoke the setdesktopwallpaper verb</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/your-app-will-crash-if-you-try-to-invoke-the-setdesktopwallpaper-verb</link>
      <pubDate>Sat, 29 Mar 2014 15:12:50 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2014/03/29/your-app-will-crash-if-you-try-to-invoke-the-setdesktopwallpaper-verb/</guid>
      <description><![CDATA[I was building a little app that would take a jpeg file and set it as the user’s wallpaper. I could...]]></description>
      <content:encoded><![CDATA[<p>I was building a little app that would take a jpeg file and set it as the user’s wallpaper. I could use the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx" target="_blank">SystemParametersInfo</a> API but I wanted something a bit more flexible (e.g. SPI only supports BMP images). So I set out to do what most people have already tried (and failed) and attempted to use the undocumented verb “setdesktopwallpaper”. And then my app crashes.</p>  <p>Looking at what was going on, something was definitely weird. At the point of the crash, my instruction pointer was pointing to garbage. It turns out there is a bug in the class that handles this verb. When that class receives the request to execute your “set desktop background” request, it will dispatch a new thread that will do that in the background. The main thread doesn’t wait for the background thread to complete, and happily continues execution. The worker thread starts executing. At some point, the main thread calls Release() on the last object that lives in the DLL that implements the handler, and that Release causes DllRelease to be called. Once the count of references to this dll gets to zero, we will unload that DLL. That’s how we get our instruction pointer to point at garbage.</p>  <p>This is usually not a problem when you’re setting the desktop wallpaper through explorer because that dll is always loaded in explorer for other reasons so it’s not at risk of getting unloaded prematurely.</p>  <p>So the workaround in the meantime is to LoadLibrary() stobject.dll which is the guy that implements this functionality.</p>]]></content:encoded>
    </item>
    <item>
      <title>Adventures in reinterpret_cast</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/adventures-in-reinterpret_cast</link>
      <pubDate>Tue, 28 Jan 2014 00:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2014/01/28/adventures-in-reinterpret_cast/</guid>
      <description><![CDATA[It&rsquo;s like dialing the wrong number and then going on as if you&rsquo;re talking to the person...]]></description>
      <content:encoded><![CDATA[<h3><em>It&rsquo;s like dialing the wrong number and then going on as if you&rsquo;re talking to the person you intended to anyway</em></h3>
<p>Today I was helping one of my teammates debug an issue he had been looking at for a while. The symptom was a crash here:</p>
<blockquote>
<p><span style="font-family: 'Courier New';">HRESULT CGadget::GetPropertyValue(PROPERTYID propertyId, VARIANT *pRetVal) <br />{ <br />&nbsp;&nbsp;&nbsp;&nbsp; switch (propertyId) <br />&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case PropertyValue1: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...; break; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... ad nauseam ... <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="background-color: #ffff00;">pRetVal-&gt;vt = VT_EMPTY;</span></strong> &lt;&lt;&lt;&lt;&lt; CRASH! <br />&nbsp;&nbsp;&nbsp;&nbsp; } <br /> }</span></p>
</blockquote>
<p align="left">and at this point in time, <span style="font-family: 'Courier New';">pRetVal</span> is null, and <span style="font-family: 'Courier New';">propertyId</span> is some bogus value. Hmm, interesting. Tracing it back, we see that there is a thread in a loop accepting requests from other threads and dispatching the appropriate type of request (after all this is in a popular UI framework&hellip;) and depending on the type of request, different parameter types will be used. <span style="font-family: 'Courier New';"><span style="font-family: Arial;">The request that makes everything happens to be one for getting the gadget&rsquo;s bounding rectangle which just redirects to somebody else&rsquo;s implementation:</span></span></p>
<blockquote>
<p align="left"><span style="font-family: 'Courier New';">HRESULT CGadget::get_BoundingRectangle(Rect *pRect) <br /> { <br />&nbsp;&nbsp;&nbsp; return _pHostedControl-&gt;get_BoundingRectangle(pRect); <br /> }</span></p>
</blockquote>
<p>However we see that the disassembly for the call to <span style="font-family: 'Courier New';">CGadget::get_BoundingRectangle </span>instruction is actually calling into our <span style="font-family: 'Courier New';">CGadget::GetPropertyValue</span>&hellip;and even worse, the value being passed as the <span style="font-family: 'Courier New';">propertyId </span>parameter is the value of the pointer <span style="font-family: 'Courier New';">pRect</span>!&nbsp; <span style="font-family: 'Courier New';"><span style="font-family: Arial;">So what&rsquo;s going on? </span></span></p>
<p><span style="font-family: 'Courier New';"><span style="font-family: Arial;">It turns out that </span>CGadget <span style="font-family: Arial;">has an interesting multiple inheritance structure, where it implements a number of interfaces, in our simplified example let&rsquo;s call them </span>Interface1 <span style="font-family: Arial;">and </span>Interface2. <br />get_BoundingRectangle <span style="font-family: Arial;">happens to be the on the 5th slot in </span>Interface1<span style="font-family: Arial;">&rsquo;s vtable, and </span>GetPropertyValue <span style="font-family: Arial;">happens to be on the 5th slot of </span>Interface2</span>&rsquo;s vtable.</p>
<p><span style="font-family: 'Courier New';"><span style="font-family: Arial;">The guy that holds the reference to </span>CGadget <span style="font-family: Arial;">actually only talks to it through </span>Interface2</span><span style="font-family: Arial;">, but this interface is being obtained in a somewhat peculiar manner:</span></p>
<blockquote>
<p><span style="font-family: 'Courier New';">CTrinket::CTrinket(Interface2 *pI2) <br /> { <br />&nbsp;&nbsp;&nbsp; _pI2 = pI2; <br /> }</span></p>
<p><span style="font-family: 'Courier New';">void CGadget::DoThings() <br /> { <br />&nbsp;&nbsp;&nbsp; CTrinket *pTrinket = new CTrinket(<strong>reinterpret_cast</strong>&lt;Interface2*&gt;(this)); <br />&nbsp;&nbsp;&nbsp; pTrinket-&gt;DispatchTrinket(); <br /> }</span></p>
</blockquote>
<p>So here it is, the culprit is that the code is doing a reinterpret_cast on an interface &ndash; even though we know the object inherits (implements) from this class/interface, <span style="font-family: 'Courier New';">reinterpret_cast </span>will not fix up the offsets so that the pointer returned points to <span style="font-family: 'Courier New';">Interface2 </span>&ndash; it will just grab the memory address of the this object and treat it as if it already has a pointer to an <span style="font-family: 'Courier New';">Interface2 </span>object; the problem is that the in-memory layout for <span style="font-family: 'Courier New';">CGadget</span>, has an <span style="font-family: 'Courier New';">Interface1 </span>at the start, and the <span style="font-family: 'Courier New';">Interface2 </span>objects starts <span style="font-family: 'Courier New';">sizeof(Interface1) </span>bytes later!</p>
<p>This is one of those cases where a <span style="font-family: 'Courier New';">C</span>-style cast (or really, a <span style="font-family: 'Courier New';">static_cast</span>) would likely be the appropriate choice instead.</p>
<p><em>Edit: or actually, don't even cast it, as the compiler will know how to cast this into one of its base classes (thanks Raymond for pointing that out :))</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Hilarious network configuration</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/hilarious-network-configuration</link>
      <pubDate>Sat, 09 Feb 2013 12:14:01 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2013/02/09/hilarious-network-configuration/</guid>
      <description><![CDATA[I call this DNS art :) Try running this from a cmd prompt:
tracert -h 99 216.81.59.173
You'll get...]]></description>
      <content:encoded><![CDATA[<p>I call this DNS art :) Try running this from a cmd prompt:</p>
<p><span style="font-family: 'courier new', courier;">tracert -h 99 <strong>216.81.59.173</strong></span></p>
<p>You'll get something like this:</p>
<pre><span style="font-family: 'courier new', courier;">&lt;initial routing...&gt;</span><br /><span style="font-family: 'courier new', courier;"> 13 * * * Request timed out.</span><br /><span style="font-family: 'courier new', courier;"> 14 150 ms 153 ms 144 ms Episode.IV [206.214.251.1]</span><br /><span style="font-family: 'courier new', courier;"> 15 152 ms 147 ms 143 ms A.NEW.HOPE [206.214.251.6]</span><br /><span style="font-family: 'courier new', courier;"> 16 146 ms 148 ms 147 ms It.is.a.period.of.civil.war [206.214.251.9]</span><br /><span style="font-family: 'courier new', courier;"> 17 147 ms 145 ms 148 ms Rebel.spaceships [206.214.251.14]</span><br /><span style="font-family: 'courier new', courier;"> 18 145 ms 147 ms 150 ms striking.from.a.hidden.base [206.214.251.17]</span><br /><span style="font-family: 'courier new', courier;"> 19 144 ms 150 ms 143 ms have.won.their.first.victory [206.214.251.22]</span><br /><span style="font-family: 'courier new', courier;"> 20 145 ms 142 ms 145 ms against.the.evil.Galactic.Empire [206.214.251.25]</span><br /><span style="font-family: 'courier new', courier;"> 21 143 ms 145 ms 147 ms During.the.battle [206.214.251.30]</span><br /><span style="font-family: 'courier new', courier;"> 22 155 ms 153 ms 147 ms Rebel.spies.managed [206.214.251.33]</span><br /><span style="font-family: 'courier new', courier;"> 23 156 ms 146 ms 153 ms to.steal.secret.plans [206.214.251.38]</span><br /><span style="font-family: 'courier new', courier;"> 24 145 ms 148 ms 146 ms to.the.Empires.ultimate.weapon [206.214.251.41]</span><br /><span style="font-family: 'courier new', courier;"> 25 142 ms 171 ms 145 ms the.DEATH.STAR [206.214.251.46]</span><br /><span style="font-family: 'courier new', courier;"> 26 171 ms 146 ms 153 ms an.armored.space.station [206.214.251.49]</span><br /><span style="font-family: 'courier new', courier;"> 27 157 ms 151 ms 142 ms with.enough.power.to [206.214.251.54]</span><br /><span style="font-family: 'courier new', courier;"> 28 161 ms 148 ms 144 ms destroy.an.entire.planet [206.214.251.57]</span><br /><span style="font-family: 'courier new', courier;"> 29 148 ms 150 ms 149 ms Pursued.by.the.Empires [206.214.251.62]</span><br /><span style="font-family: 'courier new', courier;"> 30 144 ms 145 ms 147 ms sinister.agents [206.214.251.65]</span><br /><span style="font-family: 'courier new', courier;"> 31 146 ms 142 ms 146 ms Princess.Leia.races.home [206.214.251.70]</span><br /><span style="font-family: 'courier new', courier;"> 32 152 ms 149 ms 147 ms aboard.her.starship [206.214.251.73]</span><br /><span style="font-family: 'courier new', courier;"> 33 151 ms 156 ms 145 ms custodian.of.the.stolen.plans [206.214.251.78]</span><br /><span style="font-family: 'courier new', courier;"> 34 149 ms 145 ms 147 ms that.can.save.her [206.214.251.81]</span><br /><span style="font-family: 'courier new', courier;"> 35 149 ms 150 ms 145 ms people.and.restore [206.214.251.86]</span><br /><span style="font-family: 'courier new', courier;"> 36 152 ms 150 ms 148 ms freedom.to.the.galaxy [206.214.251.89]</span><br /><span style="font-family: 'courier new', courier;"> 37 144 ms 151 ms 150 ms 0-------------------0 [206.214.251.94]</span><br /><span style="font-family: 'courier new', courier;"> 38 149 ms 144 ms 151 ms 0------------------0 [206.214.251.97]</span><br /><span style="font-family: 'courier new', courier;"> 39 149 ms 145 ms 149 ms 0-----------------0 [206.214.251.102]</span><br /><span style="font-family: 'courier new', courier;"> 40 148 ms 145 ms 146 ms 0----------------0 [206.214.251.105]</span><br /><span style="font-family: 'courier new', courier;"> 41 146 ms 144 ms 160 ms 0---------------0 [206.214.251.110]</span><br /><span style="font-family: 'courier new', courier;"> 42 150 ms 151 ms 146 ms 0--------------0 [206.214.251.113]</span><br /><span style="font-family: 'courier new', courier;"> 43 145 ms 147 ms 147 ms 0-------------0 [206.214.251.118]</span><br /><span style="font-family: 'courier new', courier;"> 44 147 ms 148 ms 148 ms 0------------0 [206.214.251.121]</span><br /><span style="font-family: 'courier new', courier;"> 45 149 ms 149 ms 147 ms 0-----------0 [206.214.251.126]</span><br /><span style="font-family: 'courier new', courier;"> 46 146 ms 149 ms 153 ms 0----------0 [206.214.251.129]</span><br /><span style="font-family: 'courier new', courier;"> 47 146 ms 143 ms 149 ms 0---------0 [206.214.251.134]</span><br /><span style="font-family: 'courier new', courier;"> 48 150 ms 149 ms 148 ms 0--------0 [206.214.251.137]</span><br /><span style="font-family: 'courier new', courier;"> 49 149 ms 153 ms 148 ms 0-------0 [206.214.251.142]</span><br /><span style="font-family: 'courier new', courier;"> 50 169 ms 146 ms 147 ms 0------0 [206.214.251.145]</span><br /><span style="font-family: 'courier new', courier;"> 51 149 ms * 260 ms 0-----0 [206.214.251.150]</span><br /><span style="font-family: 'courier new', courier;"> 52 204 ms 166 ms 204 ms 0----0 [206.214.251.153]</span><br /><span style="font-family: 'courier new', courier;"> 53 160 ms 153 ms 169 ms 0---0 [206.214.251.158]</span><br /><span style="font-family: 'courier new', courier;"> 54 181 ms 150 ms 147 ms 0--0 [206.214.251.161]</span><br /><span style="font-family: 'courier new', courier;"> 55 160 ms 150 ms 149 ms 0-0 [206.214.251.166]</span><br /><span style="font-family: 'courier new', courier;"> 56 163 ms 151 ms 151 ms 00 [206.214.251.169]</span><br /><span style="font-family: 'courier new', courier;"> 57 150 ms 153 ms 152 ms I [206.214.251.174]</span><br /><span style="font-family: 'courier new', courier;"> 58 150 ms 149 ms 149 ms By.Ryan.Werber [206.214.251.177]</span><br /><span style="font-family: 'courier new', courier;"> 59 152 ms 152 ms 151 ms When.CCIEs.Get.Bored [206.214.251.182]</span><br /><span style="font-family: 'courier new', courier;"> 60 149 ms 158 ms 148 ms CCIE.38168 [206.214.251.185]</span><br /><span style="font-family: 'courier new', courier;"> 61 151 ms 150 ms 149 ms FIN [216.81.59.173]</span></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Why does explorer tell me the file was opened by the wrong program?</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/why-does-explorer-tell-me-the-file-was-opened-by-the-wrong-program</link>
      <pubDate>Thu, 03 May 2012 23:36:13 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2012/05/03/why-does-explorer-tell-me-the-file-was-opened-by-the-wrong-program/</guid>
      <description><![CDATA[(or why Windows Audio is holding an Event Log file open)  Today’s blog post will be about the “File...]]></description>
      <content:encoded><![CDATA[<h5>(or why Windows Audio is holding an Event Log file open)</h5>  <p>Today’s blog post will be about the “File in use” dialog. You may have encountered this dialog when trying to delete a file that you happened to have already open. In Windows Vista, all you got was “this file is open in another program”. Not very useful, since you then get to figure out which program is holding the file open. In Windows 7 the system will attempt to give you more information by providing the program name, exe name, or…something else…</p>  <p>You can get one of four dialogs:</p>  <ol>   <li>     <div align="left">“File is open in &lt;program name&gt;”. This is the most common case. Windows tells you exactly which program has locked the file. You can then switch to that program – assuming there is only one copy of that program and it’s running in your session (another user on the same machine could be holding the file open, or if the file is on a network share, it could even be another user!). Then you close it and retry the operation.        <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/6102.exe_3A7F86F5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/6102.exe_5F00_3A7F86F5.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="exe" border="0" alt="exe" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/0245.exe_thumb_60E16A40.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/0245.exe_5F00_thumb_5F00_60E16A40.png" width="434" height="246" /></a></div>   </li>    <li>     <div align="left">“File is open in &lt;exe name&gt;”. You may get this dialog if the program that is holding the file open is running elevated. Since explorer.exe usually does not run elevated, it cannot read some information it needs to determine the display name of the program, so it gives you the name of the executable file. </div>      <div align="left"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/0741.exename_2E1163CC.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/0741.exename_5F00_2E1163CC.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="exename" border="0" alt="exename" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/1727.exename_thumb_18B3AE64.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/1727.exename_5F00_thumb_5F00_18B3AE64.png" width="434" height="246" /></a></div>   </li>    <li>     <div align="left">“File is open in another program”. You get this when you try to delete a folder that contains a file that is currently open. This isn’t extremely useful since it doesn’t tell you a) which file is open, or b) which program is holding it open<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/5047.folder_33EC0765.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/5047.folder_5F00_33EC0765.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="folder" border="0" alt="folder" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/2772.folder_thumb_337FD470.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/2772.folder_5F00_thumb_5F00_337FD470.png" width="434" height="258" /></a></div>   </li>    <li>“File is open in &lt;service name&gt;”      <br />      <div align="left"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/6012.audio_44F03548.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/6012.audio_5F00_44F03548.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="audio" border="0" alt="audio" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/4035.audio_thumb_7271550B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/4035.audio_5F00_thumb_5F00_7271550B.png" width="434" height="246" /></a></div>   </li> </ol>  <p>This one is the most interesting dialog. Why would the Windows Audio service be holding an event log file open?! Madness! </p>  <p>Well, it turns out that there’s only so much Windows can know about who has a file open. The file was really open by the Event Log service, which by default, runs in the same svchost.exe instance as Windows Audio. You can verify this by running “tasklist /svc” in a command prompt:</p>  <p align="center"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/4848.jnuyjjwk_4ACAD8E1.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/4848.jnuyjjwk_5F00_4ACAD8E1.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="jnuyjjwk" border="0" alt="jnuyjjwk" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/8156.jnuyjjwk_thumb_3C8C5FF1.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/8156.jnuyjjwk_5F00_thumb_5F00_3C8C5FF1.jpg" width="575" height="30" /></a></p>  <p align="left">So how does this work? at the crux of the issue is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa373649(v=vs.85).aspx" target="_blank">Restart Manager</a>, a set of APIs that let applications (esp. setup apps/install wizards) query about which program has a certain file in use that they’re trying to update/write to. It also provides APIs to tell those apps to shutdown and restart (the latter requires cooperation on the app’s part to be able to save its state and load this state upon restart). Restart manager however, doesn’t know too much about which part of a svchost instance called CreateFile. All it knows is that a certain svchost instance did it, and so it returns all the names for services running in that svchost instance.</p>  <p align="left">So, that’s why Windows Audio gets blamed for Event Log holding a file open.</p>]]></content:encoded>
    </item>
    <item>
      <title>Why do .zip files from Mac OS show up as green/encrypted?</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/why-do-zip-files-from-mac-os-show-up-as-greenencrypted</link>
      <pubDate>Thu, 03 May 2012 04:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2012/05/03/why-do-zip-files-from-mac-os-show-up-as-greenencrypted/</guid>
      <description><![CDATA[It&rsquo;s kind of funny really. The ZIP specification mandates that a program/OS creating a zip...]]></description>
      <content:encoded><![CDATA[<p>It&rsquo;s kind of funny really. The <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT" target="_blank">ZIP specification</a> mandates that a program/OS creating a zip archive include a tag informing about itself to the program trying to decompress the archive. This information is called &ldquo;version made by&rdquo;, and looks like this:</p>
<pre style="line-height: normal; widows: 2; text-transform: none; font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; word-wrap: break-word; white-space: pre-wrap; orphans: 2; color: #000000; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">          0 - MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)
          1 - Amiga                     2 - OpenVMS
          3 - UNIX                      4 - VM/CMS
          5 - Atari ST                  6 - OS/2 H.P.F.S.
          7 - Macintosh                 8 - Z-System
          9 - CP/M                     10 - Windows NTFS
         11 - MVS (OS/390 - Z/OS)      12 - VSE
         13 - Acorn Risc               14 - VFAT
         15 - alternate MVS            16 - BeOS
         17 - Tandem                   18 - OS/400
         19 - OS/X (Darwin)            20 thru 255 - unused</pre>
<p>Now, interestingly, it seems that Mac OS is tagging the zip archives it creates with the value 3 (UNIX). Ok, so far no problem, I guess.</p>
<p>The problem happens when Windows gets confused about how to interpret file/folder attributes. In FAT/NTFS, these values are stored according to this definition of <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx" target="_blank">File Attribute Constants</a>. You&rsquo;ll see that FILE_ATTRIBUTE_ENCRYPTED has a value of <strong>0x4000</strong>.</p>
<p>The interesting part is how Mac OS is storing its file attributes in the zip archive. Mac OS, being a UNIX based OS, uses the UNIX file/folder attributes system (and permissions, but that&rsquo;s a topic for another time&hellip;).. Well, it just so happens that in POSIX, the flag to describe a directory/folder (S_IFDIR) coincidentally also has the value 0x4000. So it turns out the zip decompression code wasn&rsquo;t aware that there might be other operating systems out there that might create zip archives&hellip;</p>
<p><strong>Bonus question</strong>: can you change this behavior. <strong>Answer</strong>: No; but you can clear the encryption flag from the extracted files/folders easily.</p>]]></content:encoded>
    </item>
    <item>
      <title>Remote Assistance and UAC prompts</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/remote-assistance-and-uac-prompts</link>
      <pubDate>Wed, 14 Mar 2012 21:59:09 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2012/03/14/remote-assistance-and-uac-prompts/</guid>
      <description><![CDATA[Recently, I received some e-mail sent to one of our internal DLs describing an issue a customer is...]]></description>
      <content:encoded><![CDATA[<p>Recently, I received some e-mail sent to one of our internal DLs describing an issue a customer is facing when using Remote Assistance:</p>  <blockquote>   <p><em>My customers engineer requests to connect to a user’s machine via remote assistance.</em></p>    <p><em>The user accepts and the engineer requests to take control.</em></p>    <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/5415.image_5CC157EC.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/5415.image_5F00_5CC157EC.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/1526.image_thumb_1BB2D888.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/1526.image_5F00_thumb_5F00_1BB2D888.png" width="244" height="77" /></a></p>    <p><em>The user ticks the box to allow the engineer to respond to UAC prompts – then selects Yes.</em></p>    <p><em>However – this change requires admin rights and the user is prompted for admin credentials (which they obviously don’t have)</em></p>    <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/7065.image_024AD54E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/7065.image_5F00_024AD54E.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/4745.image_thumb_074D12FD.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/4745.image_5F00_thumb_5F00_074D12FD.png" width="244" height="211" /></a></p>                        <p><em>Is there a way to work around this?</em></p> </blockquote>  <p>Why, yes! Enter UIAccess.</p>  <p>The way Remote Assistance “remote control” feature works is through an OS feature called <a href="http://blogs.msdn.com/b/cjacks/archive/2009/10/15/using-the-uiaccess-attribute-of-requestedexecutionlevel-to-improve-applications-providing-remote-control-of-the-desktop.aspx" target="_blank">UIAccess</a>, which allows the app the ability to control the desktop programmatically. By combining this with RDP/TS, Remote Assistance is able to provide the “remote control” feature.</p>  <p>However, in order for this to work properly in scenarios that prompt for elevation (i.e. UAC prompt), you have to enable a certain group policy: </p>  <h3><a href="http://technet.microsoft.com/en-us/library/dd851479.aspx" target="_blank"><font style="font-weight: normal" size="2">User Account Control: Allow UIAccess applications to prompt for elevation without using the secure desktop</font></a></h3>  <p>What this will do is it will enable Remote Assistance to show the UAC prompt on the user’s desktop, as opposed to the secure desktop. If you don’t enable this, the user being helped (call him novice) will get the prompt on his local machine – so the expert cannot interact with it since RA will only remote out the user’s desktop. At that point, the novice may not know what to do with it, and/or he may not have the administrator password. So it is important that you enable this group policy in order to have the UAC prompt show up in the user’s desktop and have RA remote out this dialog to the expert’s machine.</p>  <p>However, there was a bug with RA and how it determined where to show the UAC prompt. However I’m happy to say that my team fixed this bug recently, and you can now download a hotfix that should fix this issue.</p>  <p>You can download this hotfix here: <a href="http://support.microsoft.com/kb/2614066">http://support.microsoft.com/kb/2614066</a> (“<font style="font-weight: normal">Black screen during a Remote Assistance session in Windows Vista, in Windows Server 2008, in Windows 7, or in Windows Server 2008 R2”)</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Daylight savings time change for Chile</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/daylight-savings-time-change-for-chile</link>
      <pubDate>Sat, 10 Mar 2012 16:25:53 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2012/03/10/daylight-savings-time-change-for-chile/</guid>
      <description><![CDATA[My team is responsible for issuing updates whenever a country decides to change their daylight...]]></description>
      <content:encoded><![CDATA[<p>My team is responsible for issuing updates whenever a country decides to change their daylight savings start/end dates, or even time zone. Most recently, we’ve released an update for Chile.</p>  <p>More information: </p>  <ul>   <li><a href="http://blogs.technet.com/b/dst2007/archive/2012/03/07/hotfix-available-for-chile-dst-change.aspx">http://blogs.technet.com/b/dst2007/archive/2012/03/07/hotfix-available-for-chile-dst-change.aspx</a>&#160;</li>    <li><a href="http://blogs.technet.com/b/latam/archive/2012/02/27/chile-dst-2012-fallback.aspx">http://blogs.technet.com/b/latam/archive/2012/02/27/chile-dst-2012-fallback.aspx</a></li>    <li><a href="http://www.microsoft.com/chile/cambiodehora/">http://www.microsoft.com/chile/cambiodehora/</a></li> </ul>  <p>&#160;</p>  <p>Also, my team is hiring!</p>  <ul>   <li><a href="https://careers.microsoft.com/jobdetails.aspx?ss=&amp;pg=0&amp;so=&amp;rw=4&amp;jid=68627&amp;jlang=EN" target="_blank">Senior Development Engineer</a></li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>System Tray Notification area icons</title>
      <link>https://docs.microsoft.com/archive/blogs/asklar/system-tray-notification-area-icons</link>
      <pubDate>Tue, 06 Mar 2012 01:10:24 GMT</pubDate>
      <dc:creator><![CDATA[Alexander Sklar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asklar/2012/03/06/system-tray-notification-area-icons/</guid>
      <description><![CDATA[If you’re a developer writing for Windows 7, you’ll probably have noticed that icons in the System...]]></description>
      <content:encoded><![CDATA[<p align="justify"><font size="3" face="Calibri">If you’re a developer writing for Windows 7, you’ll probably have noticed that icons in the System Tray aren’t shown by default. Raymond Chen blogged about this recently, </font><a href="http://blogs.msdn.com/b/oldnewthing/archive/2012/02/28/10273671.aspx" target="_blank"><font size="3" face="Calibri">here</font></a><font size="3" face="Calibri"> and </font><a href="http://blogs.msdn.com/b/oldnewthing/archive/2012/02/22/10270776.aspx" target="_blank"><font size="3" face="Calibri">here</font></a><font size="3" face="Calibri">. Notification icons are identified by a GUID, a <strong>G</strong>lobally <strong>U</strong>nique <strong>ID</strong>entifier, which is just a <em>big</em> number. The idea is that each application that wanted to show an icon would use a GUID that only it knows about, the user remains in control by being the only one who can move icons from the notifications fly-out thingy (the little chevron at the left of the system tray) into the system tray (this is called promoting an icon); everybody would be happy. Well, almost. </font></p>  <p align="justify"><font size="3" face="Calibri">As Raymond explained it in his blog, apps want to make sure you get their notification, they’ll do <strong>anything </strong>to make sure you do! (including totally and completely unsupported hacks). Apps will even try to spoof other application’s icons, i.e. disguise themselves as a different app to “steal” that other app’s icons’ promotion state. To prevent this and keep the user in control and keep annoying apps at bay, logic was added that would register the path to the executable registering the icon the first time, and if a different executable tried registering the same icon, it would just be hidden. Sounds like a fairly straightforward approach.</font></p>  <p align="justify"><font size="3" face="Calibri">The problem is, what if an app’s vendor decided to change the installation folder for their app? For example, imagine the app is installed to “<font face="Courier New">C:\Program Files\MyApp 9.0</font>” and they wanted to release version 10.0, which installs to something like “<font face="Courier New">C:\Program Files\MyApp 10.0</font>”. Since we verify that the path of the calling process’ exe is the same as the exe that registered the icon, this would cause this scenario to fail. </font></p>  <p align="justify"><font size="3" face="Calibri">We decided it was probably a fair thing to do to let ISVs manage their own icons, so that they can use the same icon object from the two versions. But how would they that?</font></p>  <p align="justify"><font size="3" face="Calibri">The resulting design was that, if the path check failed, we would check the signature in the exe (and store it when you first run the app). If both the old and new exes have signatures, and the Publisher field matches, then we would allow the icon to be taken over.</font></p>  <p align="justify"><font size="3" face="Calibri">This new behavior is included in Windows 7 SP1/Windows Server 2008 SP1, and also in a “stability and reliability update” described </font><a href="http://support.microsoft.com/kb/976883" target="_blank"><font size="3" face="Calibri">here</font></a><font size="3" face="Calibri"> and downloadable </font><a href="http://support.microsoft.com/kb/977074" target="_blank"><font size="3" face="Calibri">here</font></a><font size="3" face="Calibri">. The behavior is also documented as an addendum to the MSDN documentation for the </font><a href="http://msdn.microsoft.com/en-us/library/bb773352(v=vs.85).aspx" target="_blank"><font size="3" face="Calibri">NOTIFYICONDATA structure</font></a><font size="3" face="Calibri"> in the Troubleshooting section:</font></p>  <blockquote>   <p align="justify"><em><font size="3" face="Calibri">The path of the binary file is included in the registration of the icon's GUID and cannot be changed. Settings associated with the icon are preserved through an upgrade only if the file path and GUID are unchanged. If the path must be changed, the application should remove any GUID information that was added when the existing icon was registered. Once that information is removed, you can move the binary file to a new location and reregister it with a new GUID. Any settings associated with the original GUID registration will be lost.</font></em></p>    <p align="justify"><em><font size="3" face="Calibri">This also occurs in the case of a side-by-side installation. When dealing with a side-by-side installation, new versions of the application should update the GUID of the binary file.</font></em></p>    <p align="justify"><em><font face="Calibri"><font size="3"><strong>Note</strong>&#160; The only exception to a moved file occurs when both the original and moved binary files are </font></font></em><a href="http://msdn.microsoft.com/en-us/library/ms537359(v=vs.85).aspx"><em><font size="3" face="Calibri">Authenticode</font></em></a><em><font size="3" face="Calibri">-signed by the same company. In that case, settings are preserved through the move.</font></em></p> </blockquote>  <p align="justify"><font size="3" face="Calibri">This new design/addendum to the behavior took fairly long to implement and get right, so you can say the engineer testing this and I “grew fond” of this code <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/14/22/metablogapi/8461.wlEmoticon-smile_58C2FF48.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-14-22-metablogapi/8461.wlEmoticon_2D00_smile_5F00_58C2FF48.png" />&#160;</font></p>  <p align="justify"><font size="3" face="Calibri">Anyway, hope my story “<em>infotained</em>” you, let me know in the comments section what you’d like to hear about next!</font></p>  <p align="justify"><font size="3" face="Calibri">&#160;</font></p>]]></content:encoded>
    </item>
  </channel>
</rss>