GetFriendlyNameOfCertW function (cryptdlg.h)

[The GetFriendlyNameOfCert function is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use the CertGetNameString function with the CERT_NAME_FRIENDLY_DISPLAY_TYPE flag.]

The GetFriendlyNameOfCert function retrieves the display name for a certificate.

Note  This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to CryptDlg.dll.


  [in] PCCERT_CONTEXT pccert,
       LPWSTR         pwch,
       DWORD          cwch


[in] pccert

A pointer to the certificate context whose display name is being retrieved.


A pointer to a character string that receives the display name for the certificate.


Number of characters allocated for pwch, including the terminating NULL character.

Return value

The return value is the number of characters, including the terminating NULL character, in the returned display name.



The cryptdlg.h header defines GetFriendlyNameOfCert as an alias which 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 not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header cryptdlg.h
DLL CryptDlg.dll