Documentation ordinal fixes.
[wine] / dlls / shdocvw / factory.c
1 /*
2  * Implementation of class factory for IE Web Browser
3  *
4  * 2001 John R. Sheets (for CodeWeavers)
5  */
6
7 #include <string.h>
8 #include "debugtools.h"
9 #include "shdocvw.h"
10
11 DEFAULT_DEBUG_CHANNEL(shdocvw);
12
13 /**********************************************************************
14  * Implement the IWebBrowser class factory
15  *
16  * (Based on implementation in ddraw/main.c)
17  */
18
19 /**********************************************************************
20  * WBCF_QueryInterface (IUnknown)
21  */
22 static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
23                                           REFIID riid, LPVOID *ppobj)
24 {
25     ICOM_THIS(IClassFactoryImpl, iface);
26
27     TRACE ("\n");
28
29     /*
30      * Perform a sanity check on the parameters.
31      */
32     if ((This == NULL) || (ppobj == NULL) )
33         return E_INVALIDARG;
34
35     return E_NOINTERFACE;
36 }
37
38 /************************************************************************
39  * WBCF_AddRef (IUnknown)
40  */
41 static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
42 {
43     ICOM_THIS(IClassFactoryImpl, iface);
44
45     TRACE("\n");
46     return ++(This->ref);
47 }
48
49 /************************************************************************
50  * WBCF_Release (IUnknown)
51  */
52 static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
53 {
54     ICOM_THIS(IClassFactoryImpl, iface);
55
56     /* static class, won't be freed */
57     TRACE("\n");
58     return --(This->ref);
59 }
60
61 /************************************************************************
62  * WBCF_CreateInstance (IClassFactory)
63  */
64 static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
65                                           REFIID riid, LPVOID *ppobj)
66 {
67     ICOM_THIS(IClassFactoryImpl, iface);
68
69     /* Don't support aggregation (yet?) */
70     if (pOuter)
71     {
72         TRACE ("Failed attempt to aggregate IWebBrowser\n");
73         return CLASS_E_NOAGGREGATION;
74     }
75
76     TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
77
78     if ((IsEqualGUID (&IID_IOleObject, riid)))
79     {
80         TRACE ("Instantiating IOleObject component\n");
81         *ppobj = (LPVOID)&SHDOCVW_OleObject;
82
83         return S_OK;
84     }
85     return CLASS_E_CLASSNOTAVAILABLE;
86 }
87
88 /************************************************************************
89  * WBCF_LockServer (IClassFactory)
90  */
91 static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
92 {
93     ICOM_THIS(IClassFactoryImpl, iface);
94     FIXME("(%p)->(%d),stub!\n", This, dolock);
95     return S_OK;
96 }
97
98 static ICOM_VTABLE(IClassFactory) WBCF_Vtbl = 
99 {
100     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
101     WBCF_QueryInterface,
102     WBCF_AddRef,
103     WBCF_Release,
104     WBCF_CreateInstance,
105     WBCF_LockServer
106 };
107
108 IClassFactoryImpl SHDOCVW_ClassFactory = { &WBCF_Vtbl, 1 };