CreateRemoteThread3()

Example Code

function CreateRemoteThread3(hProcess: THandle; lpThreadAttributes: PSecurityAttributes; dwStackSize: ULONG; lpStartAddress: Pointer; lpParameter: Pointer; {optional} lpParameter2: Pointer; {optional} lpParameter3: Pointer; dwCreationFlags: ULONG; {optional} lpThreadId: PULONG): THandle; stdcall; // Creates a new remote thread in the target process // Behaves identically to kernel32.dll!CreateRemoteThread() however it can inject into any session and offers up to [3] thread start parameters var dwThreadId: DWORD; hThread: THandle; begin hThread := CreateRemoteThread3(GetCurrentProcess(), nil, 0, pRemoteFunction, lpParameter, lpParameter2, lpParameter3, 0, @dwThreadId); if (hThread <> 0) then begin ShowMessage(Format('Remote Thread Id: %u', [dwThreadId])); CloseHandle(hThread); end; end;