/// <summary> /// Unregisters the program with the specified process ID. /// </summary> /// <param name="processId">The process ID of the program to unregister.</param> /// <returns><see cref="Result.Success"/>: The operation was successful.<br/> /// <see cref="ResultFs.InvalidArgument"/>: The process ID is not registered.</returns> public Result UnregisterProgram(ulong processId) { lock (ProgramInfoList) { for (LinkedListNode <ProgramInfo> node = ProgramInfoList.First; node != null; node = node.Next) { if (node.Value.Contains(processId)) { ProgramInfoList.Remove(node); return(Result.Success); } } return(ResultFs.InvalidArgument.Log()); } }
/// <summary> /// Registers a program with information about that program in the program registry. /// </summary> /// <param name="processId">The process ID of the program.</param> /// <param name="programId">The <see cref="ProgramId"/> of the program.</param> /// <param name="storageId">The <see cref="StorageId"/> where the program is located.</param> /// <param name="accessControlData">The FS access control data header located in the program's ACI.</param> /// <param name="accessControlDescriptor">The FS access control descriptor located in the program's ACID.</param> /// <returns><see cref="Result.Success"/>: The operation was successful.<br/> /// <see cref="ResultFs.InvalidArgument"/>: The process ID is already registered.</returns> public Result RegisterProgram(ulong processId, ProgramId programId, StorageId storageId, ReadOnlySpan <byte> accessControlData, ReadOnlySpan <byte> accessControlDescriptor) { var programInfo = new ProgramInfo(FsServer, processId, programId, storageId, accessControlData, accessControlDescriptor); lock (ProgramInfoList) { foreach (ProgramInfo info in ProgramInfoList) { if (info.Contains(processId)) { return(ResultFs.InvalidArgument.Log()); } } ProgramInfoList.AddLast(programInfo); return(Result.Success); } }