Esempio n. 1
0
        /// <summary>
        /// Open a global atom by number.
        /// </summary>
        /// <param name="atom">The atom to open.</param>
        /// <param name="check_exists">True to check atom exists.</param>
        /// <param name="global">True to open a global atom, otherwise a user atom.</param>
        /// <param name="throw_on_error">True to throw on error.</param>
        /// <returns>The atom object.</returns>
        public static NtResult <NtAtom> Open(ushort atom, bool check_exists, bool global, bool throw_on_error)
        {
            NtAtom ret = new NtAtom(atom, global);

            if (check_exists)
            {
                return(ret.GetName(false).Status.CreateResult(throw_on_error, () => ret));
            }
            return(ret.CreateResult());
        }
Esempio n. 2
0
        private static IEnumerable <NtAtom> GetUserAtoms()
        {
            List <NtAtom> atoms = new List <NtAtom>();

            for (int atom = 0xC000; atom < 0x10000; ++atom)
            {
                var next_atom = new NtAtom((ushort)atom, false);
                if (next_atom.GetName(false).IsSuccess)
                {
                    atoms.Add(next_atom);
                }
            }
            return(atoms.AsReadOnly());
        }