How To Create Custom Libraries in Windows 7

Default Windows 7 Libraries I recently discovered a cool little feature in Windows 7.  I’d known about the libraries that come default, which include Documents, Music, Pictures and Videos.  I thought that it was a nice idea that these libraries looked in multiple locations.  While I hadn’t had much need for it yet, I can envision my home network utilizing it once I start upgrading my home machines.

At work, I’m testing the 64-bit version of Windows 7 RTM as a developer workstation in our environment.  One thing that I constantly kept doing while making sure my environment is set up correctly, is looking for an application in the C:\Program Files folder.  Unfortunately, there are quite a few applications that are still 32-bit, so they get installed in C:\Program Files (x86) so I find that although I have a 50% chance to look in the right folder, I get it wrong about 90% of the time.  Wouldn’t it be great if there was a library that included both!  I decided to try it.

Custom Library Contents in Windows 7 Right clicking in a blank spot in my libraries window gave me a New –> Library option.  Cool!  After giving my library a name (Programs) I found there was nothing inside, I went back and right clicked on my new library and chose Properties.  I was presented with a dialog that let me change a few things, such as adding folders the library should look into.  I added my two Program Files locations, closed the dialog, opened the library and viola!  There are all of my programs!  Very cool!

Custom Windows 7 Library OptionsOne thing I will briefly note, if this library is for a type of files that you will be actually saving files into, you can select the folder that acts as the default location to save files.  That way when you are in an application and you choose to save something, you can just click on the library and it will save in the default folder.  That’s not something you’re likely to do with programs, but there are other file types.  Another library I have added, for example, is Source Code.

Customized Windows 7 Library They only thing that was disappointing at this point, was the fact that there was no option to assign a custom icon.  I did a quick search on Bing (I did a quick Google on Bing?) and found this guide regarding custom libraries.  It explained that libraries are really just XML files located in the special folder at C:\Users\<User>\AppData\Roaming\Microsoft\Windows\Libraries with some data describing the library.  One of the elements you an add to the library is called <iconReference></iconReference> which simply takes a path to an .ico files.  It does note that for the best results a 256×256 icon should be used, or an icon with appropriate sizes all in one file; however, I found one at 128×128 for my programs and it worked fine.

Using Windows 7 with Multiple Gateways (Routers) and DHCP

Early last year we implemented a second Internet connection on our network.  We wanted to make it as easy as possible to switch between the two if the primary connection went down.  We are on a Windows domain and use DHCP from one of our domain controllers so it was easy to implement the 003 Router scope option with the two gateways and it worked great!

According to RFC2131 and the DHCP Options and BOOTP Vendor Extensions;

The router option specifies a list of IP addresses for routers on the client’s subnet.  Routers SHOULD be listed in order of preference.

That last bit was the key for working in our situation.  Our Windows XP clients grabbed the multiple gateway addresses and modified the routing table like this:

Active Routes: 
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      20
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      20

Both entries have the metric of 20, which was dynamically assigned by windows based on the link speed, the first entry is the one that was used.

We recently began testing Windows 7 in our environment.  We are fairly happy with most of the new features, performance and the overall experience in the new OS.  One thing that, so far, has been a great improvement is the new network stack.  With Vista, there were several issues including problems with unexpected freezes while network requests are made and problems with notebooks when trying to close the lid.  In Windows 7 most of those issues seem to have went away.

One minor issue that we did run across seems to be a bug, in my opinion.  When our Windows 7 clients processed the same DHCP requests as our XP clients, the routing table looked like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      30
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      30

Very similar results, just slightly modified metric which I can only assume is due to an updated algorithm for calculating the dynamic metric.  The only problem is that the second entry was being used as the default gateway.  We verified this on multiple Windows 7 clients.  It seems like it goes against he “order of preference” bit of the RFC.

It took quite a while and a lot of research, but I found out that Microsoft implements a vendor specific extension, 003 Microsoft Default Router Metric Base option.  The documentation for this value reads:

This value is a specified router metric base to be used for all default gateway routes used at Windows 2000 DHCP-enabled client computers.

This value can be assigned as an integer cost metric ranging from 1 through 9,999. It is used in calculating the fastest, most reliable, and least expensive routes. If a value is not specified, a default of either one (1) or the currently set interface-specific metric is used.

This is not very specific and for a while I did not think it would apply different metrics, but rather the same metric to all of the values in the 003 Router option.  I decided to give it a try regardless of my doubts and it worked!  Now, my XP route table looks like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40       1
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40       2

And my Windows 7 route tables looks like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      31
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      32

It is still disappointing that the DHCP routing options seems to be broken in Windows 7 (IMHO), and I am sure there will be plenty of people having similar problems when they begin rolling out Windows 7 clients in their environments.  Hopefully this article will save someone a little time trying to configure their Windows 7 clients to use multiple gateways.