Click here to Skip to main content
Click here to Skip to main content
Go to top

Namespace Extensions: the IDelegateFolder mystery

, 15 Feb 2002
Rate this:
Please Sign up or sign in to vote.
Documentation for the undocumented interface IDelegateFolder

Since Internet Explorer 4, the shell namespace contains an "Internet Explorer" item.

This Internet Explorer forms a special junction point where you can include your own namespace extensions.

Microsoft uses this for their FTP folders. You can add your own by registering a url prefix in the registry. Copy the entries that are used in HKEY_CLASSES_ROOT\ftp.

However, something strange is going on. You don't see the root item of this namespace extension displayed in explorer. There is no item named "ftp folders" that is the root of all ftp folders. Instead, the "Internet Explorer" item functions as the root.

This has a very strange implication: The Internet Explorer root item had to understand the pidls of all underlying namespaces.

The solution: Internet Explorer will embed the pidls of all namespace extensions in its own pidls. The mechanism used to accomplish this is IDelegateFolder.

Using IDelegateFolder, your namespace extension will receive an IMalloc interface. The Alloc function of this IMalloc will allocate an Internet Explorer pidl that points to your namespace extension and has empty room to put your own pidl in.

This is the IID of IDelegateFolder:

// {ADD8BA80-002B-11D0-8F0F-00C04FD7D062}
DEFINE_GUID(IID_IDelegateFolder,
            0xADD8BA80L, 0x002B, 0x11D0, 0x8F, 0x0F, 0x00, 0xC0, 0x4F, 0xD7, 0xD0, 0x62);

This is the interface definition:

DECLARE_INTERFACE_(IDelegateFolder, IUnknown)
{
	// IUnknown methods
	STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
	STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
	STDMETHOD_(ULONG,Release)(THIS) PURE;

	// IDelegateFolder methods
	STDMETHOD(SetItemAlloc)(THIS_ IMalloc *pMalloc) PURE;
};

After instantiating your namespace extension, Internet Explorer will query for the IDelegateFolder interface and call SetItemAlloc, passing an IMalloc interface. You have to store this interface.

From this moment on, when ever you have to create a pidl, you have to follow these steps:

  • Call the Alloc function of this IMalloc
  • Insert your own complete pidl (including the size) at offset 4 of the returned buffer
  • Return this buffer as your own pidl

The returned buffer will already be a pidl, starting with the size (2 bytes) and then a 2 bytes signature (0x61 0x03).

All the pidls that will be passed to your namespace extension will also have this format. This means you will find your own pidl at offset 4.

The pidls are still freed the normal way, using the shell allocator.

If your namespace extensions has subfolders, then these subfolders follow the normal system. The first id in the list will be the special Internet Explorer pidl, all the others that follow are your own normal pidls.

This is not a clean solution that was chosen by Microsoft. It would have been much easier if the Internet Explorer root node would do the insertion and extraction of the embedded pidl, eliminating the need for this interface.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Henk Devos
Web Developer
Belgium Belgium
Henk studied computer science at the University of Ghent, specializing in theoretical computer science.
He is now working for Artwork Systems, Belgium, and Whirling Dervishes Software, Belgium.
Henk knows a little something about networking, graphics, object-oriented design, AI, embedded systems. He knows most of the PDF specs by heart.
Henk developed NSELib, the NameSpace Extension Library.
You can find his latest freeware software at regxplor.com. It contains a namespace extension that puts the registry in Windows Explorer. The newest commercial project is Alpha ZIP, an explorer-embedded ZIP file utility.

Comments and Discussions

 
QuestionUsing a namespace extension with a custom protocol Pinmemberbe mo22-Jun-06 21:50 
QuestionHow to add namespace extensions to the backup window, so I can backup. Pinmembergreenjade8009-Aug-04 13:26 
Generaloffset PinsussAnonymous27-Jul-04 20:02 
GeneralRe: offset PinmemberHenk Devos27-Jul-04 22:32 
QuestionHow I display the background directory context menu? PinmemberMiguel Matos1-Oct-03 1:10 
AnswerRe: How I display the background directory context menu? PinmemberHenk Devos1-Oct-03 1:36 
GeneralRe: How I display the background directory context menu? PinmemberMiguel Matos1-Oct-03 5:07 
GeneralIDelegateFolder not registered in W2K Pinmemberayeka27-May-03 20:42 
GeneralRe: IDelegateFolder not registered in W2K PinmemberHenk Devos27-May-03 21:31 
Generaljust curious... Pinmemberumeca7413-Oct-02 0:12 
GeneralRe: just curious... PinmemberHenk Devos13-Oct-02 7:33 
Question(where is) API defn for my own protocol handler? PinmemberRelishguy19-Mar-02 10:39 
AnswerRe: (where is) API defn for my own protocol handler? PinmemberRelishguy19-Mar-02 13:43 
GeneralRe: (where is) API defn for my own protocol handler? PinmemberHenk Devos22-Mar-02 7:06 
QuestionWhy root there? PinmemberMagnus H18-Feb-02 4:09 
AnswerRe: Why root there? PinmemberHenk Devos18-Feb-02 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 16 Feb 2002
Article Copyright 2002 by Henk Devos
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid