Windows has a terrible mechanism for inter-thread procedure calls. This is a way to get another thread to call a function determined by the sending thread. (What could possibly go wrong with that?) There are some security safeguards around this, but not enough.
This looks like something left over from the Windows 3.1/DOS days of no memory protection. Microsoft does not recommend it for threads outside the caller's process[2], but it's still in the OS. Some Windows expert might try disabling it for inter-process calls and see what breaks. It's only supposed to work for "desktop processes" anyway; for servers it could be disabled.
(I'm all in favor of inter-process calls, but the QNX MsgSend/MsgReceive/MsgReply mechanism is far better than this. Most others are far worse. Either performance or security is poor.)
[1] https://breakingmalware.com/injection-techniques/atombombing... [2] https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...