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;
}
}
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());
}
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());
}
Aggregations