ReactOS  0.4.13-dev-479-gec9c8fd
d3dxof.c
Go to the documentation of this file.
1 /*
2  * Implementation of DirectX File Interfaces
3  *
4  * Copyright 2004, 2008, 2010 Christian Costa
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include "config.h"
22 #include "wine/debug.h"
23 
24 #define COBJMACROS
25 
26 #include "winbase.h"
27 #include "wingdi.h"
28 
29 #include "d3dxof_private.h"
30 #include "dxfile.h"
31 
32 #include <stdio.h>
33 
35 WINE_DECLARE_DEBUG_CHANNEL(d3dxof_dump);
36 
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 IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl;
43 
47 
48 #define TOKEN_DWORD 41
49 #define TOKEN_FLOAT 42
50 
52 {
54 
55  TRACE("(%p,%p)\n", pUnkOuter, ppObj);
56 
58  if (!object)
59  return DXFILEERR_BADALLOC;
60 
61  object->IDirectXFile_iface.lpVtbl = &IDirectXFile_Vtbl;
62  object->ref = 1;
63 
64  /* Reserve first template to handle the case sensitive legacy type indexColor */
65  object->nb_xtemplates = 1;
66  strcpy(object->xtemplates[0].name, "indexColor");
67  object->xtemplates[0].nb_members = 2;
68  object->xtemplates[0].members[0].type = TOKEN_DWORD;
69  object->xtemplates[0].members[0].nb_dims = 0;
70  object->xtemplates[0].members[1].type = TOKEN_FLOAT;
71  object->xtemplates[0].members[1].nb_dims = 1;
72  object->xtemplates[0].members[1].dim_fixed[0] = TRUE;
73  object->xtemplates[0].members[1].dim_value[0] = 4;
74 
75  *ppObj = &object->IDirectXFile_iface;
76 
77  return S_OK;
78 }
79 
80 static inline IDirectXFileImpl *impl_from_IDirectXFile(IDirectXFile *iface)
81 {
82  return CONTAINING_RECORD(iface, IDirectXFileImpl, IDirectXFile_iface);
83 }
84 
85 /*** IUnknown methods ***/
86 static HRESULT WINAPI IDirectXFileImpl_QueryInterface(IDirectXFile* iface, REFIID riid, void** ppvObject)
87 {
89 
90  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
91 
93  || IsEqualGUID(riid, &IID_IDirectXFile))
94  {
95  IUnknown_AddRef(iface);
96  *ppvObject = &This->IDirectXFile_iface;
97  return S_OK;
98  }
99 
100  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
101  return E_NOINTERFACE;
102 }
103 
104 static ULONG WINAPI IDirectXFileImpl_AddRef(IDirectXFile* iface)
105 {
108 
109  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
110 
111  return ref;
112 }
113 
114 static ULONG WINAPI IDirectXFileImpl_Release(IDirectXFile* iface)
115 {
118 
119  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
120 
121  if (!ref)
123 
124  return ref;
125 }
126 
127 /*** IDirectXFile methods ***/
128 static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPVOID pvSource, DXFILELOADOPTIONS dwLoadOptions, LPDIRECTXFILEENUMOBJECT* ppEnumObj)
129 {
132  HRESULT hr;
135  DWORD bytes_written;
136 
137  TRACE("(%p/%p)->(%p,%x,%p)\n", This, iface, pvSource, dwLoadOptions, ppEnumObj);
138 
139  if (!ppEnumObj)
140  return DXFILEERR_BADVALUE;
141 
142  /* Only lowest 4 bits are relevant in DXFILELOADOPTIONS */
143  dwLoadOptions &= 0xF;
144 
146  if (FAILED(hr))
147  return hr;
148 
149  if (dwLoadOptions == DXFILELOAD_FROMFILE)
150  {
151  HANDLE hFile, file_mapping;
152 
153  TRACE("Open source file '%s'\n", (char*)pvSource);
154 
157  {
158  TRACE("File '%s' not found\n", (char*)pvSource);
159  return DXFILEERR_FILENOTFOUND;
160  }
161 
163 
164  file_mapping = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
166  if (!file_mapping)
167  {
169  goto error;
170  }
171 
172  object->mapped_memory = MapViewOfFile(file_mapping, FILE_MAP_READ, 0, 0, 0);
173  CloseHandle(file_mapping);
174  if (!object->mapped_memory)
175  {
177  goto error;
178  }
179  file_buffer = object->mapped_memory;
180  }
181  else if (dwLoadOptions == DXFILELOAD_FROMRESOURCE)
182  {
183  HRSRC resource_info;
185  LPDXFILELOADRESOURCE lpdxflr = pvSource;
186 
187  TRACE("Source in resource (module = %p, name = %s, type = %s)\n", lpdxflr->hModule, debugstr_a(lpdxflr->lpName), debugstr_a(lpdxflr->lpType));
188 
189  resource_info = FindResourceA(lpdxflr->hModule, lpdxflr->lpName, lpdxflr->lpType);
190  if (!resource_info)
191  {
193  goto error;
194  }
195 
196  file_size = SizeofResource(lpdxflr->hModule, resource_info);
197 
198  resource_data = LoadResource(lpdxflr->hModule, resource_info);
199  if (!resource_data)
200  {
202  goto error;
203  }
204 
206  if (!file_buffer)
207  {
209  goto error;
210  }
211  }
212  else if (dwLoadOptions == DXFILELOAD_FROMMEMORY)
213  {
214  LPDXFILELOADMEMORY lpdxflm = pvSource;
215 
216  TRACE("Source in memory at %p with size %d\n", lpdxflm->lpMemory, lpdxflm->dSize);
217 
218  file_buffer = lpdxflm->lpMemory;
219  file_size = lpdxflm->dSize;
220  }
221  else
222  {
223  FIXME("Source type %d is not handled yet\n", dwLoadOptions);
225  goto error;
226  }
227 
228  TRACE("File size is %d bytes\n", file_size);
229 
230  if (TRACE_ON(d3dxof_dump))
231  {
232  static USHORT num;
233  char tmp[12];
234  HANDLE file;
235  sprintf(tmp, "file%05u.x", num++);
236 
238  if (file != INVALID_HANDLE_VALUE)
239  {
240  WriteFile(file, file_buffer, file_size, &bytes_written, NULL);
241  CloseHandle(file);
242  }
243  }
244 
245  object->pDirectXFile = This;
246 
247  object->buf.pdxf = This;
248  object->buf.token_present = FALSE;
249  object->buf.buffer = file_buffer;
250  object->buf.rem_bytes = file_size;
251  hr = parse_header(&object->buf, &object->decomp_buffer);
252  if (FAILED(hr))
253  goto error;
254 
255  /* Check if there are templates defined before the object */
256  if (!parse_templates(&object->buf, TRUE))
257  {
259  goto error;
260  }
261 
262  if (TRACE_ON(d3dxof))
263  {
264  ULONG i;
265  TRACE("Registered templates (%d):\n", This->nb_xtemplates);
266  for (i = 1; i < This->nb_xtemplates; i++)
267  DPRINTF("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
268  }
269 
270  *ppEnumObj = &object->IDirectXFileEnumObject_iface;
271 
272  return DXFILE_OK;
273 
274 error:
275  IDirectXFileEnumObject_Release(&object->IDirectXFileEnumObject_iface);
276  *ppEnumObj = NULL;
277 
278  return hr;
279 }
280 
281 static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject(IDirectXFile* iface, LPCSTR szFileName, DXFILEFORMAT dwFileFormat, LPDIRECTXFILESAVEOBJECT* ppSaveObj)
282 {
285  HRESULT hr;
286 
287  FIXME("(%p/%p)->(%s,%x,%p) partial stub!\n", This, iface, szFileName, dwFileFormat, ppSaveObj);
288 
289  if (!szFileName || !ppSaveObj)
290  return E_POINTER;
291 
293  if (SUCCEEDED(hr))
294  *ppSaveObj = &object->IDirectXFileSaveObject_iface;
295  return hr;
296 }
297 
299 {
302  HRESULT hr;
303  LPBYTE decomp_buffer = NULL;
304  DWORD bytes_written;
305 
306  ZeroMemory(&buf, sizeof(buf));
307  buf.buffer = pvData;
308  buf.rem_bytes = cbSize;
309  buf.pdxf = This;
310 
311  TRACE("(%p/%p)->(%p,%d)\n", This, iface, pvData, cbSize);
312 
313  if (!pvData)
314  return DXFILEERR_BADVALUE;
315 
316  if (TRACE_ON(d3dxof_dump))
317  {
318  static USHORT num;
319  char tmp[16];
320  HANDLE file;
321  sprintf(tmp, "template%05u.x", num++);
322 
324  if (file != INVALID_HANDLE_VALUE)
325  {
326  WriteFile(file, pvData, cbSize, &bytes_written, NULL);
327  CloseHandle(file);
328  }
329  }
330 
331  hr = parse_header(&buf, &decomp_buffer);
332  if (FAILED(hr))
333  goto cleanup;
334 
335  if (!parse_templates(&buf, FALSE))
336  {
338  goto cleanup;
339  }
340 
341  if (TRACE_ON(d3dxof))
342  {
343  ULONG i;
344  TRACE("Registered templates (%d):\n", This->nb_xtemplates);
345  for (i = 1; i < This->nb_xtemplates; i++)
346  DPRINTF("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
347  }
348 
349  hr = DXFILE_OK;
350 cleanup:
351  HeapFree(GetProcessHeap(), 0, decomp_buffer);
352  return hr;
353 }
354 
355 static const IDirectXFileVtbl IDirectXFile_Vtbl =
356 {
363 };
364 
366 {
368 
369  TRACE("(%p)\n", ppObj);
370 
372  if (!object)
373  return DXFILEERR_BADALLOC;
374 
375  object->IDirectXFileBinary_iface.lpVtbl = &IDirectXFileBinary_Vtbl;
376  object->ref = 1;
377 
378  *ppObj = object;
379 
380  return DXFILE_OK;
381 }
382 
383 static inline IDirectXFileBinaryImpl *impl_from_IDirectXFileBinary(IDirectXFileBinary *iface)
384 {
385  return CONTAINING_RECORD(iface, IDirectXFileBinaryImpl, IDirectXFileBinary_iface);
386 }
387 
388 /*** IUnknown methods ***/
389 static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface(IDirectXFileBinary* iface, REFIID riid, void** ppvObject)
390 {
392 
393  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
394 
396  || IsEqualGUID(riid, &IID_IDirectXFileObject)
397  || IsEqualGUID(riid, &IID_IDirectXFileBinary))
398  {
399  IUnknown_AddRef(iface);
400  *ppvObject = &This->IDirectXFileBinary_iface;
401  return S_OK;
402  }
403 
404  /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
405  if (!IsEqualGUID(riid, &IID_IDirectXFileData)
406  && !IsEqualGUID(riid, &IID_IDirectXFileDataReference))
407  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
408 
409  return E_NOINTERFACE;
410 }
411 
412 static ULONG WINAPI IDirectXFileBinaryImpl_AddRef(IDirectXFileBinary* iface)
413 {
416 
417  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
418 
419  return ref;
420 }
421 
422 static ULONG WINAPI IDirectXFileBinaryImpl_Release(IDirectXFileBinary* iface)
423 {
426 
427  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
428 
429  if (!ref)
431 
432  return ref;
433 }
434 
435 /*** IDirectXFileObject methods ***/
436 static HRESULT WINAPI IDirectXFileBinaryImpl_GetName(IDirectXFileBinary* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
437 
438 {
440 
441  FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
442 
443  return DXFILEERR_BADVALUE;
444 }
445 
446 static HRESULT WINAPI IDirectXFileBinaryImpl_GetId(IDirectXFileBinary* iface, LPGUID pGuid)
447 {
449 
450  FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
451 
452  return DXFILEERR_BADVALUE;
453 }
454 
455 /*** IDirectXFileBinary methods ***/
456 static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize(IDirectXFileBinary* iface, DWORD* pcbSize)
457 {
459 
460  FIXME("(%p/%p)->(%p) stub!\n", This, iface, pcbSize);
461 
462  return DXFILEERR_BADVALUE;
463 }
464 
465 static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType(IDirectXFileBinary* iface, LPCSTR* pszMimeType)
466 {
468 
469  FIXME("(%p/%p)->(%p) stub!\n", This, iface, pszMimeType);
470 
471  return DXFILEERR_BADVALUE;
472 }
473 
474 static HRESULT WINAPI IDirectXFileBinaryImpl_Read(IDirectXFileBinary* iface, LPVOID pvData, DWORD cbSize, LPDWORD pcbRead)
475 {
477 
478  FIXME("(%p/%p)->(%p, %d, %p) stub!\n", This, iface, pvData, cbSize, pcbRead);
479 
480  return DXFILEERR_BADVALUE;
481 }
482 
483 static const IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl =
484 {
493 };
494 
496 {
498 
499  TRACE("(%p)\n", ppObj);
500 
502  if (!object)
503  return DXFILEERR_BADALLOC;
504 
505  object->IDirectXFileData_iface.lpVtbl = &IDirectXFileData_Vtbl;
506  object->ref = 1;
507 
508  *ppObj = object;
509 
510  return S_OK;
511 }
512 
513 static inline IDirectXFileDataImpl *impl_from_IDirectXFileData(IDirectXFileData *iface)
514 {
515  return CONTAINING_RECORD(iface, IDirectXFileDataImpl, IDirectXFileData_iface);
516 }
517 
518 /*** IUnknown methods ***/
519 static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface(IDirectXFileData* iface, REFIID riid, void** ppvObject)
520 {
522 
523  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
524 
526  || IsEqualGUID(riid, &IID_IDirectXFileObject)
527  || IsEqualGUID(riid, &IID_IDirectXFileData))
528  {
529  IUnknown_AddRef(iface);
530  *ppvObject = &This->IDirectXFileData_iface;
531  return S_OK;
532  }
533 
534  /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
535  if (!IsEqualGUID(riid, &IID_IDirectXFileBinary)
536  && !IsEqualGUID(riid, &IID_IDirectXFileDataReference))
537  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
538 
539  return E_NOINTERFACE;
540 }
541 
542 static ULONG WINAPI IDirectXFileDataImpl_AddRef(IDirectXFileData* iface)
543 {
546 
547  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
548 
549  return ref;
550 }
551 
552 static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData* iface)
553 {
556 
557  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
558 
559  if (!ref)
560  {
561  if (!This->level && !This->from_ref)
562  {
563  HeapFree(GetProcessHeap(), 0, This->pstrings);
564  if (This->pobj)
565  {
566  HeapFree(GetProcessHeap(), 0, This->pobj->pdata);
567  HeapFree(GetProcessHeap(), 0, This->pobj);
568  }
569  }
571  }
572 
573  return ref;
574 }
575 
576 /*** IDirectXFileObject methods ***/
577 static HRESULT WINAPI IDirectXFileDataImpl_GetName(IDirectXFileData* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
578 {
580  DWORD len;
581 
582  TRACE("(%p/%p)->(%p,%p)\n", This, iface, pstrNameBuf, pdwBufLen);
583 
584  if (!pdwBufLen)
585  return DXFILEERR_BADVALUE;
586 
587  len = strlen(This->pobj->name);
588  if (len)
589  len++;
590 
591  if (pstrNameBuf) {
592  if (*pdwBufLen < len)
593  return DXFILEERR_BADVALUE;
594  CopyMemory(pstrNameBuf, This->pobj->name, len);
595  /* Even if we return a size of 0, an empty string with a null byte must be returned */
596  if (*pdwBufLen && !len)
597  pstrNameBuf[0] = 0;
598  }
599  *pdwBufLen = len;
600 
601  return DXFILE_OK;
602 }
603 
604 static HRESULT WINAPI IDirectXFileDataImpl_GetId(IDirectXFileData* iface, LPGUID pGuid)
605 {
607 
608  TRACE("(%p/%p)->(%p)\n", This, iface, pGuid);
609 
610  if (!pGuid)
611  return DXFILEERR_BADVALUE;
612 
613  *pGuid = This->pobj->class_id;
614 
615  return DXFILE_OK;
616 }
617 
618 /*** IDirectXFileData methods ***/
619 static HRESULT WINAPI IDirectXFileDataImpl_GetData(IDirectXFileData* iface, LPCSTR szMember, DWORD* pcbSize, void** ppvData)
620 {
622 
623  TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_a(szMember), pcbSize, ppvData);
624 
625  if (!pcbSize || !ppvData)
626  return DXFILEERR_BADVALUE;
627 
628  if (szMember)
629  {
630  ULONG i;
631  for (i = 0; i < This->pobj->nb_members; i++)
632  if (!strcmp(This->pobj->members[i].name, szMember))
633  break;
634  if (i == This->pobj->nb_members)
635  {
636  WARN("Unknown member '%s'\n", szMember);
638  }
639  *pcbSize = This->pobj->members[i].size;
640  *ppvData = This->pobj->root->pdata + This->pobj->members[i].start;
641  }
642  else
643  {
644  *pcbSize = This->pobj->size;
645  *ppvData = This->pobj->root->pdata + This->pobj->pos_data;
646  }
647 
648  return DXFILE_OK;
649 }
650 
651 static HRESULT WINAPI IDirectXFileDataImpl_GetType(IDirectXFileData* iface, const GUID** pguid)
652 {
654  static GUID guid;
655 
656  TRACE("(%p/%p)->(%p)\n", This, iface, pguid);
657 
658  if (!pguid)
659  return DXFILEERR_BADVALUE;
660 
661  guid = This->pobj->type;
662  *pguid = &guid;
663 
664  return DXFILE_OK;
665 }
666 
667 static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData* iface, LPDIRECTXFILEOBJECT* ppChildObj)
668 {
669  HRESULT hr;
671 
672  TRACE("(%p/%p)->(%p)\n", This, iface, ppChildObj);
673 
674  if (This->cur_enum_object >= This->pobj->nb_children)
675  {
676  *ppChildObj = NULL;
678  }
679 
680  if (This->from_ref && (This->level >= 1))
681  {
682  /* Only 2 levels can be enumerated if the object is obtained from a reference */
683  *ppChildObj = NULL;
685  }
686 
687  if (This->pobj->children[This->cur_enum_object]->binary)
688  {
690 
692  if (FAILED(hr))
693  return hr;
694 
695  *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileBinary_iface;
696  }
697  else if (This->pobj->children[This->cur_enum_object]->ptarget)
698  {
700 
702  if (FAILED(hr))
703  return hr;
704 
705  object->ptarget = This->pobj->children[This->cur_enum_object++]->ptarget;
706 
707  *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileDataReference_iface;
708  }
709  else
710  {
712 
713  hr = IDirectXFileDataImpl_Create(&object);
714  if (FAILED(hr))
715  return hr;
716 
717  object->pobj = This->pobj->children[This->cur_enum_object++];
718  object->cur_enum_object = 0;
719  object->from_ref = This->from_ref;
720  object->level = This->level + 1;
721 
722  *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileData_iface;
723  }
724 
725  return DXFILE_OK;
726 }
727 
728 static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject(IDirectXFileData* iface, LPDIRECTXFILEDATA pDataObj)
729 {
731 
732  FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDataObj);
733 
734  return DXFILEERR_BADVALUE;
735 }
736 
737 static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference(IDirectXFileData* iface, LPCSTR szRef, const GUID* pguidRef)
738 {
740 
741  FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szRef, pguidRef);
742 
743  return DXFILEERR_BADVALUE;
744 }
745 
746 static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject(IDirectXFileData* iface, LPCSTR szName, const GUID* pguid, LPCSTR szMimeType, LPVOID pvData, DWORD cbSize)
747 {
749 
750  FIXME("(%p/%p)->(%s,%p,%s,%p,%d) stub!\n", This, iface, szName, pguid, szMimeType, pvData, cbSize);
751 
752  return DXFILEERR_BADVALUE;
753 }
754 
755 static const IDirectXFileDataVtbl IDirectXFileData_Vtbl =
756 {
768 };
769 
771 {
773 
774  TRACE("(%p)\n", ppObj);
775 
777  if (!object)
778  return DXFILEERR_BADALLOC;
779 
780  object->IDirectXFileDataReference_iface.lpVtbl = &IDirectXFileDataReference_Vtbl;
781  object->ref = 1;
782 
783  *ppObj = object;
784 
785  return S_OK;
786 }
787 
788 static inline IDirectXFileDataReferenceImpl *impl_from_IDirectXFileDataReference(IDirectXFileDataReference *iface)
789 {
790  return CONTAINING_RECORD(iface, IDirectXFileDataReferenceImpl, IDirectXFileDataReference_iface);
791 }
792 
793 /*** IUnknown methods ***/
794 static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface(IDirectXFileDataReference* iface, REFIID riid, void** ppvObject)
795 {
797 
798  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
799 
801  || IsEqualGUID(riid, &IID_IDirectXFileObject)
802  || IsEqualGUID(riid, &IID_IDirectXFileDataReference))
803  {
804  IUnknown_AddRef(iface);
805  *ppvObject = &This->IDirectXFileDataReference_iface;
806  return S_OK;
807  }
808 
809  /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
810  if (!IsEqualGUID(riid, &IID_IDirectXFileData)
811  && !IsEqualGUID(riid, &IID_IDirectXFileBinary))
812  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
813 
814  return E_NOINTERFACE;
815 }
816 
817 static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef(IDirectXFileDataReference* iface)
818 {
821 
822  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
823 
824  return ref;
825 }
826 
827 static ULONG WINAPI IDirectXFileDataReferenceImpl_Release(IDirectXFileDataReference* iface)
828 {
831 
832  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
833 
834  if (!ref)
836 
837  return ref;
838 }
839 
840 /*** IDirectXFileObject methods ***/
841 static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName(IDirectXFileDataReference* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
842 {
844  DWORD len;
845 
846  TRACE("(%p/%p)->(%p,%p)\n", This, iface, pstrNameBuf, pdwBufLen);
847 
848  if (!pdwBufLen)
849  return DXFILEERR_BADVALUE;
850 
851  len = strlen(This->ptarget->name);
852  if (len)
853  len++;
854 
855  if (pstrNameBuf) {
856  if (*pdwBufLen < len)
857  return DXFILEERR_BADVALUE;
858  CopyMemory(pstrNameBuf, This->ptarget->name, len);
859  /* Even if we return a size of 0, an empty string with a null byte must be returned */
860  if (*pdwBufLen && !len)
861  pstrNameBuf[0] = 0;
862  }
863  *pdwBufLen = len;
864 
865  return DXFILE_OK;
866 }
867 
868 static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId(IDirectXFileDataReference* iface, LPGUID pGuid)
869 {
871 
872  TRACE("(%p/%p)->(%p)\n", This, iface, pGuid);
873 
874  if (!pGuid)
875  return DXFILEERR_BADVALUE;
876 
877  *pGuid = This->ptarget->class_id;
878 
879  return DXFILE_OK;
880 }
881 
882 /*** IDirectXFileDataReference ***/
883 static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve(IDirectXFileDataReference* iface, LPDIRECTXFILEDATA* ppDataObj)
884 {
887  HRESULT hr;
888 
889  TRACE("(%p/%p)->(%p)\n", This, iface, ppDataObj);
890 
891  if (!ppDataObj)
892  return DXFILEERR_BADVALUE;
893 
894  hr = IDirectXFileDataImpl_Create(&object);
895  if (FAILED(hr))
896  return hr;
897 
898  object->pobj = This->ptarget;
899  object->cur_enum_object = 0;
900  object->level = 0;
901  object->from_ref = TRUE;
902 
903  *ppDataObj = &object->IDirectXFileData_iface;
904 
905  return DXFILE_OK;
906 }
907 
908 static const IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl =
909 {
916 };
917 
919 {
921 
922  TRACE("(%p)\n", ppObj);
923 
925  if (!object)
926  return DXFILEERR_BADALLOC;
927 
928  object->IDirectXFileEnumObject_iface.lpVtbl = &IDirectXFileEnumObject_Vtbl;
929  object->ref = 1;
930 
931  *ppObj = object;
932 
933  return S_OK;
934 }
935 
936 static inline IDirectXFileEnumObjectImpl *impl_from_IDirectXFileEnumObject(IDirectXFileEnumObject *iface)
937 {
938  return CONTAINING_RECORD(iface, IDirectXFileEnumObjectImpl, IDirectXFileEnumObject_iface);
939 }
940 
941 /*** IUnknown methods ***/
942 static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface(IDirectXFileEnumObject* iface, REFIID riid, void** ppvObject)
943 {
945 
946  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
947 
949  || IsEqualGUID(riid, &IID_IDirectXFileEnumObject))
950  {
951  IUnknown_AddRef(iface);
952  *ppvObject = &This->IDirectXFileEnumObject_iface;
953  return S_OK;
954  }
955 
956  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
957  return E_NOINTERFACE;
958 }
959 
960 static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef(IDirectXFileEnumObject* iface)
961 {
964 
965  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
966 
967  return ref;
968 }
969 
970 static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject* iface)
971 {
974 
975  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
976 
977  if (!ref)
978  {
979  ULONG i;
980  for (i = 0; i < This->nb_xobjects; i++)
981  IDirectXFileData_Release(This->pRefObjects[i]);
982  if (This->mapped_memory)
983  UnmapViewOfFile(This->mapped_memory);
984  HeapFree(GetProcessHeap(), 0, This->decomp_buffer);
986  }
987 
988  return ref;
989 }
990 
991 /*** IDirectXFileEnumObject methods ***/
992 static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileEnumObject* iface, LPDIRECTXFILEDATA* ppDataObj)
993 {
996  HRESULT hr;
997 
998  if (!ppDataObj)
999  return E_POINTER;
1000 
1001  *ppDataObj = NULL;
1002 
1003  TRACE("(%p/%p)->(%p)\n", This, iface, ppDataObj);
1004 
1005  if (This->nb_xobjects >= MAX_OBJECTS)
1006  {
1007  ERR("Too many objects\n");
1008  return DXFILEERR_NOMOREOBJECTS;
1009  }
1010 
1011  /* Check if there are templates defined before the object */
1012  if (!parse_templates(&This->buf, TRUE))
1013  return DXFILEERR_PARSEERROR;
1014 
1015  if (!This->buf.rem_bytes)
1016  return DXFILEERR_NOMOREOBJECTS;
1017 
1018  hr = IDirectXFileDataImpl_Create(&object);
1019  if (FAILED(hr))
1020  return hr;
1021 
1022  object->pobj = HeapAlloc(GetProcessHeap(), 0, sizeof(xobject)*MAX_SUBOBJECTS);
1023  if (!object->pobj)
1024  {
1026  goto error;
1027  }
1028 
1029  object->pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER);
1030  if (!object->pstrings)
1031  {
1033  goto error;
1034  }
1035 
1036  object->cur_enum_object = 0;
1037  object->level = 0;
1038  object->from_ref = FALSE;
1039 
1040  This->buf.pxo_globals = This->xobjects;
1041  This->buf.nb_pxo_globals = This->nb_xobjects;
1042  This->buf.level = 0;
1043  This->buf.pdata = NULL;
1044  This->buf.capacity = 0;
1045  This->buf.cur_pos_data = 0;
1046  This->buf.cur_pstrings = This->buf.pstrings = object->pstrings;
1047  This->buf.pxo = This->xobjects[This->nb_xobjects] = This->buf.pxo_tab = object->pobj;
1048  This->buf.pxo->pdata = NULL;
1049  This->buf.pxo->nb_subobjects = 1;
1050 
1051  if (!parse_object(&This->buf))
1052  {
1053  WARN("Object is not correct\n");
1055  goto error;
1056  }
1057 
1058  *ppDataObj = &object->IDirectXFileData_iface;
1059 
1060  /* Get a reference to created object */
1061  This->pRefObjects[This->nb_xobjects] = &object->IDirectXFileData_iface;
1062  IDirectXFileData_AddRef(This->pRefObjects[This->nb_xobjects]);
1063 
1064  This->nb_xobjects++;
1065 
1066  return DXFILE_OK;
1067 
1068 error:
1069 
1070  IDirectXFileData_Release(&object->IDirectXFileData_iface);
1071 
1072  return hr;
1073 }
1074 
1075 static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById(IDirectXFileEnumObject* iface, REFGUID rguid, LPDIRECTXFILEDATA* ppDataObj)
1076 {
1078 
1079  FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, rguid, ppDataObj);
1080 
1081  return DXFILEERR_BADVALUE;
1082 }
1083 
1085 {
1087 
1088  FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szName, ppDataObj);
1089 
1090  return DXFILEERR_BADVALUE;
1091 }
1092 
1093 static const IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl =
1094 {
1101 };
1102 
1104 {
1106 
1107  TRACE("(%p)\n", ppObj);
1108 
1110  if (!object)
1111  return DXFILEERR_BADALLOC;
1112 
1113  object->IDirectXFileSaveObject_iface.lpVtbl = &IDirectXFileSaveObject_Vtbl;
1114  object->ref = 1;
1115 
1116  *ppObj = object;
1117 
1118  return S_OK;
1119 }
1120 
1121 static inline IDirectXFileSaveObjectImpl *impl_from_IDirectXFileSaveObject(IDirectXFileSaveObject *iface)
1122 {
1123  return CONTAINING_RECORD(iface, IDirectXFileSaveObjectImpl, IDirectXFileSaveObject_iface);
1124 }
1125 
1126 /*** IUnknown methods ***/
1127 static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface(IDirectXFileSaveObject* iface, REFIID riid, void** ppvObject)
1128 {
1130 
1131  TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
1132 
1134  || IsEqualGUID(riid, &IID_IDirectXFileSaveObject))
1135  {
1136  IUnknown_AddRef(iface);
1137  *ppvObject = &This->IDirectXFileSaveObject_iface;
1138  return S_OK;
1139  }
1140 
1141  ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
1142  return E_NOINTERFACE;
1143 }
1144 
1145 static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef(IDirectXFileSaveObject* iface)
1146 {
1149 
1150  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
1151 
1152  return ref;
1153 }
1154 
1155 static ULONG WINAPI IDirectXFileSaveObjectImpl_Release(IDirectXFileSaveObject* iface)
1156 {
1159 
1160  TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
1161 
1162  if (!ref)
1163  HeapFree(GetProcessHeap(), 0, This);
1164 
1165  return ref;
1166 }
1167 
1168 static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates(IDirectXFileSaveObject* iface, DWORD cTemplates, const GUID** ppguidTemplates)
1169 {
1171 
1172  FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, cTemplates, ppguidTemplates);
1173 
1174  return DXFILE_OK;
1175 }
1176 
1177 static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject(IDirectXFileSaveObject* iface, REFGUID rguidTemplate, LPCSTR szName, const GUID* pguid, DWORD cbSize, LPVOID pvData, LPDIRECTXFILEDATA* ppDataObj)
1178 {
1180 
1181  FIXME("(%p/%p)->(%p,%s,%p,%d,%p,%p) stub!\n", This, iface, rguidTemplate, szName, pguid, cbSize, pvData, ppDataObj);
1182 
1183  return DXFILEERR_BADVALUE;
1184 }
1185 
1186 static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData(IDirectXFileSaveObject* iface, LPDIRECTXFILEDATA ppDataObj)
1187 {
1189 
1190  FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppDataObj);
1191 
1192  return DXFILEERR_BADVALUE;
1193 }
1194 
1195 static const IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl =
1196 {
1203 };
static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:960
static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType(IDirectXFileBinary *iface, LPCSTR *pszMimeType)
Definition: d3dxof.c:465
static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference(IDirectXFileData *iface, LPCSTR szRef, const GUID *pguidRef)
Definition: d3dxof.c:737
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId(IDirectXFileDataReference *iface, LPGUID pGuid)
Definition: d3dxof.c:868
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define DXFILEERR_FILENOTFOUND
Definition: dxfile.h:277
#define MAX_STRINGS_BUFFER
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
static HRESULT WINAPI IDirectXFileBinaryImpl_Read(IDirectXFileBinary *iface, LPVOID pvData, DWORD cbSize, LPDWORD pcbRead)
Definition: d3dxof.c:474
#define DXFILEERR_BADDATAREFERENCE
Definition: dxfile.h:289
#define CloseHandle
Definition: compat.h:398
static const struct IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl
Definition: d3dxof.c:41
DWORD DXFILEFORMAT
Definition: dxfile.h:29
#define E_NOINTERFACE
Definition: winerror.h:2364
struct IDirectXFileSaveObject * LPDIRECTXFILESAVEOBJECT
Definition: dxfile.h:56
#define MapViewOfFile
Definition: compat.h:402
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
static IDirectXFileBinaryImpl * impl_from_IDirectXFileBinary(IDirectXFileBinary *iface)
Definition: d3dxof.c:383
Definition: scsiwmi.h:51
#define IDirectXFileEnumObject_Release(p)
Definition: dxfile.h:107
static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates(IDirectXFile *iface, LPVOID pvData, DWORD cbSize)
Definition: d3dxof.c:298
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPVOID lpMemory
Definition: dxfile.h:50
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject(IDirectXFileSaveObject *iface, REFGUID rguidTemplate, LPCSTR szName, const GUID *pguid, DWORD cbSize, LPVOID pvData, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1177
#define IDirectXFileData_Release(p)
Definition: dxfile.h:185
REFIID riid
Definition: precomp.h:44
struct IDirectXFileData * LPDIRECTXFILEDATA
Definition: dxfile.h:58
static ULONG WINAPI IDirectXFileBinaryImpl_AddRef(IDirectXFileBinary *iface)
Definition: d3dxof.c:412
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName(IDirectXFileDataReference *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:841
#define IDirectXFileData_AddRef(p)
Definition: dxfile.h:184
static HRESULT WINAPI IDirectXFileDataImpl_GetId(IDirectXFileData *iface, LPGUID pGuid)
Definition: d3dxof.c:604
static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:970
static const struct IDirectXFileDataVtbl IDirectXFileData_Vtbl
Definition: d3dxof.c:39
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT IDirectXFileBinaryImpl_Create(IDirectXFileBinaryImpl **ppObj)
Definition: d3dxof.c:365
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
static ULONG WINAPI IDirectXFileImpl_Release(IDirectXFile *iface)
Definition: d3dxof.c:114
static ULONG WINAPI IDirectXFileDataReferenceImpl_Release(IDirectXFileDataReference *iface)
Definition: d3dxof.c:827
static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject(IDirectXFile *iface, LPCSTR szFileName, DXFILEFORMAT dwFileFormat, LPDIRECTXFILESAVEOBJECT *ppSaveObj)
Definition: d3dxof.c:281
static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData *iface, LPDIRECTXFILEOBJECT *ppChildObj)
Definition: d3dxof.c:667
static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject(IDirectXFileData *iface, LPDIRECTXFILEDATA pDataObj)
Definition: d3dxof.c:728
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define ZeroMemory
Definition: winbase.h:1635
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates(IDirectXFileSaveObject *iface, DWORD cTemplates, const GUID **ppguidTemplates)
Definition: d3dxof.c:1168
static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface(IDirectXFileEnumObject *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:942
#define DXFILEERR_BADVALUE
Definition: dxfile.h:271
static ULONG WINAPI IDirectXFileDataImpl_AddRef(IDirectXFileData *iface)
Definition: d3dxof.c:542
char * LPSTR
Definition: xmlstorage.h:182
#define DXFILEERR_BADFILETYPE
Definition: dxfile.h:281
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById(IDirectXFileEnumObject *iface, REFGUID rguid, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1075
#define DXFILEERR_NOMOREOBJECTS
Definition: dxfile.h:291
static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface(IDirectXFileBinary *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:389
Definition: send.c:47
static HRESULT WINAPI IDirectXFileBinaryImpl_GetId(IDirectXFileBinary *iface, LPGUID pGuid)
Definition: d3dxof.c:446
#define FILE_SHARE_READ
Definition: compat.h:125
static IDirectXFileEnumObjectImpl * impl_from_IDirectXFileEnumObject(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:936
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define DXFILELOAD_FROMFILE
Definition: dxfile.h:37
static HRESULT WINAPI IDirectXFileImpl_QueryInterface(IDirectXFile *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:86
#define DXFILE_OK
Definition: dxfile.h:268
static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1145
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * guid
unsigned char * LPBYTE
Definition: typedefs.h:52
static IDirectXFileSaveObjectImpl * impl_from_IDirectXFileSaveObject(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1121
static IDirectXFileDataReferenceImpl * impl_from_IDirectXFileDataReference(IDirectXFileDataReference *iface)
Definition: d3dxof.c:788
static ULONG WINAPI IDirectXFileBinaryImpl_Release(IDirectXFileBinary *iface)
Definition: d3dxof.c:422
#define GENERIC_WRITE
Definition: nt_native.h:90
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
HMODULE hModule
Definition: dxfile.h:44
#define DXFILEERR_BADRESOURCE
Definition: dxfile.h:280
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define DXFILEERR_PARSEERROR
Definition: dxfile.h:286
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
BOOL parse_templates(parse_buffer *buf, BOOL templates_only) DECLSPEC_HIDDEN
Definition: parsing.c:1099
static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef(IDirectXFileDataReference *iface)
Definition: d3dxof.c:817
#define FILE_MAP_READ
Definition: compat.h:427
static IDirectXFileDataImpl * impl_from_IDirectXFileData(IDirectXFileData *iface)
Definition: d3dxof.c:513
static HRESULT WINAPI IDirectXFileDataImpl_GetName(IDirectXFileData *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:577
const char * LPCSTR
Definition: xmlstorage.h:183
static char * file_buffer
Definition: regtests2xml.c:46
#define debugstr_guid
Definition: kernel32.h:35
static const struct IDirectXFileVtbl IDirectXFile_Vtbl
Definition: d3dxof.c:37
#define OPEN_EXISTING
Definition: compat.h:426
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN
Definition: parsing.c:185
static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface(IDirectXFileDataReference *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:794
#define DXFILEERR_RESOURCENOTFOUND
Definition: dxfile.h:278
static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve(IDirectXFileDataReference *iface, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:883
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HRESULT WINAPI IDirectXFileBinaryImpl_GetName(IDirectXFileBinary *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:436
static const struct IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl
Definition: d3dxof.c:42
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
struct IDirectXFileObject * LPDIRECTXFILEOBJECT
Definition: dxfile.h:57
#define WINAPI
Definition: msvc.h:8
const char file[]
Definition: icontest.c:11
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
struct IDirectXFileEnumObject * LPDIRECTXFILEENUMOBJECT
Definition: dxfile.h:55
WINE_DEFAULT_DEBUG_CHANNEL(d3dxof)
DWORD DXFILELOADOPTIONS
Definition: dxfile.h:35
static ULONG WINAPI IDirectXFileSaveObjectImpl_Release(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1155
static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize(IDirectXFileBinary *iface, DWORD *pcbSize)
Definition: d3dxof.c:456
#define InterlockedDecrement
Definition: armddk.h:52
static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData *iface)
Definition: d3dxof.c:552
static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface(IDirectXFileData *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:519
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT WINAPI IDirectXFileDataImpl_GetType(IDirectXFileData *iface, const GUID **pguid)
Definition: d3dxof.c:651
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define GENERIC_READ
Definition: compat.h:124
#define DXFILEERR_NOTDONEYET
Definition: dxfile.h:276
#define DXFILELOAD_FROMRESOURCE
Definition: dxfile.h:38
_In_ HANDLE hFile
Definition: mswsock.h:90
#define MAX_SUBOBJECTS
#define MAX_OBJECTS
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectByName(IDirectXFileEnumObject *iface, LPCSTR szName, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1084
#define S_OK
Definition: intsafe.h:59
#define CREATE_ALWAYS
Definition: disk.h:72
static const struct IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl
Definition: d3dxof.c:40
static HRESULT IDirectXFileDataImpl_Create(IDirectXFileDataImpl **ppObj)
Definition: d3dxof.c:495
#define InterlockedIncrement
Definition: armddk.h:53
unsigned short USHORT
Definition: pedump.c:61
static HRESULT WINAPI IDirectXFileDataImpl_GetData(IDirectXFileData *iface, LPCSTR szMember, DWORD *pcbSize, void **ppvData)
Definition: d3dxof.c:619
WINE_DECLARE_DEBUG_CHANNEL(d3dxof_dump)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define DPRINTF
Definition: debug.h:413
#define PAGE_READONLY
Definition: compat.h:127
static IDirectXFileImpl * impl_from_IDirectXFile(IDirectXFile *iface)
Definition: d3dxof.c:80
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
static const WCHAR szName[]
Definition: msipriv.h:1194
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileEnumObject *iface, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:992
uint32_t * LPDWORD
Definition: typedefs.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
#define TOKEN_DWORD
Definition: d3dxof.c:48
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define DXFILEERR_BADALLOC
Definition: dxfile.h:274
char * cleanup(char *str)
Definition: wpickclick.c:99
BOOL parse_object(parse_buffer *buf) DECLSPEC_HIDDEN
Definition: parsing.c:1380
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl **ppObj)
Definition: d3dxof.c:918
HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: d3dxof.c:51
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData(IDirectXFileSaveObject *iface, LPDIRECTXFILEDATA ppDataObj)
Definition: d3dxof.c:1186
#define E_POINTER
Definition: winerror.h:2365
#define UnmapViewOfFile
Definition: compat.h:403
#define TRACE_ON(x)
Definition: compat.h:65
static HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl **ppObj)
Definition: d3dxof.c:1103
static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface(IDirectXFileSaveObject *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:1127
static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile *iface, LPVOID pvSource, DXFILELOADOPTIONS dwLoadOptions, LPDIRECTXFILEENUMOBJECT *ppEnumObj)
Definition: d3dxof.c:128
static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject(IDirectXFileData *iface, LPCSTR szName, const GUID *pguid, LPCSTR szMimeType, LPVOID pvData, DWORD cbSize)
Definition: d3dxof.c:746
#define HeapFree(x, y, z)
Definition: compat.h:394
static const struct IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl
Definition: d3dxof.c:38
void * object
Definition: jmemsys.h:48
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
#define file_size(inode)
Definition: reiserfs_fs.h:1869
static HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImpl **ppObj)
Definition: d3dxof.c:770
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define TOKEN_FLOAT
Definition: d3dxof.c:49
static ULONG WINAPI IDirectXFileImpl_AddRef(IDirectXFile *iface)
Definition: d3dxof.c:104
Definition: fci.c:126
#define DXFILELOAD_FROMMEMORY
Definition: dxfile.h:39