1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 // EventListener.cpp : Implementation of DLL Exports.
23
24
25 // Note: Proxy/Stub Information
26 // To build a separate proxy/stub DLL,
27 // run nmake -f EventListenerps.mk in the project directory.
28
29 #include "stdafx.h"
30 #include "resource.h"
31 #include <initguid.h>
32 #include "EventListener.h"
33
34 #include "EventListener_i.c"
35 #include "EvtListener.h"
36
37
38 CComModule _Module;
39
40 BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_EvtListener,CEvtListener)41 OBJECT_ENTRY(CLSID_EvtListener, CEvtListener)
42 END_OBJECT_MAP()
43
44 /////////////////////////////////////////////////////////////////////////////
45 // DLL Entry Point
46
47 extern "C"
48 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
49 {
50 if (dwReason == DLL_PROCESS_ATTACH)
51 {
52 _Module.Init(ObjectMap, hInstance, &LIBID_EVENTLISTENERLib);
53 DisableThreadLibraryCalls(hInstance);
54 }
55 else if (dwReason == DLL_PROCESS_DETACH)
56 _Module.Term();
57 return TRUE; // ok
58 }
59
60 /////////////////////////////////////////////////////////////////////////////
61 // Used to determine whether the DLL can be unloaded by OLE
62
DllCanUnloadNow(void)63 STDAPI DllCanUnloadNow(void)
64 {
65 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
66 }
67
68 /////////////////////////////////////////////////////////////////////////////
69 // Returns a class factory to create an object of the requested type
70
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)71 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
72 {
73 return _Module.GetClassObject(rclsid, riid, ppv);
74 }
75
76 /////////////////////////////////////////////////////////////////////////////
77 // DllRegisterServer - Adds entries to the system registry
78
DllRegisterServer(void)79 STDAPI DllRegisterServer(void)
80 {
81 // registers object, typelib and all interfaces in typelib
82 return _Module.RegisterServer(TRUE);
83 }
84
85 /////////////////////////////////////////////////////////////////////////////
86 // DllUnregisterServer - Removes entries from the system registry
87
DllUnregisterServer(void)88 STDAPI DllUnregisterServer(void)
89 {
90 return _Module.UnregisterServer(TRUE);
91 }
92
93
94