protected Pointer getPointer() { if (pointer == null) for (String symbol : symbols) if ((pointer = library.getGlobalVariableAddress(symbol)) != null) break; return pointer; } }
protected Pointer getPointer() { if (pointer == null) for (String symbol : symbols) if ((pointer = library.getGlobalVariableAddress(symbol)) != null) break; return pointer; } }
NativeLibrary lib = NativeLibray.getInstance("mylib"); Pointer paddr = lib.getGlobalVariableAddress("Addr"); paddr.setInt(0, 1234);
public String getFunctionName(NativeLibrary library, Method method) { Mangling name = method.getAnnotation(Mangling.class); if (name != null) { for (String n : name.value()) { try { if (library.getGlobalVariableAddress(n) != null) return n; if (n.startsWith("_")) { n = n.substring(1); if (library.getGlobalVariableAddress(n) != null) return n; } } catch (Throwable ex) { ex = null; } } } if (mappers != null) for (FunctionMapper mapper : mappers) { String n = mapper.getFunctionName(library, method); if (n != null && library.getGlobalVariableAddress(n) != null) return n; } return method.getName(); }
public String getFunctionName(NativeLibrary library, Method method) { Mangling name = method.getAnnotation(Mangling.class); if (name != null) { for (String n : name.value()) { try { if (library.getGlobalVariableAddress(n) != null) return n; if (n.startsWith("_")) { n = n.substring(1); if (library.getGlobalVariableAddress(n) != null) return n; } } catch (Throwable ex) { ex = null; } } } if (mappers != null) for (FunctionMapper mapper : mappers) { String n = mapper.getFunctionName(library, method); if (n != null && library.getGlobalVariableAddress(n) != null) return n; } return method.getName(); }
public static ID getGlobal(String libraryName, String globalVarName) { return new ID(NativeLibrary.getInstance(libraryName).getGlobalVariableAddress(globalVarName).getNativeLong(0).longValue()); } }
public static WinscardLibInfo openLib() { String libraryName = Platform.isWindows() ? WINDOWS_PATH : Platform.isMac() ? MAC_PATH : PCSC_PATH; HashMap<String, Object> options = new HashMap<String, Object>(); if (Platform.isWindows()) { options.put(Library.OPTION_FUNCTION_MAPPER, new WindowsFunctionMapper()); } else if (Platform.isMac()) { options.put(Library.OPTION_FUNCTION_MAPPER, new MacFunctionMapper()); } WinscardLibrary lib = (WinscardLibrary) Native.loadLibrary(libraryName, WinscardLibrary.class, options); NativeLibrary nativeLibrary = NativeLibrary.getInstance(libraryName); // SCARD_PCI_* is #defined to the following symbols (both pcsclite and winscard) ScardIoRequest SCARD_PCI_T0 = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardT0Pci")); ScardIoRequest SCARD_PCI_T1 = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardT1Pci")); ScardIoRequest SCARD_PCI_RAW = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardRawPci")); SCARD_PCI_T0.read(); SCARD_PCI_T1.read(); SCARD_PCI_RAW.read(); SCARD_PCI_T0.setAutoSynch(false); SCARD_PCI_T1.setAutoSynch(false); SCARD_PCI_RAW.setAutoSynch(false); return new WinscardLibInfo(lib, SCARD_PCI_T0, SCARD_PCI_T1, SCARD_PCI_RAW); } }
public static WinscardLibInfo openLib() { String libraryName = Platform.isWindows() ? WINDOWS_PATH : Platform.isMac() ? MAC_PATH : PCSC_PATH; HashMap<String, Object> options = new HashMap<String, Object>(); if (Platform.isWindows()) { options.put(Library.OPTION_FUNCTION_MAPPER, new WindowsFunctionMapper()); } else if (Platform.isMac()) { options.put(Library.OPTION_FUNCTION_MAPPER, new MacFunctionMapper()); } WinscardLibrary lib = (WinscardLibrary) Native.loadLibrary(libraryName, WinscardLibrary.class, options); NativeLibrary nativeLibrary = NativeLibrary.getInstance(libraryName); // SCARD_PCI_* is #defined to the following symbols (both pcsclite and winscard) ScardIoRequest SCARD_PCI_T0 = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardT0Pci")); ScardIoRequest SCARD_PCI_T1 = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardT1Pci")); ScardIoRequest SCARD_PCI_RAW = new ScardIoRequest(nativeLibrary.getGlobalVariableAddress("g_rgSCardRawPci")); SCARD_PCI_T0.read(); SCARD_PCI_T1.read(); SCARD_PCI_RAW.read(); SCARD_PCI_T0.setAutoSynch(false); SCARD_PCI_T1.setAutoSynch(false); SCARD_PCI_RAW.setAutoSynch(false); return new WinscardLibInfo(lib, SCARD_PCI_T0, SCARD_PCI_T1, SCARD_PCI_RAW); } }