in src/com/pty4j/windows/winpty/WinPty.java [335:355]
int getConsoleProcessList() throws IOException {
if (myClosed) {
return 0;
}
int MAX_COUNT = 64;
Pointer buffer = new Memory(Native.LONG_SIZE * MAX_COUNT);
PointerByReference errPtr = new PointerByReference();
try {
int actualProcessCount = INSTANCE.winpty_get_console_process_list(myWinpty, buffer, MAX_COUNT, errPtr);
if (actualProcessCount == 0) {
WString message = INSTANCE.winpty_error_msg(errPtr.getValue());
int code = INSTANCE.winpty_error_code(errPtr.getValue());
throw new IOException("winpty_get_console_process_list failed, code: " + code + ", message: " + message);
}
// use buffer.getIntArray(0, actualProcessCount); to get actual PIDs
return actualProcessCount;
}
finally {
INSTANCE.winpty_error_free(errPtr.getValue());
}
}