Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for session change notifications #2

Open
GoogleCodeExporter opened this issue Jan 5, 2016 · 9 comments
Open

Add support for session change notifications #2

GoogleCodeExporter opened this issue Jan 5, 2016 · 9 comments

Comments

@GoogleCodeExporter
Copy link

WTSRegisterSessionNotification(Ex)

Original issue reported on code.google.com by danports on 10 May 2009 at 1:34

@GoogleCodeExporter
Copy link
Author

You can already receive session change notifications in services (via 
ServiceBase.OnSessionChange), which is where notifications are usually most 
useful, so I don't think this is a high priority.

Original comment by danports on 8 May 2011 at 12:39

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Issue 47 has been merged into this issue.

Original comment by danports on 12 Feb 2012 at 12:00

@GoogleCodeExporter
Copy link
Author

WTSRegisterSessionNotificationEx (which allows monitoring of remote RD servers) 
requires Vista/2008. On older platforms, it may be possible to work around this 
using an undocumented function in winsta.dll, but I wouldn't count on that 
being easy to implement.

Original comment by danports on 15 Feb 2012 at 3:53

@GoogleCodeExporter
Copy link
Author

WTSWaitSystemEvent is another option, but the function is riddled with bugs -- 
sometimes notifications are dispatched twice, sometimes the WTS_EVENT_FLUSH 
value doesn't work. But it's a possibility for supporting remote XP/2003 
session notifications.

See:
- http://msdn.microsoft.com/en-us/library/windows/desktop/aa383856(v=vs.85).aspx
- http://www.remkoweijnen.nl/blog/2008/01/25/using-wtswaitsystemevent/

Original comment by danports on 15 Feb 2012 at 4:06

@GoogleCodeExporter
Copy link
Author

Original comment by danports on 15 Feb 2012 at 4:28

  • Added labels: Milestone-2.1

@GoogleCodeExporter
Copy link
Author

Use the same technique the Microsoft.Win32.SystemEvents class uses to create a 
hidden window to receive the relevant messages. WTSWaitSystemEvent doesn't 
provide as much information as WTSRegisterSessionNotificationEx. We could 
support WTSRegisterSessionNotification for local notifications on XP/2003, but 
it's probably not worth supporting notifications for remote systems on those 
platforms (unless we can dig up the relevant internal API easily -- XP/2003 are 
in the extended support phase already). There's 
WinStationRegisterNotificationEvent in winsta.dll, but it's not clear how that 
works without doing some spelunking.

Original comment by danports on 26 Feb 2012 at 2:45

  • Added labels: Estimate-8

@GoogleCodeExporter
Copy link
Author

hey there,
if you use a Windows Service you can easily receive session changes:
just override the OnSessionChange method and set CanHandleSessionChangeEvent to 
true.
This method is fairly spare documented although it works.

Original comment by christop...@gmail.com on 13 Sep 2012 at 2:03

@GoogleCodeExporter
Copy link
Author

Thanks for the comment. I actually use the OnSessionChange method in one of my 
projects and noted it in the first comment -- this improvement would be for 
non-service applications that want to receive session change notifications 
(e.g. a RD Services Manager type app).

Original comment by danports on 14 Sep 2012 at 2:42

@GoogleCodeExporter
Copy link
Author

Issue 77 has been merged into this issue.

Original comment by danports on 23 Jan 2015 at 11:55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant