Windows: How to make programs think they're not running in a terminal server session?

11

3

I am using the program "SoftXPand 2011 Duo" by Miniframe on my Windows 7 PC. It makes two workstations out of one computer. It uses the terminal services built into Windows to create the additional session. I use two screens, two keyboards and two mice to create this "illusion" of two computers. It works quite well and I can even play two different 3D games on the two screens attached to this single machine (using a Radeon HD5770 and a Core i5 2500k with 8 Gbytes RAM).

There are a few downsides to this. I just found about one that is hidden on the first look. The sessions you are in (even on the first workstation) will identify as a terminal server session! Now some programs will run with limited effects (graphical), and some won't run at all.

This also resulted in some games not running at all. They just say "Cannot be run in a terminal server session" and exit. I have already proven that top modern games (DirectX 10, 11) run just as good as on the same machine without SoftXPand, so this is a pretty artificial limitation!

So, can I somehow hack my current session so it doesn't look like a terminal server session anymore? I. E.

#include <windows.h>
#pragma comment(lib, "user32.lib")

BOOL IsRemoteSession(void)
{
   return GetSystemMetrics( SM_REMOTESESSION );
}

Will return FALSE? (Not a programming question! Just an example how programs detect if they're in a terminal server session!)

sinni800

Posted 2011-06-24T09:41:53.570

Reputation: 3 048

Do you have two keyboards/screens ? Please elaborate some more on your setup. – harrymc – 2011-06-27T07:57:16.220

@harrymc Yes, I do. Editing. – sinni800 – 2011-06-27T15:18:23.460

The reason apps refuse to run on a terminal server, even when you are using the console session, is because of licensing reasons - so that one licence cannot be used by more than one person at the same time. – paradroid – 2011-07-12T12:38:13.943

Answers

8

There are several ways for an application to check whether it is running in a Terminal Server session. Some of them you might hack, as below :

  1. Registry : HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\TSAppCompat.
    This key is missing in a normal session on my desktop.
    You might try to delete it, if you can.
  2. SESSIONNAME environment variable values : Console / "RDP#" / (empty).
    You may try to run your game from the Command Prompt (cmd) after doing
    SET SESSIONNAME=Console (my desktop value) or SET SESSIONNAME= (empty).
    To find out its current value, enter SET SESSIONNAME before changing anything.
  3. The system calls GetSystemMetrics(SM_REMOTESESSION) and GetVersionEx (OSVERSIONINFOEX.wSuiteMask) return the execution context.
    Not much you can do against this one, except writing a system-hook for it.
    If interested see this codeproject.com article : API hooking revealed.

harrymc

Posted 2011-06-24T09:41:53.570

Reputation: 306 093

On 2), the session name is "console" (What the heck?). The key TSAppCompat is missing here, too. About the third... Looks hard to do. Isn't there a program that sits on top of another program and intercepts system calls like the one I mentioned? GetSystemMetrics. – sinni800 – 2011-06-27T19:58:35.230

According to your info, probably the 3rd method is the one worth attacking for GetVersionEx and GetSystemMetrics. I have added a link above (to be used by a programmer). – harrymc – 2011-06-29T07:37:42.643

Another note : If there a way to use MSTSC /admin in SoftXPand, this is worth a try.

– harrymc – 2011-06-29T07:49:40.983

@harrymc why MSTSC /admin? I will look into the api hooking... It might be too complex for my programming abilities though. – sinni800 – 2011-06-29T13:16:27.820

"MSTSC /admin" is a rather long shot : it is a somewhat different remote session type, so maybe some programs may not detect it. – harrymc – 2011-06-29T13:44:03.947

@harrymc I am not using mstsc at all. SoftXPand does not use it to create the second session or even the first. – sinni800 – 2011-06-29T16:48:52.223

0

I'm using Microsoft Remote Desktop and I've tried the first 2 methods posted by @harrymc, but they don't work in my case. The third is too complicated for me so I've not given it a try.

In the end, I found that Parallel Access enables me to use the program that was showing the error. It's not as smooth as RDP, so I use it if I really have to use the program.

Lewen

Posted 2011-06-24T09:41:53.570

Reputation: 101

0

Doesn't address the SoftXPand question directly but I ended up here because of a Google search and it is along @harrymc's answer.

I created a batch file that had a delay of 60 seconds and then starts the app I want to run. I started the batch file, logged out of my RDP connection, waited about 5 minutes and then reconnected with RDP. The pesky app I wanted was waiting for me when I got back on. Here's the batch file contents:

timeout 60

start /D "your path here" yourExecutable.exe

The quotes around the path are necessary if you have spaces in the path.

Got the batch info stuff from here: https://stackoverflow.com/questions/8324352/creating-a-batch-file-for-programs-to-start-using-a-delay

props to this guy: https://stackoverflow.com/users/959263/raihan

(it said to provide details and share my research)

LargoBoom

Posted 2011-06-24T09:41:53.570

Reputation: 1

Interesting solution, I don't know if it will be able to apply to SoftXPand though, to be honest. As I can't "leave" the session like with RDP. – sinni800 – 2020-02-27T06:13:03.543

0

I found a solution: running the programs you want by "runas"

After you log in via desktop, type that in cmd:

runas /user:YOUR_NAME "YOUR_PROGRAM_PATH"

I tested it against Bently's softwares and they do work well.

AqD

Posted 2011-06-24T09:41:53.570

Reputation: 101

Does not work with mass effect 3 (This program cannot be run remotely) – Mgamerz – 2016-09-05T16:31:46.287

This circumvents the terminal server issue? Interesting, I have to try. – sinni800 – 2014-06-17T09:00:57.823