Implemented NetQueryDisplayInformation, NetUserGetInfo, created
[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     ICOM_THIS(IClassFactoryImpl, iface);
40
41     TRACE ("\n");
42
43     /*
44      * Perform a sanity check on the parameters.
45      */
46     if ((This == NULL) || (ppobj == NULL) )
47         return E_INVALIDARG;
48
49     return E_NOINTERFACE;
50 }
51
52 /************************************************************************
53  * WBCF_AddRef (IUnknown)
54  */
55 static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
56 {
57     ICOM_THIS(IClassFactoryImpl, iface);
58
59     TRACE("\n");
60     return ++(This->ref);
61 }
62
63 /************************************************************************
64  * WBCF_Release (IUnknown)
65  */
66 static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
67 {
68     ICOM_THIS(IClassFactoryImpl, iface);
69
70     /* static class, won't be freed */
71     TRACE("\n");
72     return --(This->ref);
73 }
74
75 /************************************************************************
76  * WBCF_CreateInstance (IClassFactory)
77  */
78 static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
79                                           REFIID riid, LPVOID *ppobj)
80 {
81     ICOM_THIS(IClassFactoryImpl, iface);
82
83     /* Don't support aggregation (yet?) */
84     if (pOuter)
85     {
86         TRACE ("Failed attempt to aggregate IWebBrowser\n");
87         return CLASS_E_NOAGGREGATION;
88     }
89
90     TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
91
92     if ((IsEqualGUID (&IID_IOleObject, riid)))
93     {
94         TRACE ("Instantiating IOleObject component\n");
95         *ppobj = (LPVOID)&SHDOCVW_OleObject;
96
97         return S_OK;
98     }
99     return CLASS_E_CLASSNOTAVAILABLE;
100 }
101
102 /************************************************************************
103  * WBCF_LockServer (IClassFactory)
104  */
105 static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
106 {
107     ICOM_THIS(IClassFactoryImpl, iface);
108     FIXME("(%p)->(%d),stub!\n", This, dolock);
109     return S_OK;
110 }
111
112 static ICOM_VTABLE(IClassFactory) WBCF_Vtbl =
113 {
114     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
115     WBCF_QueryInterface,
116     WBCF_AddRef,
117     WBCF_Release,
118     WBCF_CreateInstance,
119     WBCF_LockServer
120 };
121
122 IClassFactoryImpl SHDOCVW_ClassFactory = { &WBCF_Vtbl, 1 };