Как изменить msi пакет
Перейти к содержимому

Как изменить msi пакет

  • автор:

Как изменить msi пакет

1) открываешь этот самый "мси" — если его собирал не ты (или если ты еще не разу не "сейвил" его при помощи МСИ Студио ) , то таблицы с путями к запакованным файлам (all tables/FilesSourcePath) в пакете еще нет

2) тогда жми "tools/exctract CABs- update source paths" -> все файлы заэкстрактятся по указанному тобой пути и в базе появится вышеуказанная таблица.

3) если все это прокатило — меняй файлы в том месте куда ты их распаковал и сохраняй мси. ( естесственно если будешь менять название и установочный путь к файлу — подправь в табличке)

4) если возникли проблемы — то глянь на Path Variables в IQ Views — если она указывает не туда — убей ее и повтори п2,3

5) если получаешь мессач что типа не все файлы были заэкстракчены — возможно они делаются "кастом экшеном" — и тут придется разбираться в каждом конкретном случае отдельно.

Вообще, по-простому, тебе наверно нужно просто удалить какие-то компоненты, вставить свои файлы и прописать к ним установочные пути тех которые ты грохнул.

Как изменить msi пакет

Полный спектр компьютерных услуг!

Внимание!

  • Вся информация, расположенная в данном и других разделах форума получена из открытых источников (интернет-ресурсы, средства массовой информации, печатные издания и т.п.) и/или добавлена самими пользователями. Администрация форума предоставляет его участникам площадку для общения / размещения файлов / статей и т.п. и не несет ответственности за содержание сообщений, а также за возможное нарушение авторских, смежных и каких-либо иных прав, которое может повлечь за собой информация, содержащаяся в сообщениях.

Рекламное место сдается

Decker

Просмотр профиля

Группа: Главные администраторы
Сообщений: 14349
Регистрация: 12.10.2007
Из: Twilight Zone
Пользователь №: 1

Иногда возникает задача отредактировать MSI пакет, допустим, изменить условия запуска (например, когда в пакете жестко прописано, что данный пакет можно устанавливать, к примеру, только на Windows XP, однако вы точно знаете что приложение заработает на серверных операционных системах), изменить начальные параметры установки и т.п. Сделать это можно с помощью утилиты Orca, входящей в пакет The Platform SDK for Microsoft® Windows® или с помощью сторонней утилиты SuperOrca MSI Editor.

How to replace a file in a msi installer?

I want to replace a single file inside a msi. How to do it?

6 Answers 6

This command extracts the MSI files:

msi2xml -c OutputDir TestMSI.MSI

Open OutputDir and modify the file.

To rebuild the MSI run:

xml2msi.exe -m TestMSI.xml

You need the -m to ignore the ‘MD5 checksum test’ that fails when an MSIs file(s) are modified.

You need to extract the CAB file stream from your msi using MsiDB.exe (supplied with the Windows Installer SDK). Run it from the command line with the -x option and specify the name of the cab file — this is listed in the Media table in the msi database.

Alternatively you can skip this part if you specify the «Package Files as:» option in the VSI options to «Compresses in Cabinet Files» to have the cab file left out of the msi when it’s built (it will be created in the same directory as the msi).

Once extracted you can change the specified file in the cab folder — its name has been mangled so you need to find out what msi name for the file is in the file table and then rename your new file to that.

Once done you can pop it back in with the MsiDB utility using the -a option.

Before you add with -a you need to use msidb -k to remove the cab from the MSI.

How to Edit an MSI File using ORCA Editor (plus alternative tool)

What’s the most efficient way to perform quick edits to an MSI package?

There are various tools that can help you edit an MSI package, but ORCA is the most popular free MSI editor available to achieve this, since it can help to validate and debug errors.

However, it is not a secret that ORCA is a bit challenging to use since you have to perform modifications to the MSI database.

But, we do have a solution for that! Advanced Installer allows you to edit MSI files within its GUI without making any changes in the background.

We will show you how you can use Advanced Installer to edit MSI files as an alternative or complement to the ORCA tool.

But first, let’s see how we can edit the three most common MSI package edit operations using ORCA.

  1. Modify registry keys,
  2. Add files,
  3. Change property values.

Without further ado, let’s download ORCA to get started.

How to download and install Orca — the free MSI Editor

In the past, Orca used to be available as standalone software but these days, you can only install it as a component of Microsoft Windows SDK. To download and install ORCA, follow these steps:

1. Download Microsoft Windows SDK here.

Download SDK

2. Open the installation, go through the basic wizard, and select the MSI TOOL feature when prompted.

Install SDK

3. Go to the SDK install location and run the Orca.msi. This will automatically install ORCA.

Install ORCA

4. A start-up shortcut should be created – and Orca will be located in C:\Program Files (X86)\Orca

Locating ORCA

How to Edit Your MSI Package using Orca?

Now that you have Orca installed, you can navigate to the location where your MSI package is stored, right-click on it and select Edit with Orca.

Edit with Orca

This will load your MSI database package into the Orca interface.

Before you start making changes, you should be aware that directly editing vendor MSI packages is NOT recommended.

As a best practice, we suggest using a transform file to save and apply any modifications you make to the MSI when the installation is triggered.

To do that with ORCA, click on Transform/New Transform.

New Transform

We’re all set – now, we can move on to performing the three most common modifications on an MSI.

1. Change a property value with ORCA

For this example, we want to change the value of the property DISPLAYLANGUAGE which controls the application interface display language.

From the left pane:

1. Navigate to the Property Table.

2. Locate the DISPLAYLANGUAGE property.

3. Double click on the value.

4. Replace it with the value NL.

Orca Edit Property

2. Add registry key with ORCA

For this example, we want to add a registry key that disables the auto-update function of our application.

Let’s assume that the registry key is CheckForUpdate and the value is False. It should be present in the HKLM hive under the following path Software\[Manufacturer]\[ProductName]\Settings

To achieve this, navigate to the Registry table, right-click inside the table and choose “Add Row”.

Orca Edit Registry

Fill in each row with the corresponding value (as seen below):

  • Registry: the identification name of our registry
  • Root: the hive (-1) corresponding to HKLM
  • Key: the registry key itself
  • Name: the name of the registry
  • Value: the name’s value that we want it to have
  • Component: to which component we want our registry to belong (components can be displayed under the Component table).

Add Component Value

3. Add a file with ORCA

For this example, we want to add a file containing additional application settings named settings.config.

To do this, you need to edit the following tables:

  • Component;
  • FeatureComponents;
  • File, Media;
  • And if the table is already present, MSIFileHas.

3.1. Component Table

Go to the Component table and add a new row. Complete the information accordingly.

Component: The identification name of the component. Must be unique

ComponentID: For this, use https://www.guidgenerator.com/ to generate a GUID

Directory_: The Directory name where the file will be located

Attributes: Enter 0. For more information, check MSI Documentation

Add New Row in Component Table

3.2. Feature Component Table

Go to the FeatureComponent table and add a new row. It’s time to link the created component to a feature.

Linking Created Component to Feature

3.3. File Table

Go to the File table and add a new row. It’s time to associate the file to the recently created component. Complete the information accordingly.

  • File: File name (Settings.config)
  • Component_: The component created on the previous step (ConfigFile)
  • FileName: Enter both short and long filename separate by the vertical bar char (|) Short filename can be found by opening a cmd, navigating to the folder containing the file, and typing the dir /x command
  • FileSize: The file size in bytes. You can right-click on the file and type property
  • Version: Only if needed
  • Language: Only if needed
  • Attributes: 8192 for uncompressed file. For more information, check MSI Documentation
  • Sequence: Should have the value of the current biggest sequence number in table +1.

Associate File to Created Component

3.4. Media Table

Go to the Media table and add a new row. Increase the DiskId and LastSequence just like in the previous step. Search for the biggest previous value in the table and increment it by 1.

Add New Row in Media Table

Once your modifications are done, all you need to do is save your transform file.

Save Transform File

Coming up next, let’s see how we can edit an MSI file using Advanced Installer.

How to Edit Your MSI Package using Advanced Installer?

If you are familiar with the Advanced Installer tool I would suggest you check the predefined support for editing an MSI file using our dedicated dialog: MSI Quick-Edit Mode.

Similar to Orca, to edit your MSI package, right-click it and select “Open with Advanced Installer”.

Edit MSI with Advanced Installer

Once the MSI database has loaded in Advanced Installer, you will notice a left menu pane where you will find all the options you need to directly edit your MSI.

The changes you perform in the GUI will be automatically reflected in all the related tables from the MSI. This will save you time from manually editing each MSI table and decrease the chance of human error.

1. Change an MSI property value with Advanced Installer

1.1 From the left pane, navigate to the Property tab,

1.2. Find the property you want to modify and double click on it to edit its value.

Edit Property in Advanced Installer

2. Add registry key to your MSI

2.1 From the left pane, navigate to the Registry tab,

2.2 Right-click on the registry path,and choose New Value,

Add Registry Key in Advanced Installer

2.3. Fill in the Name and the Data field with the corresponding value.

Edit Registry Entry

3. Add a file to your MSI package

When you directly modify an MSI with Advanced Installer, Advanced Installer will update the MSI during the build operation following best practices and rules such as “Short-names in the File Table”, “Separating components for each EXE, DLL, and OCX file”, “Setting the key path for each component”.

Advanced Installer generates builds in accordance with ICE Validation Standard and industry best practices gathered in over 15 years of constant contact with our customers.If you are eager to test it for yourself, try our 30-day full feature trial.

When you add any files into the MSI by using a transform file and saving it, a cabinet file will be created alongside the MST. This is NOT an Advanced Installer custom implementation, but a default behavior of MSI databases.

Conclusion

Now you know two ways to edit your MSI packages.

Both Orca and Advanced Installer are perfectly capable of editing an MSI.

However, as you can see, editing your MSI directly through the Advanced Installer GUI saves time and prevents you from having to completely repackage your MSI — which is especially important when making quick edits to your MSI package.

We hope you try this method and let us know what you think.

If you want to see how the MSI Editor works, give it a try through the Advanced Installer 30-day full-featured free trial.

Subscribe to Our Newsletter

Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *