/** * @param process NiFi Process Reference * @param logger Logger Reference for Debug * @return Returns pid or null in-case pid could not be determined * This method takes {@link Process} and {@link Logger} and returns * the platform specific Handle for Win32 Systems, a.k.a <b>pid</b> * In-case it fails to determine the pid, it will return Null. * Purpose for the Logger is to log any interaction for debugging. */ private static Long getWindowsProcessId(final Process process, final Logger logger) { /* determine the pid on windows plattforms */ try { Field f = process.getClass().getDeclaredField("handle"); f.setAccessible(true); long handl = f.getLong(process); Kernel32 kernel = Kernel32.INSTANCE; WinNT.HANDLE handle = new WinNT.HANDLE(); handle.setPointer(Pointer.createConstant(handl)); int ret = kernel.GetProcessId(handle); logger.debug("Detected pid: {}", ret); return Long.valueOf(ret); } catch (final IllegalAccessException | NoSuchFieldException nsfe) { logger.debug("Could not find PID for child process due to {}", nsfe); } return null; }
private static Pointer invalidPointerValue() { return Pointer.createConstant(Pointer.SIZE == 8 ? -1 : 0xFFFFFFFFL); }
/** * Get a window handle for a component identifier. * * @param componentId component identifier * @return native window handle */ private HWND getHWND(long componentId) { return new HWND(Pointer.createConstant(componentId)); }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
/** * To pointer. * * @return the pointer */ public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
/** * To pointer. * * @return the pointer */ public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
/** * To pointer. * * @return the pointer */ public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant( longValue() ); } }
/** * To pointer. * * @return the pointer */ public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant( longValue() ); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
public Pointer toPointer() { return Pointer.createConstant(longValue()); } }
@Nonnull protected HANDLE toHandle(long handleId) { final HANDLE handle = new HANDLE(); handle.setPointer(Pointer.createConstant(handleId)); return handle; }
private static int getPidfromHandle(long value) throws Exception { Kernel32 kernel = Kernel32.INSTANCE; W32API.HANDLE handle = new W32API.HANDLE(); handle.setPointer(Pointer.createConstant(value)); return kernel.GetProcessId(handle); }
private static int getPidFromHandle(long value) { Kernel32 kernel = Kernel32.INSTANCE; W32API.HANDLE handle = new W32API.HANDLE(); handle.setPointer(Pointer.createConstant(value)); return kernel.GetProcessId(handle); }
private static int getPidFromHandle(long value) { Kernel32 kernel = Kernel32.INSTANCE; W32API.HANDLE handle = new W32API.HANDLE(); handle.setPointer(Pointer.createConstant(value)); return kernel.GetProcessId(handle); }