Package winappdbg :: Module thread :: Class _ThreadContainer
[hide private]
[frames] | no frames]

Class _ThreadContainer

source code


Encapsulates the capability to contain Thread objects.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__initialize_snapshot(self)
Private method to automatically initialize the snapshot when you try to use it without calling any of the scan_* methods first.
source code
bool
__contains__(self, anObject)
Returns: True if the snapshot contains a Thread object with the same ID.
source code
dictionary-valueiterator
__iter__(self)
Returns: Iterator of Thread objects in this snapshot.
source code
int
__len__(self)
Returns: Count of Thread objects in this snapshot.
source code
 
_add_thread(self, aThread)
Private method to add a thread object to the snapshot.
source code
 
_del_thread(self, dwThreadId)
Private method to remove a thread object from the snapshot.
source code
 
_has_thread_id(self, dwThreadId)
Private method to test for a thread in the snapshot without triggering an automatic scan.
source code
 
_get_thread_ids(self)
Private method to get the list of thread IDs currently in the snapshot without triggering an automatic scan.
source code
 
__add_created_thread(self, event)
Private method to automatically add new thread objects from debug events.
source code
bool
_notify_create_process(self, event)
Notify the creation of the main thread of this process.
source code
bool
_notify_create_thread(self, event)
Notify the creation of a new thread in this process.
source code
bool
_notify_exit_thread(self, event)
Notify the termination of a thread.
source code
 
_ThreadContainer__add_created_thread(self, event)
Private method to automatically add new thread objects from debug events.
source code
 
_ThreadContainer__initialize_snapshot(self)
Private method to automatically initialize the snapshot when you try to use it without calling any of the scan_* methods first.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Instrumentation
 
start_thread(self, lpStartAddress, lpParameter=0, bSuspended=False)
Remotely creates a new thread in the process.
source code
    Threads snapshot
bool
has_thread(self, dwThreadId)
Returns: True if the snapshot contains a Thread object with the given global ID.
source code
Thread
get_thread(self, dwThreadId)
Returns: Thread object with the given global ID.
source code
dictionary-keyiterator
iter_thread_ids(self)
Returns: Iterator of global thread IDs in this snapshot.
source code
dictionary-valueiterator
iter_threads(self)
Returns: Iterator of Thread objects in this snapshot.
source code
list( int )
get_thread_ids(self)
Returns: List of global thread IDs in this snapshot.
source code
int
get_thread_count(self)
Returns: Count of Thread objects in this snapshot.
source code
list( Thread )
find_threads_by_name(self, name, bExactMatch=True)
Find threads by name, using different search methods.
source code
list of Window
get_windows(self)
Returns: Returns a list of windows handled by this process.
source code
 
scan_threads(self)
Populates the snapshot with running threads.
source code
 
clear_dead_threads(self)
Remove Thread objects from the snapshot referring to threads no longer running.
source code
 
clear_threads(self)
Clears the threads snapshot.
source code
 
close_thread_handles(self)
Closes all open handles to threads in the snapshot.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__initialize_snapshot(self)

source code 

Private method to automatically initialize the snapshot when you try to use it without calling any of the scan_* methods first. You don't need to call this yourself.

__contains__(self, anObject)
(In operator)

source code 
Parameters:
  • anObject (Thread, int) -
    • int: Global ID of the thread to look for.
    • Thread: Thread object to look for.
Returns: bool
True if the snapshot contains a Thread object with the same ID.

__iter__(self)

source code 
Returns: dictionary-valueiterator
Iterator of Thread objects in this snapshot.

See Also: iter_threads

__len__(self)
(Length operator)

source code 
Returns: int
Count of Thread objects in this snapshot.

See Also: get_thread_count

has_thread(self, dwThreadId)

source code 
Parameters:
  • dwThreadId (int) - Global ID of the thread to look for.
Returns: bool
True if the snapshot contains a Thread object with the given global ID.

get_thread(self, dwThreadId)

source code 
Parameters:
  • dwThreadId (int) - Global ID of the thread to look for.
Returns: Thread
Thread object with the given global ID.

iter_thread_ids(self)

source code 
Returns: dictionary-keyiterator
Iterator of global thread IDs in this snapshot.

See Also: iter_threads

iter_threads(self)

source code 
Returns: dictionary-valueiterator
Iterator of Thread objects in this snapshot.

See Also: iter_thread_ids

get_thread_ids(self)

source code 
Returns: list( int )
List of global thread IDs in this snapshot.

get_thread_count(self)

source code 
Returns: int
Count of Thread objects in this snapshot.

find_threads_by_name(self, name, bExactMatch=True)

source code 

Find threads by name, using different search methods.

Parameters:
  • name (str, None) - Name to look for. Use None to find nameless threads.
  • bExactMatch (bool) - True if the name must be exactly as given, False if the name can be loosely matched.

    This parameter is ignored when name is None.

Returns: list( Thread )
All threads matching the given name.

get_windows(self)

source code 
Returns: list of Window
Returns a list of windows handled by this process.

start_thread(self, lpStartAddress, lpParameter=0, bSuspended=False)

source code 

Remotely creates a new thread in the process.

Parameters:
  • lpStartAddress (int) - Start address for the new thread.
  • lpParameter (int) - Optional argument for the new thread.
  • bSuspended (bool) - True if the new thread should be suspended. In that case use Thread.resume to start execution.

_add_thread(self, aThread)

source code 

Private method to add a thread object to the snapshot.

Parameters:
  • aThread (Thread) - Thread object.

_del_thread(self, dwThreadId)

source code 

Private method to remove a thread object from the snapshot.

Parameters:
  • dwThreadId (int) - Global thread ID.

__add_created_thread(self, event)

source code 

Private method to automatically add new thread objects from debug events.

Parameters:
  • event (Event) - Event object.

_notify_create_process(self, event)

source code 

Notify the creation of the main thread of this process.

This is done automatically by the Debug class, you shouldn't need to call it yourself.

Parameters:
Returns: bool
True to call the user-defined handle, False otherwise.

_notify_create_thread(self, event)

source code 

Notify the creation of a new thread in this process.

This is done automatically by the Debug class, you shouldn't need to call it yourself.

Parameters:
Returns: bool
True to call the user-defined handle, False otherwise.

_notify_exit_thread(self, event)

source code 

Notify the termination of a thread.

This is done automatically by the Debug class, you shouldn't need to call it yourself.

Parameters:
Returns: bool
True to call the user-defined handle, False otherwise.

_ThreadContainer__add_created_thread(self, event)

source code 

Private method to automatically add new thread objects from debug events.

Parameters:
  • event (Event) - Event object.

_ThreadContainer__initialize_snapshot(self)

source code 

Private method to automatically initialize the snapshot when you try to use it without calling any of the scan_* methods first. You don't need to call this yourself.