1

The short of the long is that I'm looking for the enhanced, photo-realistic icons that are used in the Devices and Printers control panel folder.

I suppose I could use the Windows shell to enumerate them, but I don't have the shell pack linked to my .NET project, and I sort of think it's cheating, anyway (LOL goes here, depending on whether or not you'd appreciate one).

Most of the sparse documentation I've found regarding accessing these files outside of the shell is by going to the path "%LOCALAPPDATA%\Microsoft\Device Metadata\dmrccache"

Except, I'm running Windows 8.1 Pro, and that directory does not exist. I did find a directory called "C:\Users\Nathan\AppData\Local\Microsoft\Device Stage\Device\{8616C787-FB4C-4B21-A2FE-D263F0DC4DA5}\en-US"

This seems to hold the images for my Brother multifunction printer, but I can find no similar folders for other devices. Not to mention, the GUID key, {8616C787-FB4C-4B21-A2FE-D263F0DC4DA5}, is not found in the registry, at all, nor is it linked to any device properties that I can find associated with the printer device ... Nor does the printer device have a property key for a device metadata file (says the key does not exist, although all other device information populates, just fine.)

I looked at MSDN, and it tells you all about how to create your OWN device stage and enhanced icon XML metadata for device deployment, but there's almost no documentation for how to digest it, in windows.

I am highly familiar with and competent working with most of the SetupDiXXXXXX functions, and have built my own .NET-based hardware enumerators and classes wrapped around those functions.

But I can find no documentation dealing with the problem I have, now. The only "quick fix" solution would be to grab the icons from a shell enumeration of the Devices and Printers file...

But I would very much like a deeper understanding of the inner workings of this issue, and going through the shell COM interfaces is not my first choice of a solution (I do work with shell C API functions, quite a bit, however, and if someone can provide an answer related to that, I'm all ears).

Also, I would like to know why and if the device stage layer has somehow changed from Windows 7 to Windows 8, and why none of this is documented.

Addendum

I would not mind using the shell icon extraction if I could figure out how to get the name of the file, itself, by calculating it, if it even exists, in a directory like that.

To get to Devices and Printers, the magic name is:

::{26EE0668-A00A-44D7-9371-BEB064C98683}\0\::{A8A91A66-3A7D-4424-8D24-04E180695C7A}

If you stick that in your Explorer browser bar, it will take you there. If it's possible to grab information to attach to that path, I can use a shell C call to get the icon.

But trying the printer's instance ID did not work (it works with the networking folder).

I don't even know if it's possible in a folder like this.

Still, I would like to know more about how to just go and find these things, myself.

Nathan M
  • 873
  • 5
  • 18

1 Answers1

0

Okay. I did some digging, and it is possible to get the icon for the device without resorting to shell interfaces.

Given the base path to the Devices and Printers Folder:

::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{A8A91A66-3A7D-4424-8D24-04E180695C7A}

Doing the homework I found that all you have to do is add:

\Provider%5CMicrosoft.Base.DevQueryObjects//DDO:

To the end of the base path, followed by a URL-escaped version of the device's ContainerId as retrieved by the SetupDiXXXX functions. From there you can retrieve the photo-realistic icon.

I have done it, and it works. Just find a device's container ID, pass this data to SHParseDisplayName, then from there you can get the icon from the item image list.

HOWEVER I would still like to know why it is so hard to find information about consuming device stage information data.

ADDITIONALLY SHParseDisplayName does not work correctly with the "extremely special" folders when compiling for x86 on x64 systems... so far I can only retrieve the special photo-realistic icons with the above formula by compiling for x64, specifically. I am going to go to an actual x86 machine and see if I get a similar reaction.

Nathan M
  • 873
  • 5
  • 18