Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

Any reason Session ID = 1 instead of 0 on Vista?

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 02-20-2007   #1 (permalink)
Joseph Geretz
Guest


 

Any reason Session ID = 1 instead of 0 on Vista?

For as long as I can remember, Session ID for a console session has been 0.
We use this value to identify when our software is running from the console,
or running from within a TS or Citrix session. For a variety of reasons, we
need to know.

Anyway, I'm finding that Vista assigns Session ID of 1 to the console
session. Any reason for this, or just for the purposes of ensuring minimal
backward compatibility?

Thanks,

- Joe Geretz -



My System SpecsSystem Spec
Old 02-20-2007   #2 (permalink)
Robert Moir
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

Joseph Geretz wrote:
> For as long as I can remember, Session ID for a console session has
> been 0. We use this value to identify when our software is running
> from the console, or running from within a TS or Citrix session. For
> a variety of reasons, we need to know.
>
> Anyway, I'm finding that Vista assigns Session ID of 1 to the console
> session. Any reason for this, or just for the purposes of ensuring
> minimal backward compatibility?


It's done for a reason. If you read the old new thing blog at
http://msdn.microsoft.com/oldnewthing you'll see that whatever other
numerous faults we can assign to Microsoft, going around changing important
system parameters just for a giggle to see how many apps they can break in
one day isn't really one of them.

http://www.realvnc.com/pipermail/vnc...er/056565.html might be
of interest to you also.


My System SpecsSystem Spec
Old 02-20-2007   #3 (permalink)
DevilsPGD
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

In message <OP60uZTVHHA.4384@TK2MSFTNGP02.phx.gbl> "Joseph Geretz"
<jgeretz@nospam.com> wrote:

>For as long as I can remember, Session ID for a console session has been 0.
>We use this value to identify when our software is running from the console,
>or running from within a TS or Citrix session. For a variety of reasons, we
>need to know.
>
>Anyway, I'm finding that Vista assigns Session ID of 1 to the console
>session. Any reason for this, or just for the purposes of ensuring minimal
>backward compatibility?


It's part of the process isolation changes in Vista -- Previously, it
was often possible for an app running under Session ID 0 to directly
communicate with services and potentially trick the service into doing
something inappropriate.

Moreover, this change is required for switch user to work.
--
Insert something clever here.
My System SpecsSystem Spec
Old 02-20-2007   #4 (permalink)
Jesper
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

> > Anyway, I'm finding that Vista assigns Session ID of 1 to the console
> > session.


Not quite correct. A console session can be any session other than 0. As for
why the did that...

Short answer: This was done to isolate services from interactive
applications and prevent services from being hacked by end users.

Longer answer:
http://www.microsoft.com/whdc/system.../services.mspx

I don't think identifying console sessions versus terminal server sessions
is really a good plan. With Fast User Switching (which works in a domain in
Vista) any session that is local can actually be a terminal services session.
If you have to do it maybe the better option is to look for the session that
hosts smss.exe or csrss.exe, or one of the other services? I don't know of an
API that lets you identify the origin of a session.


> It's done for a reason. If you read the old new thing blog at
> http://msdn.microsoft.com/oldnewthing you'll see that whatever other
> numerous faults we can assign to Microsoft, going around changing important
> system parameters just for a giggle to see how many apps they can break in
> one day isn't really one of them.


Robert, that link doesn't work.
My System SpecsSystem Spec
Old 02-20-2007   #5 (permalink)
Joseph Geretz
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

> I don't think identifying console sessions versus terminal server sessions
> is really a good plan.


We need to identify the workstation that the user is on (i.e. the physical
device with the keyboard and mouse attached). With a workstation (whether or
not fast user switching is in play) it's going to be the workstation the
application is actually running on. With a Terminal Server, it's a different
device altogether, it's the client PC, not the machine which is hosting the
application process. (I'm not at work and so I don't recall offhand the
different function calls for the different scenarios.)

This is the major reason we need to differentiate. On the other hand, if you
know of an API call such as GetUserWorkstation which does this transparently
for us then we wouldn't need to worry about it ourselves explicitly.

Thanks,

- Joseph Geretz -

"Jesper" <Jesper@discussions.microsoft.com> wrote in message
news:995D1649-7646-4595-B63A-634C44A5688F@microsoft.com...
>> > Anyway, I'm finding that Vista assigns Session ID of 1 to the console
>> > session.

>
> Not quite correct. A console session can be any session other than 0. As
> for
> why the did that...
>
> Short answer: This was done to isolate services from interactive
> applications and prevent services from being hacked by end users.
>
> Longer answer:
> http://www.microsoft.com/whdc/system.../services.mspx
>
> I don't think identifying console sessions versus terminal server sessions
> is really a good plan. With Fast User Switching (which works in a domain
> in
> Vista) any session that is local can actually be a terminal services
> session.
> If you have to do it maybe the better option is to look for the session
> that
> hosts smss.exe or csrss.exe, or one of the other services? I don't know of
> an
> API that lets you identify the origin of a session.
>
>
>> It's done for a reason. If you read the old new thing blog at
>> http://msdn.microsoft.com/oldnewthing you'll see that whatever other
>> numerous faults we can assign to Microsoft, going around changing
>> important
>> system parameters just for a giggle to see how many apps they can break
>> in
>> one day isn't really one of them.

>
> Robert, that link doesn't work.



My System SpecsSystem Spec
Old 02-21-2007   #6 (permalink)
Alun Jones
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

"Joseph Geretz" <jgeretz@nospam.com> wrote in message
news:OP60uZTVHHA.4384@TK2MSFTNGP02.phx.gbl...
> For as long as I can remember, Session ID for a console session has been
> 0. We use this value to identify when our software is running from the
> console, or running from within a TS or Citrix session. For a variety of
> reasons, we need to know.


That sounds dangerously like "we need to do it because we've always needed
to do it, and now that we can't do it, rather than revisit whether we really
need to do it, we need to find a different way to do it".

You may have a valid reason, but I just have to ask the question - for
natural curiosity, if nothing else - why do you feel that you need to
differentiate between running your software at the workstation and running
your software via a terminal link?

Alun.
~~~~


My System SpecsSystem Spec
Old 02-21-2007   #7 (permalink)
Jesper
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

> This is the major reason we need to differentiate. On the other hand, if you
> know of an API call such as GetUserWorkstation which does this transparently
> for us then we wouldn't need to worry about it ourselves explicitly.


Sorry, I don't know whether such an API exists. There are APIs for
OpenWindowStation which may help, but that's all I know. I'd suggest trolling
the SDK and see what you find. I'd also be curious to know whether you find
anything.
My System SpecsSystem Spec
Old 02-21-2007   #8 (permalink)
Alun Jones
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

"Jesper" <Jesper@discussions.microsoft.com> wrote in message
news:41075277-19F2-4F0F-84B9-B4D8F67CF866@microsoft.com...
>> This is the major reason we need to differentiate. On the other hand, if
>> you
>> know of an API call such as GetUserWorkstation which does this
>> transparently
>> for us then we wouldn't need to worry about it ourselves explicitly.

>
> Sorry, I don't know whether such an API exists. There are APIs for
> OpenWindowStation which may help, but that's all I know. I'd suggest
> trolling
> the SDK and see what you find. I'd also be curious to know whether you
> find
> anything.


You could check for the existence of the environment variable "CLIENTNAME",
which will tell you in Citrix and TS sessions what computer was used to
connect in (contrast this with COMPUTERNAME. It generally won't be available
in a session tied to the console - but it might be created, there's nothing
preventing it - a user might say "set clientname=jim" for random reasons.

For TS alone, you could call WTSGetActiveSessionId and compare it to the
result from WTSQuerySessionInformation, as specified in the spec for
WTSQuerySessionInformation. I don't know whether this will work for Citrix
(but I wouldn't be surprised if it does).

Alun.
~~~~


My System SpecsSystem Spec
Old 02-27-2007   #9 (permalink)
Joseph Geretz
Guest


 

Re: Any reason Session ID = 1 instead of 0 on Vista?

Hi Alun,

> natural curiosity, if nothing else - why do you feel that you need to
> differentiate between running your software at the workstation and running
> your software via a terminal link?


We need to identify the workstation that the user is on. Since this
information is derived differently depending on whether the process is
running on a workstation or within a Terminal Session, we need to know.

Also, we've identified certain features within our code which run
differently on TS than on a workstation. These are few and far between,
however we need to distinguish between these different environments in order
to avoid problems.

BTW, I am able to do this. With a little bit of recoding to account for how
the rules of the game have changed for Vista, I can accommodate both Vista
and pre-Vista conditions.

- Joseph Geretz -

"Alun Jones" <alun@texis.invalid> wrote in message
news:%23HDyhtdVHHA.3332@TK2MSFTNGP04.phx.gbl...
> "Joseph Geretz" <jgeretz@nospam.com> wrote in message
> news:OP60uZTVHHA.4384@TK2MSFTNGP02.phx.gbl...
>> For as long as I can remember, Session ID for a console session has been
>> 0. We use this value to identify when our software is running from the
>> console, or running from within a TS or Citrix session. For a variety of
>> reasons, we need to know.

>
> That sounds dangerously like "we need to do it because we've always needed
> to do it, and now that we can't do it, rather than revisit whether we
> really need to do it, we need to find a different way to do it".
>
> You may have a valid reason, but I just have to ask the question - for
> natural curiosity, if nothing else - why do you feel that you need to
> differentiate between running your software at the workstation and running
> your software via a terminal link?
>
> Alun.
> ~~~~
>



My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista restarts for no reason jigglychar Vista performance & maintenance 4 02-09-2008 11:01 PM
what could be the reason for vista hanging sLeeK Vista installation & setup 1 01-13-2008 11:29 PM
VPN Session Icon Disappears, so I can't close Session mcambrose Vista file management 0 11-29-2007 09:16 AM
vista session limits ray Vista General 2 08-02-2007 03:44 PM
Any reason Session ID = 1 instead of 0 on Vista? Joseph Geretz Vista General 8 02-27-2007 01:21 PM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51