private NativeMethods.RM_PROCESS_INFO[] ListAppsInternal(out uint arrayLength, out NativeMethods.RM_REBOOT_REASON rebootReasons)
{
int ret;
uint arrayLengthNeeded = 1;
NativeMethods.RM_PROCESS_INFO[] processInfo;
do
{
arrayLength = arrayLengthNeeded;
processInfo = new NativeMethods.RM_PROCESS_INFO[arrayLength];
ret = NativeMethods.RmGetList(_sessionHandle, out arrayLengthNeeded, ref arrayLength, processInfo, out rebootReasons);
} while (ret == WindowsUtils.Win32ErrorMoreData);
if (ret != 0) throw BuildException(ret);
return processInfo;
}
#endregion