We should always allocate in NdrConformantStringUnmarshal if the
[wine.git] / dlls / shdocvw / factory.c
blob7770b4d551f86cad29cb9f88320150907456317b
1 /*
2 * Implementation of class factory for IE Web Browser
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
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.
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.
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
21 #include <string.h>
22 #include "wine/debug.h"
23 #include "shdocvw.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
27 /**********************************************************************
28 * Implement the WebBrowser class factory
30 * (Based on implementation in ddraw/main.c)
33 /**********************************************************************
34 * WBCF_QueryInterface (IUnknown)
36 static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
37 REFIID riid, LPVOID *ppobj)
39 TRACE("(%s %p)\n", debugstr_guid(riid), ppobj);
41 if (!ppobj)
42 return E_POINTER;
44 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
45 *ppobj = iface;
46 return S_OK;
49 WARN("Not supported interface %s\n", debugstr_guid(riid));
51 *ppobj = NULL;
52 return E_NOINTERFACE;
55 /************************************************************************
56 * WBCF_AddRef (IUnknown)
58 static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
60 SHDOCVW_LockModule();
62 return 2; /* non-heap based object */
65 /************************************************************************
66 * WBCF_Release (IUnknown)
68 static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
70 SHDOCVW_UnlockModule();
72 return 1; /* non-heap based object */
75 /************************************************************************
76 * WBCF_CreateInstance (IClassFactory)
78 static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
79 REFIID riid, LPVOID *ppobj)
81 return WebBrowser_Create(pOuter, riid, ppobj);
84 /************************************************************************
85 * WBCF_LockServer (IClassFactory)
87 static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
89 TRACE("(%d)\n", dolock);
91 if (dolock)
92 SHDOCVW_LockModule();
93 else
94 SHDOCVW_UnlockModule();
96 return S_OK;
99 static const IClassFactoryVtbl WBCF_Vtbl =
101 WBCF_QueryInterface,
102 WBCF_AddRef,
103 WBCF_Release,
104 WBCF_CreateInstance,
105 WBCF_LockServer
108 IClassFactoryImpl SHDOCVW_ClassFactory = {&WBCF_Vtbl};