Search in sources :

Example 6 with BOOLByReference

use of com.sun.jna.platform.win32.WinDef.BOOLByReference in project jna by java-native-access.

the class Rasapi32Util method getPhoneBookDialingParams.

/**
	 * get a phone book entry's dialing parameters
	 * @param entryName the phone book entry name
	 * @return the entry's dialing parameters parameters
	 * @throws Ras32Exception errors
	 */
public static RASDIALPARAMS getPhoneBookDialingParams(String entryName) throws Ras32Exception {
    synchronized (phoneBookMutex) {
        RASDIALPARAMS.ByReference rasDialParams = new RASDIALPARAMS.ByReference();
        System.arraycopy(rasDialParams.szEntryName, 0, entryName.toCharArray(), 0, entryName.length());
        BOOLByReference lpfPassword = new BOOLByReference();
        int err = Rasapi32.INSTANCE.RasGetEntryDialParams(null, rasDialParams, lpfPassword);
        if (err != WinError.ERROR_SUCCESS)
            throw new Ras32Exception(err);
        return rasDialParams;
    }
}
Also used : BOOLByReference(com.sun.jna.platform.win32.WinDef.BOOLByReference) RASDIALPARAMS(com.sun.jna.platform.win32.WinRas.RASDIALPARAMS) BOOLByReference(com.sun.jna.platform.win32.WinDef.BOOLByReference) HANDLEByReference(com.sun.jna.platform.win32.WinNT.HANDLEByReference) IntByReference(com.sun.jna.ptr.IntByReference)

Example 7 with BOOLByReference

use of com.sun.jna.platform.win32.WinDef.BOOLByReference in project jna by java-native-access.

the class TypeLibUtil method IsName.

/**
     * Checks if is name.
     * 
     * @param nameBuf
     *            the name buf
     * @param hashVal
     *            the hash val
     * @return the checks if is name
     */
public IsName IsName(String nameBuf, int hashVal) {
    LPOLESTR szNameBuf = new LPOLESTR(nameBuf);
    ULONG lHashVal = new ULONG(hashVal);
    BOOLByReference pfName = new BOOLByReference();
    HRESULT hr = this.typelib.IsName(szNameBuf, lHashVal, pfName);
    COMUtils.checkRC(hr);
    return new IsName(szNameBuf.getValue(), pfName.getValue().booleanValue());
}
Also used : ULONG(com.sun.jna.platform.win32.WinDef.ULONG) BOOLByReference(com.sun.jna.platform.win32.WinDef.BOOLByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) LPOLESTR(com.sun.jna.platform.win32.WTypes.LPOLESTR)

Example 8 with BOOLByReference

use of com.sun.jna.platform.win32.WinDef.BOOLByReference in project jna by java-native-access.

the class Advapi32Test method testAccessCheck.

public void testAccessCheck() {
    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 Memory securityDescriptorMemoryPointer = new Memory(1);
    final PRIVILEGE_SET privileges = new PRIVILEGE_SET(1);
    privileges.PrivilegeCount = new DWORD(0);
    final DWORDByReference privilegeLength = new DWORDByReference(new DWORD(privileges.size()));
    final DWORDByReference grantedAccess = new DWORDByReference();
    final BOOLByReference result = new BOOLByReference();
    final boolean status = Advapi32.INSTANCE.AccessCheck(securityDescriptorMemoryPointer, null, new DWORD(FILE_GENERIC_READ), mapping, privileges, privilegeLength, grantedAccess, result);
    assertFalse(status);
    assertFalse(result.getValue().booleanValue());
    assertEquals(WinError.ERROR_INVALID_HANDLE, Kernel32.INSTANCE.GetLastError());
}
Also used : BOOLByReference(com.sun.jna.platform.win32.WinDef.BOOLByReference) PRIVILEGE_SET(com.sun.jna.platform.win32.WinNT.PRIVILEGE_SET) GENERIC_MAPPING(com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) Memory(com.sun.jna.Memory) DWORD(com.sun.jna.platform.win32.WinDef.DWORD)

Aggregations

BOOLByReference (com.sun.jna.platform.win32.WinDef.BOOLByReference)8 IntByReference (com.sun.jna.ptr.IntByReference)5 PSID (com.sun.jna.platform.win32.WinNT.PSID)3 SECURITY_DESCRIPTOR (com.sun.jna.platform.win32.WinNT.SECURITY_DESCRIPTOR)3 Memory (com.sun.jna.Memory)2 DWORD (com.sun.jna.platform.win32.WinDef.DWORD)2 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)2 GENERIC_MAPPING (com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING)2 HANDLEByReference (com.sun.jna.platform.win32.WinNT.HANDLEByReference)2 PRIVILEGE_SET (com.sun.jna.platform.win32.WinNT.PRIVILEGE_SET)2 PSIDByReference (com.sun.jna.platform.win32.WinNT.PSIDByReference)2 RASDIALPARAMS (com.sun.jna.platform.win32.WinRas.RASDIALPARAMS)2 LPOLESTR (com.sun.jna.platform.win32.WTypes.LPOLESTR)1 BOOL (com.sun.jna.platform.win32.WinDef.BOOL)1 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)1 ACCESS_ALLOWED_ACE (com.sun.jna.platform.win32.WinNT.ACCESS_ALLOWED_ACE)1 ACL (com.sun.jna.platform.win32.WinNT.ACL)1 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1 PACLByReference (com.sun.jna.platform.win32.WinNT.PACLByReference)1