VirtualBox

source: vbox/trunk/src/VBox/Main/win/dllmain.cpp@ 31731

Last change on this file since 31731 was 30832, checked in by vboxsync, 14 years ago

Main: win burns

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/** @file
2 *
3 * DLLMAIN - COM DLL exports
4 *
5 */
6
7/*
8 * Copyright (C) 2006-2007 Oracle Corporation
9 *
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.
17 */
18
19#include "VBox/com/defs.h"
20
21#include <SessionImpl.h>
22
23#include <atlbase.h>
24#include <atlcom.h>
25
26#include <iprt/initterm.h>
27
28CComModule _Module;
29
30BEGIN_OBJECT_MAP(ObjectMap)
31 OBJECT_ENTRY(CLSID_Session, Session)
32END_OBJECT_MAP()
33
34/////////////////////////////////////////////////////////////////////////////
35// DLL Entry Point
36
37extern "C"
38BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
39{
40 if (dwReason == DLL_PROCESS_ATTACH)
41 {
42 _Module.Init(ObjectMap, hInstance, &LIBID_VirtualBox);
43 DisableThreadLibraryCalls(hInstance);
44
45 // idempotent, so doesn't harm, and needed for COM embedding scenario
46 RTR3Init();
47 }
48 else if (dwReason == DLL_PROCESS_DETACH)
49 _Module.Term();
50 return TRUE;
51}
52
53/////////////////////////////////////////////////////////////////////////////
54// Used to determine whether the DLL can be unloaded by OLE
55
56STDAPI DllCanUnloadNow(void)
57{
58 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
59}
60
61/////////////////////////////////////////////////////////////////////////////
62// Returns a class factory to create an object of the requested type
63
64STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
65{
66 return _Module.GetClassObject(rclsid, riid, ppv);
67}
68
69/////////////////////////////////////////////////////////////////////////////
70// DllRegisterServer - Adds entries to the system registry
71
72STDAPI DllRegisterServer(void)
73{
74 // registers object, typelib and all interfaces in typelib
75 return _Module.RegisterServer(TRUE);
76}
77
78/////////////////////////////////////////////////////////////////////////////
79// DllUnregisterServer - Removes entries from the system registry
80
81STDAPI DllUnregisterServer(void)
82{
83 return _Module.UnregisterServer(TRUE);
84}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette