Boah, meine Fresse! Darauf muss man erstmal kommen.
Man muss nach Anmeldung der Notifizierung definitiv GetSessionEnumerator aufrufen, dann geht das erst.
Siehe Beispielprojekt im Anhang!
Drauf gekommen bin ich deswegen:
Zitat von
Larry Osterman:
The first is that his application hasn't retrieved the current list of sessions. This is one of the really subtle things about the session enumeration APIs. In order to prevent a race condition that can occur when a session notification arrives while the application using the session APIs is starting up, the session enumeration
API discards new session notifications until the application has first retrieved the list of existing sessions.
The expected usage pattern is:
Application activates a session manager2. Application registers for session notifications. Application retrieves the current list of sessions for the endpoint and stores the session control objects into a list (don't forget to addref the session).
When a new session is created, the application takes a reference to the newly created session control object and inserts it into the list if it's not already present. Note that the session control object passed into the notification will be destroyed when the session notification returns - if you call GetSessionEnumerator at this point it will probably NOT hold the newly created session (it might, it all depends on timing).
https://stackoverflow.com/a/740241