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