471,603 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,603 software developers and data experts.

LookupPrivilegeValue function always return true irrespective of privilege status

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

Jan 4 '06 #1
1 3196
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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.