Exemple #1
0
        private static string FormatText(HandleEntry ent)
        {
            NativeHandle h = NativeBridge.DuplicateHandleFromProcess(ent.ProcessId, ent.Handle, 0, DuplicateHandleOptions.DuplicateSameAccess);

            try
            {
                StringBuilder builder = new StringBuilder();

                if ((ent.GrantedAccess & (int)HandleUtils.AccessRights.SectionMapRead) != 0)
                {
                    builder.Append("R");
                }

                if ((ent.GrantedAccess & (int)HandleUtils.AccessRights.SectionMapWrite) != 0)
                {
                    builder.Append("W");
                }

                return(String.Format("[{0}/0x{0:X}] {1} Size: {2} Access: {3}", ent.Handle.ToInt64(), ent.ObjectName, NativeBridge.GetSectionSize(h), builder.ToString()));
            }
            finally
            {
                h.Close();
            }
        }