Local Area Connections - renaming and mapping to physical adapters

Posted: 12-06-2004, 09:35 PM
I have a device that has three ethernet adapters.

My problem:
I have to some how correlate the Windows network adapter names (as seen in
device manager) to the physical hardware. Then match the network connection
names (as seen in local area connections) to the labels on the outside of the
box. Unfortunately the order in which the adapters are detected is some what
random thanks to PnP.

what I know:
How to rename a network connection using netsh command.
How to find the adapter by comparing it to the known pci slot number using
api calls.

What I need:
How can I find out (programmatically) at FBA what local area connection
belongs to what physical adapter?

Thanks
Reply With Quote

Responses to "Local Area Connections - renaming and mapping to physical adapters"

KM
Guest
Posts: n/a
 
Re: Local Area Connections - renaming and mapping to physical adapters
Posted: 12-07-2004, 03:47 AM
SilentCode,

Look at MSDN for IP Helper Functions: http://msdn.microsoft.com/library/en...start_page.asp

Also, this thread will show you a lot more ways:
http://groups-beta.google.com/group/...UTF-8&c2coff=1


KM
>I have a device that has three ethernet adapters.
>
> My problem:
> I have to some how correlate the Windows network adapter names (as seen in
> device manager) to the physical hardware. Then match the network connection
> names (as seen in local area connections) to the labels on the outside of the
> box. Unfortunately the order in which the adapters are detected is some what
> random thanks to PnP.
>
> what I know:
> How to rename a network connection using netsh command.
> How to find the adapter by comparing it to the known pci slot number using
> api calls.
>
> What I need:
> How can I find out (programmatically) at FBA what local area connection
> belongs to what physical adapter?
>
> Thanks

Reply With Quote
SilentCode
Guest
Posts: n/a
 
Re: Local Area Connections - renaming and mapping to physical adap
Posted: 12-07-2004, 07:31 PM

Thanks for the help,

What I decided to do was use the setupapi to enumerate the physical adapters
and get their pnp instance id, pci bus & device number.

I then enumerated the NET device class in the registry looking for network
connections that share the same PnpInstanceID.

I was then able to match up the network connections to the hardware devices
and with the knowledge of the PCI bus and device number generate a batch file
that used netsh to rename and set the ip addresses of the network connections.

What I really don't understand is why there aren't any clearly documented
api's for:

Enumerating the network connections (just like the "Network Connections"
control panel applet).
Relating the network connections to the hardware.
Changing the ip addresses that are persistent beyond a reboot.

I've done some extensive Google searches and everyone just churns through
the registry. There just has to be a better way

Thanks again for taking the time to help.
"KM" wrote:
> SilentCode,
>
> Look at MSDN for IP Helper Functions: http://msdn.microsoft.com/library/en...start_page.asp
>
> Also, this thread will show you a lot more ways:
> http://groups-beta.google.com/group/...UTF-8&c2coff=1
>
>
> KM
>
> >I have a device that has three ethernet adapters.
> >
> > My problem:
> > I have to some how correlate the Windows network adapter names (as seen in
> > device manager) to the physical hardware. Then match the network connection
> > names (as seen in local area connections) to the labels on the outside of the
> > box. Unfortunately the order in which the adapters are detected is some what
> > random thanks to PnP.
> >
> > what I know:
> > How to rename a network connection using netsh command.
> > How to find the adapter by comparing it to the known pci slot number using
> > api calls.
> >
> > What I need:
> > How can I find out (programmatically) at FBA what local area connection
> > belongs to what physical adapter?
> >
> > Thanks
>
>
>
Reply With Quote
Slobodan Brcin \(eMVP\)
Guest
Posts: n/a
 
Re: Local Area Connections - renaming and mapping to physical adap
Posted: 12-07-2004, 08:12 PM
Hi Silent,

Have you loked at INetConnectionManager ?
You will be able to enumerate for INetConnection interfaces, and then you will have access to NETCON_PROPERTIES structure it this
what you are looking for?
http://msdn.microsoft.com/library/de...properties.asp
> Changing the ip addresses that are persistent beyond a reboot.
"netsh interface ip" can do this, so can we. I have created program that set ip address without touching registy, but you can
torture me now and I won't be able to remember how to do this.
Search trough all NG on the net I think that there is source out there.

BTW:
Network interfaces are very tricky snce there are many interfaces that look alike, some old, some new and all implemented on
different levels and in different services and drivers, so this is mildly said a chaos, and in this chaos you need to find the
things that are most apropriate for you to use.

Regards,
Slobodan


"SilentCode" <SilentCode@discussions.microsoft.com> wrote in message news:926986DC-5828-456D-BEE2-E90427D7E3D1@microsoft.com...
>
> Thanks for the help,
>
> What I decided to do was use the setupapi to enumerate the physical adapters
> and get their pnp instance id, pci bus & device number.
>
> I then enumerated the NET device class in the registry looking for network
> connections that share the same PnpInstanceID.
>
> I was then able to match up the network connections to the hardware devices
> and with the knowledge of the PCI bus and device number generate a batch file
> that used netsh to rename and set the ip addresses of the network connections.
>
> What I really don't understand is why there aren't any clearly documented
> api's for:
>
> Enumerating the network connections (just like the "Network Connections"
> control panel applet).
> Relating the network connections to the hardware.
> Changing the ip addresses that are persistent beyond a reboot.
>
> I've done some extensive Google searches and everyone just churns through
> the registry. There just has to be a better way
>
> Thanks again for taking the time to help.
> "KM" wrote:
>
> > SilentCode,
> >
> > Look at MSDN for IP Helper Functions: http://msdn.microsoft.com/library/en...start_page.asp
> >
> > Also, this thread will show you a lot more ways:
> >
http://groups-beta.google.com/group/...UTF-8&c2coff=1
> >
> >
> > KM
> >
> > >I have a device that has three ethernet adapters.
> > >
> > > My problem:
> > > I have to some how correlate the Windows network adapter names (as seen in
> > > device manager) to the physical hardware. Then match the network connection
> > > names (as seen in local area connections) to the labels on the outside of the
> > > box. Unfortunately the order in which the adapters are detected is some what
> > > random thanks to PnP.
> > >
> > > what I know:
> > > How to rename a network connection using netsh command.
> > > How to find the adapter by comparing it to the known pci slot number using
> > > api calls.
> > >
> > > What I need:
> > > How can I find out (programmatically) at FBA what local area connection
> > > belongs to what physical adapter?
> > >
> > > Thanks
> >
> >
> >

Reply With Quote
KM
Guest
Posts: n/a
 
Re: Local Area Connections - renaming and mapping to physical adap
Posted: 12-07-2004, 08:33 PM
SilentCode,

Why didn't you like the IP Helper Functions?
To enumerate network connections you could use GetNumberOfInterfaces/GetAdaptersInfo/GetInterfaceInfo.

And as Slobodan mentioned, take a look at relatively new interfaces for ICS and ICF like IEnumNetSharingEveryConnection:
http://msdn.microsoft.com/library/en...connection.asp
> Have you loked at INetConnectionManager ?
> You will be able to enumerate for INetConnection interfaces, and then you will have access to NETCON_PROPERTIES structure it this
> what you are looking for?
> http://msdn.microsoft.com/library/de...properties.asp
>
> > Changing the ip addresses that are persistent beyond a reboot.
> "netsh interface ip" can do this, so can we. I have created program that set ip address without touching registy, but you can
> torture me now and I won't be able to remember how to do this.
I did that though the registry and it worked very stable. Beside "Windows version" problem I don't see much issues with such
approach.
> Search trough all NG on the net I think that there is source out there.
>
> BTW:
> Network interfaces are very tricky snce there are many interfaces that look alike, some old, some new and all implemented on
> different levels and in different services and drivers, so this is mildly said a chaos, and in this chaos you need to find the
> things that are most apropriate for you to use.
And even worse - the reg key and structure is changing from Window version to version :-(
On NT/2K/XP there were some changes and we always struggle to port our code (to find out those undocumented changes).

Konstantin
> > Thanks for the help,
> >
> > What I decided to do was use the setupapi to enumerate the physical adapters
> > and get their pnp instance id, pci bus & device number.
> >
> > I then enumerated the NET device class in the registry looking for network
> > connections that share the same PnpInstanceID.
> >
> > I was then able to match up the network connections to the hardware devices
> > and with the knowledge of the PCI bus and device number generate a batch file
> > that used netsh to rename and set the ip addresses of the network connections.
> >
> > What I really don't understand is why there aren't any clearly documented
> > api's for:
> >
> > Enumerating the network connections (just like the "Network Connections"
> > control panel applet).
> > Relating the network connections to the hardware.
> > Changing the ip addresses that are persistent beyond a reboot.
> >
> > I've done some extensive Google searches and everyone just churns through
> > the registry. There just has to be a better way
> >
> > Thanks again for taking the time to help.
> > "KM" wrote:
> >
> > > SilentCode,
> > >
> > > Look at MSDN for IP Helper Functions: http://msdn.microsoft.com/library/en...start_page.asp
> > >
> > > Also, this thread will show you a lot more ways:
> > >
>
http://groups-beta.google.com/group/...UTF-8&c2coff=1
> > >
> > >
> > > KM
> > >
> > > >I have a device that has three ethernet adapters.
> > > >
> > > > My problem:
> > > > I have to some how correlate the Windows network adapter names (as seen in
> > > > device manager) to the physical hardware. Then match the network connection
> > > > names (as seen in local area connections) to the labels on the outside of the
> > > > box. Unfortunately the order in which the adapters are detected is some what
> > > > random thanks to PnP.
> > > >
> > > > what I know:
> > > > How to rename a network connection using netsh command.
> > > > How to find the adapter by comparing it to the known pci slot number using
> > > > api calls.
> > > >
> > > > What I need:
> > > > How can I find out (programmatically) at FBA what local area connection
> > > > belongs to what physical adapter?
> > > >
> > > > Thanks
> > >
> > >
> > >
>
>

Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
physical to logical memry mapping ma Windows XP Device Drivers 0 01-27-2005 12:11 AM
RDC - Mapping the local printer Derek Windows XP Work Remotely 3 01-14-2004 09:24 PM
script disable/enable local area connections Tony Windows XP Network & Web 1 07-13-2003 04:58 PM
Renaming Local Discs Wolf Windows XP 1 07-11-2003 12:34 AM
Authentication tab of Local Area Connections dialog Doug Hoeffel Windows XP Embedded 0 06-25-2003 02:46 PM


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90