Welcome to MSDN Blogs Sign in | Join | Help

Deciphering the MSI Directory table, part 4

I am seriously fried. This week starts with a ramp up to an executive review and ends with a major deadline. Nothing like a double header to really get your blood flowing. Anyway, I'm just whinging away right now to lower any expectations you might have for this blog entry. I'm going to keep it simple.

I my last blog entry we discussed some common conventions found in the MSI tables. Go back and take a look at convention #5 about foreign keys. I want to talk about how the Directory table uses the foreign key column Directory_Parent to create the directory hierarchy (I promised this would simple). First, let's get an example Directory table that has a few entries in it.

Directory           Directory_Parent      DefaultDir
s72                 S72                   l255
Directory           Directory
TARGETDIR                                 SourceDir
FirstFolder         TARGETDIR             One
SecondFolder        FirstFolder           Two
ThirdFolder         SecondFolder          Three
SecondThirdFolder   SecondFolder          ThreeToo

Now let's see how the Windows Installer would interpret that data. Remember the first column simply provides a unique identifier for each directory entry. The second column is a foreign key column and we know that the underscore in the column name means it heavily suggests that it refers to the first column of the Directory table. Thus by process of elimination the last column must be the actual name of the directory. If this is right, we'd have the following directories defined.

TARGETDIR         = SourceDir\
FirstFolder       = SourceDir\One\
SecondFolder      = SourceDir\One\Two\
ThirdFolder       = SourceDir\One\Two\Three\
SecondThirdFolder = SourceDir\One\Two\ThreeToo\

If we assume that TARGETDIR and SourceDir are something special and ignore them for the moment then the rest of the directory layout hopefully make a lot of sense. The FirstFolder directory is "One" and has only one child directory, "Two". The SecondFolder directory is "Two" and has two directories in it "Three" and "ThreeToo". "Three" and "ThreeToo" are referred to by the directory identifiers ThirdFolder and SecondThirdFolder respectively.

I'm sure by this point you're thinking, "This stuff is all obvious so get to the good part!" Well, now that I've introduced the necessary basics I think we can dig into some of the more interesting facets of the Directory table.

[to be continued]

Update: I added backslashes to the end of the resolved directories because (as mentioned in the comments) this is the way the Windows Installer sees directories. I was going to cover this fact in a later blog entry but it is wise to be consistent from the beginning.

Published Tuesday, July 12, 2005 1:29 AM by robmen
Filed under:

Comments

# re: Deciphering the MSI Directory table, part 4

Tuesday, July 12, 2005 11:25 AM by AJ
Good stuff Rob. One oversight, directory table properties end with a trailing backslash though.

Okay, I know, now I am just being a jerk. :-)

# re: Deciphering the MSI Directory table, part 4

Tuesday, July 12, 2005 1:42 PM by robmen
No, AJ, that's a very good point that I was going to bring up later. However, being consistent from the beginning is probably a good idea. Thanks for pointing it out.

# re: Deciphering the MSI Directory table, part 4

Friday, October 14, 2005 11:58 AM by Christopher Painter
I'm ready for Part 5! The assume TARGETDIR and SourceDir is special is a teaser. Lets get into the DefaultDir column more please.

# Deciphering the MSI Directory table, part 7 (directories are properties)

Tuesday, October 17, 2006 1:27 PM by Rob Mensching Openly Uninstalled

In my last blog entry, I wrapped up saying that we'd talk about how to make your install directory configurable

New Comments to this post are disabled
 
Page view tracker