Edit

GetInterfaceContextTableForHostName function (ondemandconnroutehelper.h)

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

Syntax

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

Requirement Value
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