RpcServerInqDefaultPrincNameA function (rpcdce.h)

The RpcServerInqDefaultPrincName function obtains the default principal name for a given authentication service.

Syntax

RPC_STATUS RpcServerInqDefaultPrincNameA(
  unsigned long AuthnSvc,
  RPC_CSTR      *PrincName
);

Parameters

AuthnSvc

Authentication service to use when the server receives a request for a remote procedure call.

PrincName

Upon success, contains the default principal name for the given authentication service as specified by the AuthnSvc parameter. The authentication service in use defines the content of the name and its syntax. This principal name must be used as the ServerPrincName parameter of the RpcServerRegisterAuthInfo function. If the function succeeds, PrincName must be freed using the RpcStringFree function. If the function fails, the contents of PrincName is undefined and the caller has no obligation to free it.

Return value

Value Meaning
RPC_S_OK
The call succeeded.
RPC_S_OUT_OF_MEMORY
There is insufficient memory to complete the operation.
 
Note  For a list of valid error codes, see RPC Return Values.
 

Remarks

This function is the recommended way to obtain the server principal name to be passed to the RpcServerRegisterAuthInfo function. While composing the server principal name is possible without using this function, calling the function is easier and more portable across operating system versions.

Note

The rpcdce.h header defines RpcServerInqDefaultPrincName as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header rpcdce.h (include Rpc.h)
Library Rpcrt4.lib
DLL Rpcrt4.dll

See also

RpcBindingSetAuthInfo

RpcServerRegisterAuthInfo