应用程序虚拟化是如何实现的?

发布于 2024-08-30 04:53:20 字数 434 浏览 3 评论 0原文

我试图了解 App-V 和 sandboxie (App-V 等软件="http://www.sandboxie.com/" rel="noreferrer">http://www.sandboxie.com/) 工作。但就我的一生而言,我想不出有什么可以让这一切成为可能。他们如何拦截 API 调用并欺骗目标软件?如果有人说这只是魔法和仙尘,我会相信他们。说真的,有没有讨论这个问题解决方案的白皮书?

如果这在 CLR 级别上是可能的,那就太好了,但如果必须的话,我愿意采用本地化。

I am trying to understand how software like App-V and sandboxie (http://www.sandboxie.com/) work. But for the life of me, I can't think of anything that could make this possible. How do they intercept API calls and trick the target software? If someone would say that it's just magic and pixie dust, I would believe them. Seriously though, are there any white papers that discuss solutions to this problem?

If this is possible on the CLR level then that would be good but I'm willing to go native if I have to.

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

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

发布评论

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

评论(3

给不了的爱 2024-09-06 04:53:20

Sandboxie 本质上是通过将代码注入核心 Windows API 来实现的,就像病毒一样(这就是为什么 Vista x64 阻止这种行为,以及 Sandboxie 不能在该操作系统上工作的原因)。

这里是一个解释 API 挂钩的项目。我通过研究 Metamod:Source 的源代码(用于 CounterStrike 的 SourceMod)了解了这一切是如何工作的:来源 :) )

Sandboxie does it by essentially injecting code into core Windows API, the same way a virus would (which is why Vista x64 prevents this behaviour, and why Sandboxie doesn't work on that OS).

Here is a project explaining API hooking. I learned how all this work by studying the sourcecode for Metamod:Source (used for SourceMod for CounterStrike:Source :) )

默嘫て 2024-09-06 04:53:20

我不知道MS是如何做到的,但这是一种方法的基本理论......

你想要做的是挂钩到系统调用(类似于链接到中断)。

  1. 发生系统调用。
  2. 您的自定义拦截将被执行。
  3. 如果该系统调用不需要特殊处理,则继续。否则需要特殊处理并转到步骤 4。
  4. 从堆栈中获取堆栈指针、指令指针和所有这些爵士乐,并构建一个新的堆栈帧以将您发送回用户态中的自定义代码。
  5. 对用户空间中的数据、路径和内容进行处理。这样,如果底层操作系统发生变化,则不必[频繁]更新此代码。
  6. 所有数据处理完毕后,再次执行系统调用。
  7. 您的自定义中断将再次执行,但它应该检测到您正在从用户态帮助器层进行调用,并将该调用传递出去。可能需要一些堆栈帧操作来设置正确的返回地址。
  8. 常规系统调用执行。
  9. 当系统调用返回时,堆栈帧应该将您带回常规程序流程。

希望这有帮助。

I don't know how MS did it, but here is the basic theory of one way to do it ...

What you want to do is hook into the system calls (similar to chaining into interrupt).

  1. System call occurs.
  2. Your custom intercept gets executed.
  3. If this syscall does not need special processing, continue on. Otherwise it needs special processing and go to step 4.
  4. Get the stack pointer, instruction pointer and all that jazz from the stack, and build a new stack frame to send you back to your custom code in user-land.
  5. Do your massaging of data and paths and stuff in user land. This way if the underlying OS changes, this code does not have to be updated [as frequently].
  6. After all the data massaging, execute the system call again.
  7. Your custom interrupt executes again, but it should detect that you are calling from your user-land helper layer and pass the call on through. Some stack frame manipulation may be required to set up proper return addresses.
  8. Regular system call executes.
  9. When the system call returns, the stack frame should should send you back to your regular program flow.

Hope this helps.

破晓 2024-09-06 04:53:20

查看 X86 虚拟化 上的维基百科页面,其中讨论了软件虚拟化 (早期的 VMWare、Wine、Sandboxie 以及一定程度上的 App-V)和更现代的硬件虚拟化(Hyper-V、VMWare 等)。

我假设您正在专门寻找软件虚拟化,因为通过使用 .NET(或任何 CLR),您已经在一定程度上将自己从 CPU 架构中抽象出来,尤其是使用“AnyCPU”目标。

Check out the Wikipedia page on X86 Virtualization which discusses both software virtualization (early VMWare, Wine, Sandboxie and to an extent App-V) and the more modern hardware virtualization (Hyper-V, VMWare, others).

I'm assuming you're looking specifically for software virtualization as by using .NET (or any CLR) you're already abstracting yourself away from the CPU architecture to an extent, especially with the 'AnyCPU' target.

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