Login to participate
Endpoint Management & Virtualization ArticlesRSS

Conversion of Long Path Entries in to Short Path in the MSI Database

Eshwar's picture

The necessity of the short file names is providing a smooth installation of the application while deploying the application, in order to accomplish this task Windows Installer provides a property namely SHORTFILENAMES for creating the folder & file names to short file form on doing AIP. The shortfile format will be generally short|long pairs listed in the File table or Directory table.

The real problem arises in the case of vendor supplied msi files, because the vendor msi will not have any best practice followed and most of the time when you try to do AIP with SHORTFILENAMES=TRUE it throws error saying not a valid shortfile name for directory or file names, but in case of captured application this issue won’t come because the capturing tools (wise package studio, install shield, etc..) will take care of replacing the file name, directory, shortcut names in the format short|long during the capturing process. Hence smooth installation of the application.

Procedure:

To include a long file name with a short file name, separate it from the short file name with a vertical bar (|). For example, the following two strings are valid:

Eshwar.txt
Project~1.txt|Project Scripting.txt

Short and long file names must not contain the following characters:
\ ? | > < : / * "

In addition, short file names must not contain the following characters:
+ , ; = [ ]

Short file names may not include a space, although a long file name may. No space is allowed preceding the vertical bar (|) separator for the short file name/long file name syntax. If a space exists after the separator, then the long file name must have a space at the beginning of the file name. No full-path syntax is allowed.

Why do you need a shortfilename or shortpath in the MSI database?

When you are doing deployment or http installation, for the proper installation of msi file, you should have a external uncompressed folder structure and files in the format of shortfile names. And also in msi database there should not be any long path present, mainly in the below tables.

  1. file table
  2. shortcut table
  3. directory table
  4. Ini table

When will the problem appear?

If you have vendor supplied msi when you are trying to do AIP with passing a property SHORTFILENAMES=TRUE as below

Msiexec /a <path of msi> SHORTFILENAMES=TRUE

Before extracting the files the windows installer engine will check for the entries in shortcuts, directory, file tables are having proper short paths if it is not then it will throw error, if you have to get the proper extract folders and files in form of short path you have replace the long paths with short one in the form of short|long.

In order to do this I have created a new method to accomplish the task, if you are following the procedure use the below listed tools:

  1. Wise Package Studio
  2. Orca
  3. Microsoft Excel

Follow the below procedure in case of complex scenarios (huge app.)

Now let us look into the 2nd method for a complex scenario.

Step by step procedure to convert long paths to short paths

Step 1: Open the vendor supplied MSI file with wise package studio tool and go to options >tools> MSI to WSI conversion as shown below:

Step 2: Specify the location where you want the tool to create a .WSI, external folders, files and merge modules. Click Next.

Step 3: Don’t click on select all click by default on Next button

Step 4: Click Next by default on the below screen

Step 5: Keep default file location as it is and Click finish > if below message box appears click Yes.

Once the conversion is completed you can find .WSI, files & folders and merge modules in the location which you have specified in step 2.

Step 6: Open the new empty template wsi file and copy all the rows from the below mentioned table entries from the converted wsi file which you got in step 5 to new template wsi file.

  1. wisesource path table
  2. feature table
  3. featurecomponent table
  4. component table
  5. file table
  6. shortcut table
  7. inifile table
  8. directory table <delete all directory entries in the template .wsi file before copying entries>

Step 7: If MSI has merge modules files then add the merge modules file in the template wsi file manually in the script. You can find the extracted merge module in the same location where you have converted the msi>wsi location.

Step 8: Ensure the media option is set to uncompressed external folder as shown below click Media

Step 9: Ensure the build option is set to use short file names for the uncompressed outside of the install.

Go to build option and check the below mentioned option.

Step 10: After copying the respective tables entries from converted .wsi to template .wsi file, apply the steps 7, 8, 9 on the new template wsi file, the complie the wsi file.

Step 11: After doing the step 10 you will get a MSI file with short paths converted.

Check the difference between latest msi(which we got after doing step 9) and source msi file check for the file table difference if you find any difference in the sequence column or attributes column then follow from step 13.

Step 12: Open vendor MST file with ORCA tool drop the file table and import the file.idt file which you have exported from the msi file which you got file after doing step 10.

Note: this is applicable only if there is no difference in sequence, attributes column.

Step 13:

  • Use orca tool to export the file table from the msi which you got in step 9
  • Use orca tool to export the file table from the source msi file

Now you have 2 idt files

Open both the files in 2 different notepad and save the file as

  1. Modified.txt (exported idt which we got in step 9)
  2. Source.txt (exported idt file source msi)

Open 2 new Excel files

  1. Copy all the content of modified.txt file to one excel file and save as modified.xls
  2. Copy all the content of source.txt to another excel file and save as source.xls

After copying both the .idt content in to 2 Excel files.

Now select the 2 required columns attribute, sequence from the source.xls and copy to the modified.xls (before copying delete the 2 respective columns or overwrite with latest one) as shown below.

After doing the above things save the xls file as modified_source.xls

Now copy the entries of modified_source.xls, from the 4th row as shown below to the any file.idt.

Open the file.idt in notepad and after 3rd row delete all other entries now copy xls content from 4th row now the save file.idt in the different location.

After doing the above procedure, open the MST file with ORCA and drop the file table and import the latest file.idt in the script and check the difference between the new msi and base msi so that there should be difference in the file table expect in file name paths.

I've also attached a document form of this article.

Thanks,
Eshwar