(self, dwProcessId)
return aProcess
Attaches to an existing process for debugging.

        @see: L{detach}, L{execv}, L{execl}

        @type  dwProcessId: int
        @param dwProcessId: Global ID of a process to attach to.

        @rtype:  L{Process}
        @return: A new Process object. Normally you don't need to use it now,
            it's best to interact with the process from the event handler.

        @raise WindowsError: Raises an exception on error.
            Depending on the circumstances, the debugger may or may not have
            attached to the target process.
Attaches to an existing process for debugging.
Attaches to an existing process for debugging .
def attach(self, dwProcessId):
        """
        Attaches to an existing process for debugging.

        @see: L{detach}, L{execv}, L{execl}

        @type  dwProcessId: int
        @param dwProcessId: Global ID of a process to attach to.

        @rtype:  L{Process}
        @return: A new Process object. Normally you don't need to use it now,
            it's best to interact with the process from the event handler.

        @raise WindowsError: Raises an exception on error.
            Depending on the circumstances, the debugger may or may not have
            attached to the target process.
        """

        # Get the Process object from the snapshot,
        # if missing create a new one.
        try:
            aProcess = self.system.get_process(dwProcessId)
        except KeyError:
            aProcess = Process(dwProcessId)

        # Warn when mixing 32 and 64 bits.
        # This also allows the user to stop attaching altogether,
        # depending on how the warnings are configured.
        if System.bits != aProcess.get_bits():
            msg = "Mixture of 32 and 64 bits is considered experimental." \
                  " Use at your own risk!"
            warnings.warn(msg, MixedBitsWarning)

        # Attach to the process.
        win32.DebugActiveProcess(dwProcessId)

        # Add the new PID to the set of debugees.
        self.__attachedDebugees.add(dwProcessId)

        # Match the system kill-on-exit flag to our own.
        self.__setSystemKillOnExitMode()

        # If the Process object was not in the snapshot, add it now.
        if not self.system.has_process(dwProcessId):
            self.system._add_process(aProcess)

        # Scan the process threads and loaded modules.
        # This is prefered because the thread and library events do not
        # properly give some information, like the filename for each module.
        aProcess.scan_threads()
        aProcess.scan_modules()

        # Return the Process object, like the execv() and execl() methods.
        return aProcess
def attach ( self , dwProcessId ) : # Get the Process object from the snapshot, # if missing create a new one. try : aProcess = self . system . get_process ( dwProcessId ) except KeyError : aProcess = Process ( dwProcessId ) # Warn when mixing 32 and 64 bits. # This also allows the user to stop attaching altogether, # depending on how the warnings are configured. if System . bits != aProcess . get_bits ( ) : msg = "Mixture of 32 and 64 bits is considered experimental." " Use at your own risk!" warnings . warn ( msg , MixedBitsWarning ) # Attach to the process. win32 . DebugActiveProcess ( dwProcessId ) # Add the new PID to the set of debugees. self . __attachedDebugees . add ( dwProcessId ) # Match the system kill-on-exit flag to our own. self . __setSystemKillOnExitMode ( ) # If the Process object was not in the snapshot, add it now. if not self . system . has_process ( dwProcessId ) : self . system . _add_process ( aProcess ) # Scan the process threads and loaded modules. # This is prefered because the thread and library events do not # properly give some information, like the filename for each module. aProcess . scan_threads ( ) aProcess . scan_modules ( ) # Return the Process object, like the execv() and execl() methods. return aProcess