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