Windows 7 MSI Fix Datastream For All Users cab DuplicateFile
These examples demonstrate;
- Active Setup (compares a logging in users Active Setup values in their HKU to the HKLM to determine if it should do 'something'). This results in the ability to add HKU keys from and MSI. i.e. for All Users [Alternative being using an advertised entry-point (e.g. a shortcut) to trigger self-healing]
- DuplicateFile Table to utilise a .mst transform to add/modify files in an existing .msi package WITHOUT resorting to using .msp patches AND get around Windows not caching the .cab files.
Contents
Important tote about DuplicateFile Table
If you are adding a DuplicateFile table you must add it to the InstallExecuteSequence somewhere after InstallFiles, if it isn't already present.
Advance Datastream
These are the modified tables for Advance Datastream which is a badly made MSI that doesn't install for All Users and completely arses up installing the powerpoint addin.
Property table
ALLUSERS=1 - This makes it install on a per-machine basis, otherwise running install under SYSTEM account seems to make it default to ALLUSERS="" (per user) which isn't a good idea as it isn't really designed to do this. (I dont know if it has any non immediately obvious problems other than not making any shortcuts - the additional Active Setup repair takes care of lack of shortcuts at least)
PPTADDIN - This forces it to not install the PPT addin which if left causes the repair install (msiexec /fup) to break due to the package being not made correctly. (It cannot be specified on the command line with the repair as it is ignored)
Registry Table
The easiest way to add these in Insted is via 'Components' > 'Add' .reg key, after selecting a suitable 'Component_'. (I picked User_Files as other similar entries used it, despite some not being HKU (Root 1))
- Note each reg file you import with give a new series style to the 'Registry' entry in the table. (Looks like I used 5 different files in this example judging by the underscores)
The first 17 lines (\Datastream\DSAccess) add the login/password and the minimum amount of entries needed to NOT trigger it to replace them with defaults, to HKU.
The next three (SOFTWARE\Woww6432Node) are the Active Setup lines which enable it to 'repair' itself when the user logs in, with /fups. I am using the real GUID (as per guidelines but it can in fact be anything for the registry key. Obviously the GUID in the value needs to be correct though! f=repair, u=user registry repairs, p=missing files, s=shortcuts repair. ['s' is unusually vital for this as it has lots of perculiar actions going on determined to delete shortcuts otherwise.]
- It adds the HKU registry entries (user/password etc.)
- It copies any 'missing' files (i.e. the duplicatefiles, e.g. the MS Word template to the Current Users template folder.)
The next lines add the Excel addin (.xlam) and the Powerpoint addin (.ppa) for HKU.
- Note the Excel one NEEDS quoting and the Powerpoint one must MUST NOT be quoted. Bizarre.
The last 6 lines add a Trusted Location for Word and Excel that means user can load 'stuff'(templates etc) from the Datastream folder without security type warnings.
DuplicateFile Table
This copies the Word template file from the Datastream folder (defined as file _6xxx in the 'File table') into the Users Word templates folder (here called 'Templates' which the exact path is defined in the 'Directory table'). Only the 'Destname' is a real filename as opposed to a reference to the source and paths.
e.g. When an install/repair install is ran it gets copied into the users Word template folder (not Windows defined 'TemplatesFolder' which is AppData\Roaming\Windows\Templates , instead AppData\Roaming\Microsoft\Templates)
Directory Table
This defines the Word Templates folder, which ISNT the same as Windows defined 'TemplateFolder'
Shortcut Table
Desktop shortcut is simply removed. (highlighted Yellow)
Advance Datastream Charting Addin
These are the modified tables for Advance Datastream Charting Addin
To add a file you really need to use Insted's pay add-in (InstEdPlus-1.1.9.10.msi on a 30 day trial) and go via the added File Manager as doing it entirely manual is a lot of faff - but this is still rather limited.
There are several problems/bugs with this addin;
- It wont create a non existant directory structure to add a file into so you need to manually do that by adding enties in the 'Directory table', these will then appear in the filemanager bit.
- Secondly to add a file into it you need to physically create the same path structure on the drive relative to where the MSI is, browse to it in the explorer bit and drag and drop the file in - however when you try and save it out as a cab it will error out. So dont try this!
- If you try and use a differing .cab name it seems to not work.
Instead (using the addin) - Add the file in the root, save the .cab out using the default name (insted.cab). This should then create the Media/FeatureComponent/File/Component and MsiFileHash tables. Then modify the tables appropriately for its name, and target locations.
DuplicateFile Table
Apart from the 'Destname' which is the name the file ends up in reality, these are all references to other tables, e.g. file/directory table. (This is somewhat confusing as they have the same reference names as the file.)
This copies the file from the source to the target when the app is installed OR more importantly repaired, WITHOUT resorting to the .cab which will no longer exist (as not cached)
- The .config file specifies to disable updates and more importantly sets always writeable paths (c:\programdata) - if msi is installed with the SYSTEM account it screws the paths up making them non writable and breaks the chartin addin loading with access denied errors.
- The .xml file is generated from adding user/password info on a normal install and copying out the .xml file generated from the the Thomson Reuters dir (see File table for exact location)
XML File
<?xml version="1.0" encoding="utf-8"?> <DswsTokenInfo> <Meta LastModified="2012-xx-xx xx:xx:xxZ" ModifierApp="ChartAddin" /> <Info UserName="xxxxxxxx" Password="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" AssocDSId="xxxxxxxx" /> <AppsInfo> <AppInfo AppName="ChartAddin" Modified="2012-xx-xx xx:xx:xxZ" Session="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" /> </AppsInfo> </DswsTokenInfo>
Media Table
Insted addin generated - Can change the .cab name to whatever you want (from Insted.cab) and just rename the real file to same, hashes only relevant to the files in it, not the cab.
- Note the msi will be cached in c:\windows\installer but NOT the .cab (The # prefix means the default built in cab is in the MSI, I think in win7 it will stay cached in, XP they are stripped out.)
This is why you need to use the DuplicateFile table trick to store the file someplace it will be accessible on a repair install.
- You can manually remake the .cab with Makecab or cabarc etc. , so long as the file inside has correct hash is all that matters. The 'LastSequence' value will also need updating if adding additional files, see the File table 'Sqeuence' column for it. i.e. If you have 2 files in the .cab the number will need to be the higher value in the File table. In this example the second file has a Sequence of 187 so the cab's LastSequence will need to be 187 too.
FeatureComponents Table
Insted addin generated -
Directory Table
This builds up the target directory (for the temporary storage of the NEW file)
e.g. the .xml file with the user settings in gets installed to c:\ProgramData in Win7 (LocalAppDataFolder), then when a repair is called it will use this location, as a source as .cab isnt cached.
File Table
Insted addin generated - you will need to alter the 'Filename' here to fix the target path.
Can see here greyed out where it is going to end up (target_path)
Property Table
Not entirely sure this actually does anything, ALLUSERS=1 was set via commandline in the .bat of the original but didn't seem to do anything obvious, it certainly didn't install it for all users!
Component Table
Insted addin generated - will need 'Directory_' location fixing.
- Note, Can see here greyed out where it is going to end up (target_path) - DATASTREAM2 in directory table corresponds to CommonAppData\Datastream, so the file is in CommonAppData\Datastream\DswsTokenInfo.xml (its holding place for repairs, i.e. adding to HKU), not sure why the target_path looks like that, assume bug in Insted?
Registry Table
The top 3 lines are the Active Setup repair install. 'msiexec /fup {GUID}' will re-add HKU and install any missing files, in this case the .xml through the magic of DuplicateFile !
The bottom line allows IE popups from their *.datastream.com website URL(s), in HKU (Root=1). This is needed to import live data back into Excel, otherwise it will be blocked and you will get a Jscript error.
Ironically this also repairs the VSTO Office add-in HKU fixing system that is broken by installing this application under the SYSTEM account.
MsiFileHash Table
Insted addin generated - 128bit hash (4 x 32bit values) of the added file. Not sure how to manually gen this, its not md5!
Silent Install
@echo off
msiexec /i "%~dp0Advance.msi" TRANSFORMS="%~dp0datastream.mst" /q
msiexec /i "%~dp0Datastream Charting\Datastream Charting Add-In.msi" TRANSFORMS="%~dp0Datastream Charting\dscharting.mst" /q
References
Comments
blog comments powered by Disqus