cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
manisha81
Level 5

Control the Installation screens of .MSI

Hello,

My requirement is to open the MSI database to edit. Various properties and installatin of featues can be controlled by using Windows Installer Apis by calling "MsiOpenPackage" and sequential functions from Installer SDK.

But i also want to control the display of Installation screens. How can i acheive this by using Windows Installer SDK or via any other method.
E.g: I want to create a customised packge from a reqular package in which my end user should not able to see the "License Agreement" dialog and also culd not see the "Feature Selection" dialog. Please suggest ways to acheive this functionality. My .MSI has been compiled via IS 2009 and is a Basic MSI project.

Regards,
Labels (1)
0 Kudos
4 Replies
MSIYER
Level 8

There are a couple of ways that I know of editing the .msi file.
a) Use Orca tool available in the Windows Installer SDK
b) Use Installshiled

Its very easy to open the .msi files in either of the tools.

Once open in Orca you can clearly see all the tables. Its very easy to edit the tables and save your changes.

In Installshield, you need to use the Direct Editor to manipulate the UI.

Be careful though. UI sequences of complex applications can have many conditions attached to them. Be sure to keep the UI sequence flowing.
0 Kudos
manisha81
Level 5

Hi,

Msiyer - Thnx for your reply. 🙂 Well i am aware of these ways to edit the MSI.
But i want to know how can i acheive this programmatically.
My client is not having ORCA or Installshield installed at his/her premises.

Are there any windows APIs to acheive the same

Regards,
0 Kudos
MSIYER
Level 8

There are APIs available to achieve what you want.

TCHAR szQuery[MIN_BUFFER_LENGTH] = {0};
_tcscpy(szQuery,
TEXT("SELECT `Value` "
"FROM `Property` "
"WHERE Property = 'ProductVersion'"));

This Installer SQL subset query, for example, would get the value of 'ProductVersion' from the .msi database.

MsiOpenDatabase is used to open the database file for the transaction. You can use various parameters to define the type of transaction(a read-only or a write).
MsiDatabaseOpenView is then used for preparing the transaction and creating the view. The query is applied on the view and it is the live object with which you will interact.
MsiViewExecute will execute the transaction on the view.
MsiViewFetch will fetch you the required values from the view.

MsiRecordGetString actually extracts values. You should provide the exact column number from which to extract the value.

It is quite complex to perform.

Do look into these functions and understand how you can use them in your case.

Sample Pseudocode:
//Construct the query
TCHAR szQuery[MIN_BUFFER_LENGTH] = {0};
_tcscpy(szQuery,
TEXT("SELECT `Value` "
"FROM `Property` "
"WHERE Property = 'ProductVersion'"));
//handle to the .msi database
PMSIHANDLE hDatabase = NULL;
CHECK_MSI(MsiOpenDatabase(szMSIFile, MSIDBOPEN_READONLY, &hDatabase)) //open the database as readonly in this case
PMSIHANDLE hView = NULL;
CHECK_MSI(MsiDatabaseOpenView(hDatabase, szQuery, &hView));
CHECK_MSI(MsiViewExecute(hView, 0));

UINT unResult = ERROR_SUCCESS;

PMSIHANDLE hRecord = NULL; //handle to the record

if (ERROR_SUCCESS == MsiViewFetch(hView, &hRecord))
{
TCHAR szData[MIN_BUFFER_LENGTH] = {0};
DWORD dwSize = MIN_BUFFER_LENGTH;
CHECK_MSI(MsiRecordGetString(hRecord, 1, szData, &dwSize));
}


This is a C++ code snippet.
Also follow this link:
http://www.koders.com/csharp/fidEF7DC1EF2026543044B67E981A4E9C9EE2FB23AF.aspx?s=nativemethods

Hope this helps.

NOTE:
You can give the client the Orca and all necessary info and ask him/her to perform the edit.
0 Kudos
manisha81
Level 5

Thnx MSIYER. 🙂
0 Kudos