Search in sources :

Example 1 with WORDByReference

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

the class TypeInfoUtil method GetDllEntry.

/**
     * Gets the dll entry.
     * 
     * @param memid
     *            the memid
     * @param invKind
     *            the inv kind
     * @return the dll entry
     */
public DllEntry GetDllEntry(MEMBERID memid, INVOKEKIND invKind) {
    BSTRByReference pBstrDllName = new BSTRByReference();
    BSTRByReference pBstrName = new BSTRByReference();
    WORDByReference pwOrdinal = new WORDByReference();
    HRESULT hr = this.typeInfo.GetDllEntry(memid, invKind, pBstrDllName, pBstrName, pwOrdinal);
    COMUtils.checkRC(hr);
    OLEAUTO.SysFreeString(pBstrDllName.getValue());
    OLEAUTO.SysFreeString(pBstrName.getValue());
    return new DllEntry(pBstrDllName.getString(), pBstrName.getString(), pwOrdinal.getValue().intValue());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) WORDByReference(com.sun.jna.platform.win32.WinDef.WORDByReference)

Example 2 with WORDByReference

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

the class ITypeInfoTest method testGetDllEntry.

@Test
@Ignore("Needs a DLL that contains code")
public void testGetDllEntry() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID(0);
    BSTRByReference pBstrDllName = new BSTRByReference();
    BSTRByReference pBstrName = new BSTRByReference();
    WORDByReference pwOrdinal = new WORDByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetDllEntry(memid, INVOKEKIND.INVOKE_FUNC, pBstrDllName, pBstrName, pwOrdinal);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pwOrdinal: " + pwOrdinal.getValue());
            return;
        }
    }
    throw new RuntimeException("Didn't find Dll entry for member in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) WORDByReference(com.sun.jna.platform.win32.WinDef.WORDByReference) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)2 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)2 WORDByReference (com.sun.jna.platform.win32.WinDef.WORDByReference)2 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)2 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1