Click to Rate and Give Feedback
MSDN
MSDN Library
Security
Authorization
 LookupPrivilegeValue Function
LookupPrivilegeValue Function

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

Syntax

C++
BOOL WINAPI LookupPrivilegeValue(
  __in_opt  LPCTSTR lpSystemName,
  __in      LPCTSTR lpName,
  __out     PLUID lpLuid
);

Parameters

lpSystemName [in, optional]

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.

lpName [in]

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".

lpLuid [out]

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.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesLookupPrivilegeValueW (Unicode) and LookupPrivilegeValueA (ANSI)

See Also

Access Control
Basic Access Control Functions
LookupPrivilegeDisplayName
LookupPrivilegeName

Send comments about this topic to Microsoft

Build date: 9/11/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("advapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function LookupPrivilegeValue(<MarshalAs(UnmanagedType.LPTStr)> ByVal lpSystemName As String, <MarshalAs(UnmanagedType.LPTStr)> ByVal lpName As String, <Out> ByRef lpLuid As LUID) As Boolean End Function
Flag as ContentBug
C# syntax      dmex   |   Edit   |   Show History
[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool LookupPrivilegeValue([MarshalAs(UnmanagedType.LPTStr)] string lpSystemName, [MarshalAs(UnmanagedType.LPTStr)] string lpName, out LUID lpLuid);
Tags What's this?: c# (x) syntax (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker