4.21 Creating a Zone in a Virtualization Instance

The following example describes how to create a new zone "example.com" under a virtualization instance named "example_vi1" in the DNS server.

The client calls R_DnssrvOperation4 (section 3.1.4.16) 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.

  • A Unicode string containing the name of the virtualization instance under which the zone is to be created, in pwszVirtualizationInstanceID. In the example, this contains "example_vi1".

  • Zero as the context.

  • ZoneCreate as the operation.

  • DNSSRV_TYPEID_ZONE_CREATE as the type ID.

  • Create a DNS_RPC_ZONE_CREATE_INFO (section 2.2.5.2.7) structure with pszZoneName as "example.com". Pass this structure as RPC data. You can create only file-backed Primary Zones under a virtualization instance.

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