{"id":133,"date":"2007-06-08T00:07:45","date_gmt":"2007-06-08T05:07:45","guid":{"rendered":"http:\/\/www.nynaeve.net\/?p=133"},"modified":"2019-12-13T17:37:43","modified_gmt":"2019-12-13T22:37:43","slug":"selectively-suppress-wow64-filesystem-redirection-on-vista-x64-with-sysnative","status":"publish","type":"post","link":"http:\/\/www.nynaeve.net\/?p=133","title":{"rendered":"Selectively suppress Wow64 filesystem redirection on Vista x64 with &#8216;Sysnative&#8217;"},"content":{"rendered":"<p>One of the features implemented by the Wow64 layer on x64 editions of Windows for 32-bit programs is <a title=\"Wow64 Filesystem Redirection\" href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa384187.aspx\">filesystem redirection<\/a>, which operates similarly to registry redirection in that it provides a Wow64 &#8220;sandbox&#8221;, for file I\/O relating to the System32 directory.<\/p>\n<p>The reasoning behind this is that many programs have the &#8220;System32&#8221; directory name hardcoded, and more importantly, unlike the transition between 16-bit Windows and Win32, virtually all of the DLLs implementing the Windows API retained their same name (and path) across the 32-bit to 64-bit transition.<\/p>\n<p>Clearly, this creates a conflict, as there can&#8217;t be both 32-bit and 64-bit DLLs with the same name and path on the same system at the same time.  The solution that Microsoft devised, filesystem redirection, is a layer that intercepts accesses to the system32 directory made by 32-bit applications, and re-points the accesses to the SysWOW64 directory, which functions as the Wow64 version of the system32 directory (where most of the core Wow64 system DLLs reside).<\/p>\n<p>Normally, this works fairly well, but there are times when a program needs to access the real System32 directory.  For this purpose, Microsoft has provided a <a title=\"Wow64DisableWow64FsRedirection\" href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa365743.aspx\">set of APIs<\/a> to enable and disable the filesystem redirection on a per-thread basis.  This is all well and dandy, but sometimes you may find yourself needing to turn off Wow64 filesystem redirection in a place where you can&#8217;t modify a program easily.<\/p>\n<p>Until Vista, there was no easy way to do this.  Fortunately, Vista adds a &#8220;backdoor&#8221; to Wow64 filesystem redirection, in the form of a pseudo-directory named &#8220;Sysnative&#8221; that is present under the Windows directory (e.g. C:\\Windows\\Sysnative).  This pseudo-directory is not visible in directory listings, and does not exist for native 64-bit processes.  For Wow64 processes, however, it can be used to access the 64-bit system32 directory.<\/p>\n<p>Why would you need to do that in the first place?  Well, there are lots of reasons, most of them dealing with things like where there is only a 64-bit version of a program that you need to launch (or the 64-bit version is necessary, such as if you need to communicate between a 32-bit process and a 64-bit process by launching another 64-bit process or something of the sort).  Prior to Vista, situations like this were a pain, as there was no built-in way to access the 64-bit system32 directory.  The &#8220;sysnative&#8221; pseudo-directory allows the problem to be addressed in a general fashion without requiring code changes, as Wow64 programs can address the 64-bit system32 via the special path (of course, this does require the user supplying such a path, but there is little working around this given the fact that 64-bit and 32-bit system DLLs have identical names).<\/p>\n<p>Sysnative is not a universal solution, however.  Some functionality does not work well with it, as sysnative does not appear in directory listings; for instance, the common controls open\/save file dialogs won&#8217;t allow you to navigate through sysnative due to this issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the features implemented by the Wow64 layer on x64 editions of Windows for 32-bit programs is filesystem redirection, which operates similarly to registry redirection in that it provides a Wow64 &#8220;sandbox&#8221;, for file I\/O relating to the System32 directory. The reasoning behind this is that many programs have the &#8220;System32&#8221; directory name hardcoded, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/133"}],"collection":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":1,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":587,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/587"}],"wp:attachment":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}