views:

533

answers:

1

I have a Copy Hook Handler shell extension that I'm trying to install on Windows 7 64-bit.

The shell extension DLL is compiled in two separate versions for 32-bit and 64-bit Windows.

The DLL implements DLLRegisterServer which adds the necessary registry entries.

After adding the registry entries, it calls the following line of code to nofity the Windows shell:

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

Everything works great on Windows7 32-bit. The shell recognizes the extension immediately.

On 64-bit, the shell extension is only recognized after the shell is restarted.

Is there anything I can do to cause the extension to be recognized without restarting the 64-bit shell?

A: 

As it turns out, the problem was not specific to 64-bit Windows.

After consulting with Microsoft, I learned that this behavior affects Copy Hook Handlers in both 32 and 64 bit systems. The SHChangeNotify() with SHCNE_ASSOCCHANGED API apparently does not cause the shell to reload Copy Hook Handlers.

According to a Microsoft representative:

The shell builds and caches a list of registered copy hook handlers the first time copy hook handlers are called in a process. Once the list is created, there is no mechanism for updating or flushing the cache other than terminating the process. This applies to Windows Explorer and any other process that may call shell file functions, such as SHFileOperation. The best option that we can offer at this point is to reboot the system after the copy hook handler is registered.

Hope this helps someone!

Avalanchis