LookupPrivilegeValue function always return true irrespective of privilege status

P

plmanikandan

Hi,

I am using LookupPrivilegeValue to check whether SE_TCB_NAME privilege
exists for the user or not in windows 2000 .The value returned from
LookupPrivilegeValue function is always true.i checked in
administartive tools for the right act as part of operating
system[SE_TCB_NAME privilege] is disabled .my code is below

//declarations
[StructLayout(LayoutKind.Sequential)]

public struct LUID
{

public int LowPart;

public int HighPart;

}
[StructLayout(LayoutKind.Sequential)]
public struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public int Attributes;

}

[DllImport("advapi32.dll", CharSet=CharSet.Auto)]
public static extern System.Boolean LookupPrivilegeValue(string
lpSystemName,string lpName,[MarshalAs(UnmanagedType.Struct)] ref LUID
lpLuid);
internal const string SE_TCB_NAME = "SeTcbPrivilege";


//calling LookupPrivilegeValue function from main
LUID tLUID = new LUID();

bool ret=LookupPrivilegeValue(null , SE_TCB_NAME, ref tLUID);


The value for ret is always true.Is there any mistake in calling
LookupPrivilegeValue function.
my program need is to check whether SE_TCB_NAME privilege exists for
the user or not.
Please help me out to solve the problem.

Regards,
Mani
 
M

Mattias Sjögren

The value for ret is always true.Is there any mistake in calling
LookupPrivilegeValue function.
my program need is to check whether SE_TCB_NAME privilege exists for
the user or not.

Then you shouldn't use LookupPrivilegeValue, it simply does a name to
LUID lookup. Try GetTokenInformation(TokenPrivileges) instead.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top