d3d8: Downgrade a FIXME to a TRACE in IDirect3DDevice8Impl_SetVertexShader.
[wine] / dlls / msxml3 / factory.c
1 /*
2  *    MSXML Class Factory
3  *
4  * Copyright 2002 Lionel Ulmer
5  * Copyright 2005 Mike McCormack
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #define COBJMACROS
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "msxml2.h"
30
31 #include "wine/debug.h"
32
33 #include "msxml_private.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
36
37 typedef HRESULT (*fnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
38
39 /******************************************************************************
40  * MSXML ClassFactory
41  */
42 typedef struct _xmlcf
43 {
44     const struct IClassFactoryVtbl *lpVtbl;
45     fnCreateInstance pfnCreateInstance;
46 } xmlcf;
47
48 static inline xmlcf *impl_from_IClassFactory( IClassFactory *iface )
49 {
50     return (xmlcf *)((char*)iface - FIELD_OFFSET(xmlcf, lpVtbl));
51 }
52
53 static HRESULT WINAPI xmlcf_QueryInterface(
54     IClassFactory *iface,
55     REFIID riid,
56     LPVOID *ppobj )
57 {
58     if (IsEqualGUID(riid, &IID_IUnknown) ||
59         IsEqualGUID(riid, &IID_IClassFactory))
60     {
61         IClassFactory_AddRef( iface );
62         *ppobj = iface;
63         return S_OK;
64     }
65
66     FIXME("interface %s not implemented\n", debugstr_guid(riid));
67     return E_NOINTERFACE;
68 }
69
70 static ULONG WINAPI xmlcf_AddRef(
71     IClassFactory *iface )
72 {
73     return 2;
74 }
75
76 static ULONG WINAPI xmlcf_Release(
77     IClassFactory *iface )
78 {
79     return 1;
80 }
81
82 static HRESULT WINAPI xmlcf_CreateInstance(
83     IClassFactory *iface,
84     LPUNKNOWN pOuter,
85     REFIID riid,
86     LPVOID *ppobj )
87 {
88     xmlcf *This = impl_from_IClassFactory( iface );
89     HRESULT r;
90     IUnknown *punk;
91     
92     TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
93
94     *ppobj = NULL;
95
96     if (pOuter)
97         return CLASS_E_NOAGGREGATION;
98
99     r = This->pfnCreateInstance( pOuter, (LPVOID*) &punk );
100     if (FAILED(r))
101         return r;
102
103     r = IUnknown_QueryInterface( punk, riid, ppobj );
104     if (FAILED(r))
105         return r;
106     IUnknown_Release( punk );
107     return r;
108 }
109
110 static HRESULT WINAPI xmlcf_LockServer(
111     IClassFactory *iface,
112     BOOL dolock)
113 {
114     FIXME("(%p)->(%d),stub!\n",iface,dolock);
115     return S_OK;
116 }
117
118 const struct IClassFactoryVtbl xmlcf_vtbl =
119 {
120     xmlcf_QueryInterface,
121     xmlcf_AddRef,
122     xmlcf_Release,
123     xmlcf_CreateInstance,
124     xmlcf_LockServer
125 };
126
127 static xmlcf domdoccf = { &xmlcf_vtbl, DOMDocument_create };
128
129 /******************************************************************
130  *              DllGetClassObject (MSXML3.@)
131  */
132 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
133 {
134     IClassFactory *cf = NULL;
135
136     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv );
137
138     if( IsEqualGUID( rclsid, &CLSID_DOMDocument ) )
139         cf = (IClassFactory*) &domdoccf.lpVtbl;
140
141     if ( !cf )
142         return CLASS_E_CLASSNOTAVAILABLE;
143
144     return IClassFactory_QueryInterface( cf, iid, ppv );
145 }