/** * Closes all referenced handles. If an exception is thrown for * a specific handle, then it is accumulated until all * handles have been closed. If more than one exception occurs, * then it is added as a suppressed exception to the first one. * Once closed all handles, the accumulated exception (if any) is thrown * * @param refs The references to close * @see #closeHandleRef(WinNT.HANDLEByReference) */ public static void closeHandleRefs(HANDLEByReference... refs) { Win32Exception err = null; for (HANDLEByReference r : refs) { try { closeHandleRef(r); } catch(Win32Exception e) { if (err == null) { err = e; } else { err.addSuppressedReflected(e); } } } if (err != null) { throw err; } } /**