Windows provides a number of shims to workaround bugs and limitations in programs.
Shims can lie to a program about all kinds of things
- lie about the version of Windows
- lie about a file operation failing
- lie about a registry key that it couldn't open
Is there a shim to lie about the software being run from a Terminal Session (e.g. Remote Desktop)?
i have a piece of software that detects if it is running in a Terminal Session and changes its behaviour accordingly. Another piece of software refuses to run because it is says it's simiply not supported.
And like a program that refuses to run on anything higher than Windows 2000, it can run fine - if it just gives itself a chance.
Is there a "terminal session lie" shim?
Imagine the psuedocode that contains:
static class Program
{
if (System.Windows.Forms.SystemInformation.TerminalServerSession)
{
System.Environment.FastFail("We're too lazy to make our software work under TS.");
}
...
}
Other applications change their behaviour under a terminal session:
//Don't enable animations if we're in a TS window, or on battery
Boolean animationsEnabled =
(!System.Windows.Forms.SystemInformation.TerminalServerSession)
&&
(System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus !=
PowerLineStatus.Offline);
i want Windows to lie to the application, so that it doesn't think it is running in a Terminal Session/Remote Desktop Session.
This is similar to how other program's don't know how to write version check code, and so fail on anything newer than Windows XP:
static class Program
{
//Make sure we're on Windows 5.0 or later:
if (!(WinMajorVersion >= 5) && !(WinMinorVersion >= 0))
FastFail("Requires Windows XP or later");
}
The above code prompty fails on Windows versions 6.0 - which is exactly the reason why version lie shims exist.