Package com.sun.jna

Examples of com.sun.jna.Pointer


        public void setValue(PSID h) {
            getPointer().setPointer(0, h != null ? h.getPointer() : null);
        }

        public PSID getValue() {
            Pointer p = getPointer().getPointer(0);
            if (p == null) {
                return null;
            }
            else {
                return new PSID(p);
View Full Code Here


        public void setValue(HANDLE h) {
            getPointer().setPointer(0, h != null ? h.getPointer() : null);
        }

        public HANDLE getValue() {
            Pointer p = getPointer().getPointer(0);
            if (p == null) {
                return null;
            }
            if (WinBase.INVALID_HANDLE_VALUE.getPointer().equals(p)) {
                return WinBase.INVALID_HANDLE_VALUE;
View Full Code Here

            super(pointer);
            read();
            ACEs = new ACCESS_ACEStructure[AceCount];
            int offset = size();
            for (int i = 0; i < AceCount; i++) {
                Pointer share = pointer.share(offset);
                // ACE_HEADER.AceType
                final byte aceType = share.getByte(0);
                ACCESS_ACEStructure ace = null;
                switch (aceType) {
                case ACCESS_ALLOWED_ACE_TYPE:
                    ace = new ACCESS_ALLOWED_ACE(share);
                    break;
View Full Code Here

         *
         * @param pointer
         *            the pointer
         */
        public DEV_BROADCAST_HDR(long pointer) {
            this(new Pointer(pointer));
        }
View Full Code Here

        }

        int size = Version.INSTANCE.GetFileVersionInfoSize(file.getAbsolutePath(), null);
        assertTrue(size > 0);

        Pointer buffer = Kernel32.INSTANCE.LocalAlloc(WinBase.LMEM_ZEROINIT, size);
        assertTrue(!buffer.equals(Pointer.NULL));

        try
        {
            assertTrue(Version.INSTANCE.GetFileVersionInfo(file.getAbsolutePath(), 0, size, buffer));
View Full Code Here

    public void testInvalidHandleValue() {
        String EXPECTED = "@0xffffffff";
        if (Pointer.SIZE == 8) {
            EXPECTED += "ffffffff";
        }
        Pointer p = Pointer.createConstant(Pointer.SIZE == 8 ? -1 : 0xFFFFFFFFL);
        assertTrue("Wrong value: " + p, p.toString().endsWith(EXPECTED));
                    
    }
View Full Code Here

                    rects[i].x = (short)r.x;
                    rects[i].y = (short)r.y;
                    rects[i].width = (short)r.width;
                    rects[i].height = (short)r.height;
                    // Optimization: write directly to native memory
                    Pointer p = rects[i].getPointer();
                    p.setShort(0, (short)r.x);
                    p.setShort(2, (short)r.y);
                    p.setShort(4, (short)r.width);
                    p.setShort(6, (short)r.height);
                    rects[i].setAutoSynch(false);
                    // End optimization
                }
                final int UNMASKED = 1;
                x11.XSetForeground(dpy, gc, new NativeLong(UNMASKED));
View Full Code Here

                X11.WindowByReference rootp = new X11.WindowByReference();
                X11.WindowByReference parentp = new X11.WindowByReference();
                PointerByReference childrenp = new PointerByReference();
                IntByReference countp = new IntByReference();
                x11.XQueryTree(dpy, win, rootp, parentp, childrenp, countp);
                Pointer p = childrenp.getValue();
                int[] ids = p.getIntArray(0, countp.getValue());
                for (int id : ids) {
                    // TODO: more verification of correct window?
                    X11.Window child = new X11.Window(id);
                    X11.XWindowAttributes xwa = new X11.XWindowAttributes();
                    x11.XGetWindowAttributes(dpy, child, xwa);
View Full Code Here

        public void setValue(PSID h) {
            getPointer().setPointer(0, h != null ? h.getPointer() : null);
        }

        public PSID getValue() {
            Pointer p = getPointer().getPointer(0);
            if (p == null) {
                return null;
            }
            else {
                return new PSID(p);
View Full Code Here

     
      ByteBuffer bufDest = ByteBuffer.allocateDirect(4);
      bufDest.put(new byte[]{0,1,2,3});
      ByteBuffer bufSrc = ByteBuffer.allocateDirect(4);
      bufSrc.put(new byte[]{5,10,15,20});
      Pointer ptrSrc = Native.getDirectBufferPointer(bufSrc);
      Pointer ptrDest = Native.getDirectBufferPointer(bufDest);
     
      HANDLE selfHandle = kernel.GetCurrentProcess();
      kernel.WriteProcessMemory(selfHandle, ptrDest, ptrSrc, 3, null);//Write only the first three
     
    assertEquals(bufDest.get(0),5);
View Full Code Here

TOP

Related Classes of com.sun.jna.Pointer

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.