ContactEZ.net D. G. Schneider Lions Club Volunteer Project

ContactEZ.net

Automated process to create IDT files on-the-fly for Windows MSI Installer

Very often the Setup Engineer or the CM will end up working in ORCA anyway to finish the requirements correctly!
Most packaging software will give you a way to edit the tables (Direct Editor from InstallShield is more or less nothing else than Orca with a different name).

You can create MSI tables on the fly and automatically import them in the MSI, then create the DDF files that will in their turn create the CAB files.
This basic script or VB Sub will create MSI database tables and then import them into the defined MSI.

Related topics: MSI Automation, MSI Tables Overview, MSI Command Line, MSI UAC VISTA, MSI Error Table, BootStrapper VISTA, MSP VISTA, Install MSI SDK Tools V3.1.4, Create CAB File, Build MSPs, VB Script to Update PCP / MSI

Tables that need to be updated on the fly each time the packaging is needed:
Component.idt, CreateFolder.idt, CustomAction.idt, Directory.idt, FeatureComponent.idt, Features.idt, Files.idt, Media.idt, Property.idt, Registry.idt, Removefile.idt, ShortCut.idt...

You can also consider to create SelfReg.idt, Typlib.idt, LockPermissions.idt and so on...

Here are some examples (for SDK 3.5.1) on how to create the headers of the IDT files (some headers changed with different versions of the SDK).
The rest of the content of the IDT files will depend on the product being package.
The Setup Engineer or the CM
should be able to figure out how to automate the feeding of these IDTs:

Dim FNO As Integer
FNO = FreeFile/p>

Open TheIDTsPatha & "NewCustomAction.idt" For Output As #FNO
    Print #FNO, "Action" & Chr(9) & "Type" & Chr(9) & "Source" & Chr(9) & "Target"
    Print #FNO, "s72" & Chr(9) & "i2" & Chr(9) & "s64" & Chr(9) & "S255"
    Print #FNO, "CustomAction" & Chr(9) & "Action"
Close

Open TheIDTsPatha & "NewComponent.idt" For Output As #FNO
    Print #FNO, "Component" & Chr(9) & "ComponentId" & Chr(9) & "Directory_" & Chr(9) & "Attributes" & Chr(9) & "Condition" & Chr(9) & "KeyPath"
    Print #FNO, "s72" & Chr(9) & "S38" & Chr(9) & "s72" & Chr(9) & "i2" & Chr(9) & "S255" & Chr(9) & "S72"
    Print #FNO, "Component" & Chr(9) & "Component"
Close

Open TheIDTsPatha & "NewLockpermissions.idt" For Output As #FNO
    Print #FNO, "LockObject" & Chr(9) & "Table" & Chr(9) & "Domain" & Chr(9) & "User" & Chr(9) & "Permission"
    Print #FNO, "s72" & Chr(9) & "s32" & Chr(9) & "S255" & Chr(9) & "s255" & Chr(9) & "I4"
    Print #FNO, "LockPermissions" & Chr(9) & "LockObject" & Chr(9) & "Table" & Chr(9) & "Domain" & Chr(9) & "User"
Close

Open TheIDTsPatha & "NewCreateFolder.idt" For Output As #FNO
    Print #FNO, "Directory_" & Chr(9) & "Component_"
    Print #FNO, "s72" & Chr(9) & "s72"
    Print #FNO, "CreateFolder" & Chr(9) & "Directory_" & Chr(9) & "Component_"
Close

Open TheIDTsPatha & "NewDirectory.idt" For Output As #FNO
    Print #FNO, "Directory" & Chr(9) & "Directory_Parent" & Chr(9) & "DefaultDir"
    Print #FNO, "s72" & Chr(9) & "S72" & Chr(9) & "l255"
    Print #FNO, "Directory" & Chr(9) & "Directory"
Close

Open TheIDTsPatha & "NewFeatureComponent.idt" For Output As #FNO
    Print #FNO, "Feature_" & Chr(9) & "Component_"
    Print #FNO, "s38" & Chr(9) & "s72"
    Print #FNO, "FeatureComponents" & Chr(9) & "Feature_" & Chr(9) & "Component_"
Close

Open TheIDTsPatha & "NewFeatures.idt" For Output As #FNO
    Print #FNO, "Feature" & Chr(9) & "Feature_Parent" & Chr(9) & "Title" & Chr(9) & "Description" & Chr(9) & "Display" & Chr(9) & "Level" & Chr(9) & "Directory_" & Chr(9) & "Attributes"
    Print #FNO, "s38" & Chr(9) & "S38" & Chr(9) & "L64" & Chr(9) & "L255" & Chr(9) & "I2" & Chr(9) & "i2" & Chr(9) & "S72" & Chr(9) & "i2"
    Print #FNO, "Feature" & Chr(9) & "Feature"
Close

Open TheIDTsPatha & "NewFile.idt" For Output As #FNO ' Open the file.
    Print #FNO, "File" & Chr(9) & "Component_" & Chr(9) & "FileName" & Chr(9) & "FileSize" & Chr(9) & "Version" & Chr(9) & "Language" & Chr(9) & "Attributes" & Chr(9) & "Sequence"
    Print #FNO, "s72" & Chr(9) & "s72" & Chr(9) & "l255" & Chr(9) & "i4" & Chr(9) & "S72" & Chr(9) & "S20" & Chr(9) & "I2" & Chr(9) & "i2"
    Print #FNO, "File" & Chr(9) & "File"
Close

Open TheIDTsPatha & "NewMedia.idt" For Output As #FNO
    Print #FNO, "DiskId" & Chr(9) & "LastSequence" & Chr(9) & "DiskPrompt" & Chr(9) & "Cabinet" & Chr(9) & "VolumeLabel" & Chr(9) & "Source"
    Print #FNO, "i2" & Chr(9) & "i2" & Chr(9) & "L64" & Chr(9) & "S255" & Chr(9) & "S32" & Chr(9) & "S32"
    Print #FNO, "Media" & Chr(9) & "DiskId"
Close

Open TheIDTsPatha & "NewProperty.idt" For Output As #FNO
    Print #FNO, "Property" & Chr(9) & "Value"
    Print #FNO, "s72" & Chr(9) & "l0"
    Print #FNO, "Property" & Chr(9) & "Property"
Close

Open TheIDTsPatha & "NewRegistry.idt" For Output As #FNO
    Print #FNO, "Registry" & Chr(9) & "Root" & Chr(9) & "Key" & Chr(9) & "Name" & Chr(9) & "Value" & Chr(9) & "Component_"
    Print #FNO, "s72" & Chr(9) & "i2" & Chr(9) & "l255" & Chr(9) & "L255" & Chr(9) & "L0" & Chr(9) & "s72"
    Print #FNO, "Registry" & Chr(9) & "Registry"
Close

Open TheIDTsPatha & "NewRemoveFile.idt" For Output As #FNO
    Print #FNO, "FileKey" & Chr(9) & "Component_" & Chr(9) & "FileName" & Chr(9) & "DirProperty" & Chr(9) & "InstallMode"
    Print #FNO, "s72" & Chr(9) & "s72" & Chr(9) & "L255" & Chr(9) & "s72" & Chr(9) & "i2"
    Print #FNO, "RemoveFile" & Chr(9) & "FileKey"
Close

Open TheIDTsPatha & "NewShortCut.idt" For Output As #FNO
    Print #FNO, "Shortcut" & Chr(9) & "Directory_" & Chr(9) & "Name" & Chr(9) & "Component_" & Chr(9) & "Target" & Chr(9) & "Arguments" & Chr(9) & "Description" & Chr(9) & "Hotkey" & Chr(9) & "Icon_" & Chr(9) & "IconIndex" & Chr(9) & "ShowCmd" & Chr(9) & "WkDir"
    Print #FNO, "s72" & Chr(9) & "s72" & Chr(9) & "l128" & Chr(9) & "s72" & Chr(9) & "s72" & Chr(9) & "S255" & Chr(9) & "L255" & Chr(9) & "I2" & Chr(9) & "S72" & Chr(9) & "I2" & Chr(9) & "I2" & Chr(9) & "S72"
    Print #FNO, "Shortcut" & Chr(9) & "Shortcut"
Close

Open App.Path & "\createnewtables.bat" For Output As FNO
    Print #FNO, "@echo off"
    Print #FNO, "MsiDb.exe -i *.idt -f " & Chr(34) & App.Path & "\" & Product2WorkOn & "\" & Language4Product & "\NewIDTs" & Chr(34) & " -d " & Chr(34) & TheMSI & Chr(34)
Close

ShellAndClose Chr(34) & App.Path & "\createnewtables.bat" & Chr(34), 1
(for more information search for ShellAndClose)
Kill App.Path & "\createnewtables.bat"

Once you created all the IDTs you can import them using in the MSI the command line:

MsiDb.exe -i *.idt -f MyIDTFolder -d TheMSIName

See more discussions and posts about MSI:
Replacing Non-versioned Files User Data with companion files
New tools to Import VBS JPG - Unable to place file in stream - MSIDB
MSM Validation - ATL.MSM - Documentation
Remove registry info entries for all users in system or just current owner
ARPPRODUCTICON OK for XP not for W2K Add/Remove Programs
Msidb Command Line Folder Path MSI name limitations
Do NOT Associate Extension set flag file types as No Open in Verb Table
Property for All Users Shared Documents or CA?
File Hidden Attribute after installation - Source in CAB files
260 characters limit in shortcut's targets Windows not MSI/Setup Limitation

Return Home - Index

About Dominique Gérard Schneider since 1995
Participation on Google
ContactEZ.net on YouTube

Tek-Tips Forums dgschnei
Listed since 1996 ixquick
Community Services

platform sdk dgschnei
Cooperation
About Me

Tek-Tips Forums, and platform sdk (member name dgschnei)