/// <summary>
 /// Method to create an object from a set of object attributes.
 /// </summary>
 /// <param name="obj_attributes">The object attributes to create/open from.</param>
 /// <returns>The newly created object.</returns>
 protected override object CreateObject(ObjectAttributes obj_attributes)
 {
     if (ParameterSetName == "FromPath")
     {
         return(NtDebug.Open(obj_attributes, Access));
     }
     else
     {
         return(NtDebug.Current);
     }
 }
예제 #2
0
        /// <summary>
        /// Method to create an object from a set of object attributes.
        /// </summary>
        /// <param name="obj_attributes">The object attributes to create/open from.</param>
        /// <returns>The newly created object.</returns>
        protected override object CreateObject(ObjectAttributes obj_attributes)
        {
            using (var obj = NtDebug.Create(obj_attributes, Access, Flags))
            {
                switch (ParameterSetName)
                {
                case "AttachPid":
                    obj.Attach(ProcessId);
                    break;

                case "AttachProcess":
                    obj.Attach(Process);
                    break;
                }
                return(obj.Duplicate());
            }
        }
 public ScopedDebugObject(NtDebug debug_object)
 {
     _debug_object            = debug_object;
     _old_debug_object_handle = NtDbgUi.DbgUiGetThreadDebugObject();
     NtDbgUi.DbgUiSetThreadDebugObject(debug_object.Handle.DangerousGetHandle());
 }