VirtualBox

source: vbox/trunk/src/VBox/Main/win32/dllmain.cpp@ 3117

Last change on this file since 3117 was 2981, checked in by vboxsync, 18 years ago

InnoTek -> innotek: all the headers and comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/** @file
2 *
3 * DLLMAIN - COM DLL exports
4 *
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#include "VBox/com/defs.h"
24
25#include <SessionImpl.h>
26
27#include <atlbase.h>
28#include <atlcom.h>
29
30CComModule _Module;
31
32BEGIN_OBJECT_MAP(ObjectMap)
33 OBJECT_ENTRY(CLSID_Session, Session)
34END_OBJECT_MAP()
35
36/////////////////////////////////////////////////////////////////////////////
37// DLL Entry Point
38
39extern "C"
40BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
41{
42 if (dwReason == DLL_PROCESS_ATTACH)
43 {
44 _Module.Init(ObjectMap, hInstance, &LIBID_VirtualBox);
45 DisableThreadLibraryCalls(hInstance);
46 }
47 else if (dwReason == DLL_PROCESS_DETACH)
48 _Module.Term();
49 return TRUE;
50}
51
52/////////////////////////////////////////////////////////////////////////////
53// Used to determine whether the DLL can be unloaded by OLE
54
55STDAPI DllCanUnloadNow(void)
56{
57 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
58}
59
60/////////////////////////////////////////////////////////////////////////////
61// Returns a class factory to create an object of the requested type
62
63STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
64{
65 return _Module.GetClassObject(rclsid, riid, ppv);
66}
67
68/////////////////////////////////////////////////////////////////////////////
69// DllRegisterServer - Adds entries to the system registry
70
71STDAPI DllRegisterServer(void)
72{
73 // registers object, typelib and all interfaces in typelib
74 return _Module.RegisterServer(TRUE);
75}
76
77/////////////////////////////////////////////////////////////////////////////
78// DllUnregisterServer - Removes entries from the system registry
79
80STDAPI DllUnregisterServer(void)
81{
82 return _Module.UnregisterServer(TRUE);
83}
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