Re: Interactive Services related to desktop
From: Samuel Lee (samthebigbear_at_gmail.com)
Date: 11/17/04
- Previous message: Kelvin Yiu [MS]: "Re: XEnroll and local machine's cert store"
- In reply to: Eric Perlin [MS]: "Re: Interactive Services related to desktop"
- Next in thread: Rob: "Re: Interactive Services related to desktop"
- Reply: Rob: "Re: Interactive Services related to desktop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 16 Nov 2004 17:51:42 -0800
We have a dll which exports function(ShowDialog). We call the function
from the service present in the dll; and the ShowDialog function
creates a Thread and then the thread displays the dialog. Is it
recommended way?
We are not sure how to change the Thread Session ID to current Sesson
ID --(Is it not allowed because threads can not cross session
boundares?) If we can not change Thread Session ID, how should we
resolve this matter? We need to have the Thread to draw the dialog
across the multiple session. Does anyone know how to draw the dialog
on the Login Window for multiple users?
Thank you
"Eric Perlin [MS]" <ericperl@online.microsoft.com> wrote in message news:<eIn#rs5wEHA.1564@TK2MSFTNGP09.phx.gbl>...
> I recommend you stay away from interactive services. Not only do they have
> serious security implications, but they can not be used in FUS and TS
> (Terminal Services) environments, as you found out. FUS leverages TS
> (multiple TS sessions, with only one bound to the physical console) and
> processes can not cross session boundaries. Your service is hosted in a
> process that exists in session 0. It will never be able to display UI in
> other sessions.
> --
> Eric Perlin [MS]
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ---
>
> "Samuel Lee" <samthebigbear@gmail.com> wrote in message
> news:c94893b3.0411012243.5fb71ac0@posting.google.com...
> > Hi,
> > I am writing a Service that will authenticate the users during the
> > Login.
> > The way I implement this scheme is that I start separate thread that
> > draws dialog whenever the service get Event Notification (Lock,
> > Logoff, Startup) from winlogon.
> >
> > Since it is a interactive service, Windows Station that the thread
> > gets assigned is WinSta0. What I am trying to do is whenever I get
> > either Lock, Logoff, and Startup Message, I start a thread to draw
> > dialog on the "Winlogon" Desktop.
> >
> > The problem from this is that if there are multiple users, dialog does
> > not always appear on the LogIn window even I know that the thread has
> > drawn the dialog especially during the Fast User Switching. More
> > specifically, whenever I fast user switch out of the first user that I
> > log onto to any other users, Dialog appears. However, whenever I fast
> > user switch out of second or third user that I log onto to any other
> > user doesn't work.
> >
> > Did anyone have similar problem with this? Could Someone PLEASE help
> > me...
> > Thank you,
> >
> > Here is a piece of code that the thread is executing:
> >
> > DWORD dwThreadId;
> > HWINSTA hwinstaSave;
> > HDESK hdeskSave;
> > HWINSTA hwinstaUser;
> > HDESK hdeskUser;
> > HWND hParent = NULL;
> >
> > // Ensure connection to service window station and desktop, and
> > // save their handles.
> >
> > hParent = GetDesktopWindow();
> > hwinstaSave = GetProcessWindowStation();
> > hdeskSave = GetThreadDesktop(dwThreadId);
> >
> > hwinstaUser = OpenWindowStation(TEXT("Winsta0"), FALSE,
> > MAXIMUM_ALLOWED);
> >
> > if (hwinstaUser == NULL)
> > {
> > DEBUG_MSG("return in windowstation here....\n");
> > return 0;
> > }
> >
> > //SETTING THE WINDOW STATION TO Winsta0 and DESKTOP to Winlogon
> > SetProcessWindowStation(hwinstaUser);
> > hdeskUser= OpenDesktop(TEXT("Winlogon"), NULL, FALSE,
> > MAXIMUM_ALLOWED);
> > if (hdeskUser== NULL)
> > {
> > DEBUG_MSG("return in windowstation here....\n");
> > return 0;
> > }
> > SetThreadDesktop(hdeskUser);
> >
> > hParent = GetDesktopWindow();
> >
> >
> > g_hWnd =
> CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FINGER_PRINT),NULL,Welcome
> DlgProc,0);
> > SetWindowPos(g_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);
> > UpdateWindow(g_hWnd);
> >
> > // Restore window station and desktop.
> > SetThreadDesktop(hdeskSave);
> > SetProcessWindowStation(hwinstaSave);
> > CloseDesktop(hdeskUser);
> > CloseWindowStation(hwinstaUser);
> >
> >
> > int status;
> > MSG msg;
> > while ( ( status = GetMessage( &msg, NULL, 0, 0 ) ) != 0 )
> > {
> > if ( status == -1 )
> > return -1;
> >
> > if ( !IsDialogMessage( g_hWnd, &msg ) )
> > {
> > TranslateMessage( &msg );
> > DispatchMessage( &msg );
> > }
> > }
> > return 1;
- Previous message: Kelvin Yiu [MS]: "Re: XEnroll and local machine's cert store"
- In reply to: Eric Perlin [MS]: "Re: Interactive Services related to desktop"
- Next in thread: Rob: "Re: Interactive Services related to desktop"
- Reply: Rob: "Re: Interactive Services related to desktop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|