CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/rdll_template/dllmain.c
Views: 11766
1
#define REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
2
#define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN
3
#include "ReflectiveLoader.c"
4
5
#include <stdio.h>
6
#include <stdint.h>
7
#include <windows.h>
8
9
LPVOID main(LPVOID lpReserved) {
10
return;
11
}
12
13
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
14
{
15
switch (dwReason)
16
{
17
case DLL_QUERY_HMODULE:
18
hAppInstance = hinstDLL;
19
if (lpReserved != NULL)
20
{
21
*(HMODULE*)lpReserved = hAppInstance;
22
}
23
break;
24
case DLL_PROCESS_ATTACH:
25
hAppInstance = hinstDLL;
26
main(lpReserved);
27
break;
28
case DLL_PROCESS_DETACH:
29
case DLL_THREAD_ATTACH:
30
case DLL_THREAD_DETACH:
31
break;
32
}
33
return TRUE;
34
}
35
36
37