Geoff Chappell - Software Analyst
This function queries a service-provider object for an STopLevelBrowser service object and gets this object’s property bag.
HRESULT IUnknown_QueryServicePropertyBag ( IUnknown *punk, DWORD dwFlags, REFIID riid, PVOID *ppv);
The punk argument is any interface pointer to the service-provider object.
The dwFlags argument provides bit flags (as if for the documented SHGetViewStatePropertyBag function).
The riid argument is a reference to an IID for the requested interface to the property bag.
The ppv argument addresses a variable that is to receive the interface pointer.
The function returns zero for success, else an error code.
The object described by punk is expected to implement an IServiceProvider interface. If this interface’s QueryService method reveals that the object provides an STopLevelBrowser service object that has an IShellBrowserService interface, then the function calls this last interface’s GetPropertyBag method, passing the dwFlags, riid and ppv arguments.
The preceding description applies to all known versions up to and including 6.1.7600.16385 from Windows 7, but with the understanding that there is significant variation in what is meant by the IShellBrowserService interface.
The original IShellBrowserService interface has {1307EE17-EA83-49EB-96B2-3A28E2D7048A} as its IID and GetPropertyBag as its one method (other than the usual three from IUnknown). This interface is the only one known to the function in all builds of version 6.0 from before Windows Vista, including builds from Internet Explorer 7.0 and 8.0 intended for installation on Windows XP or Windows Server 2003. See the separate list of SHLWAPI Versions for the ordering of build numbers.
Builds of version 6.0 for Windows Vista instead query for IShellBrowserService4 from the following family of interfaces:
IShellBrowserService | {42DAD0E2-9B43-4E7A-B9D4-E6D1FF85D173} |
IShellBrowserService2 | {59BEAE19-B519-4B53-A5EF-31127753539C} |
IShellBrowserService3 | {62624EAD-8D46-4584-837D-2A2334DD5F81} |
IShellBrowserService4 | {F5A24314-5B8B-44FA-BC2E-31285544B520} |
in which GetPropertyBag is at offset 0x84 in the virtual function table.
Version 6.1 returns to querying for an interface that is named IShellBrowserService, but it differs yet again from the original. Its IID is {DFBC7E30-F9E5-455F-88F8-FA98C1E494CA} and its GetPropertyBag method is at offset 0x4C in the virtual function table.
What appears to have happened is that an undocumented IShellBrowserService was defined initially as a supplement to the documented IBrowserService family. These interfaces were then blended to make a new IShellBrowserService family, and finally separated (with discards) to make yet another IShellBrowserService and a new IIEBrowserService (which is just the original IShellBrowserService with a new name and IID). These changes are all tracked by this function. Note that the changes are accommodated not by querying for each of the various possible interfaces that have a GetPropertyBag method but by hoping that the relevant DLLs are all present in matching versions.
The IUnknown_QueryServicePropertyBag function is exported from SHLWAPI.DLL as ordinal 536 in version 6.0 and higher.
Though this function dates from 2001, it was still not documented by Microsoft as late as the January 2007 edition of the Windows Vista Software Development Kit (SDK).