Skip to content

Commit

Permalink
removed GetThreadId and replaced with optional CLIENTID argument
Browse files Browse the repository at this point in the history
  • Loading branch information
cod committed Aug 27, 2024
1 parent a86dc9d commit 26c3809
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions c/meterpreter/source/metsrv/remote_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ HANDLE create_remote_thread(HANDLE hProcess, SIZE_T sStackSize, LPVOID pvStartAd
BOOL bCreateSuspended;
DWORD dwThreadId;
HANDLE hThread;

CLIENTID ClientId;

if (pdwThreadId == NULL)
{
pdwThreadId = &dwThreadId;
Expand Down Expand Up @@ -74,12 +75,12 @@ HANDLE create_remote_thread(HANDLE hProcess, SIZE_T sStackSize, LPVOID pvStartAd
{
dprintf("[REMOTETHREAD] Attempting thread creation with RtlCreateUserThread");
bCreateSuspended = (dwCreateFlags & CREATE_SUSPENDED) == CREATE_SUSPENDED;
ntResult = pRtlCreateUserThread(hProcess, NULL, bCreateSuspended, 0, 0, 0, (PTHREAD_START_ROUTINE)pvStartAddress, pvStartParam, &hThread, NULL);
ntResult = pRtlCreateUserThread(hProcess, NULL, bCreateSuspended, 0, 0, 0, (PTHREAD_START_ROUTINE)pvStartAddress, pvStartParam, &hThread, &ClientId);
SetLastError(ntResult);

if (ntResult == 0 && pdwThreadId)
{
*pdwThreadId = GetThreadId(hThread);
*pdwThreadId = (DWORD) ClientId.UniqueThread;
}
}
else
Expand Down

0 comments on commit 26c3809

Please sign in to comment.