I’m trying to see if the user has the SeLoadDriver privilege. I’ve got the PLUID :
PLUID pld;
LookupPrivilegeValue(NULL, SE_LOAD_DRIVER_NAME, pld);
But now i’m not sure how to get a bool from the PLUID stating that the user has, or not, the privilege. I’ve read the related methods but it think that it might be an easy way of getting this directly from the PLUID value.
Thanks
It’s a little more involved than that.
First you need to obtain the process token’s privilege set (by calling
GetTokenInformation()) then you scan the buffer that you’ve got from that (which is an array ofLUID_AND_ATTRIBUTESstructures) for the LUID that you get fromLookupPrivilegeValue(). You can then use theLUID_AND_ATTRIBUTESthat you’ve located and check to see if theAttributescontain the required flag (SE_PRIVILEGE_ENABLEDin your case).Be aware that when you are checking for an enabled privilege you should also check that
SE_PRIVILEGE_REMOVEDis NOT set in theAttributesthat you are checking; a privilege that has bothSE_PRIVILEGE_REMOVEDandSE_PRIVILEGE_ENABLEDhas been removed and is NOT enabled…