How to tag or customize the a binary (for example of an installer)

核能气质少年 提交于 2019-12-25 02:25:40

问题


How can I tag or modify a .msi binary with custom information?

How can I give website users individual downloads, so that they don't have to sign in again in the app?

Some websites offer personal/customized/tagged installer downloads.

When you run the file, the executeable already knows who you are and automatically signs you in.

Examples are:

  • join.me where passing the presenter role, triggers a download for the other party and automatically connects them into the right conference
  • spotify had a download, that would not need you to sign in.

回答1:


You can parameterize an MSI file so that it can install with different settings based on the values you pass to it via the msiexec.exe command line. The install you kick off can run silently or interactively based on what msiexec.exe switches you define.

You can auto-generate the command lines in question directly from a web-page using Javascript, or in some other fashion. You can also customize the MSI using a more advanced option: transforms.

Rather than rewriting it all, I will link to a previous answer which describes how to use PUBLIC PROPERTIES set at the msiexec.exe command line or transforms to modify settings in MSI files during installation: How to make better use of MSI files (a little long, but the first section is all that is relevant in your case).

  1. Sample command line you can auto-generate using PUBLIC PROPERTIES:
msiexec.exe /i "MySetup.msi" /L*v "%TMP%\MyLog.log" SERIALKEY="123-456-789" EMAIL="myemail@somedomain.com" LOGINNAME="MyLogin" LOGINPASSWORD="MyPassword"

Obviously think twice about pushing the password via command line.

  1. Sample command line you can auto-generate using transforms:
msiexec.exe /i "MySetup.msi" /L*v "%TMP%\MyLog.log" TRANSFORMS="MyTransform.mst"

Inside MyTransform.mst you can change and override almost anything you want inside the whole MSI file - including setting the properties from the first sample in the Property Table.

And you can auto-generate the transform itself using the MSI API. I will dig up a better link when I have a moment.

UPDATE: there is a whole family of sample VBScripts showing how to use the MSI API in various ways. The widiffdb.vbs shows how to generate a transform (among other things). And there is a sample dedicated to just creating a transform: wigenxfm.vbs.

These scripts should be installed with Visual Studio and the SDK. Maybe email a friend (one with lots of patience!) with this installed and have them zip it for you if you are in a rush, or install the whole shebang yourself.

The MSI API can be accessed with Javascript, but I have experienced some clunky issues that are a little too detailed to explain. VBScript was used to test the object model, and hence seems to work better.

It should be possible to invoke Windows Installer from an URL. So they tell me. Good luck with that :-). I tried about 17 years ago and abandoned it. Perhaps it is better now.


And some similar answers (this question keeps coming up):

  • How to push MSI with parameter using SCCM server.
  • How to make better use of MSI files.
  • Advantages of Transforms(mst) over msi file.


来源:https://stackoverflow.com/questions/49453205/how-to-tag-or-customize-the-a-binary-for-example-of-an-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!