如何从 C 程序将 AIR 运行时加载为进程内共享库

发布于 2024-07-13 04:44:52 字数 1230 浏览 7 评论 0原文

我想按照 java.exe 的方式用 C 语言构建一个特殊的 AIR 启动程序。

我使用进程查看器查看了运行 AIR 程序,并能够找到正在使用的 AIR 运行时 DLL。 AIR 程序与 Java 不同,因为它们作为特定于平台的可执行文件安装,启动后将 AIR 运行时绑定为进程内共享库(用户双击其图标)。

好吧,我想制作一个类似于 java.exe 的 AIR 启动器。

java.exe 作为平台操作系统进程启动,该进程作为进程内共享库绑定到 Java JVM 运行时 (JRE)。 要执行的 java 应用程序被指定为 java.exe 的命令行参数。 一旦 java.exe 运行并且 JVM 功能齐全,指定的 java 应用程序类就会被 JVM 类加载器加载并执行。 然后,指定的 Java 应用程序接管,从某种意义上说,“劫持”了 java.exe 的进程。 当然,指定的 java 应用程序会在任何进程列表中显示为托管它的 java.exe 程序。

我想让 AIR 应用程序启动像这样工作。 为什么? 因此,我可以探索破解 AIR 的方法,或许还可以克服它的许多缺陷。 例如,对于初学者来说,我想通过一些可供运行的 AIR 应用程序使用的新 API 来扩展 AIR 运行时体验。

我的首要任务是:

  • 实现一个绑定接口 ActionScript3 与 C 具有可比性 向 .NET PInvoke
  • 添加用于启动进程的 API 与中找到的 API 相当 Java SE 用于执行此操作(Runtime.exec、 ProcessBuilder、Process)
  • 添加对 AIR 应用程序的支持 能够与标准输入交互, 标准输出、标准错误。 但奇怪的是 Adobe 添加了对本地文件的支持 在 AIR 中访问,他们省略了 与这些标准文件的交互 管道(但它们被发现在任何 AIR 支持的操作系统平台)。
  • 通过 stdin 实现 AMF 支持, stdout、stderr - 所以 AIR(或 Java 或 任何支持 AMF 的语言)应用程序都可以 进程间通信通过 交换 AMF 对象。 这会添加 微软的 PowerShell 的一点点 到空气。

目前Merapi提供了AMF与Java的桥接,因此展示了它的功效。 唉,Merapi 必须使用本地主机端口和套接字来进行进程间通信 - 相对于使用 stdin/stdout/stderr 进程间管道来说,这是一种笨拙的方法。

I'd like to build a special AIR launcher program in C along the lines of java.exe.

I've looked at running AIR programs with a process viewer and was able to locate the AIR runtime DLL that is being used. AIR programs are different than Java in that they are installed as platform-specific executables that bind the AIR runtime as an in-process shared library once they're launched (their icon is double-clicked by the user).

Well, I want to make an AIR launcher that is instead like the java.exe.

The java.exe is launched as a platform OS process that binds to the Java JVM runtime (JRE) as an in-process shared library. The java application that is to be executed is specified as a command-line argument to java.exe. Once java.exe is running and the JVM is fully functional, the specified java application class is loaded by the JVM class loader for execution. That specified Java application then takes over, in a sense "hijacking" the process of java.exe. Of course, the specified java application shows up in any process listing as the java.exe program that host it.

I want to make AIR app launching work like this. Why? So I can explore ways to hack AIR and perhaps overcome some of its many, many deficiencies. For instance, for starters I want to extend the AIR runtime experience with some new APIs that become available to the running AIR application.

My first order of business would be to:

  • Implement a binding interface of
    ActionScript3 to C that is comparable
    to .NET PInvoke
  • Add an API for process launching that
    is comparable to the APIs found in
    Java SE for doing this (Runtime.exec,
    ProcessBuilder, Process)
  • Add support for an AIR application to
    be able to interact with stdin,
    stdout, stderr. Strangely, though
    Adobe added support for local file
    access in AIR, they have omitted
    interaction with these standard file
    pipes (yet they are found on any
    OS platform that AIR supports).
  • Implement support of AMF over stdin,
    stdout, stderr - so AIR (or Java or
    any AMF capable language) apps can
    interprocess communication via
    exchanging AMF objects. This would add
    a touch of Microsoft's PowerShell
    to AIR.

Currently Merapi provides a AMF bridge with Java, so that demonstrates the efficacy of this. Alas, Merapi has to use a localhost port and socket for doing the interprocess communication - which is a clumsy way to go relative to using stdin/stdout/stderr interprocess pipes instead.

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

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

发布评论

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

评论(2

待"谢繁草 2024-07-20 04:44:52

听起来您想做一些非常核心的 AIR 黑客攻击。 我认为在您自己的进程中托管 AIR 运行时不会很容易。 但您可能会考虑嵌入 Flash Player ActiveX 控件。 由于它只是一个 COM 对象,因此任何 COM 应用程序都可以 CoCreateInstance() Flash Player。 COM 接口没有详细记录,但以下是一些可能有用的示例:

如果您想要获得更低级别的访问权限,您可以嵌入开源 Tarmain AS3 虚拟机。 该代码有一个名为“avmshell”的示例命令行 shell。 如果您自己构建 Tamarin VM,则可以添加以本机 C++ 实现的新 ActionScript 类。 Tamarin(和 Flash Player)使用 AS 和 C++ 之间的这种“AVM 粘合剂”来​​实现许多功能。

It sounds like you want to do some very hardcore AIR hacking. I don't think hosting the AIR runtime in your own process will be very easy. But you might consider embedding the Flash Player ActiveX Control. Since it is just a COM object, any COM application can CoCreateInstance() the Flash Player. The COM interface is not well documented, but here are some examples that might be helpful:

If you want to get even lower level access, you could embed the open-source Tarmain AS3 VM. The code has an example command-line shell called "avmshell". If you build the Tamarin VM yourself, you can add new ActionScript classes implemented in native C++. Tamarin (and the Flash Player) implement many of their features using this "AVM Glue" between AS and C++.

葬心 2024-07-20 04:44:52

我的问题提出的尝试结果被 Adob​​e 禁止(就任何潜在的商业用途而言):

来自 Adobe® AIR™ 运行时分发常见问题解答

分发或使用 Adob​​e AIR
运行时、安装程序文件或提取的
安装程序文件位于未记录的文件中
方式或目的。 例如,你
不得分发、直接致电,或者
为任何 Adob​​e 编写包装器
AIR 库或运行时组件
在您的软件应用程序中

Runtime.dll,运行时可执行文件,
template.exe 和 template.app 是
运行时组件的示例。

What my question posed attempting to do turns out to be prohibited by Adobe (so far as any potential commercial use):

From the Adobe® AIR™ Runtime Distribution FAQ:

Distribute or use the Adobe AIR
runtime, installer files, or extracted
installer files in an undocumented
manner or purpose. For example, you
may not distribute, call directly, or
write wrappers for any of the Adobe
AIR libraries or runtime components
within your software application
.
Runtime.dll, Runtime executables,
template.exe, and template.app are
examples of Runtime Components.

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