次の方法で共有


SetIpInterfaceEntry (Compact 2013)

3/26/2014

This function sets the properties of an IP interface on the local device.

Syntax

NETIOAPI_API SetIpInterfaceEntry(
  __inout  PMIB_IPINTERFACE_ROW Row
);

Parameters

  • Row
    A pointer to a MIB_IPINTERFACE_ROW structure entry for an interface. On input, the Family member of the MIB_IPINTERFACE_ROW must be set to AF_INET6 or AF_INET and the InterfaceLuid or the InterfaceIndex member of the MIB_IPINTERFACE_ROW must be specified. On a successful return, the InterfaceLuid member of the MIB_IPINTERFACE_ROW is filled in if InterfaceIndex member of the MIB_IPINTERFACE_ROW entry was specified.

Return Value

Error Code

Meaning

NO_ERROR

The function succeeds.

ERROR_ACCESS_DENIED

Access is denied. This error is returned under several conditions that include the following: the user lacks the required administrative permissions on the local device or the application is not running in an enhanced shell as the built-in Administrator (RunAs administrator).

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the Row parameter, the Family member of the MIB_IPINTERFACE_ROW pointed to by the Row parameter was not specified as AF_INET or AF_INET6, or both the InterfaceLuid or InterfaceIndex members of the MIB_IPINTERFACE_ROW pointed to by the Row parameter were unspecified.

ERROR_NOT_FOUND

The specified interface could not be found. This error is returned if the network interface specified by the InterfaceLuid or InterfaceIndex member of the MIB_IPINTERFACE_ROW pointed to by the Row parameter could not be found.

Other

Use FormatMessage to obtain the message string for the returned error.

Remarks

The InitializeIpInterfaceEntry function must be used to initialize the fields of a MIB_IPINTERFACE_ROW structure entry with default values. An application can then change the fields in the MIB_IPINTERFACE_ROW entry it wishes to modify, and then call the SetIpInterfaceEntry function.

On input, the Family member in the MIB_IPINTERFACE_ROW structure pointed to by the Row parameter must be initialized to either AF_INET or AF_INET6. In addition on input, at least one of the following members in the MIB_IPINTERFACE_ROW structure pointed to the Row parameter must be initialized: the InterfaceLuid or InterfaceIndex. The fields are used in the order listed above. So if the InterfaceLuid is specified, this member is used to determine the interface. If no value was set for the InterfaceLuid member (the values of this member was set to zero), the InterfaceIndex member is next used to determine the interface.

On output, the InterfaceLuid member of the MIB_IPINTERFACE_ROW structure pointed to by the Row parameter is filled in if the InterfaceIndex was specified.

The MaxReassemblySize, MinRouterAdvertisementInterval, MaxRouterAdvertisementInterval , Connected, SupportsWakeUpPatterns, SupportsNeighborDiscovery, SupportsRouterDiscovery, ReachableTime, TransmitOffload, and ReceiveOffload members of the MIB_IPINTERFACE_ROW structure pointed to by the Row are ignored when the SetIpInterfaceEntry function is called. These members are set by the network stack and cannot be changed by using the SetIpInterfaceEntry function.

Unprivileged concurrent access to multiple networks of different security requirements creates a security hole and allows an unprivileged application to accidentally relay data between the two networks.

The SetIpInterfaceEntry function can only be called by a user logged on as a member of the Administrators group. If SetIpInterfaceEntry is called by a user who is not a member of the Administrators group, the function call will fail and ERROR_ACCESS_DENIED is returned

See Also

Reference

IP Helper Functions
GetBestRoute
GetBestRoute2
GetIfEntry2
GetIfTable2
GetIfTable2Ex
GetIpInterfaceEntry
GetIpInterfaceTable
InitializeIpInterfaceEntry
MIB_IF_ROW2
MIB_IF_TABLE2
MIB_IPINTERFACE_ROW
MIB_IPINTERFACE_TABLE
NotifyIpInterfaceChange

Other Resources

IP Helper