/** * Get all sub keys of a key. * * @return array with all sub key names */ public Collection<String> getSubKeys() { WINBASE.FILETIME lpftLastWriteTime; TreeSet<String> subKeys = new TreeSet<String>(); char[] lpName = new char[256]; IntByReference lpcName = new IntByReference(256); lpftLastWriteTime = new WINBASE.FILETIME(); int dwIndex = 0; while (Advapi32.INSTANCE.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { subKeys.add(new String(lpName, 0, lpcName.getValue())); lpcName.setValue(256); dwIndex++; } return subKeys; }
/** * Given the process handle, waits for its completion and returns the exit code. */ public static int waitForExitProcess(Pointer hProcess) throws InterruptedException { while (true) { if (Thread.interrupted()) throw new InterruptedException(); Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000); IntByReference exitCode = new IntByReference(); exitCode.setValue(-1); Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode); int v = exitCode.getValue(); if (v !=Kernel32.STILL_ACTIVE) { return v; } } }
/** * Initialize the headset camera. * @param allowed <code>true</code> is the use of the headset camera is allowed and <code>false</code> otherwise. */ public void initCamera(boolean allowed) { hmdErrorStore.setValue(0); // clear the error store if( allowed && vrsystemFunctions != null ) { IntByReference intptr = JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRTrackedCamera_Version, hmdErrorStore); if (intptr != null){ cameraFunctions = new VR_IVRTrackedCamera_FnTable(intptr.getPointer()); if(cameraFunctions != null && hmdErrorStore.getValue() == 0 ){ cameraFunctions.setAutoSynch(false); cameraFunctions.read(); logger.config("OpenVR Camera initialized"); } } } }
size.setValue(argmax); if(LIBC.sysctl(new int[]{CTL_KERN,KERN_PROCARGS2,pid},3, m, size, NULL, intByRef)!=0) throw new IOException("Failed to obtain ken.procargs2: "+LIBC.strerror(Native.getLastError()));
@Override public boolean initVRCompositor(boolean allowed) { hmdErrorStore.setValue(0); // clear the error store if( allowed && vrsystemFunctions != null ) {
public IntByReference(int value) { super(4); setValue(value); }
public IntByReference(int value) { super(4); setValue(value); }
public IntByReference(int value) { super(4); setValue(value); }
public void set(int v) { getValue().setValue(v); } }
public void set(int v) { getValue().setValue(v); } }
MIB_IFTABLE ifTable = new MIB_IFTABLE(); IntByReference psize = new IntByReference(ifTable.size()); int status = ipHlpApi.GetIfTable(ifTable, psize, false); if (status == 122) { // Calculate the required number of elements in the MIB_IFROW array ifTable = new MIB_IFTABLE((psize.getValue() - 4) / ifTable.table[0].size()); psize.setValue(ifTable.size()); status = ipHlpApi.GetIfTable(ifTable, psize, false); // If status is still 122, then there's an issue with the MIB_IFROW definition // ... }
public int available() throws IOException { readLock.lock(); try { if (shutdownFlag) { return -1; } peekActual.setValue(0); if (!KERNEL32.PeekNamedPipe(myHandle, null, 0, null, peekActual, null)) { throw new IOException("PeekNamedPipe failed"); } return peekActual.getValue(); } finally { readLock.unlock(); } }
/** * Get all sub keys of a key. * * @return array with all sub key names */ public Collection<String> getSubKeys() { WINBASE.FILETIME lpftLastWriteTime; TreeSet<String> subKeys = new TreeSet<String>(); char[] lpName = new char[256]; IntByReference lpcName = new IntByReference(256); lpftLastWriteTime = new WINBASE.FILETIME(); int dwIndex = 0; while (Advapi32.INSTANCE.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { subKeys.add(new String(lpName, 0, lpcName.getValue())); lpcName.setValue(256); dwIndex++; } return subKeys; }
/** * Given the process handle, waits for its completion and returns the exit code. */ public static int waitForExitProcess(Pointer hProcess) throws InterruptedException { while (true) { if (Thread.interrupted()) throw new InterruptedException(); Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000); IntByReference exitCode = new IntByReference(); exitCode.setValue(-1); Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode); int v = exitCode.getValue(); if (v !=Kernel32.STILL_ACTIVE) { return v; } } }
/** * Given the process handle, waits for its completion and returns the exit code. */ public static int waitForExitProcess(Pointer hProcess) throws InterruptedException { while (true) { if (Thread.interrupted()) throw new InterruptedException(); Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000); IntByReference exitCode = new IntByReference(); exitCode.setValue(-1); Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode); int v = exitCode.getValue(); if (v !=Kernel32.STILL_ACTIVE) { return v; } } } }
/** * Given the process handle, waits for its completion and returns the exit code. */ public static int waitForExitProcess(Pointer hProcess) throws InterruptedException { while (true) { if (Thread.interrupted()) throw new InterruptedException(); Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000); IntByReference exitCode = new IntByReference(); exitCode.setValue(-1); Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode); int v = exitCode.getValue(); if (v !=Kernel32.STILL_ACTIVE) { return v; } } } }
/** * Given the process handle, waits for its completion and returns the exit code. */ public static int waitForExitProcess(Pointer hProcess) throws InterruptedException { while (true) { if (Thread.interrupted()) throw new InterruptedException(); Kernel32.INSTANCE.WaitForSingleObject(hProcess,1000); IntByReference exitCode = new IntByReference(); exitCode.setValue(-1); Kernel32.INSTANCE.GetExitCodeProcess(hProcess,exitCode); int v = exitCode.getValue(); if (v !=Kernel32.STILL_ACTIVE) { return v; } } } }
private int[] groupsOf(__password pwrecord) { boolean done = false; int[] groups = new int[0]; while (!done) { IntByReference ngroups = new IntByReference(); ngroups.setValue(groups.length); if (_libc.getgrouplist(pwrecord.name, pwrecord.gid, groups, ngroups) < 0) { groups = new int[ngroups.getValue()]; continue; } done = true; } return groups; }
@Override public DWORD callback(Pointer pbData, Pointer pvCallbackContext, ULONGByReference ulLength) { int elementsRead = elementsReadWrapper.getValue(); int remainingElements = outputStream.size() - elementsRead; int length = Math.min(remainingElements, ulLength.getValue().intValue()); pbData.write(0, outputStream.toByteArray(), elementsRead, length); elementsReadWrapper.setValue(elementsRead + length); ulLength.setValue(new ULONG(length)); return new DWORD(W32Errors.ERROR_SUCCESS); } };