Click here to Skip to main content
6,822,123 members and growing! (18,098 online)
Email Password   helpLost your password?
Desktop Development » Shell and IE programming » IE Programming     Advanced

Namespace Extensions: the IDelegateFolder mystery

By Henk Devos

Documentation for the undocumented interface IDelegateFolder
VC6, VC7, Windows, Visual-Studio, IE6.0, Dev
Posted:15 Feb 2002
Views:65,739
Bookmarked:22 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 3.64 Rating: 4.31 out of 5

1

2

3
1 vote, 33.3%
4
2 votes, 66.7%
5

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

About the Author

Henk Devos


Member
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.
Occupation: Web Developer
Location: Belgium Belgium

Other popular Shell and IE programming articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 16 of 16 (Total in Forum: 16) (Refresh)FirstPrevNext
QuestionUsing a namespace extension with a custom protocol Pinmemberbe mo22:50 22 Jun '06  
GeneralHow to add namespace extensions to the backup window, so I can backup. Pinmembergreenjade80014:26 9 Aug '04  
Generaloffset PinsussAnonymous21:02 27 Jul '04  
GeneralRe: offset PinmemberHenk Devos23:32 27 Jul '04  
GeneralHow I display the background directory context menu? PinmemberMiguel Matos2:10 1 Oct '03  
GeneralRe: How I display the background directory context menu? PinmemberHenk Devos2:36 1 Oct '03  
GeneralRe: How I display the background directory context menu? PinmemberMiguel Matos6:07 1 Oct '03  
GeneralIDelegateFolder not registered in W2K Pinmemberayeka21:42 27 May '03  
GeneralRe: IDelegateFolder not registered in W2K PinmemberHenk Devos22:31 27 May '03  
Generaljust curious... Pinmemberumeca741:12 13 Oct '02  
GeneralRe: just curious... PinmemberHenk Devos8:33 13 Oct '02  
General(where is) API defn for my own protocol handler? PinmemberRelishguy11:39 19 Mar '02  
GeneralRe: (where is) API defn for my own protocol handler? PinmemberRelishguy14:43 19 Mar '02  
GeneralRe: (where is) API defn for my own protocol handler? PinmemberHenk Devos8:06 22 Mar '02  
GeneralWhy root there? PinmemberMagnus H5:09 18 Feb '02  
GeneralRe: Why root there? PinmemberHenk Devos5:13 18 Feb '02  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

PermaLink | Privacy | Terms of Use
Last Updated: 15 Feb 2002
Editor: Chris Maunder
Copyright 2002 by Henk Devos
Everything else Copyright © CodeProject, 1999-2010
Web20 | Advertise on the Code Project