It should give information about existing network cards - not about
non-present devices.
-----Original Message-----
From: Thomas F. Divine [mailto:xxxxx@pcausa.com]
Sent: Friday, February 23, 2001 10:21 AM
To: NT Developers Interest List
Subject: [ntdev] RE: About registry key software\microsoft\windows
nt\curr entversion\networkcards
Does this method provide a way to determine which network cards are actually
“active” (currently installed), or does it provide a “history” of all
network cards that have at some time been installed on the machine?
How does one determine the currently operational network cards?
Thomas F. Divine
PCAUSA - Toolkits & Resources For Network Software Developers
NDIS Protocol - NDIS Intermediate - TDI Client
http: - http:
----- Original Message -----
From: Eliyas Yakub
To: NT Developers Interest List
Sent: Friday, February 23, 2001 1:12 PM
Subject: [ntdev] RE: About registry key software\microsoft\windows nt\curr
entversion\networkcards
> On Win2K, that’s not the right way to get device decription. You should
use
> setupdi functions to enumerate Net Class devices and get device property.
I
> have included here a function taken from the toaster package, toast.c,
that
> shows how to do that. I just replaced the device guid to
GUID_DEVCLASS_NET.
>
>
> BOOL
> PrintDeviceInfo()
> {
> #define MAX_COMP_INSTID 2096
> #define MAX_COMP_DESC 2096
> #define MAX_FRIENDLY 2096
> HDEVINFO hdi;
> DWORD dwIndex=0;
> SP_DEVINFO_DATA deid;
> BOOL fSuccess=FALSE;
> PCHAR szCompInstanceId[MAX_COMP_INSTID];
> PCHAR szCompDescription[MAX_COMP_DESC];
> PCHAR szFriendlyName[MAX_FRIENDLY];
> DWORD dwRegType;
> BOOL fFound=FALSE;
>
> // get a list of all devices of class ‘GUID_DEVCLASS_TOASTER’
> hdi = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL,
> DIGCF_PRESENT);
>
> if (INVALID_HANDLE_VALUE != hdi)
> {
>
> // enumerate over each device
> while (deid.cbSize = sizeof(SP_DEVINFO_DATA),
> SetupDiEnumDeviceInfo(hdi, dwIndex, &deid))
> {
> dwIndex++;
>
> // the right thing to do here would be to call this function
> // to get the size required to hold the instance ID and then
> // to call it second time with a buffer large enough for that
> size.
> // However, that would tend to obscure the control flow in
> // the sample code. Lets keep things simple by keeping the
> // buffer large enough.
>
> // get the device instance ID
> fSuccess = SetupDiGetDeviceInstanceId(hdi, &deid,
> (BYTE*)szCompInstanceId,
> MAX_COMP_INSTID, NULL);
> if (fSuccess)
> {
> // get the description for this instance
> fSuccess =
> SetupDiGetDeviceRegistryProperty(hdi, &deid,
> SPDRP_DEVICEDESC,
> &dwRegType,
> (BYTE*)
> szCompDescription,
> MAX_COMP_DESC,
> NULL);
> if (fSuccess)
> {
> memset(szFriendlyName, 0, MAX_FRIENDLY);
> SetupDiGetDeviceRegistryProperty(hdi, &deid,
> SPDRP_FRIENDLYNAME,
> &dwRegType,
> (BYTE*)
szFriendlyName,
> MAX_FRIENDLY,
> NULL);
> fFound = TRUE;
> printf(“Instance ID : %s\n”, szCompInstanceId);
> printf(“Description : %s\n”, szCompDescription);
> printf(“FriendlyName: %s\n\n”, szFriendlyName);
> }
> }
> }
>
> // release the device info list
> SetupDiDestroyDeviceInfoList(hdi);
> }
>
> if(fFound)
> return TRUE;
> else
> return FALSE;
> }
>
> -----Original Message-----
> From: xxxxx@necas.nec.co.jp [mailto:xxxxx@necas.nec.co.jp]
> Sent: Wednesday, February 21, 2001 6:01 PM
> To: NT Developers Interest List
> Subject: [ntdev] About registry key software\microsoft\windows
> nt\currentversion\networkcards
>
>
> Hi!everybody:
> I’ve built a program(working on windows 2k) to get the manufacturer
> information of the networkcards in my computer, such as “3Com EtherLink
III
> ISA (3C509/3C509b) in Legacy mode”.so I come to the registry key
> software\microsoft\windows nt\currentversion\networkcards, under this key
> there are subkeys 1,2…, each of these subkeys describes a network card
> and I can get out the information I wanted.
> But I found a problem for this key. I have two network cards in my
> computer, so there are two subkeys for key networkcards , then I shutdown
> my computer ,extract one card and insert it into another slot, after
reboot
> , I found there are three subkeys although there are still two cards.
> How to avoid this problem or where else can I get the message?
>
> Any help will be appreciated.
> Best Regards
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@pcausa.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</http:></http:>