使用 PHP 编辑 Windows Installer (.msi) [英] Edit Windows Installer (.msi) using PHP

查看:23
本文介绍了使用 PHP 编辑 Windows Installer (.msi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我现在完全迷失了,我通常是一个前端开发人员,根据需要了解一点 php.但是,我有一个客户端需要一个下载门户,用户可以在该门户中输入他们的电子邮件地址进行下载.除了一次捕获之外,这很容易.应用程序需要将该电子邮件存储在 xml 文件中.

Ok, so I am completely lost at this point, I am normally a front end developer who knows a bit of php as needed. I have a client, though, that needs a download portal that a user enters their email address for a download. Which is easy enough except for one catch. The application needs to have that email stored in an xml file.

我一整天都在用谷歌搜索试图解决这个问题,可能只是我不知道要搜索什么,因为我是在 mac 上工作的前端 Web 开发人员.PHP 安装在 CENT OS 网络服务器上,需要能够提取 msi,插入 xml 文件,然后重新编译它以提供给用户.

I have been googling around all day trying to figure this out and it is probably just that I have no idea what to search for as I am front end web dev who works on mac. The PHP is installed on a CENT OS webserver which will need to be able extract the msi, insert the xml file and then recompile it to be served to the user.

任何帮助或指导都会非常有帮助.谢谢!

Any help or direction would be very helpful. Thanks!

推荐答案

Windows Installer 程序包 (.MSI) 是 OLE/COM 结构化存储.Microsoft 提供了一个 Win32 API (MSI.dll) 和一个 COM 自动化接口 ("WindowsInstaller.Installer").

Windows Installer packages (.MSI) are OLE/COM Structured Storage. Microsoft provides a Win32 API ( MSI.dll ) and a COM Automation Interface ( "WindowsInstaller.Installer" ).

在 Unix 上,大部分 Win32 API 已移植到 Wine.

On Unix, much of the Win32 API has been ported to Wine.

现在我从未这样做过,但我看到了一些很有希望的事情.有一个名为 OpenMCDF 的开源项目.它是用 Visual Studio/.NET 编写的,但声称它支持 Mono.在它是一个测试应用程序(文档浏览器),当你说 File |打开它显示 .MSI 作为下拉选项,所以他们至少在考虑它.

Now I've never done this, but I see something that's promising. There is an open source project called OpenMCDF. It's written in Visual Studio / .NET but claims it supports Mono. In it is a test app (document explorer) and when you say File | Open it shows .MSI as a drop down choice so they were atleast thinking about it.

无论如何在源代码中,我看到了流和存储的类.准备好 MSI,您会发现文件被压缩到 (Microsoft) CAB 档案中,并通过将其插入流中而嵌入到 MSI 中.

Anyway in the source code I see classes for streams and storages. Ready up on MSI's and you'll find that files are compressed into (Microsoft) CAB archives and them embedded into the MSI by inserting it into the streams.

在这种情况下,我可能会使用更新后的 XML 文件创建一个新文件柜,将其记录在媒体表中并更新文件表以反映新的序列号、文件大小和媒体 ID.

In a situation like this I would likely create a new cabinet with the updated XML file, record it in the Media table and update the file table to reflect the new sequence number, file size and media Id.

对于 MSI 专家来说,这在 C# 中是微不足道的.对于 .NET 专家来说,这真的很难.对于那些既不想在 CentOS 上用 PHP 做这件事的人……祝你好运.

For an MSI expert, this is trivial to do in C#. For a .NET expert, it's really hard. For someone who is neither trying to do it in PHP on CentOS... good luck.

另一种方法是使用未压缩的文件构建 MSI,然后将其用作模板来覆盖文件并构建自解压 EXE.那对你来说可能会容易得多.只需确保 MSI 和 XML 被缓存以用于修复事务.

Another approach would be to build the MSI with that one file uncompressed and then use that as a template to overwrite the file and build a self extracting EXE. That would probably be much easier for you. Just make sure the MSI and XML get cached for repair transactions.

或者只是设置一个 Windows 服务器并将构建传递给它并在完成后将其取回.

Either that or just set up a Windows server and pass the build off to it and pick it back up when done.

这篇关于使用 PHP 编辑 Windows Installer (.msi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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