The PIDL
Explorer needs a way to uniquely identify each item in the namespace unambiguously in relation to other items in the namespace. It must be able to enumerate these items in a consistent, generic manner, even though these items represent a wide variety of data. It does this with a PIDL.
A PIDL is a pointer to an item identifier list, or
ITEMIDLIST. An ITEMIDLIST is an
array of shell item IDs. Each one of these identifiers is an array of
bytes that contains information that is specific to the namespace
extension using it.
How can Explorer use PIDLs if they are different in respect to every
extension? Well, as it turns out PIDLs are pretty simple creatures.
Let’s look at how a PIDL is defined, and you’ll be able
to see this for yourself. Here is what an
ITEMIDLIST (just remember a PIDL is a pointer to
one of these) looks like, as defined by the Platform SDK:
typedef struct _ITEMIDLIST {
SHITEMID mkid;
} ITEMIDLIST, * LPITEMIDLIST;
As you can see, an
ITEMIDLIST is nothing more than a structure that
contains one member of type SHITEMID. This
structure looks like so:
typedef struct _SHITEMID {
USHORT cb;
BYTE abID[1];
} SHITEMID, * LPSHITEMID;
The
first member of SHITEMID,
cb, contains the number of bytes of the
SHITEMID structure. SHITEMID is
a variable-length structure, and cb contains two bytes specifying its size. For those of you who have never done any C programming, you probably have never seen this technique before: the first member of a structure is used to define the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access