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.
17 Change History (most recent first):
20 Revision 1.1 2009/05/26 04:43:54 herscher
21 <rdar://problem/3948252> COM component that can be used with any .NET language and VB.
31 #include <DebugServices.h>
34 class CDLLComponentModule
: public CAtlDllModuleT
< CDLLComponentModule
>
37 DECLARE_LIBID(LIBID_Bonjour
)
38 DECLARE_REGISTRY_APPID_RESOURCEID(IDR_DLLX
, "{56608F9C-223B-4CB6-813D-85EDCCADFB4B}")
41 CDLLComponentModule _AtlModule
;
45 #pragma managed(push, off)
49 extern "C" BOOL WINAPI
DllMain(HINSTANCE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
51 debug_initialize( kDebugOutputTypeWindowsDebugger
);
52 debug_set_property( kDebugPropertyTagPrintLevel
, kDebugLevelVerbose
);
54 #ifdef _MERGE_PROXYSTUB
55 if (!PrxDllMain(hInstance
, dwReason
, lpReserved
))
59 return _AtlModule
.DllMain(dwReason
, lpReserved
);
69 // Used to determine whether the DLL can be unloaded by OLE
70 STDAPI
DllCanUnloadNow(void)
72 #ifdef _MERGE_PROXYSTUB
73 HRESULT hr
= PrxDllCanUnloadNow();
77 return _AtlModule
.DllCanUnloadNow();
81 // Returns a class factory to create an object of the requested type
82 STDAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
)
84 #ifdef _MERGE_PROXYSTUB
85 if (PrxDllGetClassObject(rclsid
, riid
, ppv
) == S_OK
)
88 return _AtlModule
.DllGetClassObject(rclsid
, riid
, ppv
);
92 // DllRegisterServer - Adds entries to the system registry
93 STDAPI
DllRegisterServer(void)
95 // registers object, typelib and all interfaces in typelib
96 HRESULT hr
= _AtlModule
.DllRegisterServer();
97 #ifdef _MERGE_PROXYSTUB
100 hr
= PrxDllRegisterServer();
106 // DllUnregisterServer - Removes entries from the system registry
107 STDAPI
DllUnregisterServer(void)
109 HRESULT hr
= _AtlModule
.DllUnregisterServer();
110 #ifdef _MERGE_PROXYSTUB
113 hr
= PrxDllRegisterServer();
116 hr
= PrxDllUnregisterServer();