Re: Windows Service - Fast User Switching - Find Active Desktop Problem

From: Peter Boulton (news_at_Data*n0-spam*Perceptions.co.uk)
Date: 04/18/05


Date: Mon, 18 Apr 2005 14:14:03 +0100

Eduardo Francos wrote on 18/04/2005 07:12:
> Peter Boulton wrote:
>
>> Hi,
>>
>> I am writing a Windows Service, which is allowed to interact with the
>> desktop. (I realise that this is not recommended, but it is currently
>> a constraint.) It needs to post advice windows on the desktop of
>> whoever is logged in. With fast user switching this could be any one
>> of any number of concurrent sessions. My service needs to post the
>> windows to the active session, so that the active user can interact
>> with it.

   <snipped>
>
>
> AFAIK services are always run in the console terminal session, Session
> 0. Addressing WinSta0 from a service will then always point to that
> session.
>
> Running a program within the security context of the user can be done
> simple by adding a UI client program in the Run key of HKLM or HKCU,
> then use whatever IPC scheme that suits your needs to communicate with
> the service.
> You may use the WTSRegisterSessionNotification related API group to know
> when user sessions are activated/deactivated so the service knows which
> client to notify. Alternatively the service can notify all connected
> clients and have the client UI decide whether to interact with its user
> or not.
>
> For further information you can refer to "How To Design a Service to
> Interact with Multiple User Sessions"
> http://support.microsoft.com/default.aspx?scid=kb;en-us;308403
>
> or "Fast User Switching: Issues for Assistive Technology Vendors"
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/accessibility.asp
>
>
>
>
> Eduardo

Thanks for the reply. So, are you saying what I want to do is
impossible? That is, launch a process in the currently logged on user's
context from my service, on the desktop of whoever has sent the ipc via
  a named pipe to my service?

If so, how do I get this, given the named pipe handle from the calling
process?

Please be gentle with me - this stuff is very new to me! Code example
would be very much appreciated!

Thanks.

Pete



Relevant Pages

  • Re: Session 0 bug in TranslateBitmapBits on Vista/Windows Server 2
    ... oddity is that in session 0, TranslateBitmapBits expects the bitmap as BGRA ... Are you aware that Session 0 on Windows Vista or Windows Server 2008 is ... Even if the user cannot see or interact with the session, ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Problems logging on to Windows Based Server.
    ... This problem occurs because the Windows 2000-based server rejects your logon ... structure that is used to track the logon session. ... The client attempts to ... This problem does not occur in conjunction with Microsoft Windows NT-based ...
    (microsoft.public.security)
  • Re: Session 0 bug in TranslateBitmapBits on Vista/Windows Server 2
    ... Are there any performance considerations around session 0's use of the ... oddity is that in session 0, TranslateBitmapBits expects the bitmap as ... Are you aware that Session 0 on Windows Vista or Windows Server 2008 is ... Even if the user cannot see or interact with the session, ...
    (microsoft.public.win32.programmer.gdi)
  • Re: RDP Crashing
    ... I sometimes cannot RDP into my Windows XP ... I leave the session locked but active. ... administrator (which kills the active session), logout, and login as myself. ... connect my W2k Client. ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: tcp 139 or 445
    ... Windows can now support direct hosting of SMB over tcp port 445. ... client open a tcp/445 socket. ... Packet: Session Request ...
    (microsoft.public.windows.server.networking)