Kristofer G. Skaug [SSBV]
2009-05-30 23:57:36 UTC
Hi all,
I'm calling the 'qwinsta.exe' utility via the commandline from a 32-bit
application as part of a function to detect Remote Desktop connections.
On my Vista Ultimate x64 system, due to the infamous 32-bit folder
redirection, invoking 'cmd.exe /s qwinsta /server' actually launches
c:\Windows\SysWOW64\cmd.exe - which in its turn is unable to find
'qwinsta.exe', as this is installed in c:\Windows\System32.
Now, I thought I'd be 'smart' and copied qwinsta.exe from
c:\Windows\System32 to c:\Windows\SysWOW64, as a result I get something that
"almost" works: It now generates output to the console, even though I'm
running the 32-bit cmd.exe, but qwinsta complains as follows:
"{Message(): LoadString Failed, Error 15105, (0x0003B01)}"
... followed by a semi normal listing of the active sessions.... which I
could use.
By also copying the manifest qwinsta.exe.mui from the \en-US subfolder of
\System32 to the same subfolder of \SysWOW64\, I was able to eliminate also
this last error.
But... uneasiness remains: Is this the way? If I want to safeguard the
functionality of my 32-bit applications under x64 Windows systems, do I need
to keep copying these system files? Also the \en-US location would seem to
be a system specific/locale-dependent thing... very error prone...
1) Do you have any suggestions for a better approach?
Including: How to detect a Remote Desktop session without resorting to
the qwinsta.exe commandline?
2) What is the appropriate API to detect that you're running on a 64-bit
flavor of Windows?
Thanks in advance,
Kristofer
I'm calling the 'qwinsta.exe' utility via the commandline from a 32-bit
application as part of a function to detect Remote Desktop connections.
On my Vista Ultimate x64 system, due to the infamous 32-bit folder
redirection, invoking 'cmd.exe /s qwinsta /server' actually launches
c:\Windows\SysWOW64\cmd.exe - which in its turn is unable to find
'qwinsta.exe', as this is installed in c:\Windows\System32.
Now, I thought I'd be 'smart' and copied qwinsta.exe from
c:\Windows\System32 to c:\Windows\SysWOW64, as a result I get something that
"almost" works: It now generates output to the console, even though I'm
running the 32-bit cmd.exe, but qwinsta complains as follows:
"{Message(): LoadString Failed, Error 15105, (0x0003B01)}"
... followed by a semi normal listing of the active sessions.... which I
could use.
By also copying the manifest qwinsta.exe.mui from the \en-US subfolder of
\System32 to the same subfolder of \SysWOW64\, I was able to eliminate also
this last error.
But... uneasiness remains: Is this the way? If I want to safeguard the
functionality of my 32-bit applications under x64 Windows systems, do I need
to keep copying these system files? Also the \en-US location would seem to
be a system specific/locale-dependent thing... very error prone...
1) Do you have any suggestions for a better approach?
Including: How to detect a Remote Desktop session without resorting to
the qwinsta.exe commandline?
2) What is the appropriate API to detect that you're running on a 64-bit
flavor of Windows?
Thanks in advance,
Kristofer