How to get MAC address of a disabled network card?

I need to get MAC address of a disabled network card, but it seems that there is no way to achieve this? (including Win9x/ME)

The following ways don’t work on disabed NICs:

  1. Netbios().
  2. GetIfTable()/GetAdaptersInfo().
  3. IOCTL_NDIS_QUERY_GLOBAL_STATS.
  4. WMI query from Win32.

Correct, the only way to do this is to query the driver, and the driver for
the disabled NIC is not loaded.

Consider the disabled device as not existing at all.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 24, 2006 10:13 AM
Subject: [ntdev] How to get MAC address of a disabled network card?

> I need to get MAC address of a disabled network card, but it seems that there
is no way to achieve this? (including Win9x/ME)
>
> The following ways don’t work on disabed NICs:
> 1. Netbios().
> 2. GetIfTable()/GetAdaptersInfo().
> 3. IOCTL_NDIS_QUERY_GLOBAL_STATS.
> 4. WMI query from Win32.
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Isn’t the mac of all nics stored in the registry, I believe so. If this
is correct, even if the nic is disabled, the mac should still be there.

m.

Maxim S. Shatskih wrote:

Correct, the only way to do this is to query the driver, and the driver for
the disabled NIC is not loaded.

Consider the disabled device as not existing at all.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
>To: “Windows System Software Devs Interest List”
>Sent: Thursday, August 24, 2006 10:13 AM
>Subject: [ntdev] How to get MAC address of a disabled network card?
>
>
>
>
>>I need to get MAC address of a disabled network card, but it seems that there
>>
>>
>is no way to achieve this? (including Win9x/ME)
>
>
>>The following ways don’t work on disabed NICs:
>>1. Netbios().
>>2. GetIfTable()/GetAdaptersInfo().
>>3. IOCTL_NDIS_QUERY_GLOBAL_STATS.
>>4. WMI query from Win32.
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>>
>>
>http://www.osronline.com/article.cfm?id=256
>
>
>>To unsubscribe, visit the List Server section of OSR Online at
>>
>>
>http://www.osronline.com/page.cfm?name=ListServer
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
>

> Isn’t the mac of all nics stored in the registry, I believe so.

Where? Cannot find this on my w2k machine.

The MAC address is stored in the registry if it is forced in the property page
as “Locally Administered Address”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

I guess they removed it or never added it in NT. On 98 and below, all
the info received from DHCP along with local info like
the mac and adapter info was stored in the reg (for each adapter). Here
on XP, I can find my full dhcp info but it doesn’t include
adapter info; I would bet there is a switch somewhere that would enable
the logging of this info.

m.

Maxim S. Shatskih wrote:

>Isn’t the mac of all nics stored in the registry, I believe so.
>
>

Where? Cannot find this on my w2k machine.

The MAC address is stored in the registry if it is forced in the property page
as “Locally Administered Address”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> I guess they removed it or never added it in NT. On 98 and below, all

the info received from DHCP along with local info like
the mac and adapter info was stored in the reg (for each adapter).
Ehrm, the MAC being received from a DHCP? How would that be possible?
The MAC is the only way to identify the client of a DHCP request until
the client has been assigned an IP address by the server. So the MAC
is definitely not part of the options of a DHCP request.

Here on XP, I can find my full dhcp info but it doesn’t include
adapter info; I would bet there is a switch somewhere that would enable
the logging of this info.
As Maxim pointed out, only if you override this (directly in the
registry, using netsh or WMI) the entry will exist *at all* otherwise
it simply does not exist. One exception are network cards without MACs
(so the OS *has* to assign a MAC). I heard these exist but never
stumbled about one …

Oliver

Oliver, I know that.

I said, “received from DHCP along with” - ‘along with’ being the
operational words here.
After the DHCP request completed, everything shown in the “ipconfig
-all” was saved to the reg, this included
the mac(speaking of non-NT systems)

On the older windows systems, the mac was saved to the registry under
the dhcp key. An excerpt from a KB article
states this:

“Windows stores the MAC addresses for each individual network adapter
under the DHCP key in the registry. The key for the MAC address (and
other information) is stored in a key in the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\DHCP”

My point was - as you know, there are ‘Magic’ keys all through out the
registry; most of these ‘magic’ keys are not documented, and must
be created and set. Since this behavior existed in '95 and '98, I would
be surprised to find that there *wasn’t* a way to enable this functionality.

m.

Oliver wrote:

> I guess they removed it or never added it in NT. On 98 and below, all
> the info received from DHCP along with local info like
> the mac and adapter info was stored in the reg (for each adapter).

Ehrm, the MAC being received from a DHCP? How would that be possible?
The MAC is the only way to identify the client of a DHCP request until
the client has been assigned an IP address by the server. So the MAC
is definitely not part of the options of a DHCP request.

> Here on XP, I can find my full dhcp info but it doesn’t include
> adapter info; I would bet there is a switch somewhere that would enable
> the logging of this info.

As Maxim pointed out, only if you override this (directly in the
registry, using netsh or WMI) the entry will exist *at all* otherwise
it simply does not exist. One exception are network cards without MACs
(so the OS *has* to assign a MAC). I heard these exist but never
stumbled about one …

Oliver


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> On the older windows systems, the mac was saved to the registry under

the dhcp key

Not all installations use DHCP. You cannot rely on this.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“MM” wrote in message news:xxxxx@ntdev…

> After the DHCP request completed, everything shown in the “ipconfig -all” was saved to the reg, this included
> the mac(speaking of non-NT systems)
>
> On the older windows systems, the mac was saved to the registry under the dhcp key. An excerpt from a KB article
> states this:
>
> “Windows stores the MAC addresses for each individual network adapter under the DHCP key in the registry. The key for the MAC
> address (and other information) is stored in a key in the following registry key:
> HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\DHCP”
>
> My point was - as you know, there are ‘Magic’ keys all through out the registry; most of these ‘magic’ keys are not
> documented, and must
> be created and set. Since this behavior existed in '95 and '98, I would be surprised to find that there wasn’t a way to
> enable this functionality.
>
> m.

On Win2k, XP… the dhcp cached data in the registry
does not include MAC address (it is in HKLM\SYSTEM\CCS\Services{adapter GUID}\Parameters\Tcpip )

–PA