/// <summary>
        /// Gets the <see cref="ProgramInfo"/> associated with the specified process ID.
        /// </summary>
        /// <param name="programInfo">If the method returns successfully, contains the <see cref="ProgramInfo"/>
        /// associated with the specified process ID.</param>
        /// <param name="processId">The process ID of the <see cref="ProgramInfo"/> to get.</param>
        /// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
        /// <see cref="ResultFs.TargetProgramNotFound"/>: The <see cref="ProgramInfo"/> was not found.</returns>
        public Result GetProgramInfo(out ProgramInfo programInfo, ulong processId)
        {
            lock (ProgramInfoList)
            {
                if (ProgramInfo.IsInitialProgram(processId))
                {
                    programInfo = GetProgramInfoForInitialProcess();
                    return(Result.Success);
                }

                foreach (ProgramInfo info in ProgramInfoList)
                {
                    if (info.Contains(processId))
                    {
                        programInfo = info;
                        return(Result.Success);
                    }
                }

                programInfo = default;
                return(ResultFs.TargetProgramNotFound.Log());
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets the <see cref="ProgramInfo"/> associated with the specified process ID.
        /// </summary>
        /// <param name="programInfo">If the method returns successfully, contains the <see cref="ProgramInfo"/>
        /// associated with the specified process ID.</param>
        /// <param name="processId">The process ID of the <see cref="ProgramInfo"/> to get.</param>
        /// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
        /// <see cref="ResultFs.ProgramInfoNotFound"/>: The <see cref="ProgramInfo"/> was not found.</returns>
        public Result GetProgramInfo(out ProgramInfo programInfo, ulong processId)
        {
            lock (ProgramInfoList)
            {
                if (ProgramInfo.IsInitialProgram(processId))
                {
                    programInfo = GetProgramInfoForInitialProcess();
                    return(Result.Success);
                }

                foreach (ProgramInfo info in ProgramInfoList)
                {
                    if (info.Contains(processId))
                    {
                        programInfo = info;
                        return(Result.Success);
                    }
                }

                UnsafeHelpers.SkipParamInit(out programInfo);
                return(ResultFs.ProgramInfoNotFound.Log());
            }
        }