Jump to content

Launch 64-bit Explorer.exe on Open Containing folder on Windows x64


saivert

Recommended Posts

Currently when you use the "Open Containing Folder" context menu on torrents on a 64-bit system, µTorrent being a 32-bit app spawns the 32-bit version of Explorer for displaying the containing folder. This is wrong. I want µTorrent to spawn the 64-bit version of Explorer.

Explanation of the whole thing:

In 64-bit (x64) Windows operating system, including Windows Vista, Microsoft implements a feature called File System Redirector on WOW64 (Windows-32-on-Windows-64 that runs 32-bit programs without modifications) subsystem layer for 32-bit programs or DLL (dynamic link libraries) which provides a WOW64 sandbox for registry calls and some file system calls. The filesystem redirection forces 32-bit application attempts to be installed into or accessed from %windir%\System32, been intercepted and get redirected or re-pointed to %windir%\SysWOW64 instead.

Possible solution:

32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. The Sysnative is just a virtual directory, alias or pseudo-directory that is not visible in Windows Explorer, directory listing, and does not support native 64-bit processes that already been accessing the %windir%\System32 folder. As such, Sysnative can only be used in file system calls, and not in application's user interface such as dialog box to open or select folder.

tl;dr Check if the OS is 64-bit and if so run %windir%\Sysnative\explorer.exe instead.

Sources:

- http://www.start64.com/index.php?option=com_content&task=view&id=2310&Itemid=126

- http://www.tipandtrick.net/2008/how-to-suppress-and-bypass-system32-file-system-redirect-to-syswow64-folder-with-sysnative/

Link to comment
Share on other sites

  • 5 months later...

OK, not that I don't understand what your saying, are there any step by step instructions for this, because I'm totally lost on where to start, I tried that Start64 program and it worked once but then after restarting my computer once it reverted back to opening the old 32 bit launcher. Ok so how do i do this? I looked at the sites given and didn't understand where the directions were! And this is annoying me, but I only have one idea that this still might be happening, and that would be because the only way i could reinstall this was to throw the installer for utorrent into the Program Files(x86) folder, any thoughts?

Ok I tried using Start64.exe to redirect instances of explorer.exe to the 64 bit by putting Start64 in the Windows folder, and then used cmd to use the command "Start64.exe "%SystemRoot%\explorer.exe" "start explorer.exe"" as my command and it worked for a little while but now it doesn't work, and I still don't get how to do run %windir%\Sysnative\explorer.exe, please dumb it down for me, I thought I fixed it but its managed to unfix itself.

Link to comment
Share on other sites

  • 5 months later...

I stumble upon this thread while looking to see if the issue regarding "Open Containing Folder" on 64-bit systems had been fixed, and after reading the posts I had a few comments to make.

Possible solution:

32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. The Sysnative is just a virtual directory, alias or pseudo-directory that is not visible in Windows Explorer, directory listing, and does not support native 64-bit processes that already been accessing the %windir%\System32 folder. As such, Sysnative can only be used in file system calls, and not in application's user interface such as dialog box to open or select folder.

Using %SystemRoot%\Sysnative sounds like a good idea, but there are reasons why it wouldn't be the solution:

[ol][li]OS support: %SystemRoot%\Sysnative is a special alias that is only natively supported on Windows Vista & Windows Server 2008 or later's implementation of the WOW64 subsystem. Windows Server 2003 64-Bit Edition needs an update (normally of limited availability) for it's WOW64 to recognize that alias, and for Windows XP Professional x64 Edition the same functionality must be simulated using a hardlink (and this is only possible on NTFS partitions, not FAT32). Even then, for both Windows XP and Windows Server 2003 %SystemRoot%\Sysnative must be manually appended to the PATH system environment variable. And you would still remove support for the Win9x lineage. As you can see, OS support for this solution is pretty heterogeneous.[/li][li]Sysnative alias must be used within the application: Don't lose your time creating hardlinks, as using this solution alone is useless since µTorrent doesn't actually make use of %SystemRoot%\Sysnative. Even if you create the hardlink (for XP) and put %SystemRoot%\Sysnative in the path, for 32-bit processes %SystemRoot%\SysWOW64 will always have priority over %SystemRoot%\Sysnative for path searching. So when a program (like µTorrent) launches Explorer without a path component the 32-bit version of Explorer will be used.[/li][li]Sysnative limited to certain API calls: %SystemRoot%\Sysnative is only useful on certain API calls (CreateFile, CreateProcess, etc.), those intercepted by the WOW64 subsystem (unless Sysnative is implemented as a hardlink, under XP x64). If you pass a path containing %SystemRoot%\Sysnative to another application (even after adding it to the system's PATH environment variable), like Explorer or a shell call, it won't know what to do with it as the alias doesn't exist within the filesystem, but rather "resolved" by Wow64.dll.[/li][/ol]

I doubt µTorrent will/should use %SystemRoot%\Sysnative, for the reasons mentioned above and because there are just better ways to launch Explorer, or more precisely a shell view of a folder's content (more at the end).

There is a manifest option to opt-out of WOW64 virtualization.

There is no such thing. Maybe you're referring to the requestedExecutionLevel entry, which permits to bypass registry virtualization by requiring the appropriate access token for properly writing to registry, but this is related to UAC, not WOW64. WOW64 filesystem redirection can only be disabled / enabled on a thread basis for 32-bit processes using Wow64DisableWow64FsRedirection / Wow64EnableWow64FsRedirection, respectively. But it should only used sporadically, i.e. you shouldn't leave the redirection off otherwise all system DLL calls will fail (calls used for things like the Open File dialog, socket APIs, etc). This is the main reason why Start64.exe doesn't work with µTorrent and most programs (Start64.exe was designed mainly for the command line processor, scripting engines and other monolithic programs not making any system call).

In any way, only the developers of µTorrent can fix the issue. But it turns out it's pretty easy: instead of passing "explorer.exe" to ShellExecuteW (or their wrapper for non-unicode systems), they should pass (previously expanded) "%SystemRoot%\explorer.exe", or better "%windir%\explorer.exe" to maintain support for both Win9x & WinNT lineages. The ideal way would be to do

ShellExecuteW(0, L"open", file->GetContainingFolder(), 0, 0, 5);

instead of

ShellExecuteW(0, 0, L"explorer.exe", file->GetContainingFolder(), 0, 5);

to support third-party shells, but then you would loose the ability to use "/select".

But I understand that it's not changing code that's long, it's testing it to make sure it works everywhere and doesn't break something else. But most importantly, I know that for all the improvements/requested features they have no choice but to go with list of priorities, and fixing this probably isn't high on the list. I guess we (you) will have to wait some more.

Link to comment
Share on other sites

  • 3 weeks later...

Why on earth can't this issue be fixed/get higher priority?

The bug has been here for a very long time, it's quite nasty (total crash of Explorer) and A LOT of people are running a 64-bit OS now...

And the solution seems quite simple to me (solution already suggested in the post above)

thanks

Link to comment
Share on other sites

Ahhh - sorry! That's good news :)

I was running a 1.9 beta that didn't include this change...

But µTorrent really should use "open" instead of just executing "explorer.exe" as described in the post above.

It's a bit weird to open a new instance of explorer I think. I'm using add-ons to explorer, and it isn't loaded when executing a new instance...

But I'm glad that the whole explorer doesn't crash anymore :)

A big thanks!

Update: Hmmm - I was a bit too quick I guess. I still get crashes because of multiple instances of "explorer.exe". Probably because the addon (Mavis Up Button in Vista). The new instance of explorere is now the 64-bit version, but I really think that multiple running instances of explorer is a bad thing, and it will cause all sorts of problems...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...