Search in sources :

Example 6 with GENERIC_MAPPING

use of com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING in project jna by java-native-access.

the class Advapi32Test method testMapGenericWriteMask.

public void testMapGenericWriteMask() {
    final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
    mapping.genericRead = new DWORD(FILE_GENERIC_READ);
    mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
    mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
    mapping.genericAll = new DWORD(FILE_ALL_ACCESS);
    final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_WRITE));
    Advapi32.INSTANCE.MapGenericMask(rights, mapping);
    assertEquals(FILE_GENERIC_WRITE, rights.getValue().intValue());
    assertTrue(GENERIC_WRITE != (rights.getValue().intValue() & GENERIC_WRITE));
}
Also used : GENERIC_MAPPING(com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) DWORD(com.sun.jna.platform.win32.WinDef.DWORD)

Aggregations

DWORD (com.sun.jna.platform.win32.WinDef.DWORD)6 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)6 GENERIC_MAPPING (com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING)6 Memory (com.sun.jna.Memory)2 BOOLByReference (com.sun.jna.platform.win32.WinDef.BOOLByReference)2 PRIVILEGE_SET (com.sun.jna.platform.win32.WinNT.PRIVILEGE_SET)2 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)1 HANDLEByReference (com.sun.jna.platform.win32.WinNT.HANDLEByReference)1