How can I force the 32-bit version of the remote desktop client to run on 64 bit Vista?

Go To StackoverFlow.com

4

We need to run the 32-bit version of the remote desktop client on 64 bit Vista, because part of our product integrates with it, and communicates with the terminal server side app via the virtual channel. The integration loads some third party 32-bit drivers, and it is not possible to load a 32-bit dll in a 64-bit process.

Normally it is quite easy to run the 32 bit version of a windows application from the command line, e.g. run window:

C:\Windows\SysWOW64\Notepad.exe

You can tell that the process is 32-bit by checking in task monitor\processes as it will have a *32 next to the filename.

However, the remote desktop client (mstsc.exe) does not want to play ball. It always runs the 64-bit version from C:\Windows\System32\mstsc.exe regardless of how I start it (run window, 32-bit cmd windows etc). I've tried writing a 32-bit C++ program to create it (normally child processes are also 32-bit) but this did not work.

I also tried calling:

Wow64DisableWow64FsRedirection
Wow64RevertWow64FsRedirection

before and after starting mstsc.exe but this did not help either.

Anyone know a way around this?

[Edit] I've done some further investigation with process monitor, and it seems that the 32-bit version of mstsc does start first, but then this creates a second 64 bit process and the 32 bit versions closes.

2009-06-16 19:33
by John Sibly
This might belong on serverfault.co - steamer25 2009-06-16 19:35
I asked the question on serverfault, but have not found the answer yet. Since it is quite a low level problem I hoped the SO community might be able to help - John Sibly 2009-06-16 19:46


3

Your question is very confused (1). Every executable on the system is compiled either as a 32-bit, or as a 64-bit executable. If you have a 64-bit executable, then it doesn't matter how you invoke it: from a 32-bit command window, from "Run" menu, or from another 32-bit program; it will always run as a 64-bit process.

You can check whether the executable is 32 or 64-bit one by looking for x64 in the output of dumpbin /HEADERS mstsc.exe.

You need to download and install a 32-bit version of mstsc.exe. In fact, I believe mstsc.exe is largely independent of installation, so you might be able to simply copy it from a 32-bit system and just run it.

UPDATE:
eran points out that invoking 32-bit mstsc.exe directly does not solve the problem, because mstsc detects that it is running on a 64-bit system and reinvokes the 64-bit version of itself. I do not know why it does that, or how to stop it from doing that. If you do, please edit this answer.

(1) Microsoft greatly helps this confusion by shipping many executables as both 32 and 64-bit versions, and magically remapping PATHs so one or the other is found; often at apparently the same pathname. But this is just "smoke and mirrors", in reality the pathname is always different.

2009-06-17 03:11
by Employed Russian
There are two versions of mstsc.exe installed. A 32-bit version in C:\Windows\SysWOW64\mstsc.exe and 64-bit in C:\Windows\System32\mstsc.exe.

I tried copying the version from SysWOW64 to my development machine and did a dumpbin /headers and confirm that it is 32 bit - John Sibly 2009-06-17 09:04

You're wrong. The OP's report is correct. What happens is that SysWOW64 does contain the 32 bit version of mstsc, which is the one he's running. However, once run the 32 bit mstsc just launches the 64 bit mstsc (from System32) and shuts itself down. This can be easily observed using ProcMon or so. Why does it work that way I don't know, nor do I know how to prevent this weird behavior.. - eran 2009-06-17 09:16
("You're wrong" refers to Employed Russian, of course. I wrote the comment without noticing the OP has commented a few minutes earlier - eran 2009-06-17 11:18
No, I am not wrong: the original question is confused, and there isn't a single statement in my answer that is incorrect. However, as you correctly point out, my suggestion of installing 32-bit mstsc.exe is unhelpful and doesn't solve the problem. I'll update my answer shortly - Employed Russian 2009-06-17 14:51
Thanks for the answer Employed Russian (+1), you clearly understand the issue I'm having. I'll make the question community wiki-so feel free to clarify it - John Sibly 2009-06-17 16:38


1



0

Have you tried an old version (say, from Windows 2000) yet?

2009-06-17 15:07
by Joshua
Yes I've tried copying over the version from 32 bit XP. Running it starts the 32 bit version (*32 next to name in task monitor) but an error message pops up: The system cannot find the file specified. C:\WinXP32\\mstsc.exe.MUI

If I copy over a version of this .MUI file and run again, it starts up but it leaves only the 64 bit version runnin - John Sibly 2009-06-17 16:03

Which is why I referred you to Windows 2000, for which there is no 64 bit version and so won't have the elevate to 64 bit check - Joshua 2009-06-17 16:19
MSTSC version 5.1 (from XP pre SP3) and 5.2 (from server 2003) works fine. Version 6.0 (from XP SP3) starts 64-bit process - Sergey Podobry 2009-12-10 10:25


0

Come to think of it, hooking IsWow64Process() to return 0 might work.

2009-12-10 18:03
by Joshua
Ads