TranslateNameA function (secext.h)

Converts a directory service object name from one format to another.

Syntax

BOOLEAN SEC_ENTRY TranslateNameA(
  [in]      LPCSTR               lpAccountName,
  [in]      EXTENDED_NAME_FORMAT AccountNameFormat,
  [in]      EXTENDED_NAME_FORMAT DesiredNameFormat,
  [out]     LPSTR                lpTranslatedName,
  [in, out] PULONG               nSize
);

Parameters

[in] lpAccountName

The name to be translated.

[in] AccountNameFormat

The format of the name to be translated. This parameter is a value from the EXTENDED_NAME_FORMAT enumeration type.

[in] DesiredNameFormat

The format of the converted name. This parameter is a value from the EXTENDED_NAME_FORMAT enumeration type. It cannot be NameUnknown.

[out] lpTranslatedName

A pointer to a buffer that receives the converted name.

[in, out] nSize

On input, the variable indicates the size of the lpTranslatedName buffer, in TCHARs. On output, the variable returns the size of the returned string, in TCHARs, including the terminating null character.

If lpTranslated is NULL and nSize is 0, the function succeeds and nSize receives the required buffer size.

If the lpTranslatedName buffer is too small to hold the converted name, the function fails and nSize receives the required buffer size.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

TranslateName fails if it cannot bind to Active Directory on a domain controller.

Note

The secext.h header defines TranslateName 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.

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 secext.h (include Security.h)
Library Secur32.lib
DLL Secur32.dll
API set ext-ms-win-secur32-translatename-l1-1-0 (introduced in Windows 8)

See also

Computer Names

DsCrackNames

EXTENDED_NAME_FORMAT

System Information Functions