Jump to content

File Associations: How many locations are there?!


xolox

Recommended Posts

Hi everyone!

I've been busy customizing my file-associations lately, and changing from this: ACDSee.bmp to BMPFile, or JPGFile, etc. Some problems I'll never solve as I want it (progs tend to reset *their* assocations), but some I can, and will, try. I downloaded some really nice XP (128px/alpha) icons to use for my most used files (archives, pictures, multimedia, etc). Most work, some don't. That is, the DefaultIcon keys... For example it seems XP keeps resetting associations related to HKEY_CLASSES_ROOT\SystemFileAssociations. So I started digging. And I never should have!

Why have I, by now, found three places to store file-associations?! Has Microsoft gone nuts, or am I missing something here? And please don't tell me there's any more locations! :)

I've found:

[HKEY_CLASSES_ROOT\]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes]

The second I could understand: Maybe users want to customize their associations without interfering with other users. But why the third? And is it really a copy of the HKCR-hive or does it just look like that? If I want to customize my associations, which keys should I use? All three? How come I've never ever heard of the second and third? I've been all over the net tweaking XP, and I've been busy with 98 and stuff years ago...

Thanks in advance for any enlightenment :rolleyes:

Link to comment
Share on other sites


It's can be pretty confusing. All you need to worry about are the keys in HKEY_CLASSES_ROOT. Any changes made there are mirrored in [HKEY_LOCAL_MACHINE\SOFTWARE\Classes] and vice-versa.

No icon information is found in the other key you listed.

If you want to edit the default icon, follow these steps.

1] Find the extension in question. .txt for example.

2] Navigate to HKEY_CLASSES_ROOT\.txt

3] Look at the default value in that key. Usually it will be 'txtfile'.

4] Navigate to HKEY_CLASSES_ROOT\txtfile. That is where you will find the key which holds the value for the default Icon. That's where you would need to make your changes.

Sometime applications change things around. I use Crimson Editor as my default text editor. It changes the default value of HKEY_CLASSES_ROOT\.txt to CrimsonEditor.txt. So I would have to navigate to HKEY_CLASSES_ROOT\CrimsonEditor.txt to change my default text file icon. Changing the settings in txtfile in this case would not work.

Basically you need to look at the default value of [HKEY_CLASSES_ROOT\.ext] which points to the key which holds the icon information.

Good Luck.

You should always backup your registry when making changes, just in case something goes wrong.

Link to comment
Share on other sites

Well, it's not that confusing, I just can't find a reason for Microsoft to mirror HKCR..

And about the DefaultIcon-keys, I know how to use them, but some just don't work (And I know for sure that it's not about a program resetting the associations, it's something inside Windows.)...

And about

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts]. I know nothing describing the filetypes or their icon's is in there, I know it's just links to the info in HKCR, but I was just wondering why the heck it's there :rolleyes:.

Well, thanks anyway's for trying to help :)

Link to comment
Share on other sites

For example: I use WinRAR to manage my archives, and I used my own icons for each archive-type. All is good, WinRAR accepts the change! But Every restart *.zip is reset!

I have the impression this is about Windows, because off all archives, only *.zip changes. The same for *.mpg/mpe/mpeg. It's only the extensions mentioned in SystemFileAssociations. Or so it seems at least! I tried unregistering the zip-dll, but it doesn't help!

Any suggestions? Maybe I should just remove the problematic keys in SystemFileAssociations ( and ONLY the problematic ones of course! ) ?!

Link to comment
Share on other sites

HKCR is a combination of both the one in HKLM and HKCU. Their's dynamically linked. If you looks closer at the registry, there are other's two. I beleive you forgot the 4th place to find extensions, HKU\SID

Link to comment
Share on other sites

I can't seem to find HKU\SID, but what you're saying about the others makes sense. Still don't understand the advantage of using two places to store everything though.

And about

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts]. I know it's only the extensions themselves, and an assocation with info from HKCR or HKLM\Software\Classes, but why? Is this really so that users can customize file assocations without influencing other users? Wouldn't know any other reason to use that tree.

Link to comment
Share on other sites

HKU\(User SID)\

It's those long strings of numbers S-1-5 or whatever.

It's not really storing it in two places. HKCR is alinked tree. If you change in HKCR is also changed in the other two as well. It'd be like mapping a network drive. Sure you can use Z: but you can also access it via \\NetworkShare\SharedDrive

Link to comment
Share on other sites

It's not about advantages, it's for backwards compatability. Waaaaayyyy backwards compatability - don't forget, you can set associations in win.ini too. Isn't that nice? It's enough to make your head explode.

Link to comment
Share on other sites

For the icons that keep switching back, try setting the permissions on that particular Default Icon key.

Righ click on DefaulIcon, select permissions, Check Full Control under Deny for Administrator(s) and System. That might keep things from resetting what you change.

<snip>

Link to comment
Share on other sites

Well I checked the permissions. No problems there. Since I use my own progs to manage archives and mulitmedia, and I'll be doind a clean install in a week, I'm just going to try and remove the SystemFileAssociations related to *.zip and *.mp* :) See what happens then!

@Nois3: I had a hunch that this had to do with compatibility... Sick that there are so many ways to do this! I'm beginning to understand better and better why Windows is so slow compared to Linux.

I mean, I use Regmon a lot, and by only opening a context-menu of a file, I generate a list of, hell, I don't know, about 200 reads from the registry. The whole context-menu is composed of regkey's spread over the registry.

Nice that everything updates inmediately, but wouldn't it be way more efficient to make a cache for stuff like this? I don't think the registry is cached in the memory, or maybe only parts, but it still means 100/150 reads for my harddrive to open a context-menu I want to see in less then 1 second.

Just my humble opinion! I'm no coder, so I might not see the effects on the whole picture!

Link to comment
Share on other sites

It's not about advantages, it's for backwards compatability. Waaaaayyyy backwards compatability - don't forget, you can set associations in win.ini too. Isn't that nice? It's enough to make your head explode.

(A little off topic, but it just requires a comment...)

Backwards compability all the way back to Win3.x and maybe even below is very weird of Microsoft. They usually operate with strategic backwards INcompability.. like macros in word/excel for instance: You gotta rewrite them for every release. Anyway, just ignore this post, it's just something I had to mention, figured it doesn't really make sense.

Link to comment
Share on other sites

I've been testing the permissions on some of my default icons. Setting Deny on Full control created some problems since it denys read access as well.

If you still have problems with your icons changing, try this: (I tested this and it worked for me)

Right click on the DefaultIcon Key, select permissions, click advanced. Select Administrator, click edit, Check 'Set Value' under Deny. Do this for Administrators, System, and any other administrative accounts. This will still allow the values for a key to be read but will keep the system and proggies from changing things.

I tested this with winzip. I never changed my default icons for zip files but for testing purposes I did. When I ran winzip, it would change the icon back to the default. After denying 'Set Value' on the key, it prevented the icon from changing back.

Good luck with you endeavors. :)

Link to comment
Share on other sites

NICE! Very good tip, thanks a lot for that! :) Would you also happen to know if there would be a way to script this without key emulation and stuff like that? I'll start looking around for this. Would never have thought of it myself... :rolleyes: again

This way I could actually make all associations permanent....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...