The RpcMgmtInqServerPrincName function returns a server's principal name.
This function is supported by both 32-bit platforms — Windows NT and Windows 95. Note that it is supported only in ANSI on Windows 95.
#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcMgmtInqServerPrincName( 
  RPC_BINDING_HANDLE  Binding,        
  unsigned int  AuthnSvc,             
  unsigned char * *  ServerPrincName  
);
 | Value | Description | 
|---|---|
| RPC_C_AUTHN_NONE | No authentication | 
| RPC_C_AUTHN_WINNT | Windows NT authentication service | 
An application calls the RpcMgmtInqServerPrincName routine to obtain the principal name of a server that is registered for a specified authentication service.
The RPC run-time library allocates memory for string returned in ServerPrincName. The application is responsible for calling the RpcStringFree routine to release the memory used by this routine.
| Value | Meaning | 
|---|---|
| RPC_S_OK | Success | 
| RPC_S_INVALID_BINDING | Invalid binding handle | 
| RPC_S_WRONG_KIND_OF_BINDING | Wrong kind of binding for operation | 
  Windows NT:  Yes
  Windows CE:  Unsupported.
  Header: Declared in rpcdce.h.
  Import Library: Link with rpcrt4.lib.