GetTenantRestrictionsHostnames function

The GetTenantRestrictionsHostnames function returns a list of hostnames (e.g. foo.ca) and subdomainSupportedHostnames (e.g. .bar.ca) to the caller. This list is kept in sync by Windows and is used by apps to apply Tenant Restrictions to those endpoints.

Syntax

STDAPI GetTenantRestrictionsHostnames(
  _Out_  LPWSTR**  hostnames,
  _Out_  UINT32*   hostnameCount,
  _Out_  LPWSTR**  subdomainSupportedHostnames,
  _Out_  UINT32*   subdomainSupportedHostnameCount
);

Parameters

hostnames [out]

hostnames contains names that must match exactly. For example, if foo.ca is in the list, then foo.ca should be subject to Tenant Restrictions, but bar.foo.ca should not.

hostnameCount [out]

The hostnameCount parameter contains the number of hostnames in the hostnames array.

subdomainSupportedHostnames [out]

subdomainSupportedHostnames contains names that allow for subdomains, e.g. if .bar.ca is in the list, sub.bar.ca should be subject to Tenant Restrictions but bar.ca should not. These entries are expected to have a preceding . to facilitate matching.

subdomainSupportedHostnameCount [out]

The subdomainSupportedHostnameCount parameter contains the number of hostnames in the subdomainSupportedHostnames array.

Return value

If the function succeeds, the function returns S_OK.

Remarks

Callers should iteratively free array entries using CoTaskMemFree and then free the array itself.

Regarding empty arrays:

  • It is valid (though not expected in practice) for both lists to be empty.
  • It is valid for one list to contain entries while the other does not.

In either case, de-allocating an empty list is not needed. No de-allocation is needed if the return value is not S_OK.

The function does not return success values other than S_OK.

This function has no associated import library or header file; you must call it using the LoadLibrary and GetProcAddress functions.

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004 [desktop apps only]
Minimum supported server Windows Server, version 2004 [desktop apps only]
DLL TenantRestrictionsPlugin.dll