Jump to content

Prevent programs from knowing they are not running on the Console


Recommended Posts

Posted

We have a program that uses the FlexLM key locks to prevent more than one

person running the program. Even when you try to fire up a second instance

of the program you are denied a license. Since only one instance on the

computer can run at a time we have had this installed on the Terminal Server

and not violated the license agreement because even when 10 people are using

the TS for whatever, only one can use the program using the FlexLM key lock.

 

I baggered out of a developer that they put in the restriction on the

program (no details on how) but Sales and Management of the software company

deny it is there because they know we and other customers will go nuts on

them for doing it. Also, there is nothing in the license agreement stating

any TS restrictions.

 

Since sales and management deny the fact that there is this restriction in

there and there is nothing in the license agreement about TS restrictions I

have no problem asking here .... How do you prevent a program from knowing

it is running in a TS session other than using "/console"?

  • Replies 3
  • Created
  • Last Reply

Popular Days

Guest Vera Noest [MVP]
Posted

Re: Prevent programs from knowing they are not running on the Console

 

The standard method is calling GetSystemMetrics().

 

The following function returns TRUE if the application is running

in a remote session and FALSE if the application is running on the

console.

 

BOOL IsRemoteSession(void){

return GetSystemMetrics( SM_REMOTESESSION );

}

 

Not much you can do there, I believe.

I would yell at the vendor.

_________________________________________________________

Vera Noest

MCSE, CCEA, Microsoft MVP - Terminal Server

TS troubleshooting: http://ts.veranoest.net

*----------- Please reply in newsgroup -------------*

 

"JN" <me@here.com> wrote on 30 okt 2008:

> We have a program that uses the FlexLM key locks to prevent more

> than one person running the program. Even when you try to fire

> up a second instance of the program you are denied a license.

> Since only one instance on the computer can run at a time we

> have had this installed on the Terminal Server and not violated

> the license agreement because even when 10 people are using the

> TS for whatever, only one can use the program using the FlexLM

> key lock.

>

> I baggered out of a developer that they put in the restriction

> on the program (no details on how) but Sales and Management of

> the software company deny it is there because they know we and

> other customers will go nuts on them for doing it. Also, there

> is nothing in the license agreement stating any TS restrictions.

>

> Since sales and management deny the fact that there is this

> restriction in there and there is nothing in the license

> agreement about TS restrictions I have no problem asking here

> .... How do you prevent a program from knowing it is running in

> a TS session other than using "/console"?

Guest jolteroli
Posted

Re: Prevent programs from knowing they are not running on the Console

 

There are two source where you can obtain reliable information if a session

is running in a terminal server session:

 

1.) GetSystemMetrics(0x1000) will compare KUSER_SHARED_DATA.ActiveConsoleId

against PEB.SessionId. If they differ, 1 is returned else 0.

 

2.) GetVersionInfo(Ex) and VerifyVersionInfo(Ex) can be used to test for the

VER_SUITE_SINGLEUSERTS and VER_SUITE_TERMINAL bits set in the wSuiteMask

member of the OSVERSIONINFO(EX) struct. In fact the information also comes

from KUSER_SHARED_DATA

 

Problem: The KUSER_SHARED_DATA is plain readonly memory. Any write to that

page would result in a page fault. Hence, it is not possible to inject a

helper-dll into the process of your program and alter any data the

KUSER_SHARED_DATA page before the program starts running.

 

Altering the PEB.SessionId that is equals to

KUSER_SHARED_DATA.ActiveConsoleId and GetSystemMetrics will return 0, might

have ugly side effects, because the session manager relies on

PEB.SessionId...

 

And patching your program after calling either GetSystemMetrics,

GetVersionInfoEx or VerifyVersionInfoEx and make it think what you want is

not allowed (wild guess ;)

 

That's the theory and as Vera already said: "Not much you can do there, I

believe..."

 

-jolt

 

"JN" <me@here.com> schrieb im Newsbeitrag

news:uXqXvYpOJHA.144@TK2MSFTNGP03.phx.gbl...

> We have a program that uses the FlexLM key locks to prevent more than one

> person running the program. Even when you try to fire up a second

> instance of the program you are denied a license. Since only one instance

> on the computer can run at a time we have had this installed on the

> Terminal Server and not violated the license agreement because even when

> 10 people are using the TS for whatever, only one can use the program

> using the FlexLM key lock.

>

> I baggered out of a developer that they put in the restriction on the

> program (no details on how) but Sales and Management of the software

> company deny it is there because they know we and other customers will go

> nuts on them for doing it. Also, there is nothing in the license

> agreement stating any TS restrictions.

>

> Since sales and management deny the fact that there is this restriction in

> there and there is nothing in the license agreement about TS restrictions

> I have no problem asking here .... How do you prevent a program from

> knowing it is running in a TS session other than using "/console"?

>

>

>

>

Posted

Re: Prevent programs from knowing they are not running on the Console

 

Thanks all....

 

"Vera Noest [MVP]" <Vera.Noest@remove-this.hem.utfors.se> wrote in message

news:Xns9B479FFD08DB3veranoesthemutforsse@207.46.248.16...

> The standard method is calling GetSystemMetrics().

>

> The following function returns TRUE if the application is running

> in a remote session and FALSE if the application is running on the

> console.

>

> BOOL IsRemoteSession(void){

> return GetSystemMetrics( SM_REMOTESESSION );

> }

>

> Not much you can do there, I believe.

> I would yell at the vendor.

> _________________________________________________________

> Vera Noest

> MCSE, CCEA, Microsoft MVP - Terminal Server

> TS troubleshooting: http://ts.veranoest.net

> *----------- Please reply in newsgroup -------------*

>

> "JN" <me@here.com> wrote on 30 okt 2008:

>

>> We have a program that uses the FlexLM key locks to prevent more

>> than one person running the program. Even when you try to fire

>> up a second instance of the program you are denied a license.

>> Since only one instance on the computer can run at a time we

>> have had this installed on the Terminal Server and not violated

>> the license agreement because even when 10 people are using the

>> TS for whatever, only one can use the program using the FlexLM

>> key lock.

>>

>> I baggered out of a developer that they put in the restriction

>> on the program (no details on how) but Sales and Management of

>> the software company deny it is there because they know we and

>> other customers will go nuts on them for doing it. Also, there

>> is nothing in the license agreement stating any TS restrictions.

>>

>> Since sales and management deny the fact that there is this

>> restriction in there and there is nothing in the license

>> agreement about TS restrictions I have no problem asking here

>> .... How do you prevent a program from knowing it is running in

>> a TS session other than using "/console"?

>


×
×
  • Create New...