Shell ID Lists 

Content / madShell /...
www.madshi.net

How does the file system path of the "Control Panel" look like? You have no idea? Well, there is no file system path for the "Control Panel", this object simply is not part of any file system. But what if one wants to create a shell link that points to the "Control Panel", how can one do that? If we can't identify the "Control Panel" with a file system path, we need another way to do that. For this purpose Microsoft implemented so called "IDLists". Each file system object and also each non file system shell object can be represented by an IDList.

An IDList works basically similar to a file system path. A file system path consists of a string with the format "X:\Folder1\Folder2\Item". Each of the 4 items of this example path is seperated by "\" characters. If we would convert this exact path into an IDList, the IDList would also contain 4 items, but the 4 items would not be substrings of one string. Instead the whole IDList would be an allocated buffer, where each item consumes any amount of memory needed in this buffer. The exact content of the binary data of each IDList item is not documented.

Unfortunately handling such IDLists is a quite annoying task, so I created an "IIDList" interface, which implements the most important functionality when dealing with IDLists. See also the IIDList Reference.

type IIDList = interface (IBasic) ['{00BED960-C78D-11D3-A530-00005A180D69}'];

Once you have a standard Windows IDList pointer (type PItemIDList), you can simply convert it into an IIDList object by calling the function "IDList". You can specify whether the standard Windows IDList gets copied (and so keeps untouched), or whether you want to tie it to the IIDList object. In the latter case the standard Windows IDList gets freed automatically when the IIDList object gets freed.

function IDList (pidl: PItemIDList; copy: boolean = false) : IIDList;

The following method checks whether the IDList that is represented by the current IIDList object is equal to another one.

function IIDList.IsEqual (const otherIDList: IIDList) : boolean;

Both functions "Clone" and "Concat" copy the whole IDList, while keeping the current IIDList untouched. "Clone" is done with coyping, "Concat" afterwards appends the specified subitem(s) to the result.

function IIDList.Clone                          : IIDList;
function IIDList.Concat (const idList: IIDList) : IIDList;

The properties "Name" and "Path" are similar to the file system functions "ExtractFileName/Path". The current IIDList keeps unchanged.

property IIDList.Name : IIDList;
property IIDList.Path : IIDList;

The following property can copy protect an IIDList object. But please note: You can't undo this copy protection!

property IIDList.ReadOnly : boolean;

The method "SplitName" splits the current IDList into 2 pieces. The 2 pieces are similar to what you get from "ExtractFileName/Path". The path piece is stored in the current IIDList object, the name piece is returned as a new IIDList object. This method fails, if the current IIDList is in read only mode.

function IIDList.SplitName : IIDList;

The "Append" method appends the specified subitem(s) to the current IDList. This method fails, if the current IIDList is in read only mode.

procedure IIDList.Append (const idList: IIDList);

The following properties refer to the standard Windows IDList buffer that is represented by the current IIDList object. "PIdl" returns the pointer to the standard Windows IDList, while "Size" returns the used size (in bytes) of it.

property IIDList.PIdl : PItemIDList;  
property IIDList.Size : integer;