I've tried a little setup for this:
one dll and one exe.
The first exe to load the dll creates the filemap and the timer thread.
The dll sets timerhandles for use with the timer thread.

This is what I want, but I can't get access to the handles from the other processes that load the dll (other instances of the same exe).
I've read that you have to use DuplicateHandle to get a copy of a WaitableTimer. But I can't use it, because I don't know which processes will load the dll.
So I thought I could use the filemap to save the handles of the timers and call duplicatehandle for each attaching process. This doesn't work because I still need a handle to the process that created the timers. And I can't use that handle unless I duplicate it, and there I have the same problem again.
And I can't communicate between the processes because I don't own them (in this example with multiple instances of the same exe I do, but in my real program I don't).
How can I use the handles in different processes? (or any handle for that matter...)

I thought about saving the handle to the creating process in the filemap. But using the handle returned by GetCurrentProcess() is only allowed in the process itself.
I just read something about OpenProcess() which can create a handle to a process from the processID (which can be stored in a filemap?). Then I can duplicate the handles of the timers stored in the filemap? (I don't think so, because the handles stored in the filemap are still not valid when duplicating in the new process).

I'm just brainstorming here, if you have an idea, feel free to jump right in

Joren