Re: Desktop Creation
- From: BT <BT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Sep 2007 12:12:08 -0700
Ok, the problem happens only on Vista (tested on XP, XP SP1, XP SP2 and
Windows Server 2003).
My version of Vista is Vista Ultimate English.
I use Visual Studio 2005 Pro in C#.
The problem is the following. I have a service started by SCM (services.exe)
which have to launch a GUI application with a different security context and
attached on a new deskop of the interactive window station (WinSta0). First,
I logon the user with LsaLogonUser() API and after I have to create the new
desktop. As my service runs without interactive desktop, I open the WinSta0
(OpenWindowStation), 'impersonate' my service using SetWindowStationProcess()
and use CreateDekstop() to create a desktop. The impersonation must be done
because CreateDesktop has not parameter for window station :
HDESK CreateDesktop(
LPCTSTR lpszDesktop,
LPCTSTR lpszDevice,
LPDEVMODE pDevmode,
DWORD dwFlags,
ACCESS_MASK dwDesiredAccess,
LPSECURITY_ATTRIBUTES lpsa
);
Win32k.sys use internally the window station attached to current process.
After have created the desktop, I launch the GUI process with
CreateProsessAsUser and specify the newly created desktop. That works very
fine on old NT kernel (XP, 2003, ...). But with Vista, the service runs in
another session (Session ID 0). The session is not depend on process but
security context (aka, token attached to the process). As no API exists to
create a deskop in a specific session, I tried to change the session Id of
the service process token (SYSTEM) after have duplicate it. But this means
failed (using SetTokenInformation with TokenSessionId parameter). I also
tried to impersonate a logged user but without good results. My question is
simple : how a process which runs in Session N can create a desktop in
another session M ? A workaround is, from the service (Session N), to create
a process with a security context associated with the session M and delegate
to this new process the desktop creation. But this is strange that no API
exists to create a desktop in another session.
Do not hesitate to ask me for more informations.
Thanks very much for you response.
Best regards.
"David J. Craig" wrote:
Restate your problem. Include minor details such as compiler used, SDK.
version, OS (including 32 or 64 bit), and how the process is created.
"BT" <BT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:71ACD29C-0EB1-43A2-8193-2DD42890DF74@xxxxxxxxxxxxxxxx
Thanks for you response, but it just works when a process A start another
process B in another desktop but in the same session. If session is
different, it is impossible to create a desktop in the WinSta0 of the
other
session. The OpenWindowStation() does not work to open station on another
session, event if object manager namespace like name '<depend on
system>\Session 1\WinSta0' is used.
Sorry, but this response dos not answer to my question.
Thanks very much for your response.
"Kellie Fitton" wrote:
On Sep 13, 9:58 am, BT <B...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
From a processus running in SYSTEM security context and Session 0, how
can I
create a desktop on another Session. It seems that API like
OpenWindowStation() and CreateDekstop() apply always on the processus
session
even if a duplicated secuirty token with other session number is used
as
impersonation. For instance, I use a security token with session 1 but
desktop creation continue to apply on session 0. Create a new deskop
and ACL
it from session 0 to another session is not a potential security risk.
If this question is out of subject here, could you tell me where I can
post
this question.
Thanks.
Hi,
The following weblink should give you some pointers:
http://msdn2.microsoft.com/en-us/library/Aa379608.aspx
Kellie.
- Follow-Ups:
- Re: Desktop Creation
- From: Stefan Kuhr
- Re: Desktop Creation
- From: David J. Craig
- Re: Desktop Creation
- References:
- Re: Desktop Creation
- From: David J. Craig
- Re: Desktop Creation
- Prev by Date: Re: Desktop Creation
- Next by Date: Re: Desktop Creation
- Previous by thread: Re: Desktop Creation
- Next by thread: Re: Desktop Creation
- Index(es):
Relevant Pages
|