/// <summary>The SPN format for the distinguished name service of the host-based service, which provides services identified with its host computer. This SPN uses the following format:
/// <summary>The SPN format for the distinguished name of the host-based service, which provides services identified with its host computer. This SPN uses the following format:
/// <summary>The SPN format for the NetBIOS service of the host-based service, which provides services identified with its host computer. This SPN uses the following format:
/// <summary>In the event of a non-fatal error, returns server distinguished names (DN) instead of their GUID DNS names.</summary>
DS_REPSYNCALL_ID_SERVERS_BY_DN=0x00000004,
/// <summary>
/// Disables all synchronization. The topology is still analyzed, and unavailable or unreachable servers are still identified.
/// </summary>
DS_REPSYNCALL_DO_NOT_SYNC=0x00000008,
/// <summary>
/// Assumes that all servers are responding. This speeds operation of the DsReplicaSyncAll function, but if some servers are not
/// responding, some transitive replications may be blocked.
/// </summary>
DS_REPSYNCALL_SKIP_INITIAL_CHECK=0x00000010,
/// <summary>
/// Pushes changes from the home server out to all partners using transitive replication. This reverses the direction of
/// replication, and the order of execution of the replication sets from the usual "pulling" mode of execution.
/// </summary>
DS_REPSYNCALL_PUSH_CHANGES_OUTWARD=0x00000020,
/// <summary>
/// Synchronizes across site boundaries. By default, DsReplicaSyncAll attempts to synchronize only with DCs in the same site as
/// the home system. Set this flag to attempt to synchronize with all DCs in the enterprise forest. However, the DCs can be
/// synchronized only if connected by a synchronous (RPC) transport.
/// </summary>
DS_REPSYNCALL_CROSS_SITE_BOUNDARIES=0x00000040,
}
/// <summary>These flag values are used both as input to DsReplicaSync and as output from DsReplicaGetInfo, PENDING_OPS, DS_REPL_OPW.ulOptions</summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="Flags">Reserved for future use. Set to <c>NULL</c>.</param>
/// <param name="SrcDomain"><para>Pointer to a null-terminated string that specifies the name of the domain to query for the SID of SrcPrincipal.</para>
/// If the source domain runs on Windows Server operating systems, SrcDomain can be either a domain name system (DNS) name, for
/// example, fabrikam.com, or a flat NetBIOS, for example, Fabrikam, name. DNS names should be used when possible.
/// </para></param>
/// <param name="SrcPrincipal">Pointer to a null-terminated string that specifies the name of a security principal, user or group, in the source domain. This
/// name is a domain-relative Security Account Manager (SAM) name, for example: evacorets.</param>
/// <param name="SrcDomainController"><para>
/// Pointer to a null-terminated string that specifies the name of the primary domain controller (PDC) Emulator in the source domain
/// to use for secure retrieval of the source principal SID and audit generation.
/// <para>If this parameter is <c>NULL</c>, the credentials of the caller are used for access to the source domain.</para></param>
/// <param name="DstDomain">Pointer to a null-terminated string that specifies the name of the destination domain in which DstPrincipal resides. This name
/// can either be a DNS name, for example, fabrikam.com, or a NetBIOS name, for example, Fabrikam. The destination domain must run
/// Windows 2000 native mode.</param>
/// <param name="DstPrincipal">Pointer to a null-terminated string that specifies the name of a security principal, user or group, in the destination domain.
/// This domain-relative SAM name identifies the principal whose <c>sIDHistory</c> attribute is updated with the SID of the SrcPrincipal.</param>
/// <returns>Returns a Win32 error codes including the following.</returns>
/// The DsBind function binds to a domain controller.DsBind uses the default process credentials to bind to the domain controller. To
/// specify alternate credentials, use the DsBindWithCred function.
/// </summary>
/// <param name="DomainControllerName">Pointer to a null-terminated string that contains the name of the domain controller to bind to. This name can be the name of the
/// domain controller or the fully qualified DNS name of the domain controller. Either name type can, optionally, be preceded by two
/// backslash characters. All of the following examples represent correctly formatted domain controller names:
/// <list type="bullet"><item><definition>"FAB-DC-01"</definition></item><item><definition>"\\FAB-DC-01"</definition></item><item><definition>"FAB-DC-01.fabrikam.com"</definition></item><item><definition>"\\FAB-DC-01.fabrikam.com"</definition></item></list><para>This parameter can be NULL. For more information, see Remarks.</para></param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind to. This parameter can be
/// NULL. For more information, see Remarks.</param>
/// <param name="phDS">Address of a HANDLE value that receives the binding handle. To close this handle, pass it to the DsUnBind function.</param>
/// <returns>
/// Returns ERROR_SUCCESS if successful or a Windows or RPC error code otherwise.
/// </returns>
/// <remarks>
/// The behavior of the DsBind function is determined by the contents of the DomainControllerName and DnsDomainName parameters. The
/// following list describes the behavior of this function based on the contents of these parameters.
/// <list type="table"><listheader><description>DomainControllerName</description><description>DnsDomainName</description><description>Description</description></listheader><item><description><c>NULL</c></description><description><c>NULL</c></description><description>DsBind will attempt to bind to a global catalog server in the forest of the local computer.</description></item><item><description>(value)</description><description><c>NULL</c></description><description>DsBind will attempt to bind to the domain controller specified by the DomainControllerName parameter.</description></item><item><description><c>NULL</c></description><description>(value)</description><description>DsBind will attempt to bind to any domain controller in the domain specified by DnsDomainName parameter.</description></item><item><description>(value)</description><description>(value)</description><description>
/// The DomainControllerName parameter takes precedence. DsBind will attempt to bind to the domain controller specified by the
/// The <c>DsBindByInstance</c> function explicitly binds to any AD LDS or Active Directory instance.
/// </summary>
/// <param name="ServerName">Pointer to a null-terminated string that specifies the name of the instance. This parameter is required to bind to an AD LDS
/// instance. If this parameter is <c>NULL</c> when binding to an Active Directory instance, then the DnsDomainName parameter must
/// contain a value. If this parameter and the DnsDomainName parameter are both <c>NULL</c>, the function fails with the return value
/// <c>ERROR_INVALID_PARAMETER</c> (87).</param>
/// <param name="Annotation"><para>
/// Pointer to a null-terminated string that specifies the port number of the AD LDS instance or <c>NULL</c> when binding to an
/// Active Directory instance. For example, "389".
/// If this parameter is <c>NULL</c> when binding by domain to an Active Directory instance, then the DnsDomainName parameter must be
/// specified. If this parameter is <c>NULL</c> when binding to an AD LDS instance, then the InstanceGuid parameter must be specified.
/// </para></param>
/// <param name="InstanceGuid">Pointer to a <c>GUID</c> value that contains the <c>GUID</c> of the AD LDS instance. The <c>GUID</c> value is the
/// <c>objectGUID</c> property of the <c>nTDSDSA</c> object of the instance. If this parameter is <c>NULL</c> when binding to an AD
/// LDS instance, the Annotation parameter must be specified.</param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that specifies the DNS name of the domain when binding to an Active Directory instance by
/// domain. Set this parameter to <c>NULL</c> to bind to an Active Directory instance by server or to an AD LDS instance.</param>
/// <param name="AuthIdentity">Handle to the credentials used to start the RPC session. Use the DsMakePasswordCredentials function to create a structure
/// suitable for AuthIdentity.</param>
/// <param name="ServicePrincipalName">Pointer to a null-terminated string that specifies the Service Principal Name to assign to the client. Passing <c>NULL</c> in
/// ServicePrincipalName is equivalent to a call to the DsBindWithCred function.</param>
/// <param name="BindFlags"><para>
/// Contains a set of flags that define the behavior of this function. This parameter can contain zero or a combination of one or
/// The <c>DsBindByInstance</c> function explicitly binds to any AD LDS or Active Directory instance.
/// </summary>
/// <param name="ServerName">Pointer to a null-terminated string that specifies the name of the instance. This parameter is required to bind to an AD LDS
/// instance. If this parameter is <c>NULL</c> when binding to an Active Directory instance, then the DnsDomainName parameter must
/// contain a value. If this parameter and the DnsDomainName parameter are both <c>NULL</c>, the function fails with the return value
/// <c>ERROR_INVALID_PARAMETER</c> (87).</param>
/// <param name="Annotation"><para>
/// Pointer to a null-terminated string that specifies the port number of the AD LDS instance or <c>NULL</c> when binding to an
/// Active Directory instance. For example, "389".
/// </para>
/// <para>
/// If this parameter is <c>NULL</c> when binding by domain to an Active Directory instance, then the DnsDomainName parameter must be
/// specified. If this parameter is <c>NULL</c> when binding to an AD LDS instance, then the InstanceGuid parameter must be specified.
/// </para></param>
/// <param name="InstanceGuid">Pointer to a <c>GUID</c> value that contains the <c>GUID</c> of the AD LDS instance. The <c>GUID</c> value is the
/// <c>objectGUID</c> property of the <c>nTDSDSA</c> object of the instance. If this parameter is <c>NULL</c> when binding to an AD
/// LDS instance, the Annotation parameter must be specified.</param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that specifies the DNS name of the domain when binding to an Active Directory instance by
/// domain. Set this parameter to <c>NULL</c> to bind to an Active Directory instance by server or to an AD LDS instance.</param>
/// <param name="AuthIdentity">Handle to the credentials used to start the RPC session. Use the DsMakePasswordCredentials function to create a structure
/// suitable for AuthIdentity.</param>
/// <param name="ServicePrincipalName">Pointer to a null-terminated string that specifies the Service Principal Name to assign to the client. Passing <c>NULL</c> in
/// ServicePrincipalName is equivalent to a call to the DsBindWithCred function.</param>
/// <param name="BindFlags"><para>
/// Contains a set of flags that define the behavior of this function. This parameter can contain zero or a combination of one or
/// The <c>DsBindToISTG</c> function binds to the computer that holds the Inter-Site Topology Generator (ISTG) role in the domain of
/// the local computer.
/// </summary>
/// <param name="SiteName">Pointer to a null-terminated string that contains the site name used when binding. If this parameter is <c>NULL</c>, the site of
/// the nearest domain controller is used.</param>
/// <param name="phDS">Address of a <c>HANDLE</c> value that receives the bind handle. To close this handle, call DsUnBind.</param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32 or RPC error code otherwise. The following are possible error codes.
/// The DsBindWithCred function binds to a domain controller using the specified credentials.
/// </summary>
/// <param name="DomainControllerName">Pointer to a null-terminated string that contains the name of the domain controller to bind to. This name can be the name of the
/// domain controller or the fully qualified DNS name of the domain controller. Either name type can, optionally, be preceded by two
/// backslash characters. All of the following examples represent correctly formatted domain controller names:
/// <list type="bullet"><item><definition>"FAB-DC-01"</definition></item><item><definition>"\\FAB-DC-01"</definition></item><item><definition>"FAB-DC-01.fabrikam.com"</definition></item><item><definition>"\\FAB-DC-01.fabrikam.com"</definition></item></list><para>This parameter can be NULL. For more information, see Remarks.</para></param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind to. This parameter can be
/// NULL. For more information, see Remarks.</param>
/// <param name="AuthIdentity">Contains an RPC_AUTH_IDENTITY_HANDLE value that represents the credentials to be used for the bind. The DsMakePasswordCredentials
/// function is used to obtain this value. If this parameter is NULL, the credentials of the calling thread are used.
/// <para>DsUnBind must be called before freeing this handle with the DsFreePasswordCredentials function.</para></param>
/// <param name="phDS">Address of a HANDLE value that receives the binding handle. To close this handle, pass it to the DsUnBind function.</param>
/// <returns>
/// Returns ERROR_SUCCESS if successful or a Windows or RPC error code otherwise.
/// The <c>DsBindWithSpn</c> function binds to a domain controller using the specified credentials and a specific service principal
/// name (SPN) for mutual authentication.
/// </para>
/// <para>
/// This function is provided for where complete control is required for mutual authentication. Do not use this function if you
/// expect DsBind to find a server for you, because SPNs are computer-specific, and it is unlikely that the SPN you provide will
/// match the server that <c>DsBind</c> finds for you. Providing a <c>NULL</c> ServicePrincipalName argument results in behavior that
/// is identical to DsBindWithCred.
/// </para>
/// </summary>
/// <param name="DomainControllerName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind to. For more information,
/// see the DomainControllerName description in the DsBind topic.</param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind to. For more information,
/// see the DnsDomainName description in the DsBind topic.</param>
/// <param name="AuthIdentity"><para>Contains an RPC_AUTH_IDENTITY_HANDLE value that represents the credentials to be used for the bind. The</para>
/// <para>
/// DsMakePasswordCredentialsfunction is used to obtain this value. If this parameter is <c>NULL</c>, the credentials of the calling
/// thread are used.
/// </para>
/// <para>DsUnBind must be called before freeing this handle with the DsFreePasswordCredentials function.</para></param>
/// <param name="ServicePrincipalName">Pointer to a null-terminated string that specifies the Service Principal Name to assign to the client. Passing <c>NULL</c> in
/// ServicePrincipalName is equivalent to a call to the DsBindWithCred function.</param>
/// <param name="phDS">Address of a <c>HANDLE</c> value that receives the binding handle. To close this handle, pass it to the DsUnBind function.</param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Windows or RPC error code otherwise. The following are the most common error codes.
/// The <c>DsBindWithSpnEx</c> function binds to a domain controller using the specified credentials and a specific service principal
/// name (SPN) for mutual authentication. This function is similar to the DsBindWithSpn function except this function allows more
/// binding options with the BindFlags parameter.
/// </para>
/// <para>
/// This function is provided where complete control is required over mutual authentication. Do not use this function if you expect
/// DsBind to find a server for you, because SPNs are computer-specific, and it is unlikely that the SPN you provide will match the
/// server that <c>DsBind</c> finds for you. Providing a <c>NULL</c> ServicePrincipalName argument results in behavior that is
/// identical to DsBindWithCred.
/// </para>
/// </summary>
/// <param name="DomainControllerName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind. For more information, see
/// the DomainControllerName description in the DsBind topic.</param>
/// <param name="DnsDomainName">Pointer to a null-terminated string that contains the fully qualified DNS name of the domain to bind. For more information, see
/// the DnsDomainName description in the DsBind topic.</param>
/// <param name="AuthIdentity"><para>Contains an RPC_AUTH_IDENTITY_HANDLE value that represents the credentials to be used for the bind. The</para>
/// <para>
/// DsMakePasswordCredentialsfunction is used to obtain this value. If this parameter is <c>NULL</c>, the credentials of the calling
/// thread are used.
/// </para>
/// <para>DsUnBind must be called before freeing this handle with the DsFreePasswordCredentials function.</para></param>
/// <param name="ServicePrincipalName">Pointer to a null-terminated string that specifies the Service Principal Name to assign to the client. Passing <c>NULL</c> in
/// ServicePrincipalName is equivalent to a call to the DsBindWithCred function.</param>
/// <param name="phDS">Address of a <c>HANDLE</c> value that receives the binding handle. To close this handle, pass it to the DsUnBind function.</param>
/// The <c>DsClientMakeSpnForTargetServer</c> function constructs a service principal name (SPN) that identifies a specific server to
/// use for authentication.
/// </summary>
/// <param name="ServiceClass">Pointer to a null-terminated string that contains the class of the service as defined by the service. This can be any string
/// unique to the service.</param>
/// <param name="ServiceName"><para>
/// Pointer to a null-terminated string that contains the distinguished name service (DNS) host name. This can either be a fully
/// qualified name or an IP address in the Internet standard format.
/// </para>
/// <para>
/// Use of an IP address for ServiceName is not recommended because this can create a security issue. Before the SPN is constructed,
/// the IP address must be translated to a computer name through DNS name resolution. It is possible for the DNS name resolution to
/// be spoofed, replacing the intended computer name with an unauthorized computer name.
/// </para></param>
/// <param name="pcSpnLength">Pointer to a <c>DWORD</c> value that, on entry, contains the size of the pszSpn buffer, in characters. On output, this parameter
/// receives the number of characters copied to the pszSpn buffer, including the terminating <c>NULL</c>.</param>
/// <param name="pszSpn">Pointer to a string buffer that receives the SPN.</param>
/// <returns>This function returns standard Windows error codes.</returns>
/// <remarks>
/// <para>When using this function, supply the service class and part of a DNS host name.</para>
/// <para>
/// This function is a simplified version of the DsMakeSpn function. The ServiceName is made canonical by resolving through DNS.
/// </para>
/// <para>GUID-based DNS names are not supported. When constructed, the simplified SPN is as follows:</para>
/// <para>The instance name portion (second position) is always set to default. The port and referrer fields are not used.</para>
/// <param name="hSafeDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function. If flags contains
/// DS_NAME_FLAG_SYNTACTICAL_ONLY, hDS can be NULL.</param>
/// <param name="flags">Contains one or more of the DS_NAME_FLAGS values used to determine how the name syntax will be cracked.</param>
/// <param name="formatOffered">Contains one of the DS_NAME_FORMAT values that identifies the format of the input names.</param>
/// <param name="formatDesired">Contains one of the DS_NAME_FORMAT values that identifies the format of the output names. The DS_SID_OR_SID_HISTORY_NAME value is
/// not supported.</param>
/// <param name="cNames">Contains the number of elements in the rpNames array.</param>
/// <param name="rpNames">Pointer to an array of pointers to null-terminated strings that contain names to be converted.</param>
/// <param name="ppResult">Pointer to a PDS_NAME_RESULT value that receives a DS_NAME_RESULT structure that contains the converted names. The caller must
/// free this memory, when it is no longer required, by calling DsFreeNameResult.</param>
/// <returns>
/// Returns a Win32 error value, an RPC error value, or one of the following.
/// <summary>A wrapper function for the DsCrackNames OS call</summary>
/// <param name="hSafeDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function. If flags contains
/// DS_NAME_FLAG_SYNTACTICAL_ONLY, hDS can be NULL.</param>
/// <param name="names">The names to be converted.</param>
/// <param name="formatDesired">Contains one of the DS_NAME_FORMAT values that identifies the format of the output names. The DS_SID_OR_SID_HISTORY_NAME value is
/// not supported.</param>
/// <param name="formatOffered">Contains one of the DS_NAME_FORMAT values that identifies the format of the input names.</param>
/// <param name="flags">Contains one or m ore of the DS_NAME_FLAGS values used to determine how the name syntax will be cracked.</param>
/// The <c>DsGetDomainControllerInfo</c> function retrieves data about the domain controllers in a domain.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="DomainName">Pointer to a null-terminated string that specifies the domain name.</param>
/// <param name="InfoLevel"><para>
/// Contains a value that indicates the version of the <c>DS_DOMAIN_CONTROLLER_INFO</c> structure to return. This can be one of the
/// following values.
/// </para>
/// <para>1</para>
/// <para>The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_1 structure format.</para>
/// <para>2</para>
/// <para>The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_2 structure format.</para>
/// <para>3</para>
/// <para>The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_3 structure format.</para></param>
/// <param name="pcOut">Pointer to a <c>DWORD</c> variable that receives the number of items returned in ppInfo array.</param>
/// <param name="ppInfo">Pointer to a pointer variable that receives an array of <c>DS_DOMAIN_CONTROLLER_INFO_*</c> structures. The type of structures in
/// this array is defined by the InfoLevel parameter. The caller must free this array, when it is no longer required, by using the
/// DsFreeDomainControllerInfo function.</param>
/// <returns>
/// <para>
/// If the function returns domain controller data, the return value is <c>ERROR_SUCCESS</c>. If the caller does not have the
/// privileges to access the server objects, the return value is <c>ERROR_SUCCESS</c>, but the <c>DS_DOMAIN_CONTROLLER_INFO</c>
/// structures could be empty.
/// </para>
/// <para>If the function fails, the return value can be one of the following error codes.</para>
/// The <c>DsGetSpn</c> function constructs an array of one or more service principal names (SPNs). Each name in the array identifies
/// an instance of a service. These SPNs may be registered with the directory service (DS) using the DsWriteAccountSpn function.
/// </summary>
/// <param name="ServiceType"><para>Identifies the format of the SPNs to compose. The ServiceType parameter can have one of the following values.</para>
/// <para>The SPNs have the following format.</para>
/// <para>The</para>
/// <para>ServiceName</para>
/// <para>parameter must be</para>
/// <para>NULL</para>
/// <para>. This is the SPN format for a host-based service, which provides services identified with its host computer. The</para>
/// <para>InstancePort</para>
/// <para>component is optional.</para>
/// <para>DS_SPN_DOMAIN, DS_SPN_NB_DOMAIN</para>
/// <para>The SPNs have the following format.</para>
/// <para>The</para>
/// <para>ServiceName</para>
/// <para>
/// parameter must be the DNS name or DN of a domain. This format is used for a replicable service that provides services to the
/// specified domain.
/// </para>
/// <para>DS_SPN_SERVICE</para>
/// <para>The SPNs have the following format.</para>
/// <para>The</para>
/// <para>ServiceName</para>
/// <para>
/// parameter must be a canonical DN or DNS name that identifies an instance of the service. For example, it could be a DNS name of a
/// SRV record, or the distinguished name of the service connection point for this service instance.
/// </para></param>
/// <param name="ServiceClass">Pointer to a constant null-terminated string that specifies the class of the service; for example, http. Generally, this can be
/// any string that is unique to the service.</param>
/// <param name="ServiceName">Pointer to a constant null-terminated string that specifies the DNS name or distinguished name (DN) of the service. ServiceName
/// is not required for a host-based service. For more information, see the description of the ServiceType parameter for the possible
/// values of ServiceName.</param>
/// <param name="InstancePort">Specifies the port number of the service instance. If this value is zero, the SPN does not include a port number.</param>
/// <param name="cInstanceNames">Specifies the number of elements in the pInstanceNames and pInstancePorts arrays. If this value is zero, pInstanceNames must
/// point to an array of cInstanceNames strings, and pInstancePorts can be either <c>NULL</c> or a pointer to an array of
/// cInstanceNames port numbers. If this value is zero, <c>DsGetSpn</c> returns only one SPN in the prpszSpn array and pInstanceNames
/// and pInstancePorts are ignored.</param>
/// <param name="pInstanceNames">Pointer to an array of null-terminated strings that specify extra instance names (not used for host names). This parameter is
/// ignored if cInstanceNames is zero. In that case, the InstanceName component of the SPN defaults to the fully qualified DNS name
/// of the local computer or the NetBIOS name if <c>DS_SPN_NB_HOST</c> or <c>DS_SPN_NB_DOMAIN</c> is specified.</param>
/// <param name="pInstancePorts">Pointer to an array of extra instance ports. If this value is non- <c>NULL</c>, it must point to an array of cInstanceNames port
/// numbers. If this value is <c>NULL</c>, the SPNs do not include a port number. This parameter is ignored if cInstanceNames is zero.</param>
/// <param name="pcSpn">Pointer to a variable that receives the number of SPNs contained in prpszSpn.</param>
/// <param name="prpszSpn">Pointer to a variable that receives a pointer to an array of SPNs. This array must be freed with DsFreeSpnArray.</param>
/// <returns>
/// <para>If the function returns an array of SPNs, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value can be one of the following error codes.</para>
/// </returns>
/// <remarks>
/// <para>
/// <c>To create SPNs for multiple instances of a replicated service running on multiple host computers</c>
/// </para>
/// <list type="number">
/// <item>
/// <term>Set cInstanceNames to the number of instances.</term>
/// </item>
/// <item>
/// <term>Specify the names of the host computers in the pInstanceNames array.</term>
/// </item>
/// </list>
/// <para>
/// <c>To create SPNs for multiple instances of a service running on the same host computer</c>
/// </para>
/// <list type="number">
/// <item>
/// <term>Set the cInstanceNames to the number of instances.</term>
/// </item>
/// <item>
/// <term>Set each entry in the pInstanceNames array to the DNS name of the host computer.</term>
/// </item>
/// <item>
/// <term>Use the pInstancePorts parameter to specify an array of unique port numbers for each instance to disambiguate the SPNs.</term>
/// </item>
/// </list>
/// <para>String parameters cannot include the forward slash (/), which is used to separate the components of the SPN.</para>
/// <para>
/// An application with the appropriate privileges, which are usually those of a domain administrator, can call the DsWriteAccountSpn
/// function to register one or more SPNs on the user or computer account where the service is running. Clients can then use the SPNs
/// The <c>DsInheritSecurityIdentity</c> function appends the <c>objectSid</c> and <c>sidHistory</c> attributes of SrcPrincipal to
/// the <c>sidHistory</c> of DstPrincipal and then deletes SrcPrincipal, all in a single transaction. To ensure that this operation
/// is atomic, SrcPrincipal and DstPrincipal must be in the same domain and hDS must be bound to a domain controller that the correct
/// permissions within that domain.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="Flags">Reserved for future use. Must be zero.</param>
/// <param name="SrcPrincipal">Pointer to a null-terminated string that specifies the name of a security principal (user or group) in the source domain. This
/// name is a domain-relative SAM name.</param>
/// <param name="DstPrincipal">Pointer to a null-terminated string that specifies the name of a security principal (user or group) in the destination domain.
/// This domain-relative SAM name identifies the principal whose <c>sidHistory</c> attribute will be updated with the SID of SrcPrincipal.</param>
/// <returns>Returns a system or RPC error code including the following.</returns>
/// <remarks>
/// <para>
/// With an operating system upgrade domain applications, which span both upgraded and non-upgraded domains, may have security
/// principals inside and outside the forest for the same logical entity at the same time.
/// </para>
/// <para>
/// When all upgraded domains have joined the same forest, <c>DsInheritSecurityIdentity</c> eliminates the duplicate objects while
/// ensuring that the remaining objects have all the security rights and privileges belonging to their respective deleted object.
/// The <c>DsListDomainsInSite</c> function lists all the domains in a site.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="site">Pointer to a null-terminated string that specifies the site name. This string is taken from the list of site names returned by
/// the DsListSites function.</param>
/// <param name="ppDomains">Pointer to a pointer to a DS_NAME_RESULT structure that receives the list of domains in the site. To free the returned structure,
/// call the DsFreeNameResult function.</param>
/// <returns>
/// If the function returns a list of domains, the return value is <c>NO_ERROR</c>. If the function fails, the return value can be
/// one of the following error codes.
/// </returns>
/// <remarks>
/// Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.
/// The <c>DsListInfoForServer</c> function lists miscellaneous data for a server.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="server">Pointer to a null-terminated string that specifies the server name. This name must be the same as one of the strings returned by
/// the DsListServersForDomainInSite or DsListServersInSite function.</param>
/// <param name="ppInfo"><para>
/// Pointer to a variable that receives a pointer to a DS_NAME_RESULT structure that contains the server data. The returned structure
/// must be deallocated using DsFreeNameResult.
/// </para>
/// <para>
/// The indexes of the array in the DS_NAME_RESULT structure indicate what data are contained by each array element. The following
/// constants may be used to specify the desired index for a particular piece of data.
/// The <c>DsListServersForDomainInSite</c> function lists all the servers in a domain in a site.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="domain">Pointer to a null-terminated string that specifies the domain name. This string must be the same as one of the strings returned
/// by DsListDomainsInSite function.</param>
/// <param name="site">Pointer to a null-terminated string that specifies the site name. This string is taken from the list of site names returned by
/// the DsListSites function.</param>
/// <param name="ppServers">Pointer to a pointer to a DS_NAME_RESULT structure that receives the list of servers in the domain. The returned structure must
/// be freed using the DsFreeNameResult function.</param>
/// <returns>
/// If the function returns a list of servers, the return value is <c>NO_ERROR</c>. If the function fails, the return value can be
/// one of the following error codes.
/// </returns>
/// <remarks>
/// Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.
/// The <c>DsListServersInSite</c> function lists all the servers in a site.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="site">Pointer to a null-terminated string that specifies the site name. The site name uses a distinguished name format. It is taken
/// from the list of sites returned by the DsListSites function.</param>
/// <param name="ppServers">Pointer to a pointer to a DS_NAME_RESULT structure that receives the list of servers in the site. The returned structure must be
/// freed using the DsFreeNameResult function.</param>
/// <returns>
/// If the function returns a list of servers, the return value is <c>NO_ERROR</c>. If the function fails, the return value can be
/// one of the following error codes.
/// </returns>
/// <remarks>
/// Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.
/// The <c>DsListSites</c> function lists all the sites in the enterprise forest.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="ppSites">Pointer to a pointer to a DS_NAME_RESULT structure that receives the list of sites in the enterprise. The site name is returned
/// in the distinguished name (DN) format. The returned structure must be freed using the DsFreeNameResult function.</param>
/// <returns>
/// If the function returns a list of sites, the return value is <c>NO_ERROR</c>. If the function fails, the return value can be one
/// of the following error codes.
/// </returns>
/// <remarks>
/// Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.
/// Constructs a credential handle suitable for use with the DsBindWithCred function.
/// </summary>
/// <param name="User">A string that contains the user name to use for the credentials.</param>
/// <param name="Domain">A string that contains the domain that the user is a member of.</param>
/// <param name="Password">A string that contains the password to use for the credentials.</param>
/// <param name="pAuthIdentity">An RPC_AUTH_IDENTITY_HANDLE value that receives the credential handle. This handle is used in a subsequent call to
/// DsBindWithCred. This handle must be freed with the DsFreePasswordCredentials function when it is no longer required.</param>
/// <returns>Returns a Windows error code.</returns>
/// <remarks>
/// A null, default credential handle is created if User, Domain and Password are all NULL. Otherwise, User must be present. The
/// Domain parameter may be NULL when User is fully qualified, such as a user in UPN format; for example, "someone@fabrikam.com".
/// <para>
/// When the handle returned in pAuthIdentity is passed to DsBindWithCred, DsUnBind must be called before freeing the handle with DsFreePasswordCredentials.
/// The <c>DsMapSchemaGuids</c> function converts GUIDs of directory service schema objects to their display names.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="cGuids">Indicates the number of elements in rGuids.</param>
/// <param name="rGuids">Pointer to an array of <c>GUID</c> values for the objects to be mapped.</param>
/// <param name="ppGuidMap">Pointer to a variable that receives a pointer to an array of DS_SCHEMA_GUID_MAP structures that contain the display names of the
/// objects in rGuids. This array must be deallocated using DsFreeSchemaGuidMap.</param>
/// <returns>
/// Returns a standard error code that includes the following values.
/// The <c>DsQuerySitesByCost</c> function gets the communication cost between one site and one or more other sites.
/// </summary>
/// <param name="hDS">A directory service handle.</param>
/// <param name="pszFromSite">Pointer to a null-terminated string that contains the relative distinguished name of the site the costs are measured from.</param>
/// <param name="rgszToSites">Contains an array of null-terminated string pointers that contain the relative distinguished names of the sites the costs are
/// measured to.</param>
/// <param name="cToSites">Contains the number of elements in the rgwszToSites array.</param>
/// <param name="dwFlags">Reserved.</param>
/// <param name="prgSiteInfo"><para>
/// Pointer to an array of DS_SITE_COST_INFO structures that receives the cost data. Each element in this array contains the cost
/// data between the site identified by the pwszFromSite parameter and the site identified by the corresponding rgwszToSites element.
/// </para>
/// <para>The caller must free this memory when it is no longer required by calling DsQuerySitesFree.</para></param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32 or RPC error code otherwise. Possible error codes include values listed in
/// the following list.
/// </returns>
/// <remarks>
/// The cost values obtained by this function are only used to compare and have no meaning by themselves. For example, the cost for
/// site 1 can be compared to the cost for site 2, but the cost for site 1 cannot be compared to a fixed value.
/// The <c>DsRemoveDsDomain</c> function removes all traces of a domain naming context from the global area of the directory service.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="DomainDN">Pointer to a null-terminated string that specifies the distinguished name of the naming context to remove from the directory service.</param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32 or RPC error code if unsuccessful. Possible error codes include the following.
/// The <c>DsRemoveDsServer</c> function removes all traces of a directory service agent (DSA) from the global area of the directory service.
/// </summary>
/// <param name="hDs">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="ServerDN">Pointer to a null-terminated string that specifies the fully qualified distinguished name of the domain controller to remove.</param>
/// <param name="DomainDN">Pointer to a null-terminated string that specifies a domain hosted by ServerDN. If this parameter is <c>NULL</c>, no verification
/// is performed to ensure that ServerDN is the last domain controller in DomainDN.</param>
/// <param name="fLastDcInDomain">Pointer to a Boolean value that receives <c>TRUE</c> if ServerDN is the last DC in DomainDN or <c>FALSE</c> otherwise. This
/// parameter receives <c>FALSE</c> if DomainDN is <c>NULL</c>.</param>
/// <param name="fCommit">Contains a Boolean value that specifies if the domain controller should actually be removed. If this parameter is nonzero,
/// ServerDN is removed. If this parameter is zero, the existence of ServerDN is checked and fLastDcInDomain is written, but the
/// domain controller is not removed.</param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32 or RPC error code if unsuccessful. Possible error codes include the following.
/// The <c>DsReplicaAdd</c> function adds a replication source reference to a destination naming context.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">The null-terminated string that specifies the distinguished name (DN) of the destination naming context (NC) for which to add the
/// replica. The destination NC record must exist locally as either an object, instantiated or not, or a reference phantom, for
/// example, a phantom with a GUID.</param>
/// <param name="SourceDsaDn">The null-terminated string that specifies the DN of the <c>NTDS-DSA</c> object for the source directory system agent. This
/// parameter is required if Options includes <c>DS_REPADD_ASYNCHRONOUS_REPLICA</c>; otherwise, it is ignored.</param>
/// <param name="TransportDn">The null-terminated string that specifies the DN of the <c>interSiteTransport</c> object that represents the transport used for
/// communication with the source server. This parameter is required if Options includes <c>DS_REPADD_INTERSITE_MESSAGING</c>;
/// otherwise, it is ignored.</param>
/// <param name="SourceDsaAddress">The null-terminated string that specifies the transport-specific address of the source DSA. This source server is identified by a
/// string name, not by its UUID. A string name appropriate for SourceDsaAddress is usually a DNS name based on a GUID, where the
/// GUID part of the name is the GUID of the <c>NTDS-DSA</c> object for the source server.</param>
/// <param name="pSchedule">Pointer to a SCHEDULE structure that contains the replication schedule data for the replication source. This parameter is
/// optional and can be <c>NULL</c> if not used.</param>
/// <param name="Options"><para>Passes additional data to be used to process the request. This parameter can be a combination of the following values.</para>
/// <para>DS_REPADD_ASYNCHRONOUS_OPERATION</para>
/// <para>Performs this operation asynchronously.</para>
/// <para>DS_REPADD_ASYNCHRONOUS_REPLICA</para>
/// <para>Does not replicate the NC. Instead, save enough state data such that it may be replicated later.</para>
/// <para>DS_REPADD_DISABLE_NOTIFICATION</para>
/// <para>
/// Disables notification-based synchronization for the NC from this source. This is expected to be a temporary state. Use
/// <c>DS_REPADD_NEVER_NOTIFY</c> to permanently disable synchronization.
/// </para>
/// <para>DS_REPADD_DISABLE_PERIODIC</para>
/// <para>Disables periodic synchronization for the NC from this source.</para>
/// <para>DS_REPADD_INITIAL</para>
/// <para>Synchronizes the NC from this source when the DSA is started.</para>
/// <para>DS_REPADD_INTERSITE_MESSAGING</para>
/// <para>
/// Synchronizes from the source DSA using the Intersite Messaging Service (IMS) transport, for example, by SMTP, rather than using
/// the native directory service RPC.
/// </para>
/// <para>DS_REPADD_NEVER_NOTIFY</para>
/// <para>
/// Disables change notifications from this source. When this flag is set, the source does not notify the destination when changes
/// occur. This is recommended for all intersite replication that may occur over WAN links.
/// </para>
/// <para>This is expected to be a permanent state; use <c>DS_REPADD_DISABLE_NOTIFICATION</c> to temporarily disable notifications.</para>
/// <para>DS_REPADD_PERIODIC</para>
/// <para>Synchronizes the NC from this source periodically, as defined in pSchedule.</para>
/// <para>DS_REPADD_USE_COMPRESSION</para>
/// <para>
/// Uses compression when replicating. This saves network bandwidth at the expense of CPU overhead at both the source and destination servers.
/// </para>
/// <para>DS_REPADD_WRITEABLE</para>
/// <para>Creates a writable replica; otherwise, the replica is read-only.</para></param>
/// <returns>
/// <para>If the function succeeds, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value can be one of the following.</para>
/// The <c>DsReplicaConsistencyCheck</c> function invokes the Knowledge Consistency Checker (KCC) to verify the replication topology.
/// The KCC dynamically adjusts the data replication topology of your network when domain controllers are added to or removed from
/// the network, when a domain controller is unavailable, or when the data replication schedules are changed.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind, DSBindWithCred, or DsBindWithSpn function.</param>
/// <param name="TaskID">Identifies the task that the KCC should execute. <c>DS_KCC_TASKID_UPDATE_TOPOLOGY</c> is the only currently supported value.</param>
/// <param name="dwFlags"><para>
/// Contains a set of flags that modify the function behavior. This can be zero or a combination of one or more of the following values.
/// </para>
/// <para>DS_KCC_FLAG_ASYNC_OP</para>
/// <para>The task is queued and then the function returns without waiting for the task to complete.</para>
/// <para>DS_KCC_FLAG_DAMPED</para>
/// <para>The task will not be added to the queue if another queued task will run soon.</para></param>
/// <returns>
/// If the function performs its operation successfully, the return value is <c>ERROR_SUCCESS</c>. If the function fails, the return
/// The <c>DsReplicaDel</c> function removes a replication source reference from a destination naming context (NC).
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">Pointer to a constant null-terminated string that specifies the distinguished name (DN) of the destination NC from which to
/// remove the replica. The destination NC record must exist locally as either an object, instantiated or not, or a reference
/// phantom, for example, a phantom with a GUID.</param>
/// <param name="DsaSrc">Pointer to a constant null-terminated Unicode string that specifies the transport-specific address of the source directory system
/// agent (DSA). This source server is identified by a string name, not by its <c>UUID</c>. A string name appropriate for DsaSrc is
/// usually a DNS name that is based on a <c>GUID</c>, where the <c>GUID</c> part of the name is the <c>GUID</c> of the nTDSDSA
/// object for the source server.</param>
/// <param name="Options"><para>Passes additional data used to process the request. This parameter can be a combination of the following values.</para>
/// <para>DS_REPDEL_ASYNCHRONOUS_OPERATION</para>
/// <para>Performs this operation asynchronously.</para>
/// <para>DS_REPDEL_IGNORE_ERRORS</para>
/// <para>
/// Ignores any error generated from contacting the source to instruct it to remove this NC from its list of servers to which it replicates.
/// </para>
/// <para>DS_REPDEL_INTERSITE_MESSAGING</para>
/// <para>Signifies the replica is mail-based rather than synchronized using native directory service RPC.</para>
/// <para>DS_REPDEL_LOCAL_ONLY</para>
/// <para>
/// Does not contact the source to tell it to remove this NC from its list of servers to which it replicates. If this flag is not set
/// and the link is based in RPC, the source is contacted.
/// </para>
/// <para>DS_REPDEL_NO_SOURCE</para>
/// <para>Deletes all the objects in the NC. This option is valid only for read-only NCs with no source.</para>
/// <para>DS_REPDEL_REF_OK</para>
/// <para>Allows deletion of a read-only replica even if it sources other read-only replicas.</para>
/// <para>DS_REPDEL_WRITEABLE</para>
/// <para>Signifies that the replica deleted can be written to.</para></param>
/// <returns>
/// <para>If the function succeeds, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>
/// If the function fails, the return value is a standard Win32 API error or <c>ERROR_INVALID_PARAMETER</c> if a parameter is invalid.
/// The <c>DsReplicaFreeInfo</c> function frees the replication state data structure allocated by the DsReplicaGetInfo or
/// DsReplicaGetInfo2 functions.
/// </summary>
/// <param name="InfoType">Contains one of the DS_REPL_INFO_TYPE values that specifies the type of replication data structure contained in pInfo. This must
/// be the same value passed to the DsReplicaGetInfo or DsReplicaGetInfo2 function when the structure was allocated.</param>
/// <param name="pInfo">Pointer to the replication data structure allocated by the DsReplicaGetInfo or DsReplicaGetInfo2 functions.</param>
/// The <c>DsReplicaGetInfo2</c> function retrieves replication state data from the directory service. This function allows paging of
/// results in cases where there are more than 1000 entries to retrieve.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="InfoType">Contains one of the DS_REPL_INFO_TYPE values that specifies the type of replication data to retrieve. This value also determines
/// which type of structure is returned in ppInfo.</param>
/// <param name="pszObject"><para>
/// Pointer to a constant null-terminated Unicode string that identifies the object to retrieve replication data for. The meaning of
/// this parameter depends on the value of the InfoType parameter. The following are possible value codes.
/// </para>
/// <para>DS_REPL_INFO_NEIGHBORS</para>
/// <para>pszObject identifies the naming context for which replication neighbors are requested.</para>
/// <para>DS_REPL_INFO_CURSORS_FOR_NC</para>
/// <para>pszObject identifies the naming context for which replication cursors are requested.</para>
/// <para>DS_REPL_INFO_METADATA_FOR_OBJ</para>
/// <para>pszObject identifies the object for which replication metadata is requested.</para>
/// <para>pszObject identifies the object for which attribute replication metadata is requested.</para></param>
/// <param name="puuidForSourceDsaObjGuid">Pointer to a <c>GUID</c> value that identifies a specific replication source. If this parameter is not <c>NULL</c> and the
/// InfoType parameter contains <c>DS_REPL_INFO_NEIGHBORS</c>, only neighbor data for the source corresponding to the nTDSDSA object
/// with the given <c>objectGuid</c> in the directory is returned. This parameter is ignored if <c>NULL</c> or if the InfoType
/// parameter is anything other than <c>DS_REPL_INFO_NEIGHBORS</c>.</param>
/// <param name="pszAttributeName"><para>
/// Pointer to a null-terminated Unicode string that contains the name of the specific attribute to retrieve replication data for.
/// </para>
/// <para>This parameter is only used if the InfoType parameter contains one of the following values.</para>
/// <param name="pszValue">Pointer to a null-terminated Unicode string that contains the distinguished name value to match. If the requested attribute is a
/// distinguished name type value, this function return the attributes that contain the specified value.</param>
/// <param name="dwFlags"><para>Contains a set of flags that modify the behavior of the function. This parameter can be zero or the following value.</para>
/// Causes the attribute metadata to account for metadata on the attribute's linked values. The resulting vector represents changes
/// for all attributes. This modified vector is useful for clients that expect all attributes and metadata to be included in the
/// attribute metadata vector.
/// </para></param>
/// <param name="dwEnumerationContext"><para>Contains the index of the next entry to retrieve. This parameter must be set to zero the first time this function is called.</para>
/// <para>This parameter is only used if the InfoType parameter contains one of the following values.</para>
/// <para>pszObject must be <c>NULL</c>.</para></param>
/// <param name="puuidForSourceDsaObjGuid">Pointer to a <c>GUID</c> value that identifies a specific replication source. If this parameter is not <c>NULL</c> and the
/// InfoType parameter contains <c>DS_REPL_INFO_NEIGHBORS</c>, only neighbor data for the source corresponding to the nTDSDSA object
/// with the given <c>objectGuid</c> in the directory is returned. This parameter is ignored if <c>NULL</c> or if the InfoType
/// parameter is anything other than <c>DS_REPL_INFO_NEIGHBORS</c>.</param>
/// <param name="ppInfo"><para>
/// Address of a structure pointer that receives the requested data. The value of the InfoType parameter determines the format of
/// this structure. For more information and list of possible InfoType values and the corresponding structure types, see DS_REPL_INFO_TYPE.
/// </para>
/// <para>The caller must free this memory when it is no longer required by calling DsReplicaFreeInfo.</para></param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32 or RPC error otherwise. The following are possible error codes.
/// The <c>DsReplicaModify</c> function modifies an existing replication source reference for a destination naming context.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">Pointer to a constant null-terminated string that specifies the distinguished name (DN) of the destination naming context (NC).</param>
/// <param name="pUuidSourceDsa">Pointer to the UUID of the source directory system agent (DSA). This parameter may be null if ModifyFields does not include
/// <c>DS_REPMOD_UPDATE_ADDRESS</c> and SourceDsaAddress is not <c>NULL</c>.</param>
/// <param name="TransportDn">Reserved for future use. Any value other than <c>NULL</c> results in <c>ERROR_NOT_SUPPORTED</c> being returned.</param>
/// <param name="SourceDsaAddress">Pointer to a constant null-terminated Unicode string that specifies the transport-specific address of the source DSA. This
/// parameter is ignored if pUuidSourceDsa is not <c>NULL</c> and ModifyFields does not include <c>DS_REPMOD_UPDATE_ADDRESS</c>.</param>
/// <param name="pSchedule">Pointer to a SCHEDULE structure that contains the replication schedule data for the replication source. This parameter is
/// optional and can be <c>NULL</c> if not used. This parameter is required if ModifyFields contains the
/// No change notifications should be received from this source. This is normally set if, and only if, the source server is in a
/// different site.
/// </para></param>
/// <param name="ModifyFields"><para>
/// Specifies what fields should be modified. At least one field must be specified in ModifyFields. This parameter can be a
/// combination of the following values.
/// </para>
/// <para>DS_REPMOD_UPDATE_ADDRESS</para>
/// <para>Updates the address associated with the referenced server.</para>
/// <para>DS_REPMOD_UPDATE_FLAGS</para>
/// <para>Updates the flags associated with the replica.</para>
/// <para>DS_REPMOD_UPDATE_RESULT</para>
/// <para>Not used. Specifying updates of result values is not currently supported. Result values default to 0.</para>
/// <para>DS_REPMOD_UPDATE_SCHEDULE</para>
/// <para>Updates the periodic replication schedule associated with the replica.</para>
/// <para>DS_REPMOD_UPDATE_TRANSPORT</para>
/// <para>Updates the transport associated with the replica.</para></param>
/// <param name="Options"><para>Passes additional data used to process the request. This parameter can be a combination of the following values.</para>
/// <para>DS_REPMOD_ASYNCHRONOUS_OPERATION</para>
/// <para>Performs this operation asynchronously.</para>
/// <para>DS_REPMOD_WRITEABLE</para>
/// <para>Indicates that the replica being modified can be written to.</para></param>
/// <returns>
/// <para>If the function succeeds, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value can be one of the following.</para>
/// The <c>DsReplicaModify</c> function modifies an existing replication source reference for a destination naming context.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">Pointer to a constant null-terminated string that specifies the distinguished name (DN) of the destination naming context (NC).</param>
/// <param name="pUuidSourceDsa">Pointer to the UUID of the source directory system agent (DSA). This parameter may be null if ModifyFields does not include
/// <c>DS_REPMOD_UPDATE_ADDRESS</c> and SourceDsaAddress is not <c>NULL</c>.</param>
/// <param name="TransportDn">Reserved for future use. Any value other than <c>NULL</c> results in <c>ERROR_NOT_SUPPORTED</c> being returned.</param>
/// <param name="SourceDsaAddress">Pointer to a constant null-terminated Unicode string that specifies the transport-specific address of the source DSA. This
/// parameter is ignored if pUuidSourceDsa is not <c>NULL</c> and ModifyFields does not include <c>DS_REPMOD_UPDATE_ADDRESS</c>.</param>
/// <param name="pSchedule">Pointer to a SCHEDULE structure that contains the replication schedule data for the replication source. This parameter is
/// optional and can be <c>NULL</c> if not used. This parameter is required if ModifyFields contains the
/// No change notifications should be received from this source. This is normally set if, and only if, the source server is in a
/// different site.
/// </para></param>
/// <param name="ModifyFields"><para>
/// Specifies what fields should be modified. At least one field must be specified in ModifyFields. This parameter can be a
/// combination of the following values.
/// </para>
/// <para>DS_REPMOD_UPDATE_ADDRESS</para>
/// <para>Updates the address associated with the referenced server.</para>
/// <para>DS_REPMOD_UPDATE_FLAGS</para>
/// <para>Updates the flags associated with the replica.</para>
/// <para>DS_REPMOD_UPDATE_RESULT</para>
/// <para>Not used. Specifying updates of result values is not currently supported. Result values default to 0.</para>
/// <para>DS_REPMOD_UPDATE_SCHEDULE</para>
/// <para>Updates the periodic replication schedule associated with the replica.</para>
/// <para>DS_REPMOD_UPDATE_TRANSPORT</para>
/// <para>Updates the transport associated with the replica.</para></param>
/// <param name="Options"><para>Passes additional data used to process the request. This parameter can be a combination of the following values.</para>
/// <para>DS_REPMOD_ASYNCHRONOUS_OPERATION</para>
/// <para>Performs this operation asynchronously.</para>
/// <para>DS_REPMOD_WRITEABLE</para>
/// <para>Indicates that the replica being modified can be written to.</para></param>
/// <returns>
/// <para>If the function succeeds, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value can be one of the following.</para>
/// The <c>DsReplicaSync</c> function synchronizes a destination naming context (NC) with one of its sources.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">Pointer to a constant null-terminated string that specifies the distinguished name of the destination NC.</param>
/// <param name="pUuidDsaSrc">Pointer to the UUID of a source that replicates to the destination NC.</param>
/// <param name="Options"><para>Passes additional data used to process the request. This parameter can be a combination of the following values.</para>
/// <para>DS_REPSYNC_ADD_REFERENCE</para>
/// <para>
/// Causes the source directory system agent (DSA) to verify that the local DSA is present in the source replicates-to list. If not,
/// the local DSA is added. This ensures that the source sends change notifications.
/// </para>
/// <para>DS_REPSYNC_ALL_SOURCES</para>
/// <para>This value is not supported.</para>
/// <para>
/// <c>Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista and Windows Server 2003:</c> Synchronizes from all sources.
/// <para>Performs this operation asynchronously.</para>
/// <para>
/// <c>Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista and Windows Server 2003:</c> Required when using <c>DS_REPSYNC_ALL_SOURCES</c>.
/// </para>
/// <para>DS_REPSYNC_FORCE</para>
/// <para>Synchronizes even if the link is currently disabled.</para>
/// <para>DS_REPSYNC_FULL</para>
/// <para>Synchronizes starting from the first Update Sequence Number (USN).</para>
/// <para>DS_REPSYNC_INTERSITE_MESSAGING</para>
/// <para>Synchronizes using an ISM.</para>
/// <para>DS_REPSYNC_NO_DISCARD</para>
/// <para>Does not discard this synchronization request, even if a similar synchronization is pending.</para>
/// <para>DS_REPSYNC_PERIODIC</para>
/// <para>Indicates this operation is a periodic synchronization request as scheduled by the administrator.</para>
/// <para>DS_REPSYNC_URGENT</para>
/// <para>Indicates this operation is a notification of an update marked urgent.</para>
/// <para>DS_REPSYNC_WRITEABLE</para>
/// <para>Replica is writable. Otherwise, it is read-only.</para></param>
/// <returns>
/// <para>If the function performs its operation successfully, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value is one of the standard Win32 API errors.</para>
/// </returns>
/// <remarks>
/// <para>
/// The server that <c>DsReplicaSync</c> executes on is called the destination. The destination naming context is brought up-to-date
/// with respect to a source system, identified by the UUID of the source system NTDS Settings object. The destination system must
/// already be configured so that the source system is one of the systems from which it receives replication data.
/// </para>
/// <para>
/// <c>Note</c> Forcing manual synchronization can prevent the directory service from properly prioritizing replication operations.
/// For example, synchronizing a new user may preempt an urgent synchronization performed to provide access to a recently locked out
/// user or to add a new trust password. If you call this API often, you can flood the network with requests, which can interfere
/// with other replication operations. For this reason, it is strongly recommended that this function be used only for single-use
/// scenarios rather than incorporating it into an application that would use it on a regular basis.
/// The <c>DsReplicaSyncAll</c> function synchronizes a server with all other servers, using transitive replication, as necessary. By
/// default, <c>DsReplicaSyncAll</c> synchronizes the server with all other servers in its site; however, you can also use it to
/// synchronize across site boundaries.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="pszNameContext">Pointer to a null-terminated string that specifies the distinguished name of the naming context to synchronize. The
/// pszNameContext parameter is optional; if its value is <c>NULL</c>, the configuration naming context is replicated.</param>
/// <param name="ulFlags"><para>Passes additional data used to process the request. This parameter can be a combination of the following values.</para>
/// <para>Disables transitive replication. Synchronization is performed only with adjacent servers.</para></param>
/// <param name="pFnCallBack">Pointer to an application-defined SyncUpdateProc function called by the <c>DsReplicaSyncAll</c> function when it encounters an
/// error, initiates synchronization of two servers, completes synchronization of two servers, or finishes synchronization of all the
/// servers in the site.</param>
/// <param name="pCallbackData">Pointer to application-defined data passed as the first argument of the SyncUpdateProc callback function pointed to by the
/// pFnCallBack parameter.</param>
/// <param name="pErrors">A NULL-terminated array of pointers to DS_REPSYNCALL_ERRINFO structures that contain errors that occurred during synchronization.
/// The memory used to hold both the array of pointers and the MsCS\mscs\clusctl_resource_type_get_private_property_fmts.xml data is
/// allocated as a single block of memory and should be freed when no longer required by a single call to <c>LocalFree</c> with the
/// pointer value returned in pErrors used as the argument.</param>
/// <returns>
/// <para>If the function succeeds, the return value is <c>ERROR_SUCCESS</c>.</para>
/// <para>If the function fails, the return value is as follows.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>DsReplicaSyncAll</c> function attempts to bind to all servers before generating a topology to synchronize from. If a
/// server cannot be contacted, the function excludes that server from the topology and attempts to work around it. Setting the
/// <c>DS_REPSYNCALL_SKIP_INITIAL_CHECK</c> flag in ulFlags bypasses the initial binding.
/// </para>
/// <para>
/// If a server cannot be contacted, the <c>DsReplicaSyncAll</c> function attempts to route around it and replicate from as many
/// servers as possible, unless <c>DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE</c> is set in ulFlags.
/// </para>
/// <para>
/// The <c>DsReplicaSyncAll</c> function can use the callback function pointed to by pFnCallBack to keep an end user informed about
/// the current status of the replication. Execution of the <c>DsReplicaSyncAll</c> function pauses when it calls the function
/// pointed to by pFnCallBack. If the return value from the callback function is <c>TRUE</c>, replication continues; otherwise, the
/// <c>DsReplicaSyncAll</c> function terminates replication.
/// The <c>DsReplicaUpdateRefs</c> function adds or removes a replication reference for a destination from a source naming context.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="NameContext">Pointer to a constant null-terminated string that specifies the distinguished name of the source naming context.</param>
/// <param name="DsaDest">Pointer to a constant null-terminated string that specifies the transport-specific address of the destination directory system agent.</param>
/// <param name="pUuidDsaDest">Pointer to a <c>UUID</c> value that contains the destination directory system agent.</param>
/// <param name="Options"><para>
/// Contains a set of flags that provide additional data used to process the request. This can be zero or a combination of one or
/// more of the following values.
/// </para>
/// <para>DS_REPUPD_ADD_REFERENCE</para>
/// <para>A reference to the destination is added to the source server.</para>
/// <para>DS_REPUPD_ASYNCHRONOUS_OPERATION</para>
/// <para>The operation is performed asynchronously.</para>
/// <para>DS_REPUPD_DELETE_REFERENCE</para>
/// <para>A reference to the destination is removed from the source server.</para>
/// <para>DS_REPUPD_WRITEABLE</para>
/// <para>The reference to the replica added or removed is writable. Otherwise, it is read-only.</para></param>
/// <returns>
/// <para>If the function succeeds, <c>ERROR_SUCCESS</c> is returned.</para>
/// <para>If the function fails, the return value can be one of the following.</para>
/// </returns>
/// <remarks>
/// If both <c>DS_REPUPD_ADD_REFERENCE</c> and <c>DS_REPUPD_DELETE_REFERENCE</c> are set in the Options parameter, a reference to the
/// destination is added if one does not already exist on the server. If a reference to the destination already exists, the reference
/// The <c>DsServerRegisterSpn</c> function composes two SPNs for a host-based service. The names are based on the DNS and NetBIOS
/// names of the local computer. The function modifies the <c>servicePrincipalName</c> attribute of either a specified account or of
/// the account associated with the calling thread. The function either registers or unregisters the SPNs.
/// </para>
/// <para>
/// A host-based service is a service instance that provides services identified with its host computer, as distinguished from a
/// replicable service where clients have no preference which host computer a service instance runs on.
/// </para>
/// </summary>
/// <param name="Operation"><para>Specifies what operation <c>DsServerRegisterSpn</c> should perform. This parameter can have one of the following values.</para>
/// <para>DS_SPN_ADD_SPN_OP</para>
/// <para>Adds the SPNs to the user or computer account.</para>
/// <para>DS_SPN_DELETE_SPN_OP</para>
/// <para>Deletes the specified SPNs from the account.</para>
/// <para>DS_SPN_REPLACE_SPN_OP</para>
/// <para>Removes all SPNs currently registered on the user or computer account and replaces them with the new SPNs.</para></param>
/// <param name="ServiceClass">Pointer to a constant null-terminated string specifying the class of the service. This parameter may be any string unique to that
/// service; either the protocol name (for example, ldap) or the string form of a GUID will work.</param>
/// <param name="UserObjectDN">Pointer to a constant null-terminated string specifying the distinguished name of a user or computer account object to write the
/// SPNs to. If this parameter is <c>NULL</c>, <c>DsServerRegisterSpn</c> writes to the account object of the primary or impersonated
/// user associated with the calling thread. If the thread is running in the security context of the LocalSystem account, the
/// function writes to the account object of the local computer.</param>
/// <returns>
/// If the function successfully registers one or more SPNs, it returns <c>ERROR_SUCCESS</c>. Modification is performed permissively,
/// so that adding a value that already exists does not return an error.
/// </returns>
/// <remarks>
/// <para>The two SPNs composed by the <c>DsServerRegisterSpn</c> function have the following format:</para>
/// <para>
/// In one SPN, the host computer is the fully qualified DNS name of the local computer. In the other SPN, the host component is the
/// NetBIOS name of the local computer.
/// </para>
/// <para>
/// In most cases, the <c>DsServerRegisterSpn</c> caller must have domain administrator privileges to successfully modify the
/// <c>servicePrincipalName</c> attribute of an account object. The exception to this rule is if the calling thread is running under
/// the LocalSystem account, <c>DsServerRegisterSpn</c> is allowed if the UserObjectDN parameter is either <c>NULL</c> or specifies
/// the distinguished name of the local computer account.
/// The <c>DsUnBind</c> function finds an RPC session with a domain controller and unbinds a handle to the directory service (DS).
/// </summary>
/// <param name="phDS">Pointer to a bind handle to the directory service. This handle is provided by a call to DsBind, DsBindWithCred, or DsBindWithSpn.</param>
/// The <c>DsWriteAccountSpn</c> function writes an array of service principal names (SPNs) to the <c>servicePrincipalName</c>
/// attribute of a specified user or computer account object in Active Directory Domain Services. The function can either register or
/// unregister the SPNs.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="Operation">Contains one of the DS_SPN_WRITE_OP values that specifies the operation that <c>DsWriteAccountSpn</c> will perform.</param>
/// <param name="pszAccount">Pointer to a constant null-terminated string that specifies the distinguished name of a user or computer object in Active
/// Directory Domain Services. The caller must have write access to the <c>servicePrincipalName</c> property of this object.</param>
/// <param name="cSpn">Specifies the number of SPNs in rpszSpn. If this value is zero, and Operation contains <c>DS_SPN_REPLACE_SPN_OP</c>, the function
/// removes all values from the <c>servicePrincipalName</c> attribute of the specified account.</param>
/// <param name="rpszSpn">Pointer to an array of constant null-terminated strings that specify the SPNs to be added to or removed from the account
/// identified by the pszAccount parameter. The DsGetSpn function is used to compose SPNs for a service.</param>
/// <returns>
/// Returns <c>ERROR_SUCCESS</c> if successful or a Win32, RPC or directory service error if unsuccessful.
/// </returns>
/// <remarks>
/// <para>
/// The <c>DsWriteAccountSpn</c> function registers the SPNs for one or more instances of a service. SPNs are used by clients, in
/// conjunction with a trusted authentication service, to authenticate the service. To protect against security attacks where an
/// application or service fraudulently registers an SPN that identifies some other service, the default DACL on user and computer
/// accounts allows only domain administrators to register SPNs in most cases.
/// </para>
/// <para>
/// One exception to this rule is that a service running under the LocalSystem account can call <c>DsWriteAccountSpn</c> to register
/// a simple SPN of the form "ServiceClass/Host:Port" if the host specified in the SPN is the DNS or NetBIOS name of the computer on
/// which the service is running.
/// </para>
/// <para>
/// Another exception is that the default DACL on computer accounts allows callers to register SPNs on themselves, subject to certain
/// constraints. For example, a computer account can have SPNs relative to its computername, of the form "host/<computername>".
/// Because the computername is contained in the SPN, the SPN is allowable.
/// </para>
/// <para>
/// None of the rules above apply if the DSA is configured to allow any SPN to be written. This reduces security, however, so it is
/// not recommended.
/// </para>
/// <para>
/// SPNs passed to <c>DsWriteAccountSpn</c> are actually added to the <c>Service-Principal-Name</c> attribute of the computer object
/// in pszAccount. This call is made using RPC to the domain controller where the account object is stored so it can securely enforce
/// policy on what SPNs are allowed on the account. Using LDAP to write directly to the SPN property is not allowed; all writes must
/// come through this RPC call. Reads using LDAP are allowed.
/// </para>
/// <para>Permissions required to set SPNs</para>
/// <para>
/// To write an arbitrary SPN on an account, the writer requires the "Write ServicePrincipalName" right, which is not granted by
/// default to the person who created the account. That person has the 'Write validated SPN" right(present only on machine accounts).
/// </para>
/// <para>Below is a summary of rights per user on machine accounts:</para>
/// <list type="table">
/// <listheader>
/// <term>User Type</term>
/// <term>Rights</term>
/// </listheader>
/// <item>
/// <term>Person creating the Account</term>
/// <term>Write validated SPN</term>
/// </item>
/// <item>
/// <term>Account Operators</term>
/// <term>Write SPN and Write Validated SPN</term>
/// </item>
/// <item>
/// <term>Authenticated Users</term>
/// <term>None</term>
/// </item>
/// <item>
/// <term>(self)</term>
/// <term>Write Validated SPN</term>
/// </item>
/// </list>
/// <para>
/// On user accounts there is no "Validated SPN" property or "Write SPN" right. Rather, the "Write public information" property set
/// The <c>DsReplicaGetInfo2</c> function retrieves replication state data from the directory service. This function allows paging of
/// results in cases where there are more than 1000 entries to retrieve.
/// </summary>
/// <param name="hDS">Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.</param>
/// <param name="InfoType">Contains one of the DS_REPL_INFO_TYPE values that specifies the type of replication data to retrieve. This value also determines
/// which type of structure is returned in ppInfo.</param>
/// <param name="pszObject"><para>
/// Pointer to a constant null-terminated Unicode string that identifies the object to retrieve replication data for. The meaning of
/// this parameter depends on the value of the InfoType parameter. The following are possible value codes.
/// </para>
/// <para>DS_REPL_INFO_NEIGHBORS</para>
/// <para>pszObject identifies the naming context for which replication neighbors are requested.</para>
/// <para>DS_REPL_INFO_CURSORS_FOR_NC</para>
/// <para>pszObject identifies the naming context for which replication cursors are requested.</para>
/// <para>DS_REPL_INFO_METADATA_FOR_OBJ</para>
/// <para>pszObject identifies the object for which replication metadata is requested.</para>
/// <para>pszObject identifies the object for which attribute replication metadata is requested.</para></param>
/// <param name="puuidForSourceDsaObjGuid">Pointer to a <c>GUID</c> value that identifies a specific replication source. If this parameter is not <c>NULL</c> and the
/// InfoType parameter contains <c>DS_REPL_INFO_NEIGHBORS</c>, only neighbor data for the source corresponding to the nTDSDSA object
/// with the given <c>objectGuid</c> in the directory is returned. This parameter is ignored if <c>NULL</c> or if the InfoType
/// parameter is anything other than <c>DS_REPL_INFO_NEIGHBORS</c>.</param>
/// <param name="pszAttributeName"><para>
/// Pointer to a null-terminated Unicode string that contains the name of the specific attribute to retrieve replication data for.
/// </para>
/// <para>This parameter is only used if the InfoType parameter contains one of the following values.</para>
/// <param name="pszValue">Pointer to a null-terminated Unicode string that contains the distinguished name value to match. If the requested attribute is a
/// distinguished name type value, this function return the attributes that contain the specified value.</param>
/// <param name="dwFlags"><para>Contains a set of flags that modify the behavior of the function. This parameter can be zero or the following value.</para>
/// Causes the attribute metadata to account for metadata on the attribute's linked values. The resulting vector represents changes
/// for all attributes. This modified vector is useful for clients that expect all attributes and metadata to be included in the
/// attribute metadata vector.
/// </para></param>
/// <param name="dwEnumerationContext"><para>Contains the index of the next entry to retrieve. This parameter must be set to zero the first time this function is called.</para>
/// <para>This parameter is only used if the InfoType parameter contains one of the following values.</para>
/// <summary>Provides a <see cref="SafeHandle"/> to an authentication identity that releases its handle at disposal using DsFreePasswordCredentials.</summary>
/// <summary>A <see cref="SafeHandle"/> for the results from <see cref="DsReplicaGetInfo2W(SafeDsHandle, DS_REPL_INFO_TYPE, string, Guid?, string, string, DsReplInfoFlags, uint, out SafeDsReplicaInfo)"/>.</summary>