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
23
24
25 // Note: Proxy/Stub Information
26 // To build a separate proxy/stub DLL,
27 // run nmake -f AxTestComponentsps.mk in the project directory.
28
29 #include "stdafx.h"
30 #include "resource.h"
31 #include <initguid.h>
32 //#include "AxTestComponents.h"
33
34 //#include "AxTestComponents_i.c"
35 #include "Basic.h"
36 #include "Foo.h"
37
38
39 CComModule _Module;
40
41 BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Basic,CBasic)42 OBJECT_ENTRY(CLSID_Basic, CBasic)
43 OBJECT_ENTRY(CLSID_Foo, CFoo)
44 END_OBJECT_MAP()
45
46 /////////////////////////////////////////////////////////////////////////////
47 // DLL Entry Point
48
49 extern "C"
50 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
51 {
52 if (dwReason == DLL_PROCESS_ATTACH)
53 {
54 _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib);
55 DisableThreadLibraryCalls(hInstance);
56 }
57 else if (dwReason == DLL_PROCESS_DETACH)
58 _Module.Term();
59 return TRUE; // ok
60 }
61
62 /////////////////////////////////////////////////////////////////////////////
63 // Used to determine whether the DLL can be unloaded by OLE
64
DllCanUnloadNow(void)65 STDAPI DllCanUnloadNow(void)
66 {
67 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
68 }
69
70 /////////////////////////////////////////////////////////////////////////////
71 // Returns a class factory to create an object of the requested type
72
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)73 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
74 {
75 return _Module.GetClassObject(rclsid, riid, ppv);
76 }
77
78 /////////////////////////////////////////////////////////////////////////////
79 // DllRegisterServer - Adds entries to the system registry
80
DllRegisterServer(void)81 STDAPI DllRegisterServer(void)
82 {
83 // registers object, typelib and all interfaces in typelib
84 return _Module.RegisterServer(TRUE);
85 }
86
87 /////////////////////////////////////////////////////////////////////////////
88 // DllUnregisterServer - Removes entries from the system registry
89
DllUnregisterServer(void)90 STDAPI DllUnregisterServer(void)
91 {
92 return _Module.UnregisterServer(TRUE);
93 }
94
95
96 //VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED