1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

Land #713, Removed GetThreadId and replaced with optional CLIENTID argument

This commit is contained in:
dledda-r7 2024-09-20 11:15:19 -04:00
commit a6da6ddac6
No known key found for this signature in database
GPG Key ID: 4D4EC504A1F02FFF

View File

@ -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;
@ -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