Obtaining network adapter friendly name from the GUID

Hi,

I am having the IM driver. It gets the callback PtBindAdapter with
parameter DeviceName, which is a GUID of underlying network adapter.
My question is - how to obtain network adapter friendly name from
mentioned GUID?

Many thanks!
Daniel B

Bet way is to do this in user-mode. It the adapter is bound to TCP/IP then
the GIID is one of the fields (AdapterName IIRC…) returned from
GetAdaptersInfo. Once you have a match a variation of the Friendly Name, IP
address, etc is in the same record. You can use WMI if you are fond of it.

I don’t know of a good way to fetch the friendly name from the kernel. You
can make a query fro OID_GEN_VENDOR_DESCRIPTION, but the string returned
there isn’t what is ordinarily shown to the user.

Thomas F. Divine
http://www.pcausa.com


From: “Daniel Bujnik”
Sent: Tuesday, July 13, 2010 12:43 PM
To: “Windows System Software Devs Interest List”
Subject: [ntdev] Obtaining network adapter friendly name from the GUID

> Hi,
>
> I am having the IM driver. It gets the callback PtBindAdapter with
> parameter DeviceName, which is a GUID of underlying network adapter.
> My question is - how to obtain network adapter friendly name from
> mentioned GUID?
>
> Many thanks!
> Daniel B
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

An undocumented way ,
NdisOpenAdapter ->
_NDIS_OPEN_BLOCK.MiniportHandle.PhysicalDeviceObject ->
IoGetDeviceProperty (DevicePropertyDeviceDescription) . Good luck

2010/7/14 Daniel Bujnik :
> Hi,
>
> I am having the IM driver. It gets the callback PtBindAdapter with
> parameter DeviceName, which is a GUID of underlying network adapter.
> My question is - how to obtain network adapter friendly name from
> mentioned GUID?
>
> Many thanks!
> Daniel B
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

How about NdisQueryBindInstanceName, NdisQueryAdapterInstanceName ?

  • pa

So many NDIS functions - and this one I overlooked!

Does it return the name shown in the Network Control Panel?

Thomas


From:
Sent: Tuesday, July 13, 2010 4:41 PM
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] Obtaining network adapter friendly name from the GUID

> How about NdisQueryBindInstanceName, NdisQueryAdapterInstanceName ?
>
> - pa
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Hi Experts,

Thank you very much for your feedback.

I am fully aware of existing user mode solution (GetAdaptersInfo) for my
problem. I am having the service, which could possibly be used for that
purpose, however that is a last resort for me and would prefer to stick
to kernel mode.

I am aware also NdisQueryAdapterInstanceName. I have used that with
pAdapt->BindingHandle but unfortuantelly I am getting a sort of name of
the next IM driver in the chain - “Realtek RTL8168C(P)/8111C(P) Family
PCI-E GBE NIC - Virtual MAchine Network Services Driver”, so it does not
really help, becouse parsing does not seem to be an option.

The other approach I made was to use registry. The key

SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\MyGuid\Connection

contains value PnpInstanceID, which can be used to access the key:

\SYSTEM\CurrentControlSet\Enum\…

Here we have FriendlyName and DeviceDesc. FriendlyName is optionall and
exists in case there are more than one adapter of the model. Such a name
ends with #x. My initiall test were promising till the moment I have
tested that approach on different machine. What I got was the DeviceDesc
set to :

@net44x32.inf,%bcm4401.devicedesc%;Broadcom 440x 10/100 Integrated
Controller”

Unless I am sure the that friendly name follows last semicolon, I can
not use that I am afraid. I haven’t found any docs on that.

Now, I will try to investigate mentioned undocumented way…

Regards,
Daniel

On 13/07/2010 23:21, Thomas F. Divine wrote:

So many NDIS functions - and this one I overlooked!

Does it return the name shown in the Network Control Panel?

Thomas


From:
> Sent: Tuesday, July 13, 2010 4:41 PM
> To: “Windows System Software Devs Interest List”
> Subject: RE:[ntdev] Obtaining network adapter friendly name from the GUID
>
>> How about NdisQueryBindInstanceName, NdisQueryAdapterInstanceName ?
>>
>> - pa
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
Hi Experts,

Thank you very much for your feedback.

I am fully aware of existing user mode solution (GetAdaptersInfo) for my
problem. I am having the service, which could possibly be used for that
purpose, however that is a last resort for me and would prefer to stick
to kernel mode.

I am aware also NdisQueryAdapterInstanceName. I have used that with
pAdapt->BindingHandle but unfortuantelly I am getting a sort of name of
the next IM driver in the chain - “Realtek RTL8168C(P)/8111C(P) Family
PCI-E GBE NIC - Virtual MAchine Network Services Driver”, so it does not
really help, becouse parsing does not seem to be an option.

The other approach I made was to use registry. The key:
SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\MyGuid\Connection

contains value PnpInstanceID, which can be used to access the key:
\SYSTEM\CurrentControlSet\Enum\…

Here we have FriendlyName and DeviceDesc. FriendlyName is optionall and
exists in case there are more than one adapter of the model. Such a name
ends with #x. My initiall test were promising till the moment I have
tested that approach on different machine. What I got was the DeviceDesc
set to :

@net44x32.inf,%bcm4401.devicedesc%;Broadcom 440x 10/100 Integrated
Controller”

Unless I am sure the that friendly name follows last semicolon, I can
not use that I am afraid. I haven’t found any docs on that.

Now, I will try to investigate mentioned undocumented way…

Regards,
Daniel

Hi Experts,

My response was truncated for some reason.
I am fully aware of existing user mode solution (GetAdaptersInfo) for my
problem. I am having the service, which could possibly be used for that
purpose, however that is a last resort for me and would prefer to stick
to kernel mode.
I am aware also NdisQueryAdapterInstanceName. I have used that with
pAdapt->BindingHandle but unfortuantelly I am getting a sort of name of
the next IM driver in the chain - “Realtek RTL8168C(P)/8111C(P) Family
PCI-E GBE NIC - Virtual MAchine Network Services Driver”, so it does not
really help, becouse parsing does not seem to be an option.
The other approach I made was to use registry. The key:
SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\MyGuid\Connection
contains value PnpInstanceID, which can be used to access the key:
\SYSTEM\CurrentControlSet\Enum\…
Here we have FriendlyName and DeviceDesc. FriendlyName is optionall and
exists in case there are more than one adapter of the model. Such a name
ends with #x. My initiall test were promising till the moment I have
tested that approach on different machine. What I got was the DeviceDesc
set to :
@net44x32.inf,%bcm4401.devicedesc%;Broadcom 440x 10/100 Integrated
Controller”
Unless I am sure the that friendly name follows last semicolon, I can
not use that I am afraid. I haven’t found any docs on that.

Now, I will try to investigate mentioned undocumented way…

Regards,
Daniel

On 13/07/2010 23:21, Thomas F. Divine wrote:

So many NDIS functions - and this one I overlooked!

Does it return the name shown in the Network Control Panel?

Thomas


From:
> Sent: Tuesday, July 13, 2010 4:41 PM
> To: “Windows System Software Devs Interest List”
> Subject: RE:[ntdev] Obtaining network adapter friendly name from the GUID
>
>> How about NdisQueryBindInstanceName, NdisQueryAdapterInstanceName ?
>>
>> - pa
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
Still cannot see the rest of my message… :frowning:

For me, friendly names are for the UI code only, and the kernel-mode or even UI-less user-mode DLL code should not bother about them, using something like GUIDs as idents.

A matter of taste though.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Daniel Bujnik” wrote in message news:xxxxx@ntdev…
> Hi,
>
> I am having the IM driver. It gets the callback PtBindAdapter with
> parameter DeviceName, which is a GUID of underlying network adapter.
> My question is - how to obtain network adapter friendly name from
> mentioned GUID?
>
> Many thanks!
> Daniel B
>

Hi Experts,

Thank you very much for your feedback.

I am fully aware of existing user mode solution (GetAdaptersInfo) for my problem. I am having the service, which could possibly be used for that purpose, however that is a last resort for me and would prefer to stick to kernel mode.

I am aware also NdisQueryAdapterInstanceName. I have used that with pAdapt->BindingHandle but unfortuantelly I am getting a sort of name of the next IM driver in the chain - “Realtek RTL8168C(P)/8111C(P) Family PCI-E GBE NIC - Virtual MAchine Network Services Driver”, so it does not really help, becouse parsing does not seem to be an option.

The other approach I made was to use registry. The key

SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\MyGuid\Connection

contains value PnpInstanceID, which can be used to access the key:

\SYSTEM\CurrentControlSet\Enum\…

Here we have FriendlyName and DeviceDesc. FriendlyName is optionall and exists in case there are more than one adapter of the model. Such a name ends with #x. My initiall test were promising till the moment I have tested that approach on different machine. What I got was the DeviceDesc set to :

@net44x32.inf,%bcm4401.devicedesc%;Broadcom 440x 10/100 Integrated Controller”

Unless I am sure the that friendly name follows last semicolon, I can not use that I am afraid. I haven’t found any docs on that.

Now, I will try to investigate mentioned undocumented way…

Regards,
Daniel

Hi Experts,

Thank you very much for your feedback.

I am fully aware of existing user mode solution (GetAdaptersInfo) for my problem. I am having the service, which could possibly be used for that purpose, however that is a last resort for me and would prefer to stick to kernel mode.

I am aware also NdisQueryAdapterInstanceName. I have used that with pAdapt->BindingHandle but unfortuantelly I am getting a sort of name of the next IM driver in the chain - Realtek RTL8168C(P)/8111C(P) Family PCI-E GBE NIC - Virtual MAchine Network Services Driver, so it does not really help, becouse parsing does not seem to be an option.

The other approach I made was to use registry. The key

SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\MyGuid\Connection

contains value PnpInstanceID, which can be used to access the key:

\SYSTEM\CurrentControlSet\Enum\…

Here we have FriendlyName and DeviceDesc. FriendlyName is optionall and exists in case there are more than one adapter of the model. Such a name ends with #x. My initiall test were promising till the moment I have tested that approach on different machine. What I got was the DeviceDesc set to :

@net44x32.inf,%bcm4401.devicedesc%;Broadcom 440x 10/100 Integrated Controller

Unless I am sure the that friendly name follows last semicolon, I can not use that I am afraid. I haven’t found any docs on that.

Now, I will try to investigate mentioned undocumented way…

Regards,
Daniel

Hi All,

Finally I managed to post the rest of my reply. Please have a look above… I have removed quotation marks and that helped…

To Maxim:

We are having the GUI app, which stores friendly names in the ini file. They are read by the the miniport of our virtual NIC. Friendly names identify instances of our intermediate drivers. We cannot use GUIDs in ini files because they are are different on every machine and disable quick deployment.

Regards,
Daniel

Daniel,

If I remember correctly, someone already adviced you to call IoGetDeviceProperty (pdo, DevicePropertyFriendlyName …)

A MAC driver can get the pdo from NdisMGetDeviceProperty.

If only an IM can get the NDIS handle of its underlying MAC, IoGetDeviceProperty is *the* way to go.

Of course, you’re free to try any undocumented ways as well.

– pa

>miniport of our virtual NIC. Friendly names identify instances of our intermediate drivers. We cannot

use GUIDs in ini files because they are are different on every machine

Same issues with friendly names, when you will localize them.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Hello,

Many thanks for all replies. Finally I decided to use NdisMGetDeviceProperty and IoGetDeviceProperty. The outcome of this is very promising. I am getting NIC friendly name followed by name of my IM driver:

Realtek RTL8168C(P)/8111C(P) Family PCI-E GBE NIC #2 - MyIMdriverName

It is straightforward to get what I want out of that, as I know MyIMdriverName of course. I could stop here…

Nevertheless I have one more question. I am using MiniportAdapterHandle handle received in MPInitialize to call NdisMGetDeviceProperty and that is why I am getting friendly name exposed by miniport edge of my own IM instead of the pure NIC friendly name.

Is there any way of getting the ndis handle of the real miniport in my intermediate driver???

Cheers,
D

An undocumented way :
NDIS_OPEN_BLOCK.Reserved6
where NDIS_OPEN_BLOCK is what NdisOpenAdapter returns to you. Good luck.

2010/7/21 :
> Is there any way of getting the ndis handle of the real miniport in my intermediate driver