Kernel32CreateRemoteThread(IntPtr, SecurityAttributes, IntPtr, IntPtr, IntPtr, CreateThreadFlags, UInt32) Method
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", CharSet = CharSet.Auto, SetLastError = true)]
public static IntPtr CreateRemoteThread(
IntPtr hProcess,
in SecurityAttributes refThreadAttributes,
IntPtr stackSize,
IntPtr startAddress,
IntPtr threadParameter,
CreateThreadFlags creationFlags,
ref uint refThreadId
)
<DllImportAttribute("Kernel32.dll", CharSet := CharSet.Auto, SetLastError := true>]
Public Shared Function CreateRemoteThread (
hProcess As IntPtr,
ByRef refThreadAttributes As SecurityAttributes,
stackSize As IntPtr,
startAddress As IntPtr,
threadParameter As IntPtr,
creationFlags As CreateThreadFlags,
ByRef refThreadId As UInteger
) As IntPtr
Dim hProcess As IntPtr
Dim refThreadAttributes As SecurityAttributes
Dim stackSize As IntPtr
Dim startAddress As IntPtr
Dim threadParameter As IntPtr
Dim creationFlags As CreateThreadFlags
Dim refThreadId As UInteger
Dim returnValue As IntPtr
returnValue = Kernel32.CreateRemoteThread(hProcess,
refThreadAttributes, stackSize,
startAddress, threadParameter, creationFlags,
refThreadId)
public:
[DllImportAttribute(L"Kernel32.dll", CharSet = CharSet::Auto, SetLastError = true)]
static IntPtr CreateRemoteThread(
IntPtr hProcess,
[InAttribute] SecurityAttributes% refThreadAttributes,
IntPtr stackSize,
IntPtr startAddress,
IntPtr threadParameter,
CreateThreadFlags creationFlags,
unsigned int% refThreadId
)
[<DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
static member CreateRemoteThread :
hProcess : IntPtr *
refThreadAttributes : SecurityAttributes byref *
stackSize : IntPtr *
startAddress : IntPtr *
threadParameter : IntPtr *
creationFlags : CreateThreadFlags *
refThreadId : uint32 byref -> IntPtr
No code example is currently available or this language may not be supported.
- hProcess IntPtr
-
A handle to the process in which the thread is to be created.
The handle must have the CreateThread,
QueryInformation,
VirtualMemoryOperation,
VirtualMemoryRead, and
VirtualMemoryWrite access rights,
and may fail without these rights on certain platforms.
- refThreadAttributes SecurityAttributes
-
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 refThreadAttributes is ,
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 IntPtr
-
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.
- threadParameter IntPtr
-
A pointer to a variable to be passed to the thread function.
- creationFlags CreateThreadFlags
-
The flags that control the creation of the thread.
- refThreadId UInt32
-
A pointer to a variable that receives the thread identifier.
If this parameter is , 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.
To get extended error information, call
GetLastWin32Error.