This function writes a PIDL to a stream.


IStream_WritePidl (
    IStream *pstm,


The pstm argument provides the address of an IStream interface to some stream object.

The pidlWrite argument provides the address of the PIDL.

Return Value

The function returns zero for success, else an error code.


The function first writes to the stream a dword that gives the size, in bytes, of the PIDL (as computed by ILGetSize), and then writes the PIDL to the stream. If either write fails, the function fails. If either write succeeds only partially, the function fails, with E_FAIL as the error code.


The IStream_WritePidl function is exported from SHLWAPI as ordinal 513 in version 6.00.

Though this function dates from 2001, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

However, the function did eventually get documented, apparently sometime in 2006. This article now conforms to Microsoft’s nomenclature.

What documentation is provided in the January 2007 edition of the Windows SDK, and it really is very little, puts “Windows Vista” as the minimum operating system. Whatever the reason that this function remained undocumented, it is evidently not that Microsoft was taking its time to be accurate.