Skip to content

Instantly share code, notes, and snippets.

@mpfund
Created December 31, 2016 11:24
Show Gist options
  • Save mpfund/ccb188979ba69f72c64372da0499e420 to your computer and use it in GitHub Desktop.
Save mpfund/ccb188979ba69f72c64372da0499e420 to your computer and use it in GitHub Desktop.
dll in process injecten
#include <iostream>
#include <windows.h>
#include <psapi.h>
using namespace std;
int main()
{
DWORD pProcessIds[500];
DWORD pBytesReturned;
HANDLE hprocess = NULL;
char filepath[300];
if(EnumProcesses(pProcessIds,sizeof(pProcessIds),&pBytesReturned)!=0)
{
for(DWORD x=0;x<=pBytesReturned/sizeof(DWORD);x++)
{
hprocess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,false,pProcessIds[x++]);
if(hprocess != NULL)
{
GetModuleFileNameEx(hprocess,NULL,filepath,sizeof(filepath));
printf("%u %s \n",pProcessIds[x-1],filepath);
}
//else{printf("%u\n",GetLastError());}
}
}
else
{printf("Enum Fehlgeschlagen\n");}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment