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]