通过 ICLRRuntimeHost 和 ExecuteInDefaultAppDomain() 在远程进程 CLR 运行时运行代码

发布于 2024-09-19 22:26:16 字数 1060 浏览 6 评论 0原文

我尝试结合 编码轮子 和分析器附加。一切似乎都很顺利,除了当我尝试枚举远程进程的默认应用程序域中正在运行的程序集时,我没有得到正确的列表。

    public class remoteFoo {
    public static int sTest(String message) {
    AppDomain currentDomain = AppDomain.CurrentDomain;
    Assembly[] assems = currentDomain.GetAssemblies();
    MessageBox.Show("List of assemblies loaded in current appdomain:");
              foreach (Assembly assem in assems)
                  MessageBox.Show(assem.ToString()); //remoteFoo gets listed, but not hostBar.
return 3; } }
remoteFoo gets listed, but not hostBar. Basically I want to use introspection to run code in the remote process's appdomain. But it seems that I don't have the right appdomain...

这是我使用的代码的链接: main.cpp

I tried to combine the examples at coding the wheel and profiler attach. Everything seems to go fine, except, when I try to enumerate running assemblies in the remote processes' default appdomain, I don't get the right list.

    public class remoteFoo {
    public static int sTest(String message) {
    AppDomain currentDomain = AppDomain.CurrentDomain;
    Assembly[] assems = currentDomain.GetAssemblies();
    MessageBox.Show("List of assemblies loaded in current appdomain:");
              foreach (Assembly assem in assems)
                  MessageBox.Show(assem.ToString()); //remoteFoo gets listed, but not hostBar.
return 3; } }

remoteFoo gets listed, but not hostBar. Basically I want to use introspection to run code in the remote process's appdomain. But it seems that I don't have the right appdomain...

Here is a link to the code I use: main.cpp

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文