0

I was unable to find a Win32 API to modify network interface properties. By "network interface properties" I mean properties, which can be set using the "network connections" panel in the System control panel manually or using "netsh interface" from the command line.

In particular, I want to modify:

  • The network connection name (e.g. "Local Area Connection #2"
  • The IPv4 network interface metric (which is "automatic" by default)

To identify the network adapter, I have a device instance ID of the PnP device manager (e.g. "ROOT\NET\0000"). I also have an instance of a SetupAPI SP_DEVINFO_DATA structure. I can probably also query the NetCfgInstanceId using SetupAPI.

Is there a Win32 API which does what I want? I don't want to use WMI. Target platforms are Windows 7 x64 or newer.

Cybran
  • 2,203
  • 2
  • 17
  • 34

1 Answers1

1

Problem 1: Try using INetworkConnection::Rename. In order to get the connection you want, you have to use INetSharingManager to enumerate all connections. Do an iteration to find the one you need to change.

Svekke
  • 1,470
  • 1
  • 12
  • 20