/** Obtain a pointer to the native glue code for this callback. */ public Pointer getTrampoline() { if (trampoline == null) { trampoline = cbstruct.getPointer(0); } return trampoline; }
/** * Indirect the native pointer, copying <em>from</em> memory pointed to by * native pointer, into the specified array. * * @param offset byte offset from pointer from which data is copied * @param buf {@link Pointer} array into which data is copied * @param index array index to which data is copied * @param length number of elements from native pointer that must be copied */ public void read(long offset, Pointer[] buf, int index, int length) { for (int i=0;i < length;i++) { Pointer p = getPointer(offset + i*Native.POINTER_SIZE); Pointer oldp = buf[i+index]; // Avoid replacing the original pointer if it hasn't changed if (oldp == null || p == null || p.peer != oldp.peer) { buf[i+index] = p; } } }
/** Returns an array of {@link Pointer}. The array length is * determined by a NULL-valued terminating element. */ public Pointer[] getPointerArray(long offset) { List<Pointer> array = new ArrayList<Pointer>(); int addOffset = 0; Pointer p = getPointer(offset); while (p != null) { array.add(p); addOffset += Native.POINTER_SIZE; p = getPointer(offset + addOffset); } return array.toArray(new Pointer[array.size()]); }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.getPointer</code>. But this method performs * a bounds checks to ensure that the indirection does not cause memory * outside the <code>malloc</code>ed space to be accessed. * * @see Pointer#getPointer(long) */ @Override public Pointer getPointer(long offset) { boundsCheck(offset, Native.POINTER_SIZE); return super.getPointer(offset); }
public Pointer getValue() { return getPointer().getPointer(0); } }
int addOffset = 0; if (length != -1) { p = getPointer(offset + addOffset); int count = 0; while (count++ < length) { if (count < length) { addOffset += Native.POINTER_SIZE; p = getPointer(offset + addOffset); while ((p = getPointer(offset + addOffset)) != null) { String s = p == null ? null
Pointer p = memory.getPointer(offset); result = p == null ? null : p.getString(0, encoding); nativeStrings.put(structField.name + ".ptr", memory.getPointer(offset)); nativeStrings.put(structField.name + ".val", result);
Structure s = (Structure)currentValue; if (Structure.ByReference.class.isAssignableFrom(type)) { s = Structure.updateStructureByReference((Class<Structure>) type, s, getPointer(offset)); } else { s.useMemory(this, (int)offset, true); result = Double.valueOf(getDouble(offset)); } else if (Pointer.class.isAssignableFrom(type)) { Pointer p = getPointer(offset); if (p != null) { Pointer oldp = currentValue instanceof Pointer Pointer p = getPointer(offset); result = p != null ? p.getString(0) : null; } else if (type == WString.class) { Pointer p = getPointer(offset); result = p != null ? new WString(p.getWideString(0)) : null; } else if (Callback.class.isAssignableFrom(type)) { Pointer fp = getPointer(offset); if (fp == null) { result = null; Pointer bp = getPointer(offset); if (bp == null) { result = null;
protected void _invokeNativeVoid(int vtableId, Object[] args) { Pointer vptr = this.getPointer().getPointer(0); // we take the vtable id and multiply with the pointer size (4 bytes on // 32bit OS) Function func = Function.getFunction(vptr.getPointer(vtableId * Native.POINTER_SIZE)); func.invokeVoid(args); }
/** * Release. * * @return the ulong */ public int Release() { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(8)); return func.invokeInt(new Object[] { this.getPointer() }); } }
public/* [local] */void ReleaseVarDesc( /* [in] */VARDESC pVarDesc) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(84)); func.invokeInt(new Object[] { this.getPointer(), pVarDesc }); } }
public HRESULT IsName( /* [annotation][out][in] */ WString szNameBuf, /* [in] */ULONG lHashVal, /* [out] */BOOLbyReference pfName) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(40)); int hr = func.invokeInt(new Object[] { this.getPointer(), szNameBuf, lHashVal, pfName }); return new HRESULT(hr); }
public/* [local] */HRESULT GetFuncDesc( /* [in] */UINT index, /* [out] */FUNCDESC.ByReference pFuncDesc) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(20)); int hr = func.invokeInt(new Object[] { this.getPointer(), index, pFuncDesc }); return new HRESULT(hr); }
public/* [local] */HRESULT GetNames( /* [in] */MEMBERID memid, /* [length_is][size_is][out] */BSTR[] rgBstrNames, /* [in] */UINT cMaxNames, /* [out] */UINTbyReference pcNames) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(28)); int hr = func.invokeInt(new Object[] { this.getPointer(), memid, rgBstrNames, cMaxNames, pcNames }); return new HRESULT(hr); }
public HRESULT GetRefTypeOfImplType( /* [in] */UINT index, /* [out] */HREFTYPEbyReference pRefType) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(32)); int hr = func.invokeInt(new Object[] { this.getPointer(), index, pRefType }); return new HRESULT(hr); }
public/* [local] */HRESULT GetIDsOfNames( /* [size_is][in] */WString[] rgszNames, /* [in] */UINT cNames, /* [size_is][out] */MEMBERID[] pMemId) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(40)); int hr = func.invokeInt(new Object[] { this.getPointer(), rgszNames, cNames, pMemId }); return new HRESULT(hr); }
public/* [local] */HRESULT CreateInstance( /* [in] */IUnknown pUnkOuter, /* [in] */REFIID riid, /* [iid_is][out] */PointerByReference ppvObj) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(64)); int hr = func.invokeInt(new Object[] { this.getPointer(), pUnkOuter, riid, ppvObj }); return new HRESULT(hr); }
public HRESULT GetTypeAttr( /* [out] */TYPEATTR.ByReference pTypeAttr) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(12)); int hr = func.invokeInt(new Object[] { this.getPointer(), pTypeAttr }); pTypeAttr.read(); return new HRESULT(hr); }
public HRESULT GetTypeComp( /* [out] */ITypeComp.ByReference pTComp) { Pointer vptr = this.getPointer().getPointer(0); Function func = Function.getFunction(vptr.getPointer(32)); PointerByReference ppTComp = new PointerByReference(); int hr = func.invokeInt(new Object[] { this.getPointer(), ppTComp }); pTComp.setPointer(ppTComp.getPointer()); return new HRESULT(hr); }
public HKEY getValue() { Pointer p = getPointer().getPointer(0); if (p == null) return null; if (WinBase.INVALID_HANDLE_VALUE.getPointer().equals(p)) return (HKEY) WinBase.INVALID_HANDLE_VALUE; HKEY h = new HKEY(); h.setPointer(p); return h; } }