public static Boolean TryRmGetList(UInt32 sessionHandle, out RmRebootReason rebootReasons, out RmProcessInfo[] affectedApps) { affectedApps = null; var nCount = 0U; var error = RmGetList(sessionHandle, out var nlength, ref nCount, affectedApps, out rebootReasons); while (error == ERROR_MORE_DATA) { affectedApps = new RmProcessInfo[nlength]; nCount = (UInt32)affectedApps.Length; error = RmGetList(sessionHandle, out nlength, ref nCount, affectedApps, out rebootReasons); } return(error == 0 ? true : false); }
private static extern Int32 RmGetList(UInt32 dwSessionHandle, out UInt32 pnProcInfoNeeded, ref UInt32 pnProcInfo, [Out] RmProcessInfo[] rgAffectedApps, out RmRebootReason lpdwRebootReasons);