4.6 Creating a Zone Scope

The following example specifies how to create a new zone scope named "example_americas" in example.com created in section 4.3. This operation is allowed on both file-backed and Active Directory integrated zones.

The client calls R_DnssrvOperation2 (section 3.1.4.6) 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 is to be created.

  • "example.com" as the zone name.

  • Zero as the context.

  • CreateZonescope as the operation.

  • DNSSRV_TYPEID_ZONE_SCOPE_CREATE as the type ID.

  • Create a DNS_RPC_ZONE_SCOPE_CREATE_INFO_V1 (section 2.2.13.1.2.1) structure with dwFlags as zero and pwszScopeName as "example_americas". Pass this structure as RPC data.

The DNS server returns ERROR_SUCCESS if the operation was successful or a Windows error code if the operation fails.