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/passivex/PassiveX.cpp
Views: 11766
1
#include "PassiveXLib.h"
2
3
#include <objbase.h>
4
#include <initguid.h>
5
6
#include "PassiveX_i.c"
7
#include "CPassiveX.h"
8
9
CComModule _Module;
10
11
BEGIN_OBJECT_MAP(ObjectMap)
12
OBJECT_ENTRY(CLSID_PassiveX, CPassiveX)
13
END_OBJECT_MAP()
14
15
namespace ATL
16
{
17
void * __stdcall __AllocStdCallThunk()
18
{
19
return HeapAlloc( GetProcessHeap(), 0, sizeof(_stdcallthunk) );
20
}
21
22
void __stdcall __FreeStdCallThunk( void * p )
23
{
24
HeapFree( GetProcessHeap(), 0, p );
25
}
26
}
27
28
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
29
{
30
if (dwReason == DLL_PROCESS_ATTACH)
31
{
32
_Module.Init(ObjectMap, hInstance, &LIBID_PassiveXCOM);
33
DisableThreadLibraryCalls(hInstance);
34
}
35
else if (dwReason == DLL_PROCESS_DETACH)
36
_Module.Term();
37
38
return TRUE;
39
}
40
41
STDAPI DllCanUnloadNow(void)
42
{
43
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
44
}
45
46
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
47
{
48
return _Module.GetClassObject(rclsid, riid, ppv);
49
}
50
51
STDAPI DllRegisterServer(void)
52
{
53
return _Module.RegisterServer(TRUE);
54
}
55
56
STDAPI DllUnregisterServer(void)
57
{
58
return _Module.UnregisterServer(TRUE);
59
}
60
61