quartz: Add a cleanup callback for parser filters to call on release.
[wine.git] / dlls / d3dxof / d3dxof.c
blob0904f64ae37636d348e7c33322d3f2af29e69736
1 /*
2 * Implementation of DirectX File Interfaces
4 * Copyright 2004 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "config.h"
25 #include "wine/debug.h"
27 #define COBJMACROS
29 #include "winbase.h"
30 #include "wingdi.h"
32 #include "d3dxof_private.h"
33 #include "dxfile.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(d3dxof);
37 static const struct IDirectXFileVtbl IDirectXFile_Vtbl;
38 static const struct IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl;
39 static const struct IDirectXFileDataVtbl IDirectXFileData_Vtbl;
40 static const struct IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl;
41 static const struct IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl;
42 static const struct IDirectXFileObjectVtbl IDirectXFileObject_Vtbl;
43 static const struct IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl;
45 HRESULT IDirectXFileImpl_Create(IUnknown* pUnkOuter, LPVOID* ppObj)
47 IDirectXFileImpl* object;
49 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
51 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileImpl));
53 object->lpVtbl.lpVtbl = &IDirectXFile_Vtbl;
54 object->ref = 1;
56 *ppObj = object;
58 return S_OK;
61 /*** IUnknown methods ***/
62 static HRESULT WINAPI IDirectXFileImpl_QueryInterface(IDirectXFile* iface, REFIID riid, void** ppvObject)
64 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
66 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
68 if (IsEqualGUID(riid, &IID_IUnknown)
69 || IsEqualGUID(riid, &IID_IDirectXFile))
71 IClassFactory_AddRef(iface);
72 *ppvObject = This;
73 return S_OK;
76 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
77 return E_NOINTERFACE;
80 static ULONG WINAPI IDirectXFileImpl_AddRef(IDirectXFile* iface)
82 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
83 ULONG ref = InterlockedIncrement(&This->ref);
85 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
87 return ref;
90 static ULONG WINAPI IDirectXFileImpl_Release(IDirectXFile* iface)
92 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
93 ULONG ref = InterlockedDecrement(&This->ref);
95 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
97 if (!ref)
98 HeapFree(GetProcessHeap(), 0, This);
100 return ref;
103 /*** IDirectXFile methods ***/
104 static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPVOID pvSource, DXFILELOADOPTIONS dwLoadOptions, LPDIRECTXFILEENUMOBJECT* ppEnumObj)
107 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
108 IDirectXFileEnumObjectImpl* object;
110 FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pvSource, dwLoadOptions, ppEnumObj);
112 if (dwLoadOptions == 0)
114 FIXME("Source is a file '%s'\n", (char*)pvSource);
117 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileEnumObjectImpl));
119 object->lpVtbl.lpVtbl = &IDirectXFileEnumObject_Vtbl;
120 object->ref = 1;
122 *ppEnumObj = (LPDIRECTXFILEENUMOBJECT)object;
124 return S_FALSE;
127 static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject(IDirectXFile* iface, LPCSTR szFileName, DXFILEFORMAT dwFileFormat, LPDIRECTXFILESAVEOBJECT* ppSaveObj)
129 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
131 FIXME("(%p/%p)->(%s,%x,%p) stub!\n", This, iface, szFileName, dwFileFormat, ppSaveObj);
133 return S_FALSE;
136 static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates(IDirectXFile* iface, LPVOID pvData, DWORD cbSize)
138 IDirectXFileImpl *This = (IDirectXFileImpl *)iface;
140 FIXME("(%p/%p)->(%p,%d) stub!\n", This, iface, pvData, cbSize);
142 return S_FALSE;
145 static const IDirectXFileVtbl IDirectXFile_Vtbl =
147 IDirectXFileImpl_QueryInterface,
148 IDirectXFileImpl_AddRef,
149 IDirectXFileImpl_Release,
150 IDirectXFileImpl_CreateEnumObject,
151 IDirectXFileImpl_CreateSaveObject,
152 IDirectXFileImpl_RegisterTemplates
155 HRESULT IDirectXFileBinaryImpl_Create(IDirectXFileBinaryImpl** ppObj)
157 IDirectXFileBinaryImpl* object;
159 TRACE("(%p)\n", ppObj);
161 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileBinaryImpl));
163 object->lpVtbl.lpVtbl = &IDirectXFileBinary_Vtbl;
164 object->ref = 1;
166 *ppObj = object;
168 return S_OK;
171 /*** IUnknown methods ***/
172 static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface(IDirectXFileBinary* iface, REFIID riid, void** ppvObject)
174 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
176 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
178 if (IsEqualGUID(riid, &IID_IUnknown)
179 || IsEqualGUID(riid, &IID_IDirectXFileObject)
180 || IsEqualGUID(riid, &IID_IDirectXFileBinary))
182 IClassFactory_AddRef(iface);
183 *ppvObject = This;
184 return S_OK;
187 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
188 return E_NOINTERFACE;
191 static ULONG WINAPI IDirectXFileBinaryImpl_AddRef(IDirectXFileBinary* iface)
193 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
194 ULONG ref = InterlockedIncrement(&This->ref);
196 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
198 return ref;
201 static ULONG WINAPI IDirectXFileBinaryImpl_Release(IDirectXFileBinary* iface)
203 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
204 ULONG ref = InterlockedDecrement(&This->ref);
206 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
208 if (!ref)
209 HeapFree(GetProcessHeap(), 0, This);
211 return ref;
214 /*** IDirectXFileObject methods ***/
215 static HRESULT WINAPI IDirectXFileBinaryImpl_GetName(IDirectXFileBinary* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
218 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
220 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
222 return S_FALSE;
225 static HRESULT WINAPI IDirectXFileBinaryImpl_GetId(IDirectXFileBinary* iface, LPGUID pGuid)
227 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
229 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
231 return S_FALSE;
234 /*** IDirectXFileBinary methods ***/
235 static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize(IDirectXFileBinary* iface, DWORD* pcbSize)
237 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
239 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pcbSize);
241 return S_FALSE;
244 static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType(IDirectXFileBinary* iface, LPCSTR* pszMimeType)
246 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
248 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pszMimeType);
250 return S_FALSE;
253 static HRESULT WINAPI IDirectXFileBinaryImpl_Read(IDirectXFileBinary* iface, LPVOID pvData, DWORD cbSize, LPDWORD pcbRead)
255 IDirectXFileBinaryImpl *This = (IDirectXFileBinaryImpl *)iface;
257 FIXME("(%p/%p)->(%p, %d, %p) stub!\n", This, iface, pvData, cbSize, pcbRead);
259 return S_FALSE;
262 static const IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl =
264 IDirectXFileBinaryImpl_QueryInterface,
265 IDirectXFileBinaryImpl_AddRef,
266 IDirectXFileBinaryImpl_Release,
267 IDirectXFileBinaryImpl_GetName,
268 IDirectXFileBinaryImpl_GetId,
269 IDirectXFileBinaryImpl_GetSize,
270 IDirectXFileBinaryImpl_GetMimeType,
271 IDirectXFileBinaryImpl_Read
274 HRESULT IDirectXFileDataImpl_Create(IDirectXFileDataImpl** ppObj)
276 IDirectXFileDataImpl* object;
278 TRACE("(%p)\n", ppObj);
280 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileDataImpl));
282 object->lpVtbl.lpVtbl = &IDirectXFileData_Vtbl;
283 object->ref = 1;
285 *ppObj = object;
287 return S_OK;
290 /*** IUnknown methods ***/
291 static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface(IDirectXFileData* iface, REFIID riid, void** ppvObject)
293 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
295 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
297 if (IsEqualGUID(riid, &IID_IUnknown)
298 || IsEqualGUID(riid, &IID_IDirectXFileObject)
299 || IsEqualGUID(riid, &IID_IDirectXFileData))
301 IClassFactory_AddRef(iface);
302 *ppvObject = This;
303 return S_OK;
306 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
307 return E_NOINTERFACE;
310 static ULONG WINAPI IDirectXFileDataImpl_AddRef(IDirectXFileData* iface)
312 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
313 ULONG ref = InterlockedIncrement(&This->ref);
315 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
317 return ref;
320 static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData* iface)
322 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
323 ULONG ref = InterlockedDecrement(&This->ref);
325 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
327 if (!ref)
328 HeapFree(GetProcessHeap(), 0, This);
330 return ref;
333 /*** IDirectXFileObject methods ***/
334 static HRESULT WINAPI IDirectXFileDataImpl_GetName(IDirectXFileData* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
337 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
339 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
341 return S_FALSE;
344 static HRESULT WINAPI IDirectXFileDataImpl_GetId(IDirectXFileData* iface, LPGUID pGuid)
346 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
348 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
350 return S_FALSE;
353 /*** IDirectXFileData methods ***/
354 static HRESULT WINAPI IDirectXFileDataImpl_GetData(IDirectXFileData* iface, LPCSTR szMember, DWORD* pcbSize, void** ppvData)
356 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
358 FIXME("(%p/%p)->(%s,%p,%p) stub!\n", This, iface, szMember, pcbSize, ppvData);
360 return S_FALSE;
363 static HRESULT WINAPI IDirectXFileDataImpl_GetType(IDirectXFileData* iface, const GUID** pguid)
365 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
367 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pguid);
369 return S_FALSE;
372 static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData* iface, LPDIRECTXFILEOBJECT* ppChildObj)
374 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
376 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppChildObj);
378 return S_FALSE;
381 static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject(IDirectXFileData* iface, LPDIRECTXFILEDATA pDataObj)
383 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
385 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDataObj);
387 return S_FALSE;
390 static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference(IDirectXFileData* iface, LPCSTR szRef, const GUID* pguidRef)
392 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
394 FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szRef, pguidRef);
396 return S_FALSE;
399 static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject(IDirectXFileData* iface, LPCSTR szName, const GUID* pguid, LPCSTR szMimeType, LPVOID pvData, DWORD cbSize)
401 IDirectXFileDataImpl *This = (IDirectXFileDataImpl *)iface;
403 FIXME("(%p/%p)->(%s,%p,%s,%p,%d) stub!\n", This, iface, szName, pguid, szMimeType, pvData, cbSize);
405 return S_FALSE;
408 static const IDirectXFileDataVtbl IDirectXFileData_Vtbl =
410 IDirectXFileDataImpl_QueryInterface,
411 IDirectXFileDataImpl_AddRef,
412 IDirectXFileDataImpl_Release,
413 IDirectXFileDataImpl_GetName,
414 IDirectXFileDataImpl_GetId,
415 IDirectXFileDataImpl_GetData,
416 IDirectXFileDataImpl_GetType,
417 IDirectXFileDataImpl_GetNextObject,
418 IDirectXFileDataImpl_AddDataObject,
419 IDirectXFileDataImpl_AddDataReference,
420 IDirectXFileDataImpl_AddBinaryObject
423 HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImpl** ppObj)
425 IDirectXFileDataReferenceImpl* object;
427 TRACE("(%p)\n", ppObj);
429 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileDataReferenceImpl));
431 object->lpVtbl.lpVtbl = &IDirectXFileDataReference_Vtbl;
432 object->ref = 1;
434 *ppObj = object;
436 return S_OK;
439 /*** IUnknown methods ***/
440 static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface(IDirectXFileDataReference* iface, REFIID riid, void** ppvObject)
442 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
444 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
446 if (IsEqualGUID(riid, &IID_IUnknown)
447 || IsEqualGUID(riid, &IID_IDirectXFileObject)
448 || IsEqualGUID(riid, &IID_IDirectXFileDataReference))
450 IClassFactory_AddRef(iface);
451 *ppvObject = This;
452 return S_OK;
455 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
456 return E_NOINTERFACE;
459 static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef(IDirectXFileDataReference* iface)
461 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
462 ULONG ref = InterlockedIncrement(&This->ref);
464 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
466 return ref;
469 static ULONG WINAPI IDirectXFileDataReferenceImpl_Release(IDirectXFileDataReference* iface)
471 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
472 ULONG ref = InterlockedDecrement(&This->ref);
474 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
476 if (!ref)
477 HeapFree(GetProcessHeap(), 0, This);
479 return ref;
482 /*** IDirectXFileObject methods ***/
483 static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName(IDirectXFileDataReference* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
485 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
487 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
489 return S_FALSE;
492 static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId(IDirectXFileDataReference* iface, LPGUID pGuid)
494 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
496 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
498 return S_FALSE;
501 /*** IDirectXFileDataReference ***/
502 static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve(IDirectXFileDataReference* iface, LPDIRECTXFILEDATA* ppDataObj)
504 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
506 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppDataObj);
508 return S_FALSE;
511 static const IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl =
513 IDirectXFileDataReferenceImpl_QueryInterface,
514 IDirectXFileDataReferenceImpl_AddRef,
515 IDirectXFileDataReferenceImpl_Release,
516 IDirectXFileDataReferenceImpl_GetName,
517 IDirectXFileDataReferenceImpl_GetId,
518 IDirectXFileDataReferenceImpl_Resolve
521 HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl** ppObj)
523 IDirectXFileEnumObjectImpl* object;
525 TRACE("(%p)\n", ppObj);
527 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileEnumObjectImpl));
529 object->lpVtbl.lpVtbl = &IDirectXFileEnumObject_Vtbl;
530 object->ref = 1;
532 *ppObj = object;
534 return S_OK;
537 /*** IUnknown methods ***/
538 static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface(IDirectXFileEnumObject* iface, REFIID riid, void** ppvObject)
540 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
542 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
544 if (IsEqualGUID(riid, &IID_IUnknown)
545 || IsEqualGUID(riid, &IID_IDirectXFileEnumObject))
547 IClassFactory_AddRef(iface);
548 *ppvObject = This;
549 return S_OK;
552 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
553 return E_NOINTERFACE;
556 static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef(IDirectXFileEnumObject* iface)
558 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
559 ULONG ref = InterlockedIncrement(&This->ref);
561 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
563 return ref;
566 static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject* iface)
568 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
569 ULONG ref = InterlockedDecrement(&This->ref);
571 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
573 if (!ref)
574 HeapFree(GetProcessHeap(), 0, This);
576 return ref;
579 /*** IDirectXFileEnumObject methods ***/
580 static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileEnumObject* iface, LPDIRECTXFILEDATA* ppDataObj)
582 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
583 IDirectXFileDataImpl* object;
585 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppDataObj);
587 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileDataImpl));
589 object->lpVtbl.lpVtbl = &IDirectXFileData_Vtbl;
590 object->ref = 1;
592 *ppDataObj = (LPDIRECTXFILEDATA)object;
594 return S_FALSE;
597 static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById(IDirectXFileEnumObject* iface, REFGUID rguid, LPDIRECTXFILEDATA* ppDataObj)
599 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
601 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, rguid, ppDataObj);
603 return S_FALSE;
606 static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectByName(IDirectXFileEnumObject* iface, LPCSTR szName, LPDIRECTXFILEDATA* ppDataObj)
608 IDirectXFileEnumObjectImpl *This = (IDirectXFileEnumObjectImpl *)iface;
610 FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szName, ppDataObj);
612 return S_FALSE;
615 static const IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl =
617 IDirectXFileEnumObjectImpl_QueryInterface,
618 IDirectXFileEnumObjectImpl_AddRef,
619 IDirectXFileEnumObjectImpl_Release,
620 IDirectXFileEnumObjectImpl_GetNextDataObject,
621 IDirectXFileEnumObjectImpl_GetDataObjectById,
622 IDirectXFileEnumObjectImpl_GetDataObjectByName
625 HRESULT IDirectXFileObjectImpl_Create(IDirectXFileObjectImpl** ppObj)
627 IDirectXFileObjectImpl* object;
629 TRACE("(%p)\n", ppObj);
631 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileObjectImpl));
633 object->lpVtbl.lpVtbl = &IDirectXFileObject_Vtbl;
634 object->ref = 1;
636 *ppObj = object;
638 return S_OK;
641 /*** IUnknown methods ***/
642 static HRESULT WINAPI IDirectXFileObjectImpl_QueryInterface(IDirectXFileObject* iface, REFIID riid, void** ppvObject)
644 IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface;
646 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
648 if (IsEqualGUID(riid, &IID_IUnknown)
649 || IsEqualGUID(riid, &IID_IDirectXFileObject))
651 IClassFactory_AddRef(iface);
652 *ppvObject = This;
653 return S_OK;
656 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
657 return E_NOINTERFACE;
660 static ULONG WINAPI IDirectXFileObjectImpl_AddRef(IDirectXFileObject* iface)
662 IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface;
663 ULONG ref = InterlockedIncrement(&This->ref);
665 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
667 return ref;
670 static ULONG WINAPI IDirectXFileObjectImpl_Release(IDirectXFileObject* iface)
672 IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface;
673 ULONG ref = InterlockedDecrement(&This->ref);
675 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
677 if (!ref)
678 HeapFree(GetProcessHeap(), 0, This);
680 return ref;
683 /*** IDirectXFileObject methods ***/
684 static HRESULT WINAPI IDirectXFileObjectImpl_GetName(IDirectXFileObject* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
686 IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface;
688 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
690 return S_FALSE;
693 static HRESULT WINAPI IDirectXFileObjectImpl_GetId(IDirectXFileObject* iface, LPGUID pGuid)
695 IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface;
697 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
699 return S_FALSE;
702 static const IDirectXFileObjectVtbl IDirectXFileObject_Vtbl =
704 IDirectXFileObjectImpl_QueryInterface,
705 IDirectXFileObjectImpl_AddRef,
706 IDirectXFileObjectImpl_Release,
707 IDirectXFileObjectImpl_GetName,
708 IDirectXFileObjectImpl_GetId
711 HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj)
713 IDirectXFileSaveObjectImpl* object;
715 TRACE("(%p)\n", ppObj);
717 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileSaveObjectImpl));
719 object->lpVtbl.lpVtbl = &IDirectXFileSaveObject_Vtbl;
720 object->ref = 1;
722 *ppObj = object;
724 return S_OK;
727 /*** IUnknown methods ***/
728 static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface(IDirectXFileSaveObject* iface, REFIID riid, void** ppvObject)
730 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
732 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
734 if (IsEqualGUID(riid, &IID_IUnknown)
735 || IsEqualGUID(riid, &IID_IDirectXFileSaveObject))
737 IClassFactory_AddRef(iface);
738 *ppvObject = This;
739 return S_OK;
742 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
743 return E_NOINTERFACE;
746 static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef(IDirectXFileSaveObject* iface)
748 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
749 ULONG ref = InterlockedIncrement(&This->ref);
751 TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1);
753 return ref;
756 static ULONG WINAPI IDirectXFileSaveObjectImpl_Release(IDirectXFileSaveObject* iface)
758 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
759 ULONG ref = InterlockedDecrement(&This->ref);
761 TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
763 if (!ref)
764 HeapFree(GetProcessHeap(), 0, This);
766 return ref;
769 static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates(IDirectXFileSaveObject* iface, DWORD cTemplates, const GUID** ppguidTemplates)
771 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
773 FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, cTemplates, ppguidTemplates);
775 return S_FALSE;
778 static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject(IDirectXFileSaveObject* iface, REFGUID rguidTemplate, LPCSTR szName, const GUID* pguid, DWORD cbSize, LPVOID pvData, LPDIRECTXFILEDATA* ppDataObj)
780 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
782 FIXME("(%p/%p)->(%p,%s,%p,%d,%p,%p) stub!\n", This, iface, rguidTemplate, szName, pguid, cbSize, pvData, ppDataObj);
784 return S_FALSE;
787 static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData(IDirectXFileSaveObject* iface, LPDIRECTXFILEDATA ppDataObj)
789 IDirectXFileSaveObjectImpl *This = (IDirectXFileSaveObjectImpl *)iface;
791 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppDataObj);
793 return S_FALSE;
796 static const IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl =
798 IDirectXFileSaveObjectImpl_QueryInterface,
799 IDirectXFileSaveObjectImpl_AddRef,
800 IDirectXFileSaveObjectImpl_Release,
801 IDirectXFileSaveObjectImpl_SaveTemplates,
802 IDirectXFileSaveObjectImpl_CreateDataObject,
803 IDirectXFileSaveObjectImpl_SaveData