VirtualBox

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

Last change on this file since 27166 was 22358, checked in by vboxsync, 15 years ago

fixed Win burns

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