1*f78e906fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f78e906fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f78e906fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f78e906fSAndrew Rist * distributed with this work for additional information
6*f78e906fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f78e906fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f78e906fSAndrew Rist * "License"); you may not use this file except in compliance
9*f78e906fSAndrew Rist * with the License. You may obtain a copy of the License at
10*f78e906fSAndrew Rist *
11*f78e906fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*f78e906fSAndrew Rist *
13*f78e906fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f78e906fSAndrew Rist * software distributed under the License is distributed on an
15*f78e906fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f78e906fSAndrew Rist * KIND, either express or implied. See the License for the
17*f78e906fSAndrew Rist * specific language governing permissions and limitations
18*f78e906fSAndrew Rist * under the License.
19*f78e906fSAndrew Rist *
20*f78e906fSAndrew Rist *************************************************************/
21*f78e906fSAndrew Rist
22*f78e906fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #define STRICT
25cdf0e10cSrcweir #define _WIN32_WINNT 0x0400
26cdf0e10cSrcweir #define _WIN32_DCOM
27cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER >= 1300)
28cdf0e10cSrcweir #undef _DEBUG
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER > 1310)
31cdf0e10cSrcweir #pragma warning(disable : 4917 4555)
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir #ifdef __MINGW32__
35cdf0e10cSrcweir #define _INIT_ATL_COMMON_VARS
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include "stdafx.h"
39cdf0e10cSrcweir
40cdf0e10cSrcweir #include <atlbase.h>
41cdf0e10cSrcweir #ifdef _MSC_VER
42cdf0e10cSrcweir #pragma warning( push )
43cdf0e10cSrcweir #pragma warning( disable: 4710 )
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir CComModule _Module;
46cdf0e10cSrcweir #ifdef _MSC_VER
47cdf0e10cSrcweir #pragma warning( pop )
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #include <atlcom.h>
50cdf0e10cSrcweir
51cdf0e10cSrcweir BEGIN_OBJECT_MAP(ObjectMap)
52cdf0e10cSrcweir END_OBJECT_MAP()
53cdf0e10cSrcweir
54cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
55cdf0e10cSrcweir // DLL Entry Point
56cdf0e10cSrcweir
57cdf0e10cSrcweir
58cdf0e10cSrcweir #include "syswinwrapper.hxx"
59cdf0e10cSrcweir #include "docholder.hxx"
60cdf0e10cSrcweir
61cdf0e10cSrcweir
62cdf0e10cSrcweir HINSTANCE DocumentHolder::m_hInstance;
63cdf0e10cSrcweir
64cdf0e10cSrcweir extern "C"
DllMain(HINSTANCE hInstance,DWORD dwReason,LPVOID)65cdf0e10cSrcweir BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir DocumentHolder::m_hInstance = hInstance;
68cdf0e10cSrcweir if (!winwrap::HatchWindowRegister(hInstance))
69cdf0e10cSrcweir return FALSE;
70cdf0e10cSrcweir
71cdf0e10cSrcweir if (dwReason == DLL_PROCESS_ATTACH)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir _Module.Init(ObjectMap, hInstance, NULL);
74cdf0e10cSrcweir DisableThreadLibraryCalls(hInstance);
75cdf0e10cSrcweir }
76cdf0e10cSrcweir else if (dwReason == DLL_PROCESS_DETACH)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir _Module.Term();
79cdf0e10cSrcweir }
80cdf0e10cSrcweir return TRUE; // ok
81cdf0e10cSrcweir }
82cdf0e10cSrcweir
83cdf0e10cSrcweir // Fix strange warnings about some
84cdf0e10cSrcweir // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
85cdf0e10cSrcweir // warning C4505: 'xxx' : unreferenced local function has been removed
86cdf0e10cSrcweir #if defined(_MSC_VER)
87cdf0e10cSrcweir #pragma warning(disable: 4505)
88cdf0e10cSrcweir #endif