Thursday, June 25, 2009

MSP - Patching rules

If you create a new version of your program and want to be able to update existing installations either with a full install package or with a patch package, you must follow some rules. Breaking these rules will cause strange effects like previously installed features appearing as advertised after the update, or files not getting updated features not getting installed etc. If you are not following them, you can expect your MSP to lead you no where :)

Some rules small and minor updates : 

  1. Follow the rules for changing or keeping the ProductCode, ProductVersion and UpgradeCode, depending of the type of update you are creating. 
  2. Always change the package code.
  3. Do not move componentes to other features.
  4. Do not move sub features. You can add new features and sub features.
  5. You can add components to existing features. If you want to add a new feature you can synchronize the installation state of a new child feature with its parent feature by setting its Remote Installation property to "Favor Parent" and its Required property to yes.
  6. Do not change component codes.
  7. Do not change the name of the key file of a component.
  8. You can modify the contents of a component (add, remove or modify files, registry keys and shortcuts), but only if that component is not shared across features.
  9. If you remove a file or registry key from a component, you must populate the RemoveFile or RemoveRegistry table respectively to delete the orphaned resource.
  10. Do not change the name of the .msi file.

Ref: Stefan Krueger@http://www.installsite.org/pages/en/msi/updates.htm


Wednesday, June 17, 2009

MultiLanguage Patch - MSP


If you are thinking about some command for MSI installer to do so, there is'nt any. What we are going to implement is a Hack where we can deploy the langauage transforms before applying the patch.

How we are going to do this is
1) Get MST files from the Installshield build output folder
2) Create a Package using NullSoft Installer( its easy)
3) Write code in nullsoft to replace the MST file locally
4) Extract the update.exe or MSP and run

Original MST file is stored in C:\WINDOWS\Installer\{PROD_CODE}\1031.MST, you can find out the path by reading HKLM\SOFTWARE\Classes\Installer\Products\MY.PROD.GUID and value of transforms key. Now you can go and replace this file and run the patch. Below is the code for doing this. Use NSIS compiler to compile it.

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_VERSION "3.3"
!define PRODUCT_PUBLISHER "ItsMe"
!define PRODUCT_WEB_SITE "http://www.MySite.com"

; MUI 1.67 compatible ------
!include "MUI.nsh"


!define MUI_ICON "Developer.ico"

;
; Language files
!insertmacro MUI_LANGUAGE "English"



SetCompress auto
OutFile "Patch.exe"
Function .onInit

SetSilent silent

FunctionEnd


Section "MainSection" SEC01
SetOutPath "$tempdir"
SetOverwrite ifnewer
File "D:\Build Output\Patch\Update.exe"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1031.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1032.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1033.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1034.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1036.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1041.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1040.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1043.mst"
File "D:\BuildOutput\Product Configuration 1\Release 1\DiskImages\DISK1\1046.mst"

ReadRegStr $0 HKLM "SOFTWARE\Classes\Installer\Products\MY.PROD.GUID" "transforms"

; remove
StrCpy $1 $0 "" -8

Rename $0 "$0.bak"
CopyFiles $tempdir\$1 $0

exec "$tempdir\Update.exe"
SectionEnd

Section -AdditionalIcons
SectionEnd

Section -Post
SectionEnd

Wednesday, May 27, 2009

How to disable Symantec Device Manager and access your disabled USB drive

Well, its going to be interesting! Symantec might be installed on your office machine and its controlled by policy, so it might be blocking you from connecting any USB device. You can enable it at your own risk, provided your are a machine admin.

open services.msc and look for Symantec Management Client Service.
Go to properties.
Open the logon tab.
Give your current network credentials.
Now go to Task Manger and kill smc.exe.

Now on Symantec will be running in your account and you are the boss. You can Stop/Start/Kill it at any time.

If you dont want to see the service running again, dont give your right password in logon. Service wouldnt start now on, because of the logon failure.

Disclaimer: I am not using the above method, neither i am recommending this to you. You are on your own buddy!
Posted by Picasa

Tuesday, May 26, 2009

Read contacts from Outlook using javascript


Following Javascript uses MAPI component and reads the contact details stored in Outlook. This works only with Outlook, not with Outlook express. It can also read the GAB if outlook is connected(following code does not do that, it prints only the addresses stored. You can remove the check for 'Contacts' to do so..).


 
<html><head>
<script language="javascript">
<!---
function readOutlookContacts()
{
obj = new ActiveXObject("Outlook.Application");
mapi= obj.GetNamespace("MAPI");
if( mapi )
{
addlst = mapi.AddressLists;
if( addlst )
{
if( addlst.count > 0 )
{
for(i = 1; i <= addlst.Count;i )
{
al = addlst.Item(i);
addentrs = al.AddressEntries;
if(al.name=="Contacts") //no need to read GA Book or other folders
{
for( tmpi = 1; tmpi <= addentrs.Count; tmpi )
{
aentry = addentrs.Item(tmpi);
email =aentry.Address;
document.write(":" +email + <br>);
}}}}
}}
}
-->
</script>
</head>
<body onLoad=javascript:readOutlookContacts()>
</body>
</html>


But take care of IE security settings for activex while running this.

Monday, May 25, 2009

Patch Installation


If you are creating a patch using installshield, you can either create an update.exe or a MSP file. Advantage of creating MSP is that; you can open it in ORCA and see the difference the patch brings out.

But be careful !!!

Never run the MSP by double clicking on it. It will trouble you for sure, you might see some features getting added automatically. You might see a new feature getting installed through patch. You will find a ADDLOCAL = newfeature getting joined to the installation in the MSI install log.

To avoid always use following command for applying the patch.

msiexec.exe /p "\Patch.msp" REINSTALL=ALL REINSTALLMODE=omus

My advice will be is to create Update.exe always if you ever need a MSP you can extract it. So, if you need a MSP out of update.exe; run the exe and search for the msp in temp folder when you are at the PatchWelcome screen.

Search Everything and dont index anything

I was using Google desktop, Copernicus, Windows Desktop search on my laptop for file search. What i have realized is that i dont need them always. Amount of CPU/Mem/Drive it takes for indexing is not worth it.Most of the times, i dont search for my documents on my machine because i know the location it many times.

Documents i get from others are in mails. So i use a tool which searches for documents just by file name, and dont use big indexes and way faster than the native windows file search.

Search Everything can search for files and gives you all the windows shell options. This is one of the Tool i found recently and love using it and reccomend others.

Well for mails i use Windows Desktop Search, because of its seemless integration with outlook. But i make sure that i dont use it for anything other than mails.

Download Search Everything

Launchy - No more start menu navigation

Most of my work begins with Windows+Space key. Thats the shortcut I have assigned for the Launchy tool.
What lauchy does is it indexes shortcuts on your start menu, plus some other applications.
I have bunch of stand alone applications that i use often and i have added this to the indexing catalog. You can type and look for the application, and Launch. Once installed you would never go back to start menu or any applicatoin folder to launch.

I even use it on my development debug folder, So that i dont waste time in looking for an application to launch.

Download Launchy