There are Windows terminal Services APIs and notifications that you could use to get some of the information.

Check out WTSEnumerateSessions, WTSRegisterSessionNotification APIs and such.