LookupPrivilegeNameA function (winbase.h)
The LookupPrivilegeName function retrieves the name that corresponds to the privilege represented on a specific system by a specified locally unique identifier (LUID).
Syntax
BOOL LookupPrivilegeNameA(
[in, optional] LPCSTR lpSystemName,
[in] PLUID lpLuid,
[out, optional] LPSTR lpName,
[in, out] LPDWORD cchName
);
Parameters
[in, optional] lpSystemName
A pointer to a null-terminated string that specifies the name of the system on which the privilege name is retrieved. If a null string is specified, the function attempts to find the privilege name on the local system.
[in] lpLuid
A pointer to the LUID by which the privilege is known on the target system.
[out, optional] lpName
A pointer to a buffer that receives a null-terminated string that represents the privilege name. For example, this string could be "SeSecurityPrivilege".
[in, out] cchName
A pointer to a variable that specifies the size, in a TCHAR value, of the lpName buffer. When the function returns, this parameter contains the length of the privilege name, not including the terminating null character. If the buffer pointed to by the lpName parameter is too small, this variable contains the required size.
Return value
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. To get extended error information, call GetLastError.
Remarks
The LookupPrivilegeName function supports only the privileges specified in the Defined Privileges section of Winnt.h. For a list of values, see Privilege Constants.
Note
The winbase.h header defines LookupPrivilegeName 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 XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winbase.h (include Windows.h) |
Library | Advapi32.lib |
DLL | Advapi32.dll |