Don't require execute permission on the process heap.
[wine] / dlls / shdocvw / factory.c
1 /*
2  * Implementation of class factory for IE Web Browser
3  *
4  * Copyright 2001 John R. Sheets (for CodeWeavers)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <string.h>
22 #include "wine/debug.h"
23 #include "shdocvw.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
26
27 /**********************************************************************
28  * Implement the IWebBrowser class factory
29  *
30  * (Based on implementation in ddraw/main.c)
31  */
32
33 /**********************************************************************
34  * WBCF_QueryInterface (IUnknown)
35  */
36 static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
37                                           REFIID riid, LPVOID *ppobj)
38 {
39     FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
40     
41     if (ppobj == NULL) return E_POINTER;
42     
43     return E_NOINTERFACE;
44 }
45
46 /************************************************************************
47  * WBCF_AddRef (IUnknown)
48  */
49 static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
50 {
51     SHDOCVW_LockModule();
52
53     return 2; /* non-heap based object */
54 }
55
56 /************************************************************************
57  * WBCF_Release (IUnknown)
58  */
59 static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
60 {
61     SHDOCVW_UnlockModule();
62
63     return 1; /* non-heap based object */
64 }
65
66 /************************************************************************
67  * WBCF_CreateInstance (IClassFactory)
68  */
69 static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
70                                           REFIID riid, LPVOID *ppobj)
71 {
72     IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
73
74     /* Don't support aggregation (yet?) */
75     if (pOuter)
76     {
77         TRACE ("Failed attempt to aggregate IWebBrowser\n");
78         return CLASS_E_NOAGGREGATION;
79     }
80
81     TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
82
83     if ((IsEqualGUID (&IID_IOleObject, riid)))
84     {
85         TRACE ("Instantiating IOleObject component\n");
86         *ppobj = (LPVOID)&SHDOCVW_OleObject;
87
88         return S_OK;
89     }
90     return CLASS_E_CLASSNOTAVAILABLE;
91 }
92
93 /************************************************************************
94  * WBCF_LockServer (IClassFactory)
95  */
96 static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
97 {
98     TRACE("(%d)\n", dolock);
99
100     if (dolock)
101             SHDOCVW_LockModule();
102     else
103             SHDOCVW_UnlockModule();
104     
105     return S_OK;
106 }
107
108 static const IClassFactoryVtbl WBCF_Vtbl =
109 {
110     WBCF_QueryInterface,
111     WBCF_AddRef,
112     WBCF_Release,
113     WBCF_CreateInstance,
114     WBCF_LockServer
115 };
116
117 IClassFactoryImpl SHDOCVW_ClassFactory = {&WBCF_Vtbl};