Win32:如何将消息发布到Windows中其他用户运行的进程? [英] Win32: How to post message to a process run by a different user in Windows?

查看:145
本文介绍了Win32:如何将消息发布到Windows中其他用户运行的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们运行两个应用程序,每个应用程序都使用RegisterWindowMessage()注册同一条消息:在计算机上同一用户会话中,应用程序A作为常规用户,应用程序B作为管理员在应用程序中,这些应用程序会将这个消息发送给另一个. 当A和B以同一用户身份运行时,一切都很好,并且我们能够使用PostMessage()消息进行通信.现在,随着应用程序B的运行,管理员消息不再出现.我们该怎么办?

We run two application, each of them register the same message using RegisterWindowMessage(): application A as a regular user and application B as administrator in the same user's session on the machine, and those applications would send this message one to another. When A and B were run as a same user everything was fine and we were able to communicate using PostMessage() messaging. Now as application B is run as administrator messages do not come through any more. What can we do about it?

这种情况是否要求我们使用其他机制(消息以外的其他机制)?

Does this situation mandate us to use other mechanisms (other than messages)?

推荐答案

在Windows Vista和更高版本中, ChangeWindowMessageFilter() ChangeWindowMessageFilterEx() 表示要从较低完整性过程中接收的每个被阻止的消息.

In Windows Vista and later, User Interface Privilege Isolation (UIPI) prevents a lower integrity process from sending window messages to a higher integrity process. In earlier Windows versions, malicious code could attack administrative processes by misusing window messages. By default, UIPI blocks all messages with a value above WM_USER, which includes messages registered via RegisterWindowMessage(). So, in order to allow A to send such messages to B, B must first call ChangeWindowMessageFilter() or ChangeWindowMessageFilterEx() for each blocked message that it wants to receive from lower integrity processes.

这篇关于Win32:如何将消息发布到Windows中其他用户运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆