use of jnc.platform.win32.EXPLICIT_ACCESS in project judge by zjnu-acm.
the class RestrictedToken method addSidToDacl.
private static void addSidToDacl(long pSid, long oldDacl, ACCESS_MODE accessMode, int access, AddressByReference newDacl) {
EXPLICIT_ACCESS newAccess = new EXPLICIT_ACCESS();
newAccess.setAccessMode(accessMode);
newAccess.setAccessPermissions(access);
newAccess.setInheritance(NO_INHERITANCE);
TRUSTEE trustee = newAccess.getTrustee();
trustee.setMultipleTrustee(0);
trustee.setMultipleTrusteeOperation(NO_MULTIPLE_TRUSTEE);
trustee.setTrusteeForm(TRUSTEE_IS_SID);
trustee.setName(pSid);
int error = Advapi32.INSTANCE.SetEntriesInAclW(1, newAccess, oldDacl, newDacl);
if (error != ERROR_SUCCESS) {
throw new Win32Exception(error);
}
}
use of jnc.platform.win32.EXPLICIT_ACCESS in project judge by zjnu-acm.
the class RestrictedToken method addSidToDacl.
private static void addSidToDacl(Pointer pSid, Pointer oldDacl, ACCESS_MODE accessMode, int access, PointerByReference newDacl) {
EXPLICIT_ACCESS newAccess = new EXPLICIT_ACCESS();
newAccess.setAccessMode(accessMode);
newAccess.setAccessPermissions(access);
newAccess.setInheritance(NO_INHERITANCE);
TRUSTEE trustee = newAccess.getTrustee();
trustee.setMultipleTrustee(0);
trustee.setMultipleTrusteeOperation(NO_MULTIPLE_TRUSTEE);
trustee.setTrusteeForm(TRUSTEE_IS_SID);
trustee.setTrusteeType(TRUSTEE_IS_UNKNOWN);
trustee.setName(pSid);
if (log.isDebugEnabled()) {
log.debug("addSidToDacl: {} {}", accessMode, SID.toString(pSid));
}
int error = Advapi32.INSTANCE.SetEntriesInAclW(1, newAccess, oldDacl, newDacl);
if (error != ERROR_SUCCESS) {
throw new Win32Exception(error);
}
}
Aggregations