0% found this document useful (0 votes)
43 views

Windows Win32 API Nla

Uploaded by

wanghoa6868
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Windows Win32 API Nla

Uploaded by

wanghoa6868
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 204

Tell us about your PDF experience.

Network List Manager


Article01/24/2023

Overview of the Network List Manager technology.

To develop Network List Manager, you need these headers:

netlistmgr.h
ondemandconnroutehelper.h

For programming guidance for this technology, see:

Network List Manager

Enumerations

NLM_CONNECTION_COST

The NLM_CONNECTION_COST enumeration specifies a set of cost levels and cost flags supported
in Windows 8 Cost APIs.

NLM_CONNECTION_PROPERTY_CHANGE

The NLM_CONNECTION PROPERTY_CHANGE enumeration is a set of flags that define changes


made to the properties of a network connection.

NLM_CONNECTIVITY

The NLM_Connectivity enumeration is a set of flags that provide notification whenever


connectivity related parameters have changed.

NLM_DOMAIN_AUTHENTICATION_KIND

Defines constants that specify a domain authentication method.

NLM_DOMAIN_TYPE

The NLM_DOMAIN_TYPE enumeration is a set of flags that specify the domain type of a network.

NLM_ENUM_NETWORK

The NLM_ENUM_NETWORK enumeration contains a set of flags that specify what types of
networks are enumerated.
NLM_INTERNET_CONNECTIVITY

The NLM_INTERNET_CONNECTIVITY enumeration defines a set of flags that provide additional


data for IPv4 or IPv6 network connectivity.

NLM_NETWORK_CATEGORY

The NLM_NETWORK_CATEGORY enumeration is a set of flags that specify the category type of a
network.

NLM_NETWORK_CLASS

NLM_NETWORK_CLASS enumeration defines a set of flags that specify if a network has been
identified.

NLM_NETWORK_PROPERTY_CHANGE

The NLM_NETWORK_PROPERTY_CHANGE enumeration is a set of flags that define changes made


to the properties of a network.

Functions

ClearSimulatedProfileInfo

Clears the connection profile values previously applied to the internet connection profile by
SetSimulatedProfileInfo. The next internet connection query, via GetInternetConnectionProfile, will
use system information.

Clone

The Clone method creates an enumerator that contains the same enumeration state as the
enumerator currently in use. (IEnumNetworkConnections.Clone)

Clone

The Clone method creates an enumerator that contains the same enumeration state as the
enumerator currently in use. (IEnumNetworks.Clone)

ConnectionCostChanged

ConnectionCostChanged method notifies an application of a network cost change for a


connection.
ConnectionDataPlanStatusChanged

ConnectionDataPlanStatusChanged method notifies an application of a data plan status change


on a connection.

ConnectivityChanged

The NetworkConnectivityChanged method is called when network connectivity related changes


occur. (INetworkListManagerEvents.ConnectivityChanged)

CostChanged

CostChanged method is called to indicates a cost change for either machine-wide Internet
connectivity, or the first-hop of routing to a specific destination on a connection.

DataPlanStatusChanged

DataPlanStatusChanged method is called to indicate a change to the status of a data plan


associated with either a connection used for machine-wide Internet connectivity, or the first-hop
of routing to a specific destination on a connection.

FreeInterfaceContextTable

This function frees the interface context table retrieved using the
GetInterfaceContextTableForHostName function.

get__NewEnum

The get_NewEnum property returns an automation enumerator object that you can use to iterate
through the IEnumNetworkConnections collection.

get__NewEnum

The get_NewEnum property returns an automation enumerator object that you can use to iterate
through the IEnumNetworks collection.

get_IsConnected

The get_IsConnected property specifies if the network has any network connectivity.

get_IsConnected

The get_IsConnected property specifies if the associated network connection has network
connectivity.

get_IsConnected

The get_IsConnected property specifies if the local machine has network connectivity.
get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the network has internet connectivity.

get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the associated network connection has


internet connectivity.

get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the local machine has internet connectivity.

GetAdapterId

The GetAdapterID method returns the ID of the network adapter used by this connection.

GetCategory

The GetCategory method returns the category of a network.

GetConnectionId

The GetConnectionID method returns the Connection ID associated with this network connection.

GetConnectivity

The GetConnectivity method returns the connectivity state of the network.

GetConnectivity

The GetConnectivity method returns the connectivity state of the network connection.

GetConnectivity

The GetConnectivity method returns the overall connectivity state of the machine.

GetCost

GetCost method retrieves the network cost associated with a connection.

GetCost

GetCost method retrieves the current cost of either a machine-wide internet connection, or the
first-hop of routing to a specific destination on a connection.

GetDataPlanStatus

GetDataPlanStatus method retrieves the status of the data plan associated with a connection.
GetDataPlanStatus

GetDataPlanStatus retrieves the data plan status for either a machine-wide internet connection ,
or the first-hop of routing to a specific destination on a connection.

GetDescription

The GetDescription method returns a description string for the network.

GetDomainType

The GetDomainType method returns the domain type of a network.

GetDomainType

The GetDomainType method returns the domain type of the network connection.

GetInterfaceContextTableForHostName

This function retrieves an interface context table for the given hostname and connection profile
filter.

GetName

The GetName method returns the name of a network.

GetNetwork

The GetNetwork method returns the network associated with the connection.

GetNetwork

The GetNetwork method retrieves a network based on a supplied network ID.

GetNetworkConnection

The GetNetworkConnection method retrieves a network based on a supplied Network Connection


ID.

GetNetworkConnections

The GetNetworkConnections method returns an enumeration of all network connections for a


network. A network can have multiple connections to it from different interfaces or different links
from the same interface.

GetNetworkConnections

The GetNetworkConnections method enumerates a complete list of the network connections that
have been made.
GetNetworkId

The GetNetworkId method returns the unique identifier of a network.

GetNetworks

The GetNetworks method retrieves the list of networks available on the local machine.

GetTimeCreatedAndConnected

The GetTimeCreatedAndConnected method returns the local date and time when the network
was created and connected.

IsDomainAuthenticatedBy

Queries whether the specified domain authentication method succeeded for this network.

IsDomainAuthenticatedBy

Queries whether the specified domain authentication method succeeded for this network
connection.

NetworkAdded

The NetworkAdded method is called when a new network is added. The GUID of the new network
is provided.

NetworkConnectionConnectivityChanged

The NetworkConnectionConnectivityChanged method notifies a client when connectivity change


events occur on a network connection level.

NetworkConnectionPropertyChanged

The NetworkConnectionPropertyChanged method notifies a client when property change events


related to a specific network connection occur.

NetworkConnectivityChanged

The NetworkConnectivityChanged method is called when network connectivity related changes


occur. (INetworkEvents.NetworkConnectivityChanged)

NetworkDeleted

The NetworkDeleted method is called when a network is deleted.

NetworkPropertyChanged

The NetworkPropertyChanged method is called when a network property change is detected.


Next

The Next method gets the next specified number of elements in the enumeration sequence.
(IEnumNetworkConnections.Next)

Next

The Next method gets the next specified number of elements in the enumeration sequence.
(IEnumNetworks.Next)

OnDemandGetRoutingHint

The OnDemandGetRoutingHint function looks up a destination in the Route Request cache and, if
a match is found, return the corresponding Interface ID.

OnDemandRegisterNotification

The OnDemandRegisterNotification function allows an application to register to be notified when


the Route Requests cache is modified.

OnDemandUnRegisterNotification

The OnDemandUnregisterNotification function allows an application to unregister for notifications


and clean up resources.

Reset

The Reset method resets the enumeration sequence to the beginning.


(IEnumNetworkConnections.Reset)

Reset

The Reset method resets the enumeration sequence to the beginning. (IEnumNetworks.Reset)

SetCategory

The SetCategory method sets the category of a network. Changes made take effect immediately.
Callers of this API must be members of the Administrators group.

SetDescription

The SetDescription method sets or replaces the description for a network.

SetDestinationAddresses

SetDestinationAddresses method registers specified destination IPv4/IPv6 addresses to receive


cost or data plan status change notifications.
SetName

The SetName method sets or renames a network.

SetSimulatedProfileInfo

The SetSimulatedProfileInfo method applies a specific set of connection profile values to the
internet connection profile in support of the simulation of specific metered internet connection
conditions.

Skip

The Skip method skips over the next specified number of elements in the enumeration sequence.
(IEnumNetworkConnections.Skip)

Skip

The Skip method skips over the next specified number of elements in the enumeration sequence.
(IEnumNetworks.Skip)

Interfaces

IEnumNetworkConnections

The IEnumNetworkConnections interface provides a standard enumerator for network


connections. It enumerates active, disconnected, or all network connections within a network. This
interface can be obtained from the INetwork interface.

IEnumNetworks

The IEnumNetworks interface is a standard enumerator for networks. It enumerates all networks
available on the local machine. This interface can be obtained from the INetworkListManager
interface.

INetwork

The INetwork interface represents a network on the local machine. It can also represent a
collection of network connections with a similar network signature.

INetwork2

The INetwork2 interface represents a network on the local machine. It can also represent a
collection of network connections with a similar network signature.
INetworkConnection

The INetworkConnection interface represents a single network connection.

INetworkConnection2

The INetworkConnection2 interface represents a single network connection.

INetworkConnectionCost

To query current network cost and data plan status associated with a connection.

INetworkConnectionCostEvents

This interface to notify an application of cost and data plan status change events for a connection.

INetworkConnectionEvents

The INetworkConnectionEvents interface is a message sink interface that a client implements to


get network connection-related events. Applications that are interested in lower-level events (such
as authentication changes) must implement this interface.

INetworkCostManager

Use this interface to query for machine-wide cost and data plan status information associated
with either a connection used for machine-wide Internet connectivity, or the first-hop of routing
to a specific destination on a connection.

INetworkCostManagerEvents

This interface to notify an application of machine-wide cost and data plan related events.

INetworkEvents

INetworkEvents is a notification sink interface that a client implements to get network related
events. These APIs are all callback functions that are called automatically when the respective
events are raised.

INetworkListManager

The INetworkListManager interface provides a set of methods to perform network list


management functions.

INetworkListManagerEvents

INetworkListManagerEvents is a message sink interface that a client implements to get overall


machine state related events. Applications that are interested on higher-level events, for example
internet connectivity, implement this interface.
Structures

NET_INTERFACE_CONTEXT

The interface context that is part of the NET_INTERFACE_CONTEXT_TABLE structure.

NET_INTERFACE_CONTEXT_TABLE

The table of NET_INTERFACE_CONTEXT structures.

NLM_DATAPLAN_STATUS

NLM_DATAPLAN_STATUS structure stores the current data plan status information supplied by the
carrier.

NLM_SIMULATED_PROFILE_INFO

Used to specify values that are used by SetSimulatedProfileInfo to override current internet
connection profile values in an RDP Child Session to support the simulation of specific metered
internet connection conditions.

NLM_SOCKADDR

NLM_SOCKADDR structure contains the IPv4/IPv6 destination address.

NLM_USAGE_DATA

NLM_USAGE_DATA structure stores information that indicates the data usage of a plan.

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


netlistmgr.h header
Article01/24/2023

This header is used by Network List Manager. For more information, see:

Network List Manager

netlistmgr.h contains the following programming interfaces:

Interfaces

IEnumNetworkConnections

The IEnumNetworkConnections interface provides a standard enumerator for network


connections. It enumerates active, disconnected, or all network connections within a network. This
interface can be obtained from the INetwork interface.

IEnumNetworks

The IEnumNetworks interface is a standard enumerator for networks. It enumerates all networks
available on the local machine. This interface can be obtained from the INetworkListManager
interface.

INetwork

The INetwork interface represents a network on the local machine. It can also represent a
collection of network connections with a similar network signature.

INetwork2

The INetwork2 interface represents a network on the local machine. It can also represent a
collection of network connections with a similar network signature.

INetworkConnection

The INetworkConnection interface represents a single network connection.

INetworkConnection2

The INetworkConnection2 interface represents a single network connection.

INetworkConnectionCost

To query current network cost and data plan status associated with a connection.
INetworkConnectionCostEvents

This interface to notify an application of cost and data plan status change events for a connection.

INetworkConnectionEvents

The INetworkConnectionEvents interface is a message sink interface that a client implements to


get network connection-related events. Applications that are interested in lower-level events (such
as authentication changes) must implement this interface.

INetworkCostManager

Use this interface to query for machine-wide cost and data plan status information associated
with either a connection used for machine-wide Internet connectivity, or the first-hop of routing
to a specific destination on a connection.

INetworkCostManagerEvents

This interface to notify an application of machine-wide cost and data plan related events.

INetworkEvents

INetworkEvents is a notification sink interface that a client implements to get network related
events. These APIs are all callback functions that are called automatically when the respective
events are raised.

INetworkListManager

The INetworkListManager interface provides a set of methods to perform network list


management functions.

INetworkListManagerEvents

INetworkListManagerEvents is a message sink interface that a client implements to get overall


machine state related events. Applications that are interested on higher-level events, for example
internet connectivity, implement this interface.

Structures

NLM_DATAPLAN_STATUS

NLM_DATAPLAN_STATUS structure stores the current data plan status information supplied by the
carrier.
NLM_SIMULATED_PROFILE_INFO

Used to specify values that are used by SetSimulatedProfileInfo to override current internet
connection profile values in an RDP Child Session to support the simulation of specific metered
internet connection conditions.

NLM_SOCKADDR

NLM_SOCKADDR structure contains the IPv4/IPv6 destination address.

NLM_USAGE_DATA

NLM_USAGE_DATA structure stores information that indicates the data usage of a plan.

Enumerations

NLM_CONNECTION_COST

The NLM_CONNECTION_COST enumeration specifies a set of cost levels and cost flags supported
in Windows 8 Cost APIs.

NLM_CONNECTION_PROPERTY_CHANGE

The NLM_CONNECTION PROPERTY_CHANGE enumeration is a set of flags that define changes


made to the properties of a network connection.

NLM_CONNECTIVITY

The NLM_Connectivity enumeration is a set of flags that provide notification whenever


connectivity related parameters have changed.

NLM_DOMAIN_AUTHENTICATION_KIND

Defines constants that specify a domain authentication method.

NLM_DOMAIN_TYPE

The NLM_DOMAIN_TYPE enumeration is a set of flags that specify the domain type of a network.

NLM_ENUM_NETWORK

The NLM_ENUM_NETWORK enumeration contains a set of flags that specify what types of
networks are enumerated.
NLM_INTERNET_CONNECTIVITY

The NLM_INTERNET_CONNECTIVITY enumeration defines a set of flags that provide additional


data for IPv4 or IPv6 network connectivity.

NLM_NETWORK_CATEGORY

The NLM_NETWORK_CATEGORY enumeration is a set of flags that specify the category type of a
network.

NLM_NETWORK_CLASS

NLM_NETWORK_CLASS enumeration defines a set of flags that specify if a network has been
identified.

NLM_NETWORK_PROPERTY_CHANGE

The NLM_NETWORK_PROPERTY_CHANGE enumeration is a set of flags that define changes made


to the properties of a network.

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections interface
(netlistmgr.h)
Article07/27/2022

The IEnumNetworkConnections interface provides a standard enumerator for network


connections. It enumerates active, disconnected, or all network connections within a
network. This interface can be obtained from the INetwork interface.

Inheritance
The IEnumNetworkConnections interface inherits from the IUnknown interface.
IEnumNetworkConnections also has these types of members:

Methods
The IEnumNetworkConnections interface has these methods.

IEnumNetworkConnections::Clone

The Clone method creates an enumerator that contains the same enumeration state as the
enumerator currently in use. (IEnumNetworkConnections.Clone)

IEnumNetworkConnections::get__NewEnum

The get_NewEnum property returns an automation enumerator object that you can use to iterate
through the IEnumNetworkConnections collection.

IEnumNetworkConnections::Next

The Next method gets the next specified number of elements in the enumeration sequence.
(IEnumNetworkConnections.Next)

IEnumNetworkConnections::Reset

The Reset method resets the enumeration sequence to the beginning.


(IEnumNetworkConnections.Reset)

IEnumNetworkConnections::Skip

The Skip method skips over the next specified number of elements in the enumeration sequence.
(IEnumNetworkConnections.Skip)
Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections::Clone
method (netlistmgr.h)
Article07/27/2022

The Clone method creates an enumerator that contains the same enumeration state as
the enumerator currently in use.

Syntax
C++

HRESULT Clone(
[out] IEnumNetworkConnections **ppEnumNetwork
);

Parameters
[out] ppEnumNetwork

Pointer to new IEnumNetworkConnections interface instance.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The ppEnum parameter is not a valid pointer.

E_OUTOFMEMORY Insufficient memory exists to perform the operation.

E_UNEXPECTED Failed for unknown reasons.

Requirements

Minimum supported client Windows Vista [desktop apps only]


Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworkConnections

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections::get__NewEn
um method (netlistmgr.h)
Article10/13/2021

The get_NewEnum property returns an automation enumerator object that you can use
to iterate through the IEnumNetworkConnections collection.

Syntax
C++

HRESULT get__NewEnum(
[out] IEnumVARIANT **ppEnumVar
);

Parameters
[out] ppEnumVar

Contains the new instance of the implemented interface.

Return value
Returns S_OK if the method succeeds.

Remarks
In Microsoft Visual Basic and Microsoft C#, you do not need to use the corresponding
_NewEnum property, because it is automatically used in the implementation of the For
Each loop (for each in Visual C#).

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworkConnections

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections::Next
method (netlistmgr.h)
Article07/27/2022

The Next method gets the next specified number of elements in the enumeration
sequence.

Syntax
C++

HRESULT Next(
[in] ULONG celt,
[out] INetworkConnection **rgelt,
[out] ULONG *pceltFetched
);

Parameters
[in] celt

Number of elements requested.

[out] rgelt

Pointer to a list of pointers returned by INetworkConnection.

[out] pceltFetched

Pointer to the number of elements supplied. May be NULL if celt is one.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

S_FALSE The number of elements skipped was not celt.

E_OUTOFMEMORY Insufficient memory exists to perform the operation.


E_POINTER The ppElements parameter is not a valid pointer.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworkConnections

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections::Reset
method (netlistmgr.h)
Article07/27/2022

The Reset method resets the enumeration sequence to the beginning.

Syntax
C++

HRESULT Reset();

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_OUTOFMEMORY Insufficient memory exists to perform the operation.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworkConnections

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworkConnections::Skip
method (netlistmgr.h)
Article07/27/2022

The Skip method skips over the next specified number of elements in the enumeration
sequence.

Syntax
C++

HRESULT Skip(
[in] ULONG celt
);

Parameters
[in] celt

Number of elements to skip over in the enumeration.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

S_FALSE The number of elements skipped was not celt.

E_OUTOFMEMORY Insufficient memory exists to perform the operation.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworkConnections

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks interface (netlistmgr.h)
Article07/27/2022

The IEnumNetworks interface is a standard enumerator for networks. It enumerates all


networks available on the local machine. This interface can be obtained from the
INetworkListManager interface.

Inheritance
The IEnumNetworks interface inherits from the IUnknown interface. IEnumNetworks
also has these types of members:

Methods
The IEnumNetworks interface has these methods.

IEnumNetworks::Clone

The Clone method creates an enumerator that contains the same enumeration state as the
enumerator currently in use. (IEnumNetworks.Clone)

IEnumNetworks::get__NewEnum

The get_NewEnum property returns an automation enumerator object that you can use to iterate
through the IEnumNetworks collection.

IEnumNetworks::Next

The Next method gets the next specified number of elements in the enumeration sequence.
(IEnumNetworks.Next)

IEnumNetworks::Reset

The Reset method resets the enumeration sequence to the beginning. (IEnumNetworks.Reset)

IEnumNetworks::Skip

The Skip method skips over the next specified number of elements in the enumeration sequence.
(IEnumNetworks.Skip)

Remarks
The list of connected or disconnected networks is cached by IEnumNetworks when it is
instantiated. This list is not updated when the connectivity state of a network changes.
The INetwork interface is recommended for retrieving the current connectivity state of a
network.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks::Clone method
(netlistmgr.h)
Article07/27/2022

The Clone method creates an enumerator that contains the same enumeration state as
the enumerator currently in use.

Syntax
C++

HRESULT Clone(
[out] IEnumNetworks **ppEnumNetwork
);

Parameters
[out] ppEnumNetwork

Pointer to a new IEnumNetworks interface.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworks

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks::get__NewEnum
method (netlistmgr.h)
Article10/13/2021

The get_NewEnum property returns an automation enumerator object that you can use
to iterate through the IEnumNetworks collection.

Syntax
C++

HRESULT get__NewEnum(
[out] IEnumVARIANT **ppEnumVar
);

Parameters
[out] ppEnumVar

Contains the new instance of the implemented interface.

Return value
Returns S_OK if the method succeeds.

Remarks
In Microsoft Visual Basic and Microsoft C#, you do not need to use the corresponding
_NewEnum property, because it is automatically used in the implementation of the For
Each loop (for each in Visual C#).

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworks

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks::Next method
(netlistmgr.h)
Article07/27/2022

The Next method gets the next specified number of elements in the enumeration
sequence.

Syntax
C++

HRESULT Next(
[in] ULONG celt,
[out] INetwork **rgelt,
[out] ULONG *pceltFetched
);

Parameters
[in] celt

Number of elements requested in the enumeration.

[out] rgelt

Pointer to the enumerated list of pointers returned by INetwork.

[out] pceltFetched

Pointer to the number of elements returned.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

S_FALSE The number of elements returned was not equal to celt.

E_OUTOFMEMORY Insufficient memory exists to perform the operation.


E_POINTER The ppElements parameter is not a valid pointer.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworks

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks::Reset method
(netlistmgr.h)
Article07/27/2022

The Reset method resets the enumeration sequence to the beginning.

Syntax
C++

HRESULT Reset();

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_OUTOFMEMORY Insufficient memory exists to perform the operation.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworks

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


IEnumNetworks::Skip method
(netlistmgr.h)
Article07/27/2022

The Skip method skips over the next specified number of elements in the enumeration
sequence.

Syntax
C++

HRESULT Skip(
[in] ULONG celt
);

Parameters
[in] celt

Number of elements to skip in the enumeration.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

S_FALSE The number of elements skipped was not celt.

E_OUTOFMEMORY Insufficient memory exists to perform the operation.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
IEnumNetworks

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork interface (netlistmgr.h)
Article07/22/2021

The INetwork interface represents a network on the local machine. It can also represent a collection
of network connections with a similar network signature.

Inheritance
The INetwork interface inherits from the IUnknown interface. INetwork also has these types of
members:

Methods
The INetwork interface has these methods.

INetwork::get_IsConnected

The get_IsConnected property specifies if the network has any network connectivity.

INetwork::get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the network has internet connectivity.

INetwork::GetCategory

The GetCategory method returns the category of a network.

INetwork::GetConnectivity

The GetConnectivity method returns the connectivity state of the network.

INetwork::GetDescription

The GetDescription method returns a description string for the network.

INetwork::GetDomainType

The GetDomainType method returns the domain type of a network.

INetwork::GetName

The GetName method returns the name of a network.

INetwork::GetNetworkConnections

The GetNetworkConnections method returns an enumeration of all network connections for a network. A
network can have multiple connections to it from different interfaces or different links from the same interface.
INetwork::GetNetworkId

The GetNetworkId method returns the unique identifier of a network.

INetwork::GetTimeCreatedAndConnected

The GetTimeCreatedAndConnected method returns the local date and time when the network was created and
connected.

INetwork::SetCategory

The SetCategory method sets the category of a network. Changes made take effect immediately. Callers of this
API must be members of the Administrators group.

INetwork::SetDescription

The SetDescription method sets or replaces the description for a network.

INetwork::SetName

The SetName method sets or renames a network.

Remarks
The COM Object that implements INetwork also implements a property bag for additional properties.
To get access to this property bag you can use the INetwork interface and QueryInterface for
IPropertyBag. The property bag on this COM Object contains the following properties:

Parameter Type Description

NA_DomainAuthenticationFailed VT_BOOL Specifies that a domain network is not able to


authenticate against the domain controller.

NA_NetworkClass NLM_NETWORK_CLASS value Specifies the class of network. Possible values


stored as VT_UINT include:
NLM_NETWORK_IDENTIFYING (0x01)
This is the special "Identifying" network. No
properties on this network class can be
changed.
NLM_NETWORK_IDENTIFIED (0x02)
This is an Identified network.
NLM_NETWORK_UNIDENTIFIED (0x03)
This is the special "Unidentified" network.
The category of this network can be
changed, but it will not persist when the
network is disconnected.

NA_InternetConnectivityV4 NLM_INTERNET_CONNECTIVITY Provides details regarding IPv4 or IPv6 network


or value stored as VT_UINT connectivity. Possible values include:
NLM_INTERNET_CONNECTIVITY_WEBHIJACK
NA_InternetConnectivityV6 (0x1)
The detected network is a hotspot. For
example, when connected to a coffee Wi-Fi
hotspot network and the local HTTP traffic is
being redirected to a captive portal, this flag
will be set.
NLM_INTERNET_CONNECTIVITY_PROXIED
(0x2)
The detected network has a proxy
configuration. For example, when connected
to a corporate network using a proxy for
HTTP access, this flag will be set.
NLM_INTERNET_CONNECTIVITY_CORPORATE
(0x4)
The machine has been configured for Direct
Access and access is detected to the
corporate domain network Direct Access has
been configured for.

NA_NameSetByPolicy VT_BOOL The name of the network has been set by group
policy.

NA_IconSetByPolicy VT_BOOL The icon of the network has been set by group
policy.

NA_DescriptionSetByPolicy VT_BOOL The description of the network has been set by


group policy.

NA_CategorySetByPolicy VT_BOOL The category of the network has been set by group
policy.

NA_NameReadOnly VT_BOOL The name of the network is read only.

NA_IconReadOnly VT_BOOL The icon of the network is read only.

NA_DescriptionReadOnly VT_BOOL The description of the network is read only.

NA_CategoryReadOnly VT_BOOL The category of the network is read only.

NA_AllowMerge VT_BOOL The network can be merged with another network.

The IPropertyBag interface accepts LPCOLESTR as part of the IPropertyBag::Read and


IPropertyBag::Write methods. For convenience, the string values for these properties are defined
inside netlistmgr.h using the same names.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows


Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::get_IsConnected method
(netlistmgr.h)
Article10/13/2021

The get_IsConnected property specifies if the network has any network connectivity.

Syntax
C++

HRESULT get_IsConnected(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE, this network is connected; if FALSE, it is not.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::get_IsConnectedToInternet
method (netlistmgr.h)
Article10/13/2021

The get_IsConnectedToInternet property specifies if the network has internet


connectivity.

Syntax
C++

HRESULT get_IsConnectedToInternet(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE, this network has connectivity to the internet; if FALSE, it does not.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetCategory method
(netlistmgr.h)
Article10/13/2021

The GetCategory method returns the category of a network.

Syntax
C++

HRESULT GetCategory(
[out] NLM_NETWORK_CATEGORY *pCategory
);

Parameters
[out] pCategory

Pointer to a NLM_NETWORK_CATEGORY enumeration value that specifies the category


information for the network.

Return value
Returns S_OK if the method succeeds.

Remarks
The private or public network categories must never be used to assume which Windows
Firewall ports are open, as the user can change the default settings of these categories.
Instead, Windows Firewall APIs should be called to ensure the ports that the required
ports are open.

Requirements

Minimum supported client Windows Vista [desktop apps only]


Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

NLM_NETWORK_CATEGORY

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetConnectivity method
(netlistmgr.h)
Article10/13/2021

The GetConnectivity method returns the connectivity state of the network.

Syntax
C++

HRESULT GetConnectivity(
[out] NLM_CONNECTIVITY *pConnectivity
);

Parameters
[out] pConnectivity

Pointer to a NLM_CONNECTIVITY enumeration value that contains a bitmask that


specifies the connectivity state of this network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

NLM_CONNECTIVITY

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetDescription method
(netlistmgr.h)
Article10/13/2021

The GetDescription method returns a description string for the network.

Syntax
C++

HRESULT GetDescription(
[out] BSTR *pszDescription
);

Parameters
[out] pszDescription

Pointer to a string that specifies the text description of the network. This value must be
freed using the SysFreeString API.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The pointer passed is NULL.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows


Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetDomainType method
(netlistmgr.h)
Article10/13/2021

The GetDomainType method returns the domain type of a network.

Syntax
C++

HRESULT GetDomainType(
[out] NLM_DOMAIN_TYPE *pNetworkType
);

Parameters
[out] pNetworkType

Pointer to an NLM_DOMAIN_TYPE enumeration value that specifies the domain type of


the network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetName method
(netlistmgr.h)
Article10/13/2021

The GetName method returns the name of a network.

Syntax
C++

HRESULT GetName(
[out] BSTR *pszNetworkName
);

Parameters
[out] pszNetworkName

Pointer to the name of the network.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns the following
value.

Return code Description

E_POINTER The pointer passed is NULL.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetNetworkConnections
method (netlistmgr.h)
Article10/13/2021

The GetNetworkConnections method returns an enumeration of all network


connections for a network. A network can have multiple connections to it from different
interfaces or different links from the same interface.

Syntax
C++

HRESULT GetNetworkConnections(
[out] IEnumNetworkConnections **ppEnumNetworkConnection
);

Parameters
[out] ppEnumNetworkConnection

Pointer to an IEnumNetworkConnections interface instance that enumerates the list of


local connections to this network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetNetworkId method
(netlistmgr.h)
Article10/13/2021

The GetNetworkId method returns the unique identifier of a network.

Syntax
C++

HRESULT GetNetworkId(
[out] GUID *pgdGuidNetworkId
);

Parameters
[out] pgdGuidNetworkId

Pointer to a GUID that specifies the network ID.

Return value
Returns S_OK if the method succeeds.

Remarks
The caller is responsible for allocating the buffer pointed to by pgdGuidNetworkId. This
buffer must be large enough to hold a GUID.

Calling GetNetworkId will return S_OK even if the network requested has been deleted.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::GetTimeCreatedAndConnecte
d method (netlistmgr.h)
Article10/13/2021

The GetTimeCreatedAndConnected method returns the local date and time when the
network was created and connected.

Syntax
C++

HRESULT GetTimeCreatedAndConnected(
[out] DWORD *pdwLowDateTimeCreated,
[out] DWORD *pdwHighDateTimeCreated,
[out] DWORD *pdwLowDateTimeConnected,
[out] DWORD *pdwHighDateTimeConnected
);

Parameters
[out] pdwLowDateTimeCreated

Pointer to a datetime when the network was created. Specifically, it contains the low
DWORD of FILETIME.dwLowDateTime.

[out] pdwHighDateTimeCreated

Pointer to a datetime when the network was created. Specifically, it contains the high
DWORD of FILETIME.dwLowDateTime.

[out] pdwLowDateTimeConnected

Pointer to a datetime when the network was last connected to. Specifically, it contains
the low DWORD of FILETIME.dwLowDateTime.

[out] pdwHighDateTimeConnected

Pointer to a datetime when the network was last connected to. Specifically, it contains
the high DWORD of FILETIME.dwLowDateTime.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The pointer passed is NULL.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::SetCategory method
(netlistmgr.h)
Article10/13/2021

The SetCategory method sets the category of a network. Changes made take effect
immediately. Callers of this API must be members of the Administrators group.

Syntax
C++

HRESULT SetCategory(
[in] NLM_NETWORK_CATEGORY NewCategory
);

Parameters
[in] NewCategory

Pointer to a NLM_NETWORK_CATEGORY enumeration value that specifies the new


category of the network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::SetDescription method
(netlistmgr.h)
Article10/13/2021

The SetDescription method sets or replaces the description for a network.

Syntax
C++

HRESULT SetDescription(
[in] BSTR szDescription
);

Parameters
[in] szDescription

Zero-terminated string that contains the description of the network.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER szDescription is NULL.

HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) The given name is too long.

Remarks
The maximum length for a network description is 1024 characters.

Requirements
Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork::SetName method
(netlistmgr.h)
Article10/13/2021

The SetName method sets or renames a network.

Syntax
C++

HRESULT SetName(
[in] BSTR szNetworkNewName
);

Parameters
[in] szNetworkNewName

Zero-terminated string that contains the new name of the network.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER szNetworkNewName is NULL.

HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) The name provided is too long.

Remarks
The maximum length of a network name can be 128 characters and cannot contain
spaces only, tab or "\ /: * ? " < > |".

Requirements
Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetwork

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork2 interface (netlistmgr.h)
Article05/24/2022

The INetwork2 interface represents a network on the local machine. It can also
represent a collection of network connections with a similar network signature.

Inheritance
The INetwork2 interface derives from the INetwork interface.

Methods
The INetwork2 interface has these methods.

INetwork2::IsDomainAuthenticatedBy

Queries whether the specified domain authentication method succeeded for this network.

Remarks
See Remarks for INetwork.

Requirements

Minimum supported client Windows 11 Build 22621

Target Platform Windows

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetwork2::IsDomainAuthenticatedBy
method (netlistmgr.h)
Article05/24/2022

Queries whether the specified domain authentication method succeeded for this
network.

Syntax
C++

HRESULT IsDomainAuthenticatedBy(
NLM_DOMAIN_AUTHENTICATION_KIND domainAuthenticationKind,
BOOL *pValue
);

Parameters
domainAuthenticationKind

Type: [in] NLM_DOMAIN_AUTHENTICATION_KIND

The specific domain authentication method to query about.

pValue

Type: [out, retval] BOOL*

The function dereferences pValue, and assigns TRUE if this network has the same
domain authentication kind as that specified in the domainAuthenticationKind
parameter; or FALSE if this network has a different domain authentication kind from that
specified in domainAuthenticationKind.

Return value
Returns S_OK if successful.

Example
In this example, a hypothetical networking diagnostic tool seeks to ensure that
connections to a corporate network have correct authentication properties.

C++

void LogToConsole(std::wstring output, std::wstring networkName)


{
// Implementation not shown for brevity.
}

void RunDiagnostics()
{
winrt::com_ptr<::INetworkListManager> nlm;
winrt::com_ptr<::IEnumNetworks> enumNetworks;
winrt::com_ptr<::INetwork> network;
ULONG numberOfNetworksEnumerated{ 0 };
winrt::check_hresult(::CoCreateInstance(CLSID_NetworkListManager,
nullptr, CLSCTX_ALL, IID_PPV_ARGS(&nlm)));
winrt::check_hresult(nlm->GetNetworks(NLM_ENUM_NETWORK_ALL,
enumNetworks.put()));

while ((enumNetworks->Next(1, network.put(),


&numberOfNetworksEnumerated) == S_OK))
{
try
{
if (numberOfNetworksEnumerated == 1)
{
winrt::com_ptr<::INetwork2> network2{
network.as<::INetwork2>() };
BSTR networkName{};
HRESULT hr{ network2->GetName(&networkName) };
winrt::check_hresult(network2->GetName(&networkName));

BOOL isLdapAuthenticated{ FALSE };


BOOL isTlsAuthenticated{ FALSE };
BOOL isNotDomainAuthenticated{ FALSE };
winrt::check_hresult(network2-
>IsDomainAuthenticatedBy(NLM_DOMAIN_AUTHENTICATION_KIND_LDAP,
&isLdapAuthenticated));
winrt::check_hresult(network2-
>IsDomainAuthenticatedBy(NLM_DOMAIN_AUTHENTICATION_KIND_TLS,
&isTlsAuthenticated));
winrt::check_hresult(network2-
>IsDomainAuthenticatedBy(NLM_DOMAIN_AUTHENTICATION_KIND_NONE,
&isNotDomainAuthenticated));

if (!isNotDomainAuthenticated)
{
if (!!isLdapAuthenticated)
{
LogToConsole(L"Network is domain authenticated via
LDAP", networkName);
}
if (!!isTlsAuthenticated)
{
LogToConsole(L"Network is domain authenticated via
TLS", networkName);
}

if (!isLdapAuthenticated && !isTlsAuthenticated)


{
LogToConsole(L"Network was not expected to be domain
authenticated for any other kinds", networkName);
}
}
else
{
LogToConsole(L"Network is not domain authenticated",
networkName);
}
}
}
catch (...)
{
// Handle exception.
}
}
}

Requirements

Minimum supported client Windows 11 Build 22621

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection2::IsDomainAuthenticatedBy method

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection interface
(netlistmgr.h)
Article07/22/2021

The INetworkConnection interface represents a single network connection.

Inheritance
The INetworkConnection interface inherits from the IUnknown interface.
INetworkConnection also has these types of members:

Methods
The INetworkConnection interface has these methods.

INetworkConnection::get_IsConnected

The get_IsConnected property specifies if the associated network connection has network
connectivity.

INetworkConnection::get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the associated network connection has


internet connectivity.

INetworkConnection::GetAdapterId

The GetAdapterID method returns the ID of the network adapter used by this connection.

INetworkConnection::GetConnectionId

The GetConnectionID method returns the Connection ID associated with this network connection.

INetworkConnection::GetConnectivity

The GetConnectivity method returns the connectivity state of the network connection.

INetworkConnection::GetDomainType

The GetDomainType method returns the domain type of the network connection.
INetworkConnection::GetNetwork

The GetNetwork method returns the network associated with the connection.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::get_IsConnected
method (netlistmgr.h)
Article10/13/2021

The get_IsConnected property specifies if the associated network connection has


network connectivity.

Syntax
C++

HRESULT get_IsConnected(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE, this network connection has connectivity; if FALSE, it does not.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::get_IsConnectedT
oInternet method (netlistmgr.h)
Article10/13/2021

The get_IsConnectedToInternet property specifies if the associated network connection


has internet connectivity.

Syntax
C++

HRESULT get_IsConnectedToInternet(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE, this network connection has connectivity to the internet; if FALSE, it does not.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::GetAdapterId
method (netlistmgr.h)
Article10/13/2021

The GetAdapterID method returns the ID of the network adapter used by this
connection.

Syntax
C++

HRESULT GetAdapterId(
[out] GUID *pgdAdapterId
);

Parameters
[out] pgdAdapterId

Pointer to a GUID that specifies the adapter ID of the TCP/IP interface used by this
network connection.

Return value
Returns S_OK if the method succeeds.

Remarks
It is possible for multiple connections to have the same AdapterID.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows


Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::GetConnectionId
method (netlistmgr.h)
Article10/13/2021

The GetConnectionID method returns the Connection ID associated with this network
connection.

Syntax
C++

HRESULT GetConnectionId(
[out] GUID *pgdConnectionId
);

Parameters
[out] pgdConnectionId

Pointer to a GUID that specifies the Connection ID associated with this network
connection.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::GetConnectivity
method (netlistmgr.h)
Article10/13/2021

The GetConnectivity method returns the connectivity state of the network connection.

Syntax
C++

HRESULT GetConnectivity(
[out] NLM_CONNECTIVITY *pConnectivity
);

Parameters
[out] pConnectivity

Pointer to a NLM_CONNECTIVITY enumeration value that contains a bitmask that


specifies the connectivity of this network connection.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::GetDomainType
method (netlistmgr.h)
Article10/13/2021

The GetDomainType method returns the domain type of the network connection.

Syntax
C++

HRESULT GetDomainType(
[out] NLM_DOMAIN_TYPE *pDomainType
);

Parameters
[out] pDomainType

Pointer to an NLM_DOMAIN_TYPE enumeration value that specifies the domain type of


the network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection::GetNetwork
method (netlistmgr.h)
Article10/13/2021

The GetNetwork method returns the network associated with the connection.

Syntax
C++

HRESULT GetNetwork(
[out] INetwork **ppNetwork
);

Parameters
[out] ppNetwork

Pointer to a pointer that receives an INetwork interface instance that specifies the
network associated with the connection.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection2 interface
(netlistmgr.h)
Article05/24/2022

The INetworkConnection2 interface represents a single network connection.

Inheritance
The INetworkConnection2 interface derives from the INetworkConnection interface.

Methods
The INetworkConnection2 interface has these methods.

INetworkConnection2::IsDomainAuthenticatedBy

Queries whether the specified domain authentication method succeeded for this network
connection.

Requirements

Minimum supported client Windows 11 Build 22621

Target Platform Windows

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnection2::IsDomainAuthen
ticatedBy method (netlistmgr.h)
Article05/24/2022

Queries whether the specified domain authentication method succeeded for this
network connection.

Syntax
C++

HRESULT IsDomainAuthenticatedBy(
NLM_DOMAIN_AUTHENTICATION_KIND domainAuthenticationKind,
BOOL *pValue
);

Parameters
domainAuthenticationKind

Type: [in] NLM_DOMAIN_AUTHENTICATION_KIND

The specific domain authentication method to query about.

pValue

Type: [out, retval] BOOL*

The function dereferences pValue, and assigns TRUE if this network connection has the
same domain authentication kind as that specified in the domainAuthenticationKind
parameter; or FALSE if this network connection has a different domain authentication
kind from that specified in domainAuthenticationKind.

Return value
Returns S_OK if successful.

Remarks
See Remarks for INetwork2::IsDomainAuthenticatedBy method.

Example
See Example for INetwork2::IsDomainAuthenticatedBy method.

Requirements

Minimum supported client Windows 11 Build 22621

Target Platform Windows

Header netlistmgr.h

See also
INetwork2::IsDomainAuthenticatedBy method

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCost interface
(netlistmgr.h)
Article07/22/2021

Use this interface to query current network cost and data plan status associated with a
connection.

Inheritance
The INetworkConnectionCost interface inherits from the IUnknown interface.
INetworkConnectionCost also has these types of members:

Methods
The INetworkConnectionCost interface has these methods.

INetworkConnectionCost::GetCost

GetCost method retrieves the network cost associated with a connection.

INetworkConnectionCost::GetDataPlanStatus

GetDataPlanStatus method retrieves the status of the data plan associated with a connection.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
IUnknown
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCost::GetCost
method (netlistmgr.h)
Article10/13/2021

The GetCost method retrieves the network cost associated with a connection.

Syntax
C++

HRESULT GetCost(
[out] DWORD *pCost
);

Parameters
[out] pCost

A DWORD value that represents the network cost of the connection. The lowest 16 bits
represent the cost level and the highest 16 bits represent the cost flags. Possible values
are defined by the NLM_CONNECTION_COST enumeration.

Return value
Returns S_OK on success. Otherwise an HRESULT error code is returned. Possible values
include:

Return code Description

E_POINTER pCost is NULL

HRESULT_FROM_WIN32(ERROR_NO_NETWORK) Network connectivity is currently unavailable.

Requirements

Minimum supported client Windows 8 [desktop apps only]


Minimum supported server Windows Server 2012 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnectionCost

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCost::GetDataPlanS
tatus method (netlistmgr.h)
Article10/13/2021

The GetDataPlanStatus method retrieves the status of the data plan associated with a
connection.

Syntax
C++

HRESULT GetDataPlanStatus(
[out] NLM_DATAPLAN_STATUS *pDataPlanStatus
);

Parameters
[out] pDataPlanStatus

Pointer to an NLM_DATAPLAN_STATUS structure that describes the status of the data


plan associated with the connection. The caller supplies the memory of this structure.

Return value
Returns S_OK on success. Otherwise, an HRESULT error code is returned. Possible values
include:

Return code Description

E_POINTER pDataPlanStatus is NULL.

HRESULT_FROM_WIN32(ERROR_NO_NETWORK) Network connectivity is currently unavailable.

Requirements

Minimum supported client Windows 8 [desktop apps only]


Minimum supported server Windows Server 2012 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnectionCost

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCostEvents
interface (netlistmgr.h)
Article07/22/2021

Use this interface to notify an application of cost and data plan status change events for
a connection.

Inheritance
The INetworkConnectionCostEvents interface inherits from the IUnknown interface.
INetworkConnectionCostEvents also has these types of members:

Methods
The INetworkConnectionCostEvents interface has these methods.

INetworkConnectionCostEvents::ConnectionCostChanged

ConnectionCostChanged method notifies an application of a network cost change for a


connection.

INetworkConnectionCostEvents::ConnectionDataPlanStatusChanged

ConnectionDataPlanStatusChanged method notifies an application of a data plan status change


on a connection.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCostEvents::Connec
tionCostChanged method (netlistmgr.h)
Article10/13/2021

The ConnectionCostChanged method notifies an application of a network cost change


for a connection.

Syntax
C++

HRESULT ConnectionCostChanged(
[in] GUID connectionId,
[in] DWORD newCost
);

Parameters
[in] connectionId

A unique ID that identifies the connection on which the cost change event occurred.

[in] newCost

A DWORD value that represents the new cost of the connection. The lowest 16 bits
represent the cost level, and the highest 16 bits represent the flags. Possible values are
defined by the NLM_CONNECTION_COST enumeration.

Return value
This method returns S_OK on success.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
INetworkConnectionCostEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionCostEvents::Connec
tionDataPlanStatusChanged method
(netlistmgr.h)
Article06/24/2021

The ConnectionDataPlanStatusChanged method notifies an application of a data plan


status change on a connection.

Syntax
C++

HRESULT ConnectionDataPlanStatusChanged(
GUID connectionId
);

Parameters
connectionId

A unique ID that identifies the connection on which the data plan status change event
occurred.

Return value
This method returns S_OK on success.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
See also
INetworkConnectionCostEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionEvents interface
(netlistmgr.h)
Article07/22/2021

The INetworkConnectionEvents interface is a message sink interface that a client


implements to get network connection-related events. Applications that are interested
in lower-level events (such as authentication changes) must implement this interface.

Inheritance
The INetworkConnectionEvents interface inherits from the IUnknown interface.
INetworkConnectionEvents also has these types of members:

Methods
The INetworkConnectionEvents interface has these methods.

INetworkConnectionEvents::NetworkConnectionConnectivityChanged

The NetworkConnectionConnectivityChanged method notifies a client when connectivity change


events occur on a network connection level.

INetworkConnectionEvents::NetworkConnectionPropertyChanged

The NetworkConnectionPropertyChanged method notifies a client when property change events


related to a specific network connection occur.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionEvents::NetworkCo
nnectionConnectivityChanged method
(netlistmgr.h)
Article10/13/2021

The NetworkConnectionConnectivityChanged method notifies a client when


connectivity change events occur on a network connection level.

Syntax
C++

HRESULT NetworkConnectionConnectivityChanged(
[in] GUID connectionId,
[in] NLM_CONNECTIVITY newConnectivity
);

Parameters
[in] connectionId

A GUID that identifies the network connection on which the event occurred.

[in] newConnectivity

NLM_CONNECTIVITY enumeration value that specifies the new connectivity for this
network connection.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
INetworkConnectionEvents

NLM_CONNECTIVITY

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkConnectionEvents::NetworkCo
nnectionPropertyChanged method
(netlistmgr.h)
Article10/13/2021

The NetworkConnectionPropertyChanged method notifies a client when property


change events related to a specific network connection occur.

Syntax
C++

HRESULT NetworkConnectionPropertyChanged(
[in] GUID connectionId,
[in] NLM_CONNECTION_PROPERTY_CHANGE flags
);

Parameters
[in] connectionId

A GUID that identifies the network connection on which the event occurred.

[in] flags

The NLM_CONNECTION_PROPERTY_CHANGE flags for this connection.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
INetworkConnectionEvents

NLM_CONNECTION_PROPERTY_CHANGE

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManager interface
(netlistmgr.h)
Article07/22/2021

Use this interface to query for machine-wide cost and data plan status information
associated with either a connection used for machine-wide Internet connectivity, or the
first-hop of routing to a specific destination on a connection. Additionally, this interface
enables applications to specify destination IP addresses to receive cost or data plan
status change notifications for.

Inheritance
The INetworkCostManager interface inherits from the IUnknown interface.
INetworkCostManager also has these types of members:

Methods
The INetworkCostManager interface has these methods.

INetworkCostManager::GetCost

GetCost method retrieves the current cost of either a machine-wide internet connection, or the
first-hop of routing to a specific destination on a connection.

INetworkCostManager::GetDataPlanStatus

GetDataPlanStatus retrieves the data plan status for either a machine-wide internet connection ,
or the first-hop of routing to a specific destination on a connection.

INetworkCostManager::SetDestinationAddresses

SetDestinationAddresses method registers specified destination IPv4/IPv6 addresses to receive


cost or data plan status change notifications.

Requirements

Minimum supported client Windows 8 [desktop apps only]


Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h

See also
INetworkCostManagerEvents

IUnknown

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManager::GetCost method
(netlistmgr.h)
Article10/13/2021

The GetCost method retrieves the current cost of either a machine-wide internet
connection, or the first-hop of routing to a specific destination on a connection. If
destIPaddr is NULL, this method instead returns the cost of the network used for
machine-wide Internet connectivity.

Syntax
C++

HRESULT GetCost(
[out] DWORD *pCost,
[in] NLM_SOCKADDR *pDestIPAddr
);

Parameters
[out] pCost

A DWORD value that indicates the cost of the connection. The lowest 16 bits represent
the cost level, and the highest 16 bits represent the flags. Possible values are defined by
the NLM_CONNECTION_COST enumeration.

[in] pDestIPAddr

An NLM_SOCKADDR structure containing the destination IPv4/IPv6 address. If NULL, this


method will instead return the cost associated with the preferred connection used for
machine Internet connectivity.

Return value
Returns S_OK on success, otherwise an HRESULT error code is returned.

Return code Description

E_POINTER pCost is NULL


E_PENDING Currently determining the interface used
to route to the destination

E_INVALIDARG The destination IPv4/IPv6 address


specified by destIPAddr is invalid.

HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) The request is not supported. This error is


returned if either an IPv4 or IPv6 stack is
not present on the local computer but
either an IPv4 or IPv6 address was
specified by destIPAddr.

HRESULT_FROM_WIN32(ERROR_NO_NETWORK) Network connectivity is currently


unavailable.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h

See also
INetworkCostManager

NLM_SOCKADDR

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManager::GetDataPlanStat
us method (netlistmgr.h)
Article10/13/2021

The GetDataPlanStatus retrieves the data plan status for either a machine-wide internet
connection , or the first-hop of routing to a specific destination on a connection. If an
IPv4/IPv6 address is not specified, this method returns the data plan status of the
connection used for machine-wide Internet connectivity.

Syntax
C++

HRESULT GetDataPlanStatus(
[out] NLM_DATAPLAN_STATUS *pDataPlanStatus,
[in] NLM_SOCKADDR *pDestIPAddr
);

Parameters
[out] pDataPlanStatus

Pointer to an NLM_DATAPLAN_STATUS structure that describes the data plan status


associated with a connection used to route to a destination. If destIPAddr specifies a
tunnel address, the first available data plan status in the interface stack is returned.

[in] pDestIPAddr

An NLM_SOCKADDR structure containing the destination IPv4/IPv6 or tunnel address. If


NULL, this method returns the cost associated with the preferred connection used for
machine Internet connectivity.

Return value
Returns S_OK on success, otherwise an HRESULT error code is returned.

Return code Description

E_POINTER pDataPlanStatus is NULL.


E_PENDING Determining the interface used to route to
the destination

E_INVALIDARG The destination address specified by


destIPAddr is invalid.

HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) The request is not supported. This error is


returned if either an IPv4 or IPv6 stack is
not present on the local computer but
either an IPv4 or IPv6 address was
specified by destIPAddr.

HRESULT_FROM_WIN32(ERROR_NO_NETWORK) Network connectivity is currently


unavailable.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h

See also
INetworkCostManager

NLM_SOCKADDR

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManager::SetDestinationA
ddresses method (netlistmgr.h)
Article10/13/2021

The SetDestinationAddresses method registers specified destination IPv4/IPv6


addresses to receive cost or data plan status change notifications.

Syntax
C++

HRESULT SetDestinationAddresses(
[in] UINT32 length,
[in] NLM_SOCKADDR *pDestIPAddrList,
VARIANT_BOOL bAppend
);

Parameters
[in] length

The number of destination IPv4/IPv6 addresses in the list.

[in] pDestIPAddrList

A NLM_SOCKADDR structure containing a list of destination IPv4/IPv6 addresses to


register for cost or data plan status change notification.

bAppend

If true, pDestIPAddrList will be appended to the existing address list; otherwise the
existing list will be overwritten.

Return value
Returns S_OK on success, otherwise an HRESULT error code is returned.

Return code Description

E_INVALIDARG Returned if one of the following occurs:


length is 0.
length is larger than
NLM_MAX_ADDRESS_LIST_SIZE(10)
bAppend is VARIANT_TRUE, but
including the number of
subscribed destinations in the
existing list with the value of
length exceeds
NLM_MAX_ADDRESS_SIZE.
A destination address in the
supplied list is invalid.

E_POINTER destIPAddrList is NULL.

HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) The request is not supported. This error


is returned if either an IPv4 or IPv6 stack
is not present on the local computer but
either an IPv4 or IPv6 address was
specified by destIPAddr.

HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED) This method was called after registering


for INetworkCostManagerEvents by
calling IConnectionPoint::Advise. See
Remark for more information.

Remarks
This method must be called before IConnectionPoint::Advise. Once
IConnectionPoint::Advise is called, this method will not complete successfully until last
sink calls IConnectionPoint::UnAdvise. However, this method can be called multiple
times prior to the call to IConnectionPoint::Advise.

If a list of destination addresses indicated by pDestIPAddrList contains duplicate


addresses, only one of each will be used to notify cost changes. Callers can clear a list of
destinations by calling this function with length set to 0, destIPAddrList set NULL, and
bAppend set FALSE.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows


Header netlistmgr.h

See also
IConnectionPoint::Advise

IConnectionPoint::UnAdvise

INetworkCostManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManagerEvents interface
(netlistmgr.h)
Article07/22/2021

Use this interface to notify an application of machine-wide cost and data plan related
events.

Inheritance
The INetworkCostManagerEvents interface inherits from the IUnknown interface.
INetworkCostManagerEvents also has these types of members:

Methods
The INetworkCostManagerEvents interface has these methods.

INetworkCostManagerEvents::CostChanged

CostChanged method is called to indicates a cost change for either machine-wide Internet
connectivity, or the first-hop of routing to a specific destination on a connection.

INetworkCostManagerEvents::DataPlanStatusChanged

DataPlanStatusChanged method is called to indicate a change to the status of a data plan


associated with either a connection used for machine-wide Internet connectivity, or the first-hop
of routing to a specific destination on a connection.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h
See also
IUnknown

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManagerEvents::CostChan
ged method (netlistmgr.h)
Article10/13/2021

The CostChanged method is called to indicates a cost change for either machine-wide
Internet connectivity, or the first-hop of routing to a specific destination on a
connection.

Syntax
C++

HRESULT CostChanged(
[in] DWORD newCost,
[in] NLM_SOCKADDR *pDestAddr
);

Parameters
[in] newCost

A DWORD that represents the new cost of the connection. The lowest 16 bits represent
the cost level, and the highest 16 bits represent the flags. Possible values are defined by
the NLM_CONNECTION_COST enumeration.

[in] pDestAddr

An NLM_SOCKADDR structure containing an IPv4/IPv6 address that identifies the


destination on which the event occurred. If destAddr is NULL, the change is a machine-
wide Internet connectivity change.

Return value
Returns S_OK on success.

Requirements
Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h

See also
INetworkCostManagerEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkCostManagerEvents::DataPlanS
tatusChanged method (netlistmgr.h)
Article06/24/2021

The DataPlanStatusChanged method is called to indicate a change to the status of a


data plan associated with either a connection used for machine-wide Internet
connectivity, or the first-hop of routing to a specific destination on a connection.

Syntax
C++

HRESULT DataPlanStatusChanged(
NLM_SOCKADDR *pDestAddr
);

Parameters
pDestAddr

An NLM_SOCKADDR structure containing an IPv4/IPv6 address that identifies the


destination for which the event occurred. If destAddr is NULL, the change is a machine-
wide Internet connectivity change.

Return value
Returns S_OK on success.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Target Platform Windows

Header netlistmgr.h
See also
INetworkCostManagerEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkEvents interface (netlistmgr.h)
Article07/27/2022

INetworkEvents is a notification sink interface that a client implements to get network


related events. These APIs are all callback functions that are called automatically when
the respective events are raised.

Inheritance
The INetworkEvents interface inherits from the IUnknown interface. INetworkEvents
also has these types of members:

Methods
The INetworkEvents interface has these methods.

INetworkEvents::NetworkAdded

The NetworkAdded method is called when a new network is added. The GUID of the new network
is provided.

INetworkEvents::NetworkConnectivityChanged

The NetworkConnectivityChanged method is called when network connectivity related changes


occur. (INetworkEvents.NetworkConnectivityChanged)

INetworkEvents::NetworkDeleted

The NetworkDeleted method is called when a network is deleted.

INetworkEvents::NetworkPropertyChanged

The NetworkPropertyChanged method is called when a network property change is detected.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkEvents::NetworkAdded method
(netlistmgr.h)
Article10/13/2021

The NetworkAdded method is called when a new network is added. The GUID of the
new network is provided.

Syntax
C++

HRESULT NetworkAdded(
[in] GUID networkId
);

Parameters
[in] networkId

A GUID that specifies the new network that was added.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkEvents::NetworkConnectivityCh
anged method (netlistmgr.h)
Article07/27/2022

The NetworkConnectivityChanged method is called when network connectivity related


changes occur.

Syntax
C++

HRESULT NetworkConnectivityChanged(
[in] GUID networkId,
[in] NLM_CONNECTIVITY newConnectivity
);

Parameters
[in] networkId

A GUID that specifies the new network that was added.

[in] newConnectivity

NLM_CONNECTIVITY enumeration value that contains the new connectivity of this


network.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows


Header netlistmgr.h

See also
INetworkEvents

NLM_CONNECTIVITY

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkEvents::NetworkDeleted
method (netlistmgr.h)
Article10/13/2021

The NetworkDeleted method is called when a network is deleted.

Syntax
C++

HRESULT NetworkDeleted(
[in] GUID networkId
);

Parameters
[in] networkId

GUID that contains the network ID of the network that was deleted.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkEvents
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkEvents::NetworkPropertyChang
ed method (netlistmgr.h)
Article10/13/2021

The NetworkPropertyChanged method is called when a network property change is


detected.

Syntax
C++

HRESULT NetworkPropertyChanged(
[in] GUID networkId,
[in] NLM_NETWORK_PROPERTY_CHANGE flags
);

Parameters
[in] networkId

GUID that specifies the network on which this event occurred.

[in] flags

NLM_NETWORK_PROPERTY_CHANGE enumeration value that specifies the network


property that changed.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows


Header netlistmgr.h

See also
INetworkEvents

NLM_NETWORK_PROPERTY_CHANGE

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager interface
(netlistmgr.h)
Article07/22/2021

The INetworkListManager interface provides a set of methods to perform network list


management functions.

Inheritance
The INetworkListManager interface inherits from the IDispatch interface.
INetworkListManager also has these types of members:

Methods
The INetworkListManager interface has these methods.

INetworkListManager::ClearSimulatedProfileInfo

Clears the connection profile values previously applied to the internet connection profile by
SetSimulatedProfileInfo. The next internet connection query, via GetInternetConnectionProfile, will
use system information.

INetworkListManager::get_IsConnected

The get_IsConnected property specifies if the local machine has network connectivity.

INetworkListManager::get_IsConnectedToInternet

The get_IsConnectedToInternet property specifies if the local machine has internet connectivity.

INetworkListManager::GetConnectivity

The GetConnectivity method returns the overall connectivity state of the machine.

INetworkListManager::GetNetwork

The GetNetwork method retrieves a network based on a supplied network ID.

INetworkListManager::GetNetworkConnection

The GetNetworkConnection method retrieves a network based on a supplied Network Connection


ID.
INetworkListManager::GetNetworkConnections

The GetNetworkConnections method enumerates a complete list of the network connections that
have been made.

INetworkListManager::GetNetworks

The GetNetworks method retrieves the list of networks available on the local machine.

INetworkListManager::SetSimulatedProfileInfo

The SetSimulatedProfileInfo method applies a specific set of connection profile values to the
internet connection profile in support of the simulation of specific metered internet connection
conditions.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::ClearSimulatedPr
ofileInfo method (netlistmgr.h)
Article06/29/2021

Clears the connection profile values previously applied to the internet connection profile
by SetSimulatedProfileInfo. The next internet connection query, via
GetInternetConnectionProfile, will use system information.

Syntax
C++

HRESULT ClearSimulatedProfileInfo();

Return value
Returns S_OK on success.

Requirements

Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

SetSimulatedProfileInfo

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::get_IsConnected
method (netlistmgr.h)
Article10/13/2021

The get_IsConnected property specifies if the local machine has network connectivity.

Syntax
C++

HRESULT get_IsConnected(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE , the network has at least local connectivity via ipv4 or ipv6 or both. The network
may also have internet connectivity. Thus, the network is connected.

If FALSE, the network does not have local or internet connectivity. The network is not
connected.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h
See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::get_IsConnectedT
oInternet method (netlistmgr.h)
Article10/13/2021

The get_IsConnectedToInternet property specifies if the local machine has internet


connectivity.

Syntax
C++

HRESULT get_IsConnectedToInternet(
[out] VARIANT_BOOL *pbIsConnected
);

Parameters
[out] pbIsConnected

If TRUE, the local machine is connected to the internet; if FALSE, it is not.

Return value
Returns S_OK if successful.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::GetConnectivity
method (netlistmgr.h)
Article10/13/2021

The GetConnectivity method returns the overall connectivity state of the machine.

Syntax
C++

HRESULT GetConnectivity(
[out] NLM_CONNECTIVITY *pConnectivity
);

Parameters
[out] pConnectivity

Pointer to an NLM_CONNECTIVITY enumeration value that contains a bitmask that


specifies the network connectivity of this machine.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::GetNetwork
method (netlistmgr.h)
Article10/13/2021

The GetNetwork method retrieves a network based on a supplied network ID.

Syntax
C++

HRESULT GetNetwork(
[in] GUID gdNetworkId,
[out] INetwork **ppNetwork
);

Parameters
[in] gdNetworkId

GUID that specifies the network ID.

[out] ppNetwork

Pointer to a pointer that receives the INetwork interface instance for this network.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The pointer passed is NULL.

E_UNEXPECTED The GUID is invalid.

Requirements
Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::GetNetworkConn
ection method (netlistmgr.h)
Article10/13/2021

The GetNetworkConnection method retrieves a network based on a supplied Network


Connection ID.

Syntax
C++

HRESULT GetNetworkConnection(
[in] GUID gdNetworkConnectionId,
[out, retval] INetworkConnection **ppNetworkConnection
);

Parameters
[in] gdNetworkConnectionId

A GUID that specifies the Network Connection ID.

[out, retval] ppNetworkConnection

Pointer to a pointer to the INetworkConnection object associated with the supplied


gdNetworkConnectionId.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

S_FALSE The network associated with the specified network


connection ID was not found.

E_POINTER The pointer passed is NULL.

E_UNEXPECTED The specified GUID is invalid.


Remarks
This method can return S_FALSE if a network connection associated with the specified ID
has been removed. For example, it is possible for a client to receive a
INetworkConnectionEvents::NetworkConnectionConnectivityChanged event along with a
network connection ID, but find that the network connection has been disconnected or
even replaced by the time INetworkListManager::GetNetworkConnection is called with
the provided ID.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkConnection

INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::GetNetworkConn
ections method (netlistmgr.h)
Article10/13/2021

The GetNetworkConnections method enumerates a complete list of the network


connections that have been made.

Syntax
C++

HRESULT GetNetworkConnections(
[out] IEnumNetworkConnections **ppEnum
);

Parameters
[out] ppEnum

Pointer to a pointer that receives an IEnumNetworkConnections interface instance that


enumerates all network connections on the machine.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The pointer passed is NULL.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::GetNetworks
method (netlistmgr.h)
Article10/13/2021

The GetNetworks method retrieves the list of networks available on the local machine.

Syntax
C++

HRESULT GetNetworks(
[in] NLM_ENUM_NETWORK Flags,
[out] IEnumNetworks **ppEnumNetwork
);

Parameters
[in] Flags

NLM_ENUM_NETWORK enumeration value that specifies the flags for the network
(specifically, connected or not connected).

[out] ppEnumNetwork

Pointer to a pointer that receives an IEnumNetworks interface instance that contains the
enumerator for the list of available networks.

Return value
Returns S_OK if the method succeeds. Otherwise, the method returns one of the
following values.

Return code Description

E_POINTER The pointer passed is NULL.

E_UNEXPECTED The GUID is invalid.

Requirements
Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManager

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManager::SetSimulatedProf
ileInfo method (netlistmgr.h)
Article06/24/2021

The SetSimulatedProfileInfo method applies a specific set of connection profile values


to the internet connection profile in support of the simulation of specific metered
internet connection conditions.

The simulation only applies in an RDP Child Session and does not affect the primary user
session. The simulated internet connection profile is returned via the Windows Runtime
API GetInternetConnectionProfile.

Syntax
C++

HRESULT SetSimulatedProfileInfo(
NLM_SIMULATED_PROFILE_INFO *pSimulatedInfo
);

Parameters
pSimulatedInfo

Specific connection profile values to simulate on the current internet connection profile
when calling GetInternetConnectionProfile from an RDP Child Session

Return value
Returns S_OK on success.

Requirements

Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]


Target Platform Windows

Header netlistmgr.h

See also
Child Sessions (Windows)

ClearSimulatedProfileInfo

INetworkListManager

NLM_SIMULATED_PROFILE_INFO

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManagerEvents interface
(netlistmgr.h)
Article07/27/2022

INetworkListManagerEvents is a message sink interface that a client implements to get


overall machine state related events. Applications that are interested on higher-level
events, for example internet connectivity, implement this interface.

Inheritance
The INetworkListManagerEvents interface inherits from the IUnknown interface.
INetworkListManagerEvents also has these types of members:

Methods
The INetworkListManagerEvents interface has these methods.

INetworkListManagerEvents::ConnectivityChanged

The NetworkConnectivityChanged method is called when network connectivity related changes


occur. (INetworkListManagerEvents.ConnectivityChanged)

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
NLM_CONNECTIVITY
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


INetworkListManagerEvents::Connectivit
yChanged method (netlistmgr.h)
Article07/27/2022

The NetworkConnectivityChanged method is called when network connectivity related


changes occur.

Syntax
C++

HRESULT ConnectivityChanged(
[in] NLM_CONNECTIVITY newConnectivity
);

Parameters
[in] newConnectivity

An NLM_CONNECTIVITY enumeration value that contains the new connectivity settings


of the machine.

Return value
Returns S_OK if the method succeeds.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header netlistmgr.h

See also
INetworkListManagerEvents

NLM_CONNECTIVITY

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_CONNECTION_COST enumeration
(netlistmgr.h)
Article01/31/2022

The NLM_CONNECTION_COST enumeration specifies a set of cost levels and cost flags
supported in Windows 8 Cost APIs.

Syntax
C++

typedef enum NLM_CONNECTION_COST {


NLM_CONNECTION_COST_UNKNOWN = 0,
NLM_CONNECTION_COST_UNRESTRICTED = 0x1,
NLM_CONNECTION_COST_FIXED = 0x2,
NLM_CONNECTION_COST_VARIABLE = 0x4,
NLM_CONNECTION_COST_OVERDATALIMIT = 0x10000,
NLM_CONNECTION_COST_CONGESTED = 0x20000,
NLM_CONNECTION_COST_ROAMING = 0x40000,
NLM_CONNECTION_COST_APPROACHINGDATALIMIT = 0x80000
} ;

Constants

NLM_CONNECTION_COST_UNKNOWN
Value: 0
The cost is unknown.

NLM_CONNECTION_COST_UNRESTRICTED
Value: 0x1
The connection is unlimited and is considered to be unrestricted of usage charges and capacity
constraints.

NLM_CONNECTION_COST_FIXED
Value: 0x2
The use of this connection is unrestricted up to a specific data transfer limit.

NLM_CONNECTION_COST_VARIABLE
Value: 0x4
This connection is regulated on a per byte basis.
NLM_CONNECTION_COST_OVERDATALIMIT
Value: 0x10000
The connection is currently in an OverDataLimit state as it has exceeded the carrier specified data
transfer limit.

NLM_CONNECTION_COST_CONGESTED
Value: 0x20000
The network is experiencing high traffic load and is congested.

NLM_CONNECTION_COST_ROAMING
Value: 0x40000
The connection is roaming outside the network and affiliates of the home provider.

NLM_CONNECTION_COST_APPROACHINGDATALIMIT
Value: 0x80000
The connection is approaching the data limit specified by the carrier.

Remarks
The value returned by the INetworkConnectionCost::GetCost method can have multiple
bits set with the values specified by this enumeration.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server None supported

Header netlistmgr.h

See also
INetworkConnectionCost::GetCost

Feedback
Was this page helpful? ツ Yes ト No
Get help at Microsoft Q&A
NLM_CONNECTION_PROPERTY_CHANG
E enumeration (netlistmgr.h)
Article01/31/2022

The NLM_CONNECTION PROPERTY_CHANGE enumeration is a set of flags that define


changes made to the properties of a network connection.

Syntax
C++

typedef enum NLM_CONNECTION_PROPERTY_CHANGE {


NLM_CONNECTION_PROPERTY_CHANGE_AUTHENTICATION = 0x1
} ;

Constants

NLM_CONNECTION_PROPERTY_CHANGE_AUTHENTICATION
Value: 0x1
The Authentication (Domain Type) of this Network Connection has changed.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_CONNECTIVITY enumeration
(netlistmgr.h)
Article01/31/2022

The NLM_Connectivity enumeration is a set of flags that provide notification whenever


connectivity related parameters have changed.

Syntax
C++

typedef enum NLM_CONNECTIVITY {


NLM_CONNECTIVITY_DISCONNECTED = 0,
NLM_CONNECTIVITY_IPV4_NOTRAFFIC = 0x1,
NLM_CONNECTIVITY_IPV6_NOTRAFFIC = 0x2,
NLM_CONNECTIVITY_IPV4_SUBNET = 0x10,
NLM_CONNECTIVITY_IPV4_LOCALNETWORK = 0x20,
NLM_CONNECTIVITY_IPV4_INTERNET = 0x40,
NLM_CONNECTIVITY_IPV6_SUBNET = 0x100,
NLM_CONNECTIVITY_IPV6_LOCALNETWORK = 0x200,
NLM_CONNECTIVITY_IPV6_INTERNET = 0x400
} ;

Constants

NLM_CONNECTIVITY_DISCONNECTED
Value: 0
The underlying network interfaces have no connectivity to any network.

NLM_CONNECTIVITY_IPV4_NOTRAFFIC
Value: 0x1
There is connectivity to a network, but the service cannot detect any IPv4 Network Traffic.

NLM_CONNECTIVITY_IPV6_NOTRAFFIC
Value: 0x2
There is connectivity to a network, but the service cannot detect any IPv6 Network Traffic.

NLM_CONNECTIVITY_IPV4_SUBNET
Value: 0x10
There is connectivity to the local subnet using the IPv4 protocol.
NLM_CONNECTIVITY_IPV4_LOCALNETWORK
Value: 0x20
There is connectivity to a routed network using the IPv4 protocol.

NLM_CONNECTIVITY_IPV4_INTERNET
Value: 0x40
There is connectivity to the Internet using the IPv4 protocol.

NLM_CONNECTIVITY_IPV6_SUBNET
Value: 0x100
There is connectivity to the local subnet using the IPv6 protocol.

NLM_CONNECTIVITY_IPV6_LOCALNETWORK
Value: 0x200
There is connectivity to a local network using the IPv6 protocol.

NLM_CONNECTIVITY_IPV6_INTERNET
Value: 0x400
There is connectivity to the Internet using the IPv6 protocol.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_DATAPLAN_STATUS structure
(netlistmgr.h)
Article06/24/2021

The NLM_DATAPLAN_STATUS structure stores the current data plan status information
supplied by the carrier.

Syntax
C++

typedef struct NLM_DATAPLAN_STATUS {


GUID InterfaceGuid;
NLM_USAGE_DATA UsageData;
DWORD DataLimitInMegabytes;
DWORD InboundBandwidthInKbps;
DWORD OutboundBandwidthInKbps;
FILETIME NextBillingCycle;
DWORD MaxTransferSizeInMegabytes;
DWORD Reserved;
} NLM_DATAPLAN_STATUS;

Members
InterfaceGuid

The unique ID of the interface associated with the data plan. This GUID is determined by
the system when a data plan is first used by a system connection.

UsageData

An NLM_USAGE_DATA structure containing current data usage value expressed in


megabytes, as well as the system time at the moment this value was last synced.

If this value is not supplied, NLM_USAGE_DATA will indicate


NLM_UNKNOWN_DATAPLAN_STATUS for UsageInMegabytes and a value of '0' will be
set for LastSyncTime.

DataLimitInMegabytes

The data plan usage limit expressed in megabytes. If this value is not supplied, a default
value of NLM_UNKNOWN_DATAPLAN_STATUS is set.
InboundBandwidthInKbps

The maximum inbound connection bandwidth expressed in kbps. If this value is not
supplied, a default value of NLM_UNKNOWN_DATAPLAN_STATUS is set.

OutboundBandwidthInKbps

The maximum outbound connection bandwidth expressed in kbps. If this value is not
supplied, a default value of NLM_UNKNOWN_DATAPLAN_STATUS is set.

NextBillingCycle

The start time of the next billing cycle. If this value is not supplied, a default value of '0'
is set.

MaxTransferSizeInMegabytes

The maximum suggested transfer size for this network expressed in megabytes. If this
value is not supplied, a default value of NLM_UNKNOWN_DATAPLAN_STATUS is set.

Reserved

Reserved for future use.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]

Header netlistmgr.h

See also
INetworkConnectionCost::GetDataPlanStatus

INetworkCostManagerEvents::DataPlanStatusChanged

NLM_USAGE_DATA

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_DOMAIN_AUTHENTICATION_KIND
enumeration (netlistmgr.h)
Article05/24/2022

Defines constants that specify a domain authentication method.

Only one of the listed constants is set for any instance of DomainAuthenticationKind. In
some scenarios, the constant set will represent the most preferred protocol used to
determine whether the domain was authenticated.

Syntax
C++

typedef enum NLM_DOMAIN_AUTHENTICATION_KIND {


NLM_DOMAIN_AUTHENTICATION_KIND_NONE,
NLM_DOMAIN_AUTHENTICATION_KIND_LDAP,
NLM_DOMAIN_AUTHENTICATION_KIND_TLS
} ;

Constants

NLM_DOMAIN_AUTHENTICATION_KIND_NONE
Specifies no domain authentication method; and/or that the network couldn't be domain-
authenticated.

NLM_DOMAIN_AUTHENTICATION_KIND_LDAP
Specifies the domain authentication method for an Active Directory network; and/or that the
machine was successful in a Lightweight Directory Access Protocol (LDAP) authentication request
against the configured Active Directory servers on the current network.

NLM_DOMAIN_AUTHENTICATION_KIND_TLS
Specifies the Transport Layer Security (TLS) domain authentication method; and/or that the
network connection was able to successfully complete a HTTPS connection with verified TLS
authentication to an endpoint configured by the AllowedTlsAuthenticationEndpoints Mobile
Device Management (MDM) policy.

Requirements
Minimum supported client Windows 11 Build 22621

Header netlistmgr.h

See also
INetwork2::IsDomainAuthenticatedBy method
INetworkConnection2::IsDomainAuthenticatedBy method

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_DOMAIN_TYPE enumeration
(netlistmgr.h)
Article01/31/2022

The NLM_DOMAIN_TYPE enumeration is a set of flags that specify the domain type of a
network.

Syntax
C++

typedef enum NLM_DOMAIN_TYPE {


NLM_DOMAIN_TYPE_NON_DOMAIN_NETWORK = 0,
NLM_DOMAIN_TYPE_DOMAIN_NETWORK = 0x1,
NLM_DOMAIN_TYPE_DOMAIN_AUTHENTICATED = 0x2
} ;

Constants

NLM_DOMAIN_TYPE_NON_DOMAIN_NETWORK
Value: 0
The Network is not an Active Directory Network.

NLM_DOMAIN_TYPE_DOMAIN_NETWORK
Value: 0x1
The Network is an Active Directory Network, but this machine is not authenticated against it.

NLM_DOMAIN_TYPE_DOMAIN_AUTHENTICATED
Value: 0x2
The Network is an Active Directory Network, and this machine is authenticated against it.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_ENUM_NETWORK enumeration
(netlistmgr.h)
Article01/31/2022

The NLM_ENUM_NETWORK enumeration contains a set of flags that specify what types
of networks are enumerated.

Syntax
C++

typedef enum NLM_ENUM_NETWORK {


NLM_ENUM_NETWORK_CONNECTED = 0x1,
NLM_ENUM_NETWORK_DISCONNECTED = 0x2,
NLM_ENUM_NETWORK_ALL = 0x3
} ;

Constants

NLM_ENUM_NETWORK_CONNECTED
Value: 0x1
Returns connected networks

NLM_ENUM_NETWORK_DISCONNECTED
Value: 0x2
Returns disconnected networks

NLM_ENUM_NETWORK_ALL
Value: 0x3
Returns connected and disconnected networks

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_INTERNET_CONNECTIVITY
enumeration (netlistmgr.h)
Article01/31/2022

The NLM_INTERNET_CONNECTIVITY enumeration defines a set of flags that provide


additional data for IPv4 or IPv6 network connectivity.

Syntax
C++

typedef enum NLM_INTERNET_CONNECTIVITY {


NLM_INTERNET_CONNECTIVITY_WEBHIJACK = 0x1,
NLM_INTERNET_CONNECTIVITY_PROXIED = 0x2,
NLM_INTERNET_CONNECTIVITY_CORPORATE = 0x4
} ;

Constants

NLM_INTERNET_CONNECTIVITY_WEBHIJACK
Value: 0x1
Indicates that the detected network is a hotspot. For example, when connected to a coffee Wi-Fi
hotspot network and the local HTTP traffic is being redirected to a captive portal, this flag will be
set.

NLM_INTERNET_CONNECTIVITY_PROXIED
Value: 0x2
Indicates that the detected network has a proxy configuration. For example, when connected to a
corporate network using a proxy for HTTP access, this flag will be set.

NLM_INTERNET_CONNECTIVITY_CORPORATE
Value: 0x4
Indicates that the machine is configured for Direct Access and that access to the corporate
domain network, for which Direct Access was previously configured, has been detected.

Remarks
These connectivity flags can be retrieved by querying for the NA_InternetConnectivityV4
or NA_InternetConnectivityV6 properties using the IPropertyBag interface for an
INetwork or INetworkConnection interface.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Header netlistmgr.h

See also
INetwork

INetworkConnection

IPropertyBag

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_NETWORK_CATEGORY
enumeration (netlistmgr.h)
Article01/31/2022

The NLM_NETWORK_CATEGORY enumeration is a set of flags that specify the category


type of a network.

Syntax
C++

typedef enum NLM_NETWORK_CATEGORY {


NLM_NETWORK_CATEGORY_PUBLIC = 0,
NLM_NETWORK_CATEGORY_PRIVATE = 0x1,
NLM_NETWORK_CATEGORY_DOMAIN_AUTHENTICATED = 0x2
} ;

Constants

NLM_NETWORK_CATEGORY_PUBLIC
Value: 0
The network is a public (untrusted) network.

NLM_NETWORK_CATEGORY_PRIVATE
Value: 0x1
The network is a private (trusted) network.

NLM_NETWORK_CATEGORY_DOMAIN_AUTHENTICATED
Value: 0x2
The network is authenticated against an Active Directory domain.

Remarks
The private or public network categories must never be used to assume which Windows
Firewall ports are open, as the user can change the default settings of these categories.
Instead, Firewall APIs should be called to ensure the ports that the required ports are
open.
Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_NETWORK_CLASS enumeration
(netlistmgr.h)
Article01/31/2022

The NLM_NETWORK_CLASS enumeration defines a set of flags that specify if a network


has been identified.

Syntax
C++

typedef enum NLM_NETWORK_CLASS {


NLM_NETWORK_IDENTIFYING = 0x1,
NLM_NETWORK_IDENTIFIED = 0x2,
NLM_NETWORK_UNIDENTIFIED = 0x3
} ;

Constants

NLM_NETWORK_IDENTIFYING
Value: 0x1
The network is being identified.

NLM_NETWORK_IDENTIFIED
Value: 0x2
The network has been identified.

NLM_NETWORK_UNIDENTIFIED
Value: 0x3
The network has not been identified.

Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]


Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_NETWORK_PROPERTY_CHANGE
enumeration (netlistmgr.h)
Article01/31/2022

The NLM_NETWORK_PROPERTY_CHANGE enumeration is a set of flags that define


changes made to the properties of a network.

Syntax
C++

typedef enum NLM_NETWORK_PROPERTY_CHANGE {


NLM_NETWORK_PROPERTY_CHANGE_CONNECTION = 0x1,
NLM_NETWORK_PROPERTY_CHANGE_DESCRIPTION = 0x2,
NLM_NETWORK_PROPERTY_CHANGE_NAME = 0x4,
NLM_NETWORK_PROPERTY_CHANGE_ICON = 0x8,
NLM_NETWORK_PROPERTY_CHANGE_CATEGORY_VALUE = 0x10
} ;

Constants

NLM_NETWORK_PROPERTY_CHANGE_CONNECTION
Value: 0x1
A connection to this network has been added or removed.

NLM_NETWORK_PROPERTY_CHANGE_DESCRIPTION
Value: 0x2
The description of the network has changed.

NLM_NETWORK_PROPERTY_CHANGE_NAME
Value: 0x4
The name of the network has changed.

NLM_NETWORK_PROPERTY_CHANGE_ICON
Value: 0x8

NLM_NETWORK_PROPERTY_CHANGE_CATEGORY_VALUE
Value: 0x10
The category of the network has changed.
Requirements

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Header netlistmgr.h

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_SIMULATED_PROFILE_INFO
structure (netlistmgr.h)
Article09/01/2022

Used to specify values that are used by SetSimulatedProfileInfo to override current


internet connection profile values in an RDP Child Session to support the simulation of
specific metered internet connection conditions.

Syntax
C++

typedef struct NLM_SIMULATED_PROFILE_INFO {


WCHAR ProfileName[256];
NLM_CONNECTION_COST cost;
DWORD UsageInMegabytes;
DWORD DataLimitInMegabytes;
} NLM_SIMULATED_PROFILE_INFO;

Members
ProfileName[256]

Name for the simulated profile.

cost

The network cost. Possible values are defined by NLM_CONNECTION_COST.

UsageInMegabytes

The data usage.

DataLimitInMegabytes

The data limit of the plan.

Requirements
Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]

Header netlistmgr.h

See also
Child Sessions (Windows)

ClearSimulatedProfileInfo

SetSimulatedProfileInfo

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_SOCKADDR structure
(netlistmgr.h)
Article09/01/2022

The NLM_SOCKADDR structure contains the IPv4/IPv6 destination address.

Syntax
C++

typedef struct NLM_SOCKADDR {


BYTE data[128];
} NLM_SOCKADDR;

Members
data[128]

An IPv4/IPv6 destination address.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]

Header netlistmgr.h

See also
INetworkCostManager

INetworkCostManagerEvents

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NLM_USAGE_DATA structure
(netlistmgr.h)
Article08/03/2021

The NLM_USAGE_DATA structure stores information that indicates the data usage of a
plan.

Syntax
C++

typedef struct NLM_USAGE_DATA {


DWORD UsageInMegabytes;
FILETIME LastSyncTime;
} NLM_USAGE_DATA;

Members
UsageInMegabytes

The data usage of a plan, represented in megabytes.

LastSyncTime

The timestamp of last time synced with carriers about the data usage stored in this
structure.

Remarks
If usage is not supplied, UsageInMegabytes is set to
NLM_UNKNOWN_DATAPLAN_STATUS (0xFFFFFFFF), and LastSyncTime is set to 0.

Requirements

Minimum supported client Windows 8 [desktop apps only]

Minimum supported server Windows Server 2012 [desktop apps only]


Header netlistmgr.h

See also
INetworkCostManager::GetDataPlanStatus

NLM_DATAPLAN_STATUS

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


ondemandconnroutehelper.h header
Article01/24/2023

This header is used by Network List Manager. For more information, see:

Network List Manager

ondemandconnroutehelper.h contains the following programming interfaces:

Functions

FreeInterfaceContextTable

This function frees the interface context table retrieved using the
GetInterfaceContextTableForHostName function.

GetInterfaceContextTableForHostName

This function retrieves an interface context table for the given hostname and connection profile
filter.

OnDemandGetRoutingHint

The OnDemandGetRoutingHint function looks up a destination in the Route Request cache and, if
a match is found, return the corresponding Interface ID.

OnDemandRegisterNotification

The OnDemandRegisterNotification function allows an application to register to be notified when


the Route Requests cache is modified.

OnDemandUnRegisterNotification

The OnDemandUnregisterNotification function allows an application to unregister for notifications


and clean up resources.

Structures

NET_INTERFACE_CONTEXT

The interface context that is part of the NET_INTERFACE_CONTEXT_TABLE structure.


NET_INTERFACE_CONTEXT_TABLE

The table of NET_INTERFACE_CONTEXT structures.

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


FreeInterfaceContextTable function
(ondemandconnroutehelper.h)
Article10/13/2021

This function frees the interface context table retrieved using the
GetInterfaceContextTableForHostName function.

Syntax
C++

void FreeInterfaceContextTable(
[in] NET_INTERFACE_CONTEXT_TABLE *InterfaceContextTable
);

Parameters
[in] InterfaceContextTable

The interface context table retrieved using the GetInterfaceContextTableForHostName


function.

Return value
None

Requirements

Minimum supported client Windows 10 [desktop apps only]

Minimum supported server Windows Server 2016 [desktop apps only]

Target Platform Windows

Header ondemandconnroutehelper.h

Library OnDemandConnRouteHelper.lib
DLL OnDemandConnRouteHelper.dll

See also
GetInterfaceContextTableForHostName

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


GetInterfaceContextTableForHostName
function (ondemandconnroutehelper.h)
Article10/13/2021

This function retrieves an interface context table for the given hostname and connection
profile filter.

Syntax
C++

HRESULT GetInterfaceContextTableForHostName(
[in, optional] PCWSTR HostName,
[in, optional] PCWSTR ProxyName,
[in] DWORD Flags,
[in, optional] BYTE
*ConnectionProfileFilterRawData,
[in] DWORD
ConnectionProfileFilterRawDataSize,
[out] NET_INTERFACE_CONTEXT_TABLE **InterfaceContextTable
);

Parameters
[in, optional] HostName

The destination hostname.

[in, optional] ProxyName

The HTTP proxy name.

[in] Flags

You can use the following flags.

Flag Description

NET_INTERFACE_FLAG_NONE Use the default behavior.

NET_INTERFACE_FLAG_CONNECT_IF_NEEDED Indicates whether the underlying connection


should be activated or not.
[in, optional] ConnectionProfileFilterRawData

The connection profile filter blog which is a byte cast of wcm_selection_filters.

[in] ConnectionProfileFilterRawDataSize

The size of the ConnectionProfileFilterRawData in bytes.

[out] InterfaceContextTable

This is set to the list of NET_INTERFACE_CONTEXT structures containing the interface


indices and configuration names that can be used for the hostname and filter.

Return value
This function returns the following HRESULT values depending on the status.

HRESULT Description

S_OK This is returned if a connection that satisfies the parameters and internal
policies exists. NET_INTERFACE_CONTEXT_TABLE will contain a list of
interfaces indices and configuration names of those connections. When
S_OK is returned, FreeInterfaceContextTable should be called to release the
context table.

S_FALSE This is returned to indicate that any connection or default interface can be
used for this hostname and filter. The NET_INTERFACE_CONTEXT_TABLE will
be null in this case because the caller can use the default route to satisfy the
requirements.

E_NOTFOUND This is returned if no connection is currently available or existing connection


don't meet the connection filter and the internal policy for the host. The
exact return code would be HRESULT(ERROR_NOT_FOUND)

E_INVALIDARG This is returned if the caller passes an invalid argument, uses an


unsupported flag, has a bad connection filter data, incorrect size or null
NET_INTERFACE_CONTEXT_TABLE

E_OUTOFMEMORY This is returned if there is not enough memory to complete the operation.

FAILED(HRESULT) This is returned because of failures that are outside the control of this
function.

Requirements
Minimum supported client Windows 10 [desktop apps only]

Minimum supported server Windows Server 2016 [desktop apps only]

Target Platform Windows

Header ondemandconnroutehelper.h

Library OnDemandConnRouteHelper.lib

DLL OnDemandConnRouteHelper.dll

See also
FreeInterfaceContextTable

NET_INTERFACE_CONTEXT_TABLE

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NET_INTERFACE_CONTEXT structure
(ondemandconnroutehelper.h)
Article10/05/2021

The interface context that is part of the NET_INTERFACE_CONTEXT_TABLE structure.

Syntax
C++

typedef struct _NET_INTERFACE_CONTEXT {


ULONG InterfaceIndex;
LPWSTR ConfigurationName;
} NET_INTERFACE_CONTEXT;

Members
InterfaceIndex

The interface index.

ConfigurationName

The configuration name.

Requirements

Minimum supported client Windows 10 [desktop apps only]

Minimum supported server Windows Server 2016 [desktop apps only]

Header ondemandconnroutehelper.h

See also
GetInterfaceContextTableForHostName

NET_INTERFACE_CONTEXT_TABLE
Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


NET_INTERFACE_CONTEXT_TABLE
structure (ondemandconnroutehelper.h)
Article10/05/2021

The table of NET_INTERFACE_CONTEXT structures.

Syntax
C++

typedef struct _NET_INTERFACE_CONTEXT_TABLE {


HANDLE InterfaceContextHandle;
UINT NumberOfEntries;
NET_INTERFACE_CONTEXT *InterfaceContextArray;
} NET_INTERFACE_CONTEXT_TABLE;

Members
InterfaceContextHandle

A handle to the interface context.

NumberOfEntries

The number of entries in the table.

InterfaceContextArray

An array of NET_INTERFACE_CONTEXT structures.

Requirements

Minimum supported client Windows 10 [desktop apps only]

Minimum supported server Windows Server 2016 [desktop apps only]

Header ondemandconnroutehelper.h
See also
GetInterfaceContextTableForHostName

NET_INTERFACE_CONTEXT

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


OnDemandGetRoutingHint function
(ondemandconnroutehelper.h)
Article10/13/2021

The OnDemandGetRoutingHint function looks up a destination in the Route Request


cache and, if a match is found, return the corresponding Interface ID.

Syntax
C++

HRESULT OnDemandGetRoutingHint(
[in] PCWSTR destinationHostName,
[out] DWORD *interfaceIndex
);

Parameters
[in] destinationHostName

An PWSTR describing the target host name for a network communication.

[out] interfaceIndex

The interface index of the network adapter to be used for communicating with the
target host.

Return value
This function returns the following to indicate operation results:

Return code Description

S_OK A match was found in the dll cache. The


pdwInterfaceIndex will contain the index of the interface
to be used to communicate with the target host.

S_FALSE A match was not found in the dll cache for the specified
host name.
Requirements

Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]

Target Platform Windows

Header ondemandconnroutehelper.h

Library OnDemandConnRouteHelper.lib

DLL OnDemandConnRouteHelper.dll

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


OnDemandRegisterNotification function
(ondemandconnroutehelper.h)
Article10/13/2021

The OnDemandRegisterNotification function allows an application to register to be


notified when the Route Requests cache is modified. For example, this allows the system
to recycle cached connections when a Route Request is added or removed from the
cache.

Syntax
C++

HRESULT OnDemandRegisterNotification(
[in] ONDEMAND_NOTIFICATION_CALLBACK callback,
[in, optional] void *callbackContext,
[out] HANDLE *registrationHandle
);

Parameters
[in] callback

A pointer to a function of type ONDEMAND_NOTIFICATION_CALLBACK to receive the


notifications.

[in, optional] callbackContext

A pointer to a memory location containing optional context to be passed to the


callback.

[out] registrationHandle

A pointer to a HANDLE to receive a handle to the registration in case of success.

Return value
Returns S_OK on success.
Remarks
The ONDEMAND_NOTIFICATION_CALLBACK function is defined as:

syntax

typedef void (WINAPI *ONDEMAND_NOTIFICATION_CALLBACK) (PVOID);

Requirements

Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]

Target Platform Windows

Header ondemandconnroutehelper.h

Library OnDemandConnRouteHelper.lib

DLL OnDemandConnRouteHelper.dll

See also
OnDemandUnregisterNotification

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A


OnDemandUnRegisterNotification
function (ondemandconnroutehelper.h)
Article10/13/2021

The OnDemandUnregisterNotification function allows an application to unregister for


notifications and clean up resources.

Syntax
C++

HRESULT OnDemandUnRegisterNotification(
[in] HANDLE registrationHandle
);

Parameters
[in] registrationHandle

A HANDLE obtained from a successful OnDemandRegisterNotification call.

Return value
Returns S_OK on success.

Requirements

Minimum supported client Windows 8.1 [desktop apps only]

Minimum supported server Windows Server 2012 R2 [desktop apps only]

Target Platform Windows

Header ondemandconnroutehelper.h

Library OnDemandConnRouteHelper.lib

DLL OnDemandConnRouteHelper.dll
See also
OnDemandRegisterNotification

Feedback
Was this page helpful? ツ Yes ト No

Get help at Microsoft Q&A

You might also like