Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.LongByReference


                        val = new Long(Long.parseLong((String)val)).longValue();
                    } else {
                        throw new RuntimeException("Attempt to pass ineligible value to long: "+val);
                    }
                }
                return new LongByReference((Long)val);
               
            case 'f':
                if ( !float.class.isInstance(val) ){
                    if ( Number.class.isInstance(val) ){
                        val = ((Number)val).floatValue();
View Full Code Here


            args[0] = peer;
            args[1] = parent;
            for ( int i=2; i<numArgs; i++){
                long argumentSigAddr = (Long)pSig.send("getArgumentTypeAtIndex:", i);
                String argumentSignature = new Pointer(argumentSigAddr).getString(0);
                LongByReference ptrRef = new LongByReference();
                msg(invocation, "getArgument:atIndex:", ptrRef.getPointer(), i);
                args[i] = ptrRef.getValue();
            }
            char retTypeChar = strReturnType.charAt(0);
           
            Class retType = null;
            switch ( retTypeChar){
View Full Code Here

                                        //argPtr.toNative(),
                                        argumentSignature,
                                        TypeMapper.getInstance()
                                );
                    } else {
                        LongByReference ptrRef = new LongByReference();
                       
                        msg(invocation, "getArgument:atIndex:", ptrRef.getPointer(), i);
                      
                        args[i-2] = TypeMapper
                                    .getInstance()
                                    .cToJ(
                                        ptrRef.getValue(),
                                        //argPtr.toNative(),
                                        argumentSignature,
                                        TypeMapper.getInstance()
                                );
                    }
View Full Code Here

        IntByReference iref = new IntByReference();
        lib.incrementInt32ByReference(iref);
        assertEquals("Int argument not modified", 1, iref.getValue());
    }
    public void testLongByReference() {
        LongByReference lref = new LongByReference();
        lib.incrementInt64ByReference(lref);
        assertEquals("Long argument not modified", 1, lref.getValue());
    }
View Full Code Here

   
    private void testAlignStruct(int index) {
        AlignmentTest lib = (AlignmentTest)Native.loadLibrary("testlib", AlignmentTest.class);
        try {
            IntByReference offset = new IntByReference();
            LongByReference value = new LongByReference();
            Class cls = Class.forName(getClass().getName() + "$TestStructure" + index);
            Structure s = (Structure)cls.newInstance();
            int result = lib.testStructureAlignment(s, index, offset, value);
            assertEquals("Wrong native value at field " + result
                         + "=0x" + Long.toHexString(value.getValue())
                         + " (actual native field offset=" + offset.getValue()
                         + ") in " + s, -2, result);
        }
        catch(Exception e) {
            throw new Error(e);
View Full Code Here

                        val = new Long(Long.parseLong((String)val)).longValue();
                    } else {
                        throw new RuntimeException("Attempt to pass ineligible value to long: "+val);
                    }
                }
                return new LongByReference((Long)val);
               
            case 'f':
                if ( !float.class.isInstance(val) ){
                    if ( Number.class.isInstance(val) ){
                        val = ((Number)val).floatValue();
View Full Code Here

    private void testAlignStruct(int index) {
        AlignmentTest lib = (AlignmentTest)Native.loadLibrary("testlib", AlignmentTest.class);
        try {
            IntByReference offset = new IntByReference();
            LongByReference value = new LongByReference();
            Class cls = Class.forName(getClass().getName() + "$TestStructure" + index);
            Structure s = (Structure)cls.newInstance();
            int result = lib.testStructureAlignment(s, index, offset, value);
            assertEquals("Wrong native value at field " + result
                         + "=0x" + Long.toHexString(value.getValue())
                         + " (actual native field offset=" + offset.getValue()
                         + ") in " + s, -2, result);
        }
        catch(Exception e) {
            throw new Error(e);
View Full Code Here

    private void testAlignStruct(int index) {
        AlignmentTest lib = (AlignmentTest)Native.loadLibrary("testlib", AlignmentTest.class);
        try {
            IntByReference offset = new IntByReference();
            LongByReference value = new LongByReference();
            Class cls = Class.forName(getClass().getName() + "$TestStructure" + index);
            Structure s = (Structure)cls.newInstance();
            int result = lib.testStructureAlignment(s, index, offset, value);
            assertEquals("Wrong native value at field " + result
                         + "=0x" + Long.toHexString(value.getValue())
                         + " (actual native field offset=" + offset.getValue()
                         + ") in " + s, -2, result);
        }
        catch(Exception e) {
            throw new Error(e);
View Full Code Here

    }
    if (lpType.getValue() != WinNT.REG_QWORD) {
      throw new RuntimeException("Unexpected registry type "
          + lpType.getValue() + ", expected REG_QWORD");
    }
    LongByReference data = new LongByReference();
    rc = Advapi32.INSTANCE.RegQueryValueEx(hKey, value, 0,
        lpType, data, lpcbData);
    if (rc != W32Errors.ERROR_SUCCESS
        && rc != W32Errors.ERROR_INSUFFICIENT_BUFFER) {
      throw new Win32Exception(rc);
    }
    return data.getValue();
  }
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.LongByReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.