在另一个任意应用程序中调用 .NET 对象的方法

发布于 2024-08-03 14:08:06 字数 222 浏览 11 评论 0原文

我问这个问题主要是出于好奇。

当使用 TestComplete 时,我注意到我可以将我的脚本指向任意正在运行的 .NET 应用程序,抓取一个控件,对其进行反射,甚至调用它的方法。我不知道他们是如何做到这一点的。据我所知,这不是简单的 UIAutomation,因为我可以获取私有字段。另外,这不是远程处理,因为该应用程序没有额外的钩子。

如何获取在另一个进程上运行的另一个 .NET 对象并调用它?

I'm asking mostly out of idle curiosity.

When using TestComplete, I've noticed I can point my script at an arbitrary running .NET application, grab a control, reflect on it, and even call methods on it. I have no idea how they pull this off. This isn't simple UIAutomation, as far as I can tell, since I can grab private fields. Also, this isn't remoting, because the app has no extra hooks.

How can I get a hold of another .NET object running on another process and call into it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

身边 2024-08-10 14:08:07

这是代码注入的一种形式。

一旦您被注入执行诸如获取私有变量之类的侵入性操作,使用 .Net 就会容易得多,因为内省方面已经内置供您使用。

这篇代码项目文章向您展示了如何做到这一点

This is a form of code injection.

It is just much easier with .Net once you have been injected to do invasive things like grabbing private variables and the like because the introspection aspects are already built in for you to use.

This code project article shows you how to do it

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文