Device Interface ReferenceStrings list in Windbg

Venkat Narain wrote:

Actually having multiple GUIDs simplifies this problem on the client
side. Is there a recommended way to maintain an array of GUIDs? Can I
have a look up table in the driver?

You didn’t really need to ask this question, did you?

GUID Interfaces = {
GUID_MY_INTERFACE_ONE,
GUID_MY_INTERFACE_TWO,
GUID_MY_INTERFACE_THREE,
GUID_MY_INTERFACE_FOUR
};

Then you can use ARRAYSIZE(Interfaces) to know how many, or just add
GUID_NULL and check for that in your loop.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

hi Tim,

Actually no :slight_smile: . I was asking if I should maintain this array in some registry or INF(?) or just a simple lookup table (like you mentioned) in the driver itself. I am not entirely familiar with how drivers would separate data from the code and support various platforms.

thanks,
Venkat

xxxxx@yahoo.com wrote:

Actually no :slight_smile: . I was asking if I should maintain this array in some registry or INF(?) or just a simple lookup table (like you mentioned) in the driver itself. I am not entirely familiar with how drivers would separate data from the code and support various platforms.

Each GUID is only 16 bytes. Just make it a global constant array. I
can see why you’d think about the registry, but that’s really only
useful for things you want to configure without modifying the binary.
In this case, you can’t make a new GUID available unless the driver
knows how to respond to it, so the array might as well be built in.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

“A programatic way”?? This IS a programatic way. We’re not suggesting you hand-edit the registry and add the data, right?

The symlink name is fixed. But, whatever. I’d store the info each time… I don’t think you’d do it in DriverEntry, though… I’d probably do it in EvtDriverDeviceAdd, where you create the device interface.

Anything “can cause problems” and Doron is speaking in GENERAL (and IN GENERAL I agree with him) – But in your case, if each device instance has a predefined name, then it won’t have problems.

Either of those will work. They seem way more complicated than necessary to me, and IOCTL_GET_ID seems silly – Everybody opens every device and does IOCTL_GET_ID until they find the device they want? So, you have to allow an infinite number of simultaneous opens, but only one client that actually USES the device?? Yuck.

Mr. Holan is an excellent architect, and Mr. Roberts’ and Shatskih’s engineering is also excellent. So, we’re not talking about making something work… you’ve already gotten a whole pile of options from which to choose. We’re just discussing what the “best approach is”… and good luck with THAT. You know, put 3 engineers in a room and you’ll get at least 4 different opinions on any given topic, right?

In any case… my advice is to not over think this. Pick one way that you can easily implement what you want to do, and just do it. You’ll only have to worry about whether anybody ELSE likes the method you’ve chosen if they code-review your driver :slight_smile:

Peter
OSR