Skip to content

Commit

Permalink
Land #713, Removed GetThreadId and replaced with optional CLIENTID ar…
Browse files Browse the repository at this point in the history
…gument
  • Loading branch information
dledda-r7 committed Sep 20, 2024
2 parents 435a3a2 + a5c1849 commit a6da6dd
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 = PtrToUint(ClientId.UniqueThread);
}
}
else
Expand Down

0 comments on commit a6da6dd

Please sign in to comment.