SecMakeSPN function (ntifs.h)

SecMakeSPN creates a service provider name string that can be used when communicating with specific security service providers.

Syntax

KSECDDDECLSPEC NTSTATUS SecMakeSPN(
  [in]            IN PUNICODE_STRING     ServiceClass,
  [in]            IN PUNICODE_STRING     ServiceName,
  [in, optional]  IN PUNICODE_STRING     InstanceName,
  [in, optional]  IN USHORT              InstancePort,
  [in, optional]  IN PUNICODE_STRING     Referrer,
  [in, out]       IN OUT PUNICODE_STRING Spn,
  [out, optional] OUT PULONG             Length,
  [in]            IN BOOLEAN             Allocate
);

Parameters

[in] ServiceClass

A pointer to a Unicode string specifying the service class for the security service provider.

[in] ServiceName

A pointer to a Unicode string specifying the service name for the security service provider.

[in, optional] InstanceName

A pointer to an optional Unicode string specifying the instance name for connecting with the security service provider.

[in, optional] InstancePort

Port number for an instance of the service. Use 0 for the default port. If this parameter is zero, the SPN does not include a port number.

[in, optional] Referrer

Pointer to a constant null-terminated string that specifies the DNS name of the host that gave an IP address referral. This parameter is ignored unless the ServiceName parameter specifies an IP address.

[in, out] Spn

A pointer to a Unicode string for storing the security service provider name string created by this function.

[out, optional] Length

Pointer to a ULONG that receives the actual length of the SPN created, including the terminating null character.

[in] Allocate

A Boolean variable indicating if the memory for storing the Spn Unicode string should be allocated by this function. If this parameter is true, memory for Spn will be allocated from paged pool.

Return value

SecMakeSPN returns STATUS_SUCCESS on success or one of the following error codes on failure.

Return code Description
STATUS_BUFFER_OVERFLOW The Allocate parameter was set to false and one of the following conditions occurred: (1) The Spn parameter was a NULL pointer. (2) The maximum length for the Spn Unicode string parameter was too small.
STATUS_INVALID_PARAMETER A total length of the Spn parameter exceeds 65535 bytes.
STATUS_NO_MEMORY The Allocate parameter was set to true, but the memory allocation request failed.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h, FltKernel.h)
Library Ksecdd.lib
IRQL <= APC_LEVEL

See also

SecMakeSPNEx

SecMakeSPNEx2