共用方式為


Deciphering the MSI Directory table, part 1.

It's been about a month and a half since I've had the mental wherewithal to sit down and blog about something interesting in the Windows Installer or WiX toolset or something otherwise setup related. I've been in integration hell which would be something interesting to blog about but now isn't the time (ask me again in a year). Today I decided to focus on something else that has been frustrating me a bit. I have wanted to blog about some basic Windows Installer concepts that seem to always trip up developers that are new to MSI and/or WiX.

Well, I was recently conversing with Fredrik Grohn (of the WiX COM+ CustomAction fame) via IM about some of the good ol' times when I was an intern on the Windows Installer team. During that conversation I remembered one of the first mental hurdles I had to make when I was first learning the Windows Installer, the Directory table. The more I thought about it the more I realized the Directory table was a great place to start up again.

So let's go back to January of 1998. The Windows Installer was still under construction but capable of a lot of basic installation machinations. There was no MSI SDK to speak of at the time. All information about the Windows Installer was focused around the atrium on the third floor of Building 17.

I was one week new and knew nothing about relational databases, SQL, or file versions. This was particularly troubling because my mentor said my first task was to create a program that would update a relational database (he called it an MSI file) with the versions from some files (he mentioned that not all files have versions) using SQL (which I divined was a language of some sort). I took a deep breath and started looking for something that made sense.

After dumping the example MSI file to text files called IDT files (I hadn't written Orca yet) I quickly found the File table. I saw the Version column and started feeling like there was a chance I might not get fired quite yet. Then I hit the Directory table.

The Directory table contains three columns: Directory, Directory_Parent, and DefaultDir. Two of the columns are just identifiers and the column that actually contains the name of the directory isn't called "Directory". Moreover in my example the name of the directory sometimes contained a pipe (think "|") or colon (think ":") or both. That really confused me because any time I tried to create a directory with that character explorer would tell me I had an invalid character. I could feel the panic etching its way up and under my fingernails.

So, once again I took a deep breath and walked around to the other side of the Building 17 atrium to sit down in Ben Chamberlain's office. Ben had been a developer on the Windows Installer for a few years by then and I was told he could answer all of my Directory table questions. He did and next time I will share them with you.

[to be continued]

Comments

  • Anonymous
    June 22, 2005
    The comment has been removed
  • Anonymous
    June 23, 2005
    I'm very curious as to what comes next :-)
  • Anonymous
    June 23, 2005
    The comment has been removed
  • Anonymous
    June 25, 2005
    The comment has been removed
  • Anonymous
    June 27, 2005
    Imagine a blog entry where I slowly continue to take apart the Directory table.
  • Anonymous
    June 27, 2005
    AJ,

    First, I'm trying to "write less" "more often" since it is obvious that when I try to "write more" "less often" that "less often" turns into "never". We'll see if it works. Second, there are a lot of subtleties of the Windows Installer that can be learned by digging deeply into such a simple table. I hope to go beyond what you can read in MSDN about the Directory table and explain why things ended up the way they did. Finally, I hope to grow from this topic into more complex topics related to the Directory table (such as the multitude of ways you can customize the install location for an application). Each topic will be able to build on the topic before it.

    The real question open to me is how much information do I need to post in each blog entry along the way to keep readers interested? I'm finding that I'm doing much better posting two or three paragraphs instead of my typical seven to ten. Hopefully, it isn't too frustrating waiting for each weeks small installment. In any case, I'm reading the feedback and will try to adjust from that.
  • Anonymous
    June 29, 2005
    I guess I prefer the longer posts with a conclusion. Now, I am here to read the rest of the story and offer some more feedback.

    Please understand, I love reading your blog and I almost always learn something new. It is much appreciated.
  • Anonymous
    June 29, 2005
    AJ, I appreciate the feedback.

    After a couple weeks here is how I see things. I expect most readers (how many? 3? 5?) would rather I write complete stories as often as I'm writing this story in many parts. However, I think I've proven (to myself anyway) that I can't get complete stories posted at all. So we'll just have to take this as the lesser of two evils. <smile/>
  • Anonymous
    January 31, 2006
    Your "File table" link points to the same link the "Directory table" link points to.I think it should be the file table link:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/file_table.asp
  • Anonymous
    February 01, 2006
    Gee, I was going to ask another question, but I -finally- got a clue... That orca.exe is not distributed with the Platform SDK, but that *orca.msi * IS. - It took me a while - I must have read it a half a dozen times before it clicked. - Doh! ;)