1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
30 #include <DebugServices.h>
36 class CDLLComponentModule
: public CAtlDllModuleT
< CDLLComponentModule
>
42 DECLARE_LIBID(LIBID_Bonjour
)
44 DECLARE_REGISTRY_APPID_RESOURCEID(IDR_DLLX
, "{56608F9C-223B-4CB6-813D-85EDCCADFB4B}")
50 CDLLComponentModule _AtlModule
;
58 #pragma managed(push, off)
66 extern "C" BOOL WINAPI
DllMain(HINSTANCE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
70 debug_initialize( kDebugOutputTypeWindowsDebugger
);
71 debug_set_property( kDebugPropertyTagPrintLevel
, kDebugLevelVerbose
);
75 #ifdef _MERGE_PROXYSTUB
77 if (!PrxDllMain(hInstance
, dwReason
, lpReserved
))
85 return _AtlModule
.DllMain(dwReason
, lpReserved
);
105 // Used to determine whether the DLL can be unloaded by OLE
107 STDAPI
DllCanUnloadNow(void)
111 #ifdef _MERGE_PROXYSTUB
113 HRESULT hr
= PrxDllCanUnloadNow();
121 return _AtlModule
.DllCanUnloadNow();
129 // Returns a class factory to create an object of the requested type
131 STDAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
)
135 #ifdef _MERGE_PROXYSTUB
137 if (PrxDllGetClassObject(rclsid
, riid
, ppv
) == S_OK
)
143 return _AtlModule
.DllGetClassObject(rclsid
, riid
, ppv
);
151 // DllRegisterServer - Adds entries to the system registry
153 STDAPI
DllRegisterServer(void)
157 // registers object, typelib and all interfaces in typelib
159 HRESULT hr
= _AtlModule
.DllRegisterServer();
161 #ifdef _MERGE_PROXYSTUB
167 hr
= PrxDllRegisterServer();
179 // DllUnregisterServer - Removes entries from the system registry
181 STDAPI
DllUnregisterServer(void)
185 HRESULT hr
= _AtlModule
.DllUnregisterServer();
187 #ifdef _MERGE_PROXYSTUB
193 hr
= PrxDllRegisterServer();
199 hr
= PrxDllUnregisterServer();