As many people quickly figured out, the reason why the
the WaitForSingleObject returns immediately
is that the call is failing.
The reason is that the second process opened the handle
with EVENT_MODIFY_STATE access,
which
grants permission to call
the SetEvent function,
the ResetEvent function,
and
the fatally flawed PulseEvent function...