Adding Custom Prerequisites to your MSI package

by Digvijay 16. May 2008 18:05

Recently I made an installer for an Outlook 2007 Add-in developed using VSTO/VS 2008 and it worked fine on all development machines I have, but I noticed that it would fail to run on a fresh VPC image.

I had added all the necessary CA permissions, correct registry entries to the installer but I could not figure out what was missing!

 

A bit of goggling and I found some interesting things that I would share here:

 

A shared office 2007 add-in would need the following as prerequisites

  • .NET Framework
  • VSTO Runtime
  • Office 2007 Primary Interop Assemblies

So I decided to go ahead and add them to my installer but to my surprise the VS 2008 prerequisite dialog did not contain any of these. So how do i add them to the prerequisites dialog on my development machine???

It seems gotdotnet hosted such a tool which is now moved to codeplex. I could add all these 3 as a prerequisite and boom! it worked. This tool called the BMG or the Bootstrap Manifest Generator can take up arbitrary executables and MSI packages and add them as custom prerequisites!

 

A click once version of BMG can be found here.

 

Here is a nice article describing it.

Tags:

Installers | Office Development | VSTO

Installing Phidgets runtime as a part of Installation

by Digvijay 2. March 2008 13:53

Phidgets Inc recommends installing specific libraries where possible to avoid redundancy but I found that most computes running windows now have .NET 2.0 more or less.

 

Now if you ever needed to install Phidgets runtime as a part of your application installer these might be the steps you take.

 

1. Down load the Phidgets installer MSI from http://www.phidgets.com/downloads.php?os_id=1

 

2. Place it in the install script for InnoSetup as

   1:  [Files]
   2:  Source: Files\MyApp.exe; DestDir: {app}; Flags: ignoreversion confirmoverwrite comparetimestamp
   3:  Source: Files\Phidget_2.1.3.20080206.msi; DestDir: {tmp}; Flags: ignoreversion confirmoverwrite comparetimestamp deleteafterinstall

3. In the install  run section place an entry like

[Run]Filename: msiexec.exe; Parameters: "/i""{tmp}\Phidget_2.1.3.20080206.msi"""; StatusMsg: Installing Phidgets runtime components ...

OR from the Editor UI (I use ISTool, you can use anyone you like but the options may vary)

 

Technorati Tags: ,,

Tags:

InnoSetup | Installers | Phidgets

Orca and Activatenow

by Digvijay 22. February 2008 16:38

Recently i came across activate now as a "so called" advanced activation service wherein one could embed custom actions in the msi package while building a Visual Studio MSI project for activating the product using Activatenow SDK.

Not that i needed to use any specific software, I was just curious to know how secure would that be and just tried to bypass the protection.

ORCA is a MSI Database Editor tool which i used to remove the custom action and the product installed just fine.

 

I wonder is there a real security with software until both software and hardware vendors work hand in hand to develop a strong licensing mechanism. But of course, most people will not like it (I am one of them), but just looking at the different options available today, there can be hard to break protections but not 100% foolproof. But what the heck! Cryptography is all about the limitation of computing power versus mathematical complexity!

Disclaimer: The post contains a description of how the protection was bypassed as a part of my studies, this does not constitute an act of reverse engineering or trying to break any specific software for commercial or personal benefit. However, if this post is offending to any parties they can contact me and i shall remove this post.

 

Technorati Tags: ,,

Tags:

Installers | Security

Making InnoSetup download the .NET 1.x/2.0/3.x runtime during installation if not Installed

by Digvijay 11. February 2008 17:25

After a bit of research I could find how to add an extra step to let innosetup download the .NET runtime for you.

 

Here is the script that you can add to your [code] section:

 

   1:  [Code]
   2:  var
   3:    dotnetRedistPath: string;
   4:    downloadNeeded: boolean;
   5:    dotNetNeeded: boolean;
   6:    memoDependenciesNeeded: string; 
   7:   
   8:  procedure isxdl_AddFile(URL, Filename: PChar);
   9:  external 'isxdl_AddFile@files:isxdl.dll stdcall';
  10:  function isxdl_DownloadFiles(hWnd: Integer): Integer;
  11:  external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
  12:  function isxdl_SetOption(Option, Value: PChar): Integer;
  13:  external 'isxdl_SetOption@files:isxdl.dll stdcall'; 
  14:   
  15:  const
  16:    dotnetRedistURL = 'http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe';
  17:   
  18:  function InitializeSetup(): Boolean; 
  19:   
  20:  begin
  21:    Result := true;
  22:    dotNetNeeded := false; 
  23:   
  24:    // Check for required netfx installation
  25:    if (not RegKeyExists(HKLM, 'Software\Microsoft\.NETFramework\policy\v2.0')) then begin
  26:      dotNetNeeded := true;
  27:      if (not IsAdminLoggedOn()) then begin
  28:        MsgBox('<Application Name> needs the Microsoft .NET Framework to be installed by an Administrator', mbInformation, MB_OK);
  29:        Result := false;
  30:      end else begin
  31:        memoDependenciesNeeded := memoDependenciesNeeded + '      .NET Framework' #13;
  32:        dotnetRedistPath := ExpandConstant('{src}\dotnetfx.exe');
  33:        if not FileExists(dotnetRedistPath) then begin
  34:          dotnetRedistPath := ExpandConstant('{tmp}\dotnetfx.exe');
  35:          if not FileExists(dotnetRedistPath) then begin
  36:            isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
  37:            downloadNeeded := true;
  38:          end;
  39:        end;
  40:        SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
  41:      end;
  42:    end else
  43:    begin
  44:        memoDependenciesNeeded := 'The Microsoft .NET 2.0 Framework is already installed.' #13 'The <Application Name> Installer may now proceed.' #13;
  45:    end; 
  46:   
  47:  end; 
  48:   
  49:  function NextButtonClick(CurPage: Integer): Boolean;
  50:  var
  51:    hWnd: Integer;
  52:    ResultCode: Integer; 
  53:   
  54:  begin
  55:    Result := true; 
  56:   
  57:    if CurPage = wpReady then begin 
  58:   
  59:      hWnd := StrToInt(ExpandConstant('{wizardhwnd}')); 
  60:   
  61:      // don't try to init isxdl if it's not needed because it will error on < ie 3
  62:      if downloadNeeded then begin 
  63:   
  64:        isxdl_SetOption('label', 'Downloading Microsoft .NET 2.0 Framework');
  65:        isxdl_SetOption('description', <Application Name> installer needs to install the Microsoft .NET 2.0 Framework. Please wait while it is downloaded to your computer.');
  66:        if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
  67:      end;
  68:      if (Result = true) and (dotNetNeeded = true) then begin
  69:        if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
  70:           // handle success if necessary; ResultCode contains the exit code
  71:           if not (ResultCode = 0) then begin
  72:             Result := false;
  73:           end;
  74:        end else begin
  75:           // handle failure if necessary; ResultCode contains the error code
  76:           Result := false;
  77:        end;
  78:      end;
  79:    end;
  80:  end; 
  81:   
  82:  function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
  83:  var
  84:    s: string; 
  85:   
  86:  begin
  87:    if memoDependenciesNeeded <> '' then s := s + 'Dependencies to install:' + NewLine + memoDependenciesNeeded + NewLine;
  88:    s := s + MemoDirInfo + NewLine + NewLine; 
  89:   
  90:    Result := s
  91:  end; 
  92:   
  93:  function FrameWorkName(Param: String): String;
  94:  var
  95:    Names: TArrayOfString;
  96:    I: Integer;
  97:    FrameworkInstall: Cardinal;
  98:  begin
  99:    Result := '';
 100:    if RegGetSubkeyNames(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP', Names) then begin
 101:      for I := 0 to GetArrayLength(Names) - 1 do begin
 102:         RegQueryDwordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\'+Names[I], 'Install', FrameworkInstall);
 103:         if FrameworkInstall = 1 then begin
 104:            Result := Names[I];
 105:         end;
 106:       end;
 107:    end;
 108:  end;

Let me know if anyone finds this bit useful!

 

Cheers!

 

Technorati Tags: ,

Tags:

InnoSetup | Installers

 

About Digvijay

  Digvijay Chauhan
I am a developer living in Stockholm, Sweden and I love to program and work on cutting edge technologies in the Microsoft Technology space.

LinkedIn Twitter StackOverflow

Certifications

Digvijay Chauhan Microsoft Certification Logo

Other Pages

RecentPosts

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

Most comments

Live Traffic

Live Traffic Feed
  Västra Frölunda, Vastra Gotaland arrived from digvijay.eu on "blank_page"

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Translate