C# Class Binarysharp.MemoryManagement.Threading.ThreadCore

Static core class providing tools for manipulating threads.
Datei anzeigen Open project: ZenLulz/MemorySharp Class Usage Examples

Public Methods

Method Description
CreateRemoteThread ( SafeMemoryHandle processHandle, IntPtr startAddress, IntPtr parameter, ThreadCreationFlags creationFlags = ThreadCreationFlags.Run ) : SafeMemoryHandle

Creates a thread that runs in the virtual address space of another process.

GetExitCodeThread ( SafeMemoryHandle threadHandle ) : IntPtr?

Retrieves the termination status of the specified thread.

GetThreadContext ( SafeMemoryHandle threadHandle, ThreadContextFlags contextFlags = ThreadContextFlags.Full ) : ThreadContext

Retrieves the context of the specified thread.

GetThreadSelectorEntry ( SafeMemoryHandle threadHandle, uint selector ) : LdtEntry

Retrieves a descriptor table entry for the specified selector and thread.

NtQueryInformationThread ( SafeMemoryHandle threadHandle ) : ThreadBasicInformation

Retrieves information about the specified thread.

OpenThread ( ThreadAccessFlags accessFlags, int threadId ) : SafeMemoryHandle

Opens an existing thread object.

ResumeThread ( SafeMemoryHandle threadHandle ) : uint

Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.

SetThreadContext ( SafeMemoryHandle threadHandle, ThreadContext context ) : void

Sets the context for the specified thread.

SuspendThread ( SafeMemoryHandle threadHandle ) : uint

Suspends the specified thread.

TerminateThread ( SafeMemoryHandle threadHandle, int exitCode ) : void

Terminates a thread.

WaitForSingleObject ( SafeMemoryHandle handle ) : WaitValues

Waits an infinite amount of time for the specified object to become signaled.

WaitForSingleObject ( SafeMemoryHandle handle, System.TimeSpan timeout ) : WaitValues

Waits until the specified object is in the signaled state or the time-out interval elapses.

Method Details

CreateRemoteThread() public static method

Creates a thread that runs in the virtual address space of another process.
public static CreateRemoteThread ( SafeMemoryHandle processHandle, IntPtr startAddress, IntPtr parameter, ThreadCreationFlags creationFlags = ThreadCreationFlags.Run ) : SafeMemoryHandle
processHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the process in which the thread is to be created.
startAddress System.IntPtr A pointer to the application-defined function to be executed by the thread and represents the starting address of the thread in the remote process.
parameter System.IntPtr A pointer to a variable to be passed to the thread function.
creationFlags ThreadCreationFlags The flags that control the creation of the thread.
return Binarysharp.MemoryManagement.Native.SafeMemoryHandle

GetExitCodeThread() public static method

Retrieves the termination status of the specified thread.
public static GetExitCodeThread ( SafeMemoryHandle threadHandle ) : IntPtr?
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread.
return IntPtr?

GetThreadContext() public static method

Retrieves the context of the specified thread.
public static GetThreadContext ( SafeMemoryHandle threadHandle, ThreadContextFlags contextFlags = ThreadContextFlags.Full ) : ThreadContext
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread whose context is to be retrieved.
contextFlags ThreadContextFlags Determines which registers are returned or set.
return Binarysharp.MemoryManagement.Native.ThreadContext

GetThreadSelectorEntry() public static method

Retrieves a descriptor table entry for the specified selector and thread.
public static GetThreadSelectorEntry ( SafeMemoryHandle threadHandle, uint selector ) : LdtEntry
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread containing the specified selector.
selector uint The global or local selector value to look up in the thread's descriptor tables.
return Binarysharp.MemoryManagement.Native.LdtEntry

NtQueryInformationThread() public static method

Retrieves information about the specified thread.
public static NtQueryInformationThread ( SafeMemoryHandle threadHandle ) : ThreadBasicInformation
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread to query.
return Binarysharp.MemoryManagement.Native.ThreadBasicInformation

OpenThread() public static method

Opens an existing thread object.
public static OpenThread ( ThreadAccessFlags accessFlags, int threadId ) : SafeMemoryHandle
accessFlags ThreadAccessFlags The access to the thread object.
threadId int The identifier of the thread to be opened.
return Binarysharp.MemoryManagement.Native.SafeMemoryHandle

ResumeThread() public static method

Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.
public static ResumeThread ( SafeMemoryHandle threadHandle ) : uint
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread to be restarted.
return uint

SetThreadContext() public static method

Sets the context for the specified thread.
public static SetThreadContext ( SafeMemoryHandle threadHandle, ThreadContext context ) : void
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread whose context is to be set.
context Binarysharp.MemoryManagement.Native.ThreadContext A pointer to a structure that contains the context to be set in the specified thread.
return void

SuspendThread() public static method

Suspends the specified thread.
public static SuspendThread ( SafeMemoryHandle threadHandle ) : uint
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread that is to be suspended.
return uint

TerminateThread() public static method

Terminates a thread.
public static TerminateThread ( SafeMemoryHandle threadHandle, int exitCode ) : void
threadHandle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the thread to be terminated.
exitCode int The exit code for the thread.
return void

WaitForSingleObject() public static method

Waits an infinite amount of time for the specified object to become signaled.
public static WaitForSingleObject ( SafeMemoryHandle handle ) : WaitValues
handle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the object.
return WaitValues

WaitForSingleObject() public static method

Waits until the specified object is in the signaled state or the time-out interval elapses.
public static WaitForSingleObject ( SafeMemoryHandle handle, System.TimeSpan timeout ) : WaitValues
handle Binarysharp.MemoryManagement.Native.SafeMemoryHandle A handle to the object.
timeout System.TimeSpan The time-out interval. If this parameter is NULL, the function does not enter a wait state if the object is not signaled; it always returns immediately.
return WaitValues