![]() |
sponsored links |
|
|
sponsored links
|
|
1
5th August 18:30
External User
Posts: 1
|
I have scrawled up some posts and was asked by one of your
groupies if I could post some of them in here. So this is just for comments from anyone whom is interested. I have plenty more this is more so to get feedback from you guys. Current User self healing. First I will outline a few important items which are critical to building MSI packages. Features: A feature is a container which may hold other features and components. Component: A component is a container designed to hold application related information such as: regsitry keys files ODBC configuration to name a few. A component has a unique identifier called a {GUID} which is represent by a 16 bit HEX code. Primary Key: The primary key is an item in a component which is checked during advertised actuation. Entry Points: Items within the package can be advertised. It is common to use shortcuts and file extensions as advertised entry points. An advertised entry point will trigger the checking of primary keys for components within a feature. I will outline a little more exactly how healing works which will assist in understanding why to use the following feature / component structure. For the following assume there is only one Feature called "COMPLETE" and a few components such as "COMPONENT1" "COMPONENT2" and "COMPONENT3" COMPONENT1 contains 1 file "FILE1.TXT" with a primary key of "FILE1.TXT" COMPONENT2 contains 1 file "FILE2.TXT" with a primary key of "FILE2.TXT" COMPONENT3 contains 1 advertised shortcut "SHORTCUT1" contains 1 file "FILE3.TXT with a primary key of "FILE3.TXT" contains 1 file "FILE4.TXT COMPONENT4 contains 1 HKCU reg key with a primary key of "HKCU\test" When an entry point such as a shortcut is triggered in an MSI the following will occur. The msi self healing operation will begin its checking process in the following manner. The MSI will enumerate what feature the entry point or in this case the shortcut belongs to. For the above example assume a user runs SHORTCUT1 which is the advertised entry point. This action will cause the MSI to find out what FEATURE SHORTCUT1 is in. The next step is to find out what other components are in this feature. In this case COMPONENT1 COMPONENT2 and COMPONENT3 Each of the COMPONENTS in the same feature as the entry point will be checked. The primary key of each component will then be checked against the workstation to ensure that these primary keys exist. In this case COMPONENT1 has a primary key of FILE1.TXT therefore the msi will check if FILE1.TXT exists on the workstation and continue this process through all of the COMPONENTS within the same FEATURE the entry point is in. If any of the PRIMARY KEYS are missing the entire feature is healed. As depicted above if FILE4.TXT is missing nothing will happen. FILE4.TXT is not a primary key therefore the MSI will not care if it does not exist. Now a very important thing to note here is if there are any parent FEATURES windows installer will then step into the parent FEATURE and being this process again and continue until all parent FEATURES are checked. Now for the interesting part. Anyone whom has been packaging for a while will know that HKCU registry keys are often the cause of trouble within a package. The current user keys normally are only delivered the user whom is logged in at the time of installation. The msi technology has attempted to overcome this shortcoming and uses self healing to configure current user settings for all users of a given workstation. When using Wise Package Studio the default actions within Wise will create a COMPONENT called "CurrentUser" this component will have all of the HKCU registry keys inside it. If your using other applications such as InstallShield I expect you could achieve the same results relatively easily. Now assuming we followed default configuration of Wise all of our components would go into the "COMPLETE" FEATURE including the aforementioned "CurrentUser" COMPONENT. If you were to use this default methodology any new users logging into a machine and running an advertised entry point would trigger the healing mechanism's checking routines. This would eventually get to the "CurrentUser" COMPONENT and would find that the primary key for the "CurrentUser" COMPONENT would not exist. This in turn would trigger a heal of the entire COMPLETE FEATURE. Now on a small application this may be acceptable however if you have a 600mb application reinstalling the entire application for a new user would probably be extremely excessive. So to counter this effect with the help of some of the mentioned persons this idea was developed. Create a new FEATURE STRUCTURE as follows: FEATURE "CurrentUser" Move your "Complete" FEATURE to a child of the "CurrentUser" FEATURE. so you will have the following. CurrentUser ------------Complete Whenever you have an application which contains HKCU components put the HKCU components into a COMPONENT called "CurrentUser" and put that COMPONENT into your "CurrentUser" FEATURE. The remainderof the application would go into your COMPLETE FEATURE as pictured below. Feature:CurrentUser Component: CurrentUser --------Feature:Complete -------- Component: Component1 -------- Component: Component2 -------- Component: Component3 Now in this scenario if you run the SHORTCUT1 as per the previous example the COMPLETE FEATURE is checked as per normal windows installer operation. In a good package this will not result in healing of the COMPLETE FEATURE as it should already be delivered during install time. But what is good about this is that once the COMPLETE feature is finished its checking routine Windows Installer behaviour steps up to the parent FEATURE in this case "CurrentUser" and checks that feature also. If a new user is logged in the primary key for the "CurrentUser" COMPONENT will not exist which will trigger healing on the "CurrentUser" FEATURE therefore effectively you are now only healing a tiny portion of your package not the entire application. I hope this is helpful to some of you. Its pretty hard to put into words so hopefully it will clear up some behaviour and assist with healing HKCU components. Next time I will address the Current User files. Please if you have any comments feel free to mail me on huckey@mindless.com |
|
|