Kernel32CreateRemoteThreadEx(IntPtr, IntPtr, IntPtr, ThreadStart, IntPtr, CreateThreadFlags, IntPtr, UInt32) Method
Creates a thread that runs in the virtual address space of another process
and optionally specifies extended attributes such as processor group affinity.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
public static IntPtr CreateRemoteThreadEx(
IntPtr hProcess,
IntPtr threadAttributes,
IntPtr stackSize,
ThreadStart startAddress,
IntPtr parameter,
CreateThreadFlags creationFlags,
IntPtr attributeList,
out uint refThreadId
)
<DllImportAttribute("Kernel32.dll", ExactSpelling := true, SetLastError := true>]
Public Shared Function CreateRemoteThreadEx (
hProcess As IntPtr,
threadAttributes As IntPtr,
stackSize As IntPtr,
startAddress As ThreadStart,
parameter As IntPtr,
creationFlags As CreateThreadFlags,
attributeList As IntPtr,
<OutAttribute> ByRef refThreadId As UInteger
) As IntPtr
Dim hProcess As IntPtr
Dim threadAttributes As IntPtr
Dim stackSize As IntPtr
Dim startAddress As ThreadStart
Dim parameter As IntPtr
Dim creationFlags As CreateThreadFlags
Dim attributeList As IntPtr
Dim refThreadId As UInteger
Dim returnValue As IntPtr
returnValue = Kernel32.CreateRemoteThreadEx(hProcess,
threadAttributes, stackSize, startAddress,
parameter, creationFlags, attributeList,
refThreadId)
public:
[DllImportAttribute(L"Kernel32.dll", ExactSpelling = true, SetLastError = true)]
static IntPtr CreateRemoteThreadEx(
[InAttribute] IntPtr hProcess,
[InAttribute] IntPtr threadAttributes,
IntPtr stackSize,
ThreadStart^ startAddress,
[InAttribute] IntPtr parameter,
CreateThreadFlags creationFlags,
IntPtr attributeList,
[OutAttribute] unsigned int% refThreadId
)
[<DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)>]
static member CreateRemoteThreadEx :
hProcess : IntPtr *
threadAttributes : IntPtr *
stackSize : IntPtr *
startAddress : ThreadStart *
parameter : IntPtr *
creationFlags : CreateThreadFlags *
attributeList : IntPtr *
refThreadId : uint32 byref -> IntPtr
No code example is currently available or this language may not be supported.
- hProcess IntPtr
-
A handle to the process.
The handle must have the CreateThread,
QueryInformation,
VirtualMemoryOperation,
VirtualMemoryWrite,
and VirtualMemoryRead access rights.
- threadAttributes IntPtr
-
A pointer to a SecurityAttributes structure that specifies a
security descriptor for the new thread and determines whether child processes can inherit the returned handle.
If threadAttributes is NULL, the thread gets a default security descriptor
and the handle cannot be inherited.
The access control lists (ACL) in the default security descriptor for a thread come from the primary token of the creator.
- stackSize IntPtr
-
The initial size of the stack, in bytes.
The system rounds this value to the nearest page.
If this parameter is 0 (zero), the new thread uses the default size for the executable.
- startAddress ThreadStart
-
A pointer to the application-defined function of type LPTHREAD_START_ROUTINE
to be executed by the thread and represents the starting address of the thread in the remote process.
The function must exist in the remote process.
- parameter IntPtr
-
A pointer to a variable to be passed to the thread function pointed to by startAddress.
This parameter can be NULL.
- creationFlags CreateThreadFlags
-
The flags that control the creation of the thread.
- attributeList IntPtr
-
An attribute list that contains additional parameters for the new thread.
This list is created by the InitializeProcThreadAttributeList function.
- refThreadId UInt32
-
A pointer to a variable that receives the thread identifier.
If this parameter is NULL, the thread identifier is not returned.
IntPtr
If the function succeeds, the return value is a handle to the new thread.
If the function fails, the return value is NULL.