3
* DLLMAIN - COM DLL exports
8
* Copyright (C) 2006-2007 Oracle Corporation
10
* This file is part of VirtualBox Open Source Edition (OSE), as
11
* available from http://www.virtualbox.org. This file is free software;
12
* you can redistribute it and/or modify it under the terms of the GNU
13
* General Public License (GPL) as published by the Free Software
14
* Foundation, in version 2 as it comes in the "COPYING" file of the
15
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
#include "VBox/com/defs.h"
21
#include <SessionImpl.h>
22
#include <VirtualBoxCallbackImpl.h>
27
#include <iprt/initterm.h>
31
BEGIN_OBJECT_MAP(ObjectMap)
32
OBJECT_ENTRY(CLSID_Session, Session)
33
OBJECT_ENTRY(CLSID_CallbackWrapper, CallbackWrapper)
36
/////////////////////////////////////////////////////////////////////////////
40
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
42
if (dwReason == DLL_PROCESS_ATTACH)
44
_Module.Init(ObjectMap, hInstance, &LIBID_VirtualBox);
45
DisableThreadLibraryCalls(hInstance);
47
// idempotent, so doesn't harm, and needed for COM embedding scenario
50
else if (dwReason == DLL_PROCESS_DETACH)
55
/////////////////////////////////////////////////////////////////////////////
56
// Used to determine whether the DLL can be unloaded by OLE
58
STDAPI DllCanUnloadNow(void)
60
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
63
/////////////////////////////////////////////////////////////////////////////
64
// Returns a class factory to create an object of the requested type
66
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
68
return _Module.GetClassObject(rclsid, riid, ppv);
71
/////////////////////////////////////////////////////////////////////////////
72
// DllRegisterServer - Adds entries to the system registry
74
STDAPI DllRegisterServer(void)
76
// registers object, typelib and all interfaces in typelib
77
return _Module.RegisterServer(TRUE);
80
/////////////////////////////////////////////////////////////////////////////
81
// DllUnregisterServer - Removes entries from the system registry
83
STDAPI DllUnregisterServer(void)
85
return _Module.UnregisterServer(TRUE);