/// <nodoc /> public static ReportedFileAccess Deserialize( BuildXLReader reader, IReadOnlyList <ReportedProcess> processes, Func <BuildXLReader, AbsolutePath> readPath) { return(new ReportedFileAccess( operation: (ReportedFileOperation)reader.ReadByte(), process: processes != null ? processes[reader.ReadInt32Compact()] : ReportedProcess.Deserialize(reader), requestedAccess: (RequestedAccess)reader.ReadInt32Compact(), status: (FileAccessStatus)reader.ReadInt32Compact(), explicitlyReported: reader.ReadBoolean(), error: reader.ReadUInt32(), // In general if process is executed externally, e.g., in VM, the obtained USN cannot be translated to the host. // However, for our low-privilege build, we are going to map the host volumes to the VM, and thus the USN // can still be used. usn: new Usn(reader.ReadUInt64()), desiredAccess: (DesiredAccess)reader.ReadUInt32(), shareMode: (ShareMode)reader.ReadUInt32(), creationDisposition: (CreationDisposition)reader.ReadUInt32(), flagsAndAttributes: (FlagsAndAttributes)reader.ReadUInt32(), manifestPath: readPath != null ? readPath(reader) : reader.ReadAbsolutePath(), path: reader.ReadNullableString(), enumeratePatttern: reader.ReadNullableString(), fileAccessStatusMethod: (FileAccessStatusMethod)reader.ReadByte())); }
/// <summary> /// Deserializes an instance of <see cref="SandboxedProcessResult"/>. /// </summary> /// <param name="reader"></param> /// <returns></returns> public static SandboxedProcessResult Deserialize(BuildXLReader reader) { int exitCode = reader.ReadInt32(); bool killed = reader.ReadBoolean(); bool timedOut = reader.ReadBoolean(); bool hasDetoursInjectionFailures = reader.ReadBoolean(); IReadOnlyList <ReportedProcess> allReportedProcesses = reader.ReadReadOnlyList(r => ReportedProcess.Deserialize(r)); IReadOnlyList <ReportedProcess> survivingChildProcesses = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => allReportedProcesses[r2.ReadInt32()])); ProcessTimes primaryProcessTimes = reader.ReadNullable(r => ProcessTimes.Deserialize(r)); JobObject.AccountingInformation? jobAccountingInformation = reader.ReadNullableStruct(r => JobObject.AccountingInformation.Deserialize(r)); SandboxedProcessOutput standardOutput = reader.ReadNullable(r => SandboxedProcessOutput.Deserialize(r)); SandboxedProcessOutput standardError = reader.ReadNullable(r => SandboxedProcessOutput.Deserialize(r)); IReadOnlyList <ReportedFileAccess> fileAccesses = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => ReportedFileAccess.Deserialize(r2, allReportedProcesses, readPath: null))); IReadOnlyList <ReportedFileAccess> explicitlyReportedFileAccesses = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => ReportedFileAccess.Deserialize(r2, allReportedProcesses, readPath: null))); IReadOnlyList <ReportedFileAccess> allUnexpectedFileAccesses = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => ReportedFileAccess.Deserialize(r2, allReportedProcesses, readPath: null))); IReadOnlyList <ReportedProcess> processes = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => allReportedProcesses[r2.ReadInt32()])); IReadOnlyList <ProcessDetouringStatusData> detouringStatuses = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => ProcessDetouringStatusData.Deserialize(r2))); string dumpFileDirectory = reader.ReadNullableString(); string dumpCreationExceptionMessage = reader.ReadNullableString(); string standardInputExceptionMessage = reader.ReadNullableString(); int numberOfPRocessLaunchRetries = reader.ReadInt32(); bool hasReadWriteToReadFileAccessRequest = reader.ReadBoolean(); string messageProcessingFailureMessage = reader.ReadNullableString(); long processStartTime = reader.ReadInt64(); int warningCount = reader.ReadInt32(); long detoursMaxHeapSize = reader.ReadInt64(); int lastMessageCount = reader.ReadInt32(); bool messageCountSemaphoreCreated = reader.ReadBoolean(); return(new SandboxedProcessResult() { ExitCode = exitCode, Killed = killed, TimedOut = timedOut, HasDetoursInjectionFailures = hasDetoursInjectionFailures, SurvivingChildProcesses = survivingChildProcesses, PrimaryProcessTimes = primaryProcessTimes, JobAccountingInformation = jobAccountingInformation, StandardOutput = standardOutput, StandardError = standardError, FileAccesses = fileAccesses != null ? new HashSet <ReportedFileAccess>(fileAccesses) : null, ExplicitlyReportedFileAccesses = explicitlyReportedFileAccesses != null ? new HashSet <ReportedFileAccess>(explicitlyReportedFileAccesses) : null, AllUnexpectedFileAccesses = allUnexpectedFileAccesses != null ? new HashSet <ReportedFileAccess>(allUnexpectedFileAccesses) : null, Processes = processes, DetouringStatuses = detouringStatuses, DumpFileDirectory = dumpFileDirectory, DumpCreationException = dumpCreationExceptionMessage != null ? new Exception(dumpCreationExceptionMessage) : null, StandardInputException = standardInputExceptionMessage != null ? new Exception(standardInputExceptionMessage) : null, NumberOfProcessLaunchRetries = numberOfPRocessLaunchRetries, HasReadWriteToReadFileAccessRequest = hasReadWriteToReadFileAccessRequest, MessageProcessingFailure = messageProcessingFailureMessage != null ? new Failure <string>(messageProcessingFailureMessage) : null, ProcessStartTime = processStartTime, WarningCount = warningCount, DetoursMaxHeapSize = detoursMaxHeapSize, LastMessageCount = lastMessageCount, MessageCountSemaphoreCreated = messageCountSemaphoreCreated }); }