LookupPrivilegeValueA function (winbase.h)

The LookupPrivilegeValue function retrieves the locally unique identifier (LUID) used on a specified system to locally represent the specified privilege name.

Syntax

BOOL LookupPrivilegeValueA(
  [in, optional] LPCSTR lpSystemName,
  [in]           LPCSTR lpName,
  [out]          PLUID  lpLuid
);

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] lpName

A pointer to a null-terminated string that specifies the name of the privilege, as defined in the Winnt.h header file. For example, this parameter could specify the constant, SE_SECURITY_NAME, or its corresponding string, "SeSecurityPrivilege".

[out] lpLuid

A pointer to a variable that receives the LUID by which the privilege is known on the system specified by the lpSystemName parameter.

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 LookupPrivilegeValue function supports only the privileges specified in the Defined Privileges section of Winnt.h. For a list of values, see Privilege Constants.

Examples

For an example that uses this function, see Enabling and Disabling Privileges.

Note

The winbase.h header defines LookupPrivilegeValue 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

See also

Access Control

Basic Access Control Functions

LookupPrivilegeDisplayName

LookupPrivilegeName