use of com.sun.jna.platform.win32.WinNT.SECURITY_DESCRIPTOR in project jna by java-native-access.
the class Advapi32Test method testSetGetSecurityDescriptorControl.
public void testSetGetSecurityDescriptorControl() {
SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR(64 * 1024);
assertTrue(Advapi32.INSTANCE.InitializeSecurityDescriptor(sd, WinNT.SECURITY_DESCRIPTOR_REVISION));
assertTrue(Advapi32.INSTANCE.SetSecurityDescriptorControl(sd, (short) WinNT.SE_DACL_PROTECTED, (short) WinNT.SE_DACL_PROTECTED));
ShortByReference pControl = new ShortByReference();
IntByReference lpdwRevision = new IntByReference();
assertTrue(Advapi32.INSTANCE.GetSecurityDescriptorControl(sd, pControl, lpdwRevision));
assertTrue(pControl.getValue() == WinNT.SE_DACL_PROTECTED);
assertTrue(lpdwRevision.getValue() == WinNT.SECURITY_DESCRIPTOR_REVISION);
}
use of com.sun.jna.platform.win32.WinNT.SECURITY_DESCRIPTOR in project jna by java-native-access.
the class Advapi32Test method testMakeSelfRelativeSD.
public void testMakeSelfRelativeSD() {
SECURITY_DESCRIPTOR absolute = new SECURITY_DESCRIPTOR(64 * 1024);
assertTrue(Advapi32.INSTANCE.InitializeSecurityDescriptor(absolute, WinNT.SECURITY_DESCRIPTOR_REVISION));
SECURITY_DESCRIPTOR_RELATIVE relative = new SECURITY_DESCRIPTOR_RELATIVE(64 * 1024);
IntByReference lpdwBufferLength = new IntByReference(64 * 1024);
assertTrue(Advapi32.INSTANCE.MakeSelfRelativeSD(absolute, relative, lpdwBufferLength));
assertEquals(WinNT.SECURITY_DESCRIPTOR_REVISION, relative.Revision);
}
Aggregations