Click here to Skip to main content
Email Password   helpLost your password?

Introduction

Encoding a Custom Action Type field is relatively simple. You just need to use the different values as flags, and use that as a number. Decoding is a completely different matter. There are several conflicting rules, and various flags have the same value. To make matters more complex, the msidbCustomActionTypeBinaryData flag has a value of 0, making it impossible to use as a flag. In this very simple project, I have encoded the rules to decode.

Background

Before reading this article, you should have a good grasp on what a MSI database is, and how to edit it using Orca. You will not be doing that with this program, but not being able to do that renders the contents of this article somewhat useless.

Using the code 

The rules for encoding are very simple, and they are as follows:

Action Types with values lower than 7 imply the use of msidbCustomActionTypeBinaryData. All others are not using it.

If msidbCustomActionTypeInScript is present, the values 0x100 and 0x200 are msidbCustomActionTypeRollback and msidbCustomActionTypeCommit. If it's not present, those values represent msidbCustomActionTypeFirstSequence and msidbCustomActionTypeOncePerProcess. Also, the value msidbCustomActionTypeClientRepeat should never be selected at the same time as msidbCustomActionTypeInScript.

The first 7 values are exclusive. That is, an action may be msidbCustomActionTypeDll, msidbCustomActionTypeExe, msidbCustomActionTypeTextData, msidbCustomActionTypeJScript, msidbCustomActionTypeVBScript or msidbCustomActionTypeInstall but none of them at the same time. This basically amounts to values 1 through 7 not being flags, but textual values.

Points of Interest 

The Type column was obviously grown organically, and as such it doesn't make sense as a true flag. This makes sense historically, but it makes decoding much more difficult than what it should be.  I hope my little program helps with that confusion.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralGreat Tool
Gord Smith
5:45 15 Apr '09  
Thanks. This tool really helps when examining a .msi file to see what's happening. Thumbs Up

What would make it even better would be if we could check/uncheck boxes and see the decimal number updated. Sometimes you just want to tweak a custom action.

I know one can do the math oneself, but then why bother to write the tool at all? Smile
GeneralRe: Great Tool
joaquinjares
5:55 15 Apr '09  
Yep, I agree. I didn't do it because I didn't want to code all the rules for checkboxes. For instance, the first 7 can't be checked at the same time (only one of them) and I didn't decide on what would happen if you try (the check changes, is disabled, shows an error, etc). Also, there are rules I still don't understand for encoding, although I think I have all the math correctly for decoding. I'll try it anyway...

J

GeneralRe: Great Tool
Gord Smith
12:01 15 Apr '09  
While you're at it, I think there might be a bug.

e.g. type in 34, you get Exe and Directory as expected.

Add 64 for Continue, i.e. type in 98, and you get Exe and Continue, Directory has disappeared.


Last Updated 18 Sep 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010