http://bugs.winehq.org/show_bug.cgi?id=36692
--- Comment #7 from milasudril@gmail.com --- (In reply to Vincent Povirk from comment #6)
DuplicateHandle can still pull an anonymous event handle out of another process and start using it.
So, you either need the server to be able to tell the process that controls a handle that it's being moved into the server, or you need a more efficient way of doing this that works across processes.
What about letting DuplicateHandle change the behaviour of the event functions. If an event is created with
CreateEvent(NULL,0,0,NULL);
set vtable pointers associated with the event so they point to an implementation like pevents. When something is done that this implementation cannot do (DuplicateHandle, I guess WaitForMultipleObjects too since that function can take an hetrogenous array of waitable objects), switch to current implementation. This implies that all tricky functions need to copy the state of the event and create it inside wineserver. A drawback is that there will probably be a need for a mutex when this transfer is done.