Exemplo n.º 1
0
    def open(self):
        """Open a process and/or thread.
        @return: operation status.
        """
        ret = bool(self.pid or self.thread_id)
        if self.pid and not self.h_process:
            if self.pid == os.getpid():
                self.h_process = KERNEL32.GetCurrentProcess()
            else:
                self.h_process = KERNEL32.OpenProcess(PROCESS_ALL_ACCESS, False, self.pid)
            ret = True

        if self.thread_id and not self.h_thread:
            self.h_thread = KERNEL32.OpenThread(THREAD_ALL_ACCESS, False, self.thread_id)
            ret = True
        return ret
Exemplo n.º 2
0
 def open_thread(self):
     """Open a thread handle."""
     return KERNEL32.OpenThread(THREAD_ALL_ACCESS, False, self.tid)