访问外部窗口句柄 [英] Access to external window handles

查看:145
本文介绍了访问外部窗口句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在处理的程序有问题。它是由vista / Windows 7中增加的安全性造成的,特别是UIPI,它阻止了一个具有较低完整性级别的窗口与较高的一个说话。



案例,我想告诉窗口与高完整性级别进入我们的应用程序,它在XP或Windows 7上安全关闭的完美无缺的工作。



我有尝试直接设置更高IL窗口的HWND,而不是使用findwindow()函数,这工作正常,但尝试移动它或通常与它交互时,程序失败。窗口句柄由应用程序保存以便由在较低IL处运行的应用程序嵌入和读取。



我还尝试将清单中的UIaccess设置为TRUE并进行数字签名程序,但没有运气。



有关如何解决这个问题的任何想法?
感谢。

解决方案

只是想我会跟着这个,因为任何人谁也挣扎,



我有2个应用程序,highIL.exe和lowIL。 exe,highIL想要找到lowIL.exe窗口,将其设置为子窗口,并将其移动到在highIL.exe上为其创建的区域。这被vista +中的UIPI阻止。



最后我在vista中使用了ChangeWindowMessageFilter方法,在Windows7中使用了ChangeWindowMessageFilterEx,它们都在user32.dll中。这些功能允许你在UIPI中打一个洞,允许你想要的消息。



我使用RegisterWindowMessage函数创建了一些自定义消息,我使用这个函数在highIL和lowIL应用程序中注册该方法,该行看起来有点像这样: p>

  const UINT MY_MOVEINTWINDOW_MSG = RegisterWindowMessage(_T(MyMsg.MoveWindow)); 

然后,lowIL.exe能够将这些消息发送到highIL.exe窗口, 。



这个方法只有在你有权限访问高和低IL时才能工作。
MSDN还有一个ChangeWindowMessageFilterEx函数的工作示例,其中有网站


I am having a problem with the program I am currently working on. It is caused by the increased security in vista/Windows 7, specifically the UIPI which prevents a window with a lower integrity level 'talking' to a higher one.

In my case, i am wanting to tell the window with a high Integrity level to move into our application, It works flawlessly on XP or windows 7 with the security off.

I have tried setting the HWND of the higher IL window directly, rather than using the findwindow() function, this works fine but the program then fails when trying to move it or generally interact with it. The windowhandle is saved by the app to be embedded and read by the app running at a lower IL.

I have also tried setting UIaccess in the manifest to TRUE and digitally signing the program but no luck.

Any ideas on how to solve this problem? thanks.

解决方案

Just thought i would follow this up for anyone who also struggled as I have finally found a way to do this.

IL = Integrity Level.

I had 2 apps, highIL.exe and lowIL.exe, the highIL wanted to find the lowIL.exe window, set it as a child window and move it into a zone created for it on the highIL.exe. This was blocked by the UIPI in vista+.

In the end i used the ChangeWindowMessageFilter method in vista and the ChangeWindowMessageFilterEx in Windows7, both found in the user32.dll. These functions allow you to poke a hole in the UIPI to allow messages that you want through.

I created a few custom messages using RegisterWindowMessage function, I used this function to register the method in both highIL and lowIL applications, the line looked a little like this:

const UINT MY_MOVEINTWINDOW_MSG = RegisterWindowMessage(_T("MyMsg.MoveWindow"));

The lowIL.exe is then able to send these messages to the highIL.exe window without them being blocked. Then it was a case of just simply adding and writing message handlers.

This method will only work if you have access to both the high and low IL. The MSDN also has a working example of the ChangeWindowMessageFilterEx function on there Website

这篇关于访问外部窗口句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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