4.8 Enumerating Zone Scopes

The following example specifies how to enumerate all zone scopes on a zone example.com on the DNS server.

The client calls R_DnssrvComplexOperation2 (section 3.1.4.8) and provides the following parameters:

  • DNS_RPC_CURRENT_CLIENT_VER (section 2.2.1.2.1) as the client version.

  • Zero as the settings flag.

  • A Unicode string containing the FQDN of the DNS server on which the zone scopes are to be enumerated.

  • "example.com" as the zone name.

  • Zero as the context.

  • EnumZonescopes as the operation.

  • DNSSRV_TYPEID_NULL as the input type ID.

  • NULL as the input RPC data.

  • A pointer to a DWORD where the DNS RPC type of the output data will be stored.

  • A pointer to a DNSSRV_RPC_UNION structure where the results of the RPC operation will be stored.

The DNS server returns ERROR_SUCCESS if the operation is successful or a Windows error code if the operation fails. If the operation is successful, the output type ID will be set to DNSSRV_TYPEID_ZONE_SCOPE_ENUM and the ZonescopeList member of the output DNSSRV_RPC_UNION structure will be set to the zone scope enumeration results. The client can iterate the elements of ZonescopeList.ZoneArray in the union to examine the zones returned by the enumeration.

After the client is finished with the zone scope enumeration result, it calls MIDL_user_free on each pointer in the ZonescopeList.ZonescopeArray.