5

I'm currently trying to create a custom Shell Namespace Extension (for presenting a virtual folder containing "subfolders" and "files", which are actually the representation of data in a hierarchical tree structure from a remote service).

The extension is written C#, which - I'm aware - used to be a bad idea, but ever since .NET 4 introduced the possibility of different versions of the .NET runtime coexisting within the same process, I figured this limitation was no longer an issue.

So far I've gotten it to work fine in Windows XP by following the plenty examples and references available on the web, but when I try it in Windows 7 (I have not tried it in Vista yet, so I don't know whether it would work there), the extension is not loaded. According to my debug log output, it registers fine, but when I open a Windows Explorer window, none of the usual calls to the COM interfaces seem to occur (usually starting with IPersistFolder::Initialize). In fact, not even the class constructor is being called. I do not know whether the interfaces are being queried for (successfully or not) because I'm not sure how to detect that in .NET so I can log it. So, basically, I don't have any clues to go by, because it fails even before I get the chance to record any useful info about what might be going wrong.

Does anyone happen to have any idea what the problem might be? Are there any peculiarities in Windows 7 as opposed to Windows XP that need to be taken into account when dealing with shell namespace extensions that I should be aware of? If more details are required, feel free to ask (I tried to keep it brief, because I'm sure noone would appreciate me copy&pasting my entire code here, and I couldn't cut it down to just the relevant parts because I simply don't know which ones these are...)

Andreas Baus
  • 2,556
  • 3
  • 16
  • 21

3 Answers3

4

I had a very similar case just now:

  • I saw my shell extension in the right location (in my case "My Computer"), icon and all.
  • Still, no instantiation was done on my COM class (I checked process monitor), and no call to IPersistFolder::Initialize.

I was using ATL and 64bit, so I knew .NET was not my problem.

Turns out the problem was I didn't have the following value in the registry: [HKEY_CLASSES_ROOT\CLSID\{your CLSID}\ShellFolder] "Attributes"=dword:20000000

(It's not enough to have the key or value exist - you need to have (at least) this specific attribute value to get something started).

After you add it, you need to kill all explorer.exe processes and start one again (e.g. using task manager). I hope this solves your problem too.

Oren
  • 1,796
  • 1
  • 15
  • 17
0

Thanks @Oren, for me the issue was that I needed to remove all other versions in the following regedit entry: HKEY_CLASSES_ROOT\CLSID{your CLSID}\InprocServer32\

I only left the current version. I think the issue was that I had a version number that was higher than my current version.

To add; I had to do the same and more to another computer which was having a similar issue. I removed all other versions from HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\CLSID{your CLSID}\InprocServer32\

Sniipe
  • 1,116
  • 3
  • 13
  • 28
0

It can be due to following reasons:

  1. Does your namespace have any dependencies that may fail to load?

  2. Did the registration occur successfully? Did you actually check the registry if proper entries are created? Remember that if UAC is on you may need elevated privileges.


As an alternative to developing such complicated beasts yourself, consider using EZNamespaceExtensions - it makes it very easy and you can focus on providing your nse-specific functionality.

DISCLAIMER: We are the developers of EZNamespaceExtensions.

logicnp
  • 5,796
  • 1
  • 28
  • 32
  • The registry entries all look fine. As far as dependencies are concerned, the extension uses nothing but the .NET 4 runtime (which is of course installed). Unfortunately, I have no idea how to determine whether anything required does or does not load, anyway. BTW, There's nothing in the system event log providing any hints either. I feel like I'm blindfolded in the fog... – Andreas Baus Jul 18 '11 at 12:58
  • Big problem with EZNamespaceExtension.NET. It hasn't been updated for a long time. LogicNP seems to have lost their interest in EZNamespaceExtension.NET because there hasn't been a release with new a handful of features since 2010. No .NET 4 support and no support for Windows 8 ribbon toolbar. – tronda Nov 21 '12 at 09:04
  • While there have been no new major versions (no need), we have been making new builds for minor updates from time to time. .Net 4.0: Again untrue - in fact, with .Net 4.0 support for side-by-side runtimes, developing nses in .Net just got easier! Win8 ribbon: MS has not documented the API to do ribbon integration. If you have links to relevant document, please share so we can add this functionality. – logicnp Nov 21 '12 at 15:06
  • @logicnp are you guys still active? Tried contacting you several times but no result. – Mayank Jun 05 '17 at 01:06