cx_freeze bdist_msi:创建注册表项? [英] cx_freeze bdist_msi: create registry entries?

查看:104
本文介绍了cx_freeze bdist_msi:创建注册表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去使用过cx_freeze中的 bdist_msi ,它的工作原理很好。

I used bdist_msi from cx_freeze in the past and it works nice.

现在我需要创建注册表条目

Now I need to create registry entries

是否可以通过cx_freeze中的 bdist_msi 创建注册表项?

Is it possible to create registry entries with bdist_msi from cx_freeze?

以前使用wixtools进行过这些设置:

With the wixtools these settings were done in the past:

<!-- File extension .foostarter -->
<RegistryValue Root='HKCR' Type='string' Key='.foostarter' Value='foostarter.File' />
<RegistryValue Root='HKCR' Type='string' Key='.foostarter' Name='Content Type' 
                           Value='application/vnd.foobar-modstarter' />
<RegistryValue Root='HKCR' Key='foostarter.File\Shell\Open' Type='string' Value='Ausfuehren' />
<RegistryValue Root='HKCR' Key='foostarter.File\Shell\Open\Command' Type='string'
               Value='"[#foostarter.exe]" file "%%1"' />

<!-- protocol foostarter://... -->
<RegistryValue Root='HKCR' Key='foostarter' Type='string' Value='URL: foostarter Protocol' />
<RegistryValue Root='HKCR' Key='foostarter' Type='string' Name='URL Protocol' Value=''/>
<RegistryValue Root='HKCR' Key='foostarter\shell\open\command' Type='string' 
               Value='"[#foostarter.exe]" url "%%1"' />

<!-- start without asking -->
<RegistryValue Root='HKLM' Key='Software\Microsoft\Internet Explorer\ProtocolExecute\foostarter' 
               Name='WarnOnOpen' Value='0' Type='integer' />


推荐答案

MSI-MS SQL



我对 bdist_msi 不熟悉。但是,如果您有合适的工具,绝对可以对MSI文件进行后处理以添加注册表项。我不确定您是否要将此脚本编写成脚本并自动执行,或者是否可以使用适当的工具进行任何手动操作?

MSI - MS SQL

I am not familiar with bdist_msi. However, it is definitely possible to post-process an MSI file to add registry entries if you have the right tools to do so. I am not sure if you want this scripted and automated, or if any manual steps with an appropriate tool is OK?

如您从使用python库所了解的 msilib ,一个MSI文件实际上是一个原始的MS SQL数据库,您可以使用自动化和原始SQL方言对其进行更新。请参见下面的 使用WiRunSQL.vbs 进行MSI修复。 msilib 是可能只是访问 MSI COM API -或完全 Win32 C ++函数-您知道我对Python知之甚少:-)。 COM与Win32上的某些上下文(我认为这对您来说并不重要)。

As you have understood from using the python library msilib, an MSI file is really a primitive MS SQL database under the hood, and you can update it using automation and a primitive SQL dialect. See "Hotfixing MSI using WiRunSQL.vbs" below. The msilib is probably just a wrapper accessing the MSI COM API - or the down-to-the-metal Win32 C++ functions - you see how little I know about Python :-). Some context on COM vs Win32 (not important for you I think).

如果您在MSI数据库表中插入条目,则实际上并不需要知道 bdist_msi 生成的组件名称,您可以在两个 Component表 Registry表中包含所需记录(除了 bdist_msi )。然后,您还需要写入 FeatureComponents表,以将组件添加到功能中。我认为这不是很琐碎,但也没有那么糟糕。我没有使用> msilib ,但听起来您已经拥有了吗?也许是使用常规MSI API的示例?

If you insert entries in the MSI database tables, you don't really need to know the component name generated by bdist_msi, you can insert new records in both the Component table and in the Registry table with whatever records you need (in addition to those created by bdist_msi). Then you need to also write to the FeatureComponents table to add the component to a feature. Not quite trivial, but not that bad either I guess. I don't have any sample Python code using msilib, but it sounds like you already have that? Maybe a sample using regular MSI API? Here goes:

使用WiRunSQL.vbs修补MSI MSI SDK中有一个VBScript 称为 WiRunSQL.vbs 可用于以非常简单的方式(只是简化的SQL)以脚本方式将数据直接插入MSI文件中。 我在此答案中(底部)对此进行了简要描述 。如果安装了Visual Studio,只需在 Program Files(x86) 下搜索VBScript文件。

Hotfixing MSI using WiRunSQL.vbs: There is a VBScript in the MSI SDK called WiRunSQL.vbs that can be used to insert data directly into an MSI file in a scripted fashion in a very simple fashion (just simplified SQL). I describe this briefly in this answer (bottom). If you have Visual Studio installed, just search for the VBScript file under Program Files (x86).


简易修复?: 上面的SQL修补程序VBScript是否就可以满足您的需要?它非常易于使用和自动化,并且是Microsoft VBScript。很少有其他纠缠和间接层。

Easy Fix?: Could the above SQL hotfixing VBScript be all you need? It is very simple to use and to automate, and it is a Microsoft VBScript. Few other entanglements and layers of indirection.



快速MSI更新模型



对MSI的更改示例(打开到MSDN的链接以查看每个列的含义):

Quick MSI Update Mockup

Sample changes to MSI (open links to MSDN to see what each column means):

组件表: 使用标准Pope-Mo-GUID滚动 :-)

Component Table: (rolling with standard Pope-Mo-GUID :-) )

MyComp {77777777-7777-7777-7777-777777777777} TARGETDIR 4 MyValue

> 注册表表:

MyValue -1 软件\ [制造商]\[产品名称]\ New_Key 1 MyComp

FeatureComponents表:

MyFeature MyComp

我希望以上内容有一定道理。让我介绍一些手动或非脚本化/非自动化的替代方法:

I hope the above made some sort of sense. Let me spin through a few "manual" or non-scripted / non-automated alternatives:

免费工具 有几个您可以尝试的工具。该链接描述了免费的 Orca (正式的Microsoft SDK MSI查看器和编辑器-如果安装了Visual Studio,请尝试搜索 Orca-x86_en-us.msi -在 Program Files(x86) 下-然后安装它), SuperOrca 安装 。这些是免费工具。

Free Tools: There are several tools you can try. That link describes the free Orca (offical Microsoft SDK MSI viewer and editor - if you got Visual Studio installed try searching for Orca-x86_en-us.msi - under Program Files (x86) - then just install it), SuperOrca and InstEd. Those are free tools.

具有免费功能的商业工具 :还有 高级安装程序 -一种商业工具,可免费使用一些基本功能。我认为这包括添加注册表项。我刚刚测试了它可以在完整版中使用。与Orca或其他免费工具相比,该工具的GUI更好-可以自动更新所有关联的表。我不知道 Installshield PACE Suite -其他主要的商业工具,但是如果您已经可以使用它们,那么它们可以轻松地完成工作。并快速提及:已建立的主要部署工具列表

Commercial Tools With Free Features: There is also Advanced Installer - a commercial tool that allows some basic functionality for free. I think that includes adding a registry key entry. I just tested that it works in the full version. This tool has much better GUI than Orca or the other free tools - and updates all associated tables automagically. I am not aware of any free features in Installshield or PACE Suite - the other major commercial tools, but should you already have them available, then they can do the job easily. And a quick mention: List of major, established deployment tools.

WiX :看到的样子有点熟悉WiX ,一种选择是)-使用WiX构建整个安装程序。也许你已经这样做了?您可以使用 dark.exe 将现有的MSI反编译为WiX格式。 此dark.exe (第4节)。然后,您可以更新WiX XML并重新编译-尽管这可能需要一些技巧和技巧。

WiX: Seeing as you appear somewhat familiar with WiX, one option would be to (re)-build the whole installer with WiX. Maybe you already do? You can decompile an existing MSI to WiX format using dark.exe. This dark.exe process is described here (section 4). You can then update the WiX XML and recompile - though this may require some black art and massage to work.

某些链接

Some Links:

  • https://github.com/python/cpython/blob/master/Lib/distutils/command/bdist_msi.py (skimmed, I can't see any registry support from the quick look either, but I know very little about this)
  • http://www.pyinstaller.org/
  • Does an universal cross-platform installer exists?
  • How to create windows installer
  • https://docs.python.org/3/library/msilib.html?highlight=bdist_msi (for others)

这篇关于cx_freeze bdist_msi:创建注册表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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