ReactOS 0.4.15-dev-7889-g76290a6
d3dxof.c File Reference
#include "wine/debug.h"
#include "winbase.h"
#include "wingdi.h"
#include "d3dxof_private.h"
#include "dxfile.h"
#include <stdio.h>
Include dependency graph for d3dxof.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define TOKEN_DWORD   41
 
#define TOKEN_FLOAT   42
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dxof)
 
 WINE_DECLARE_DEBUG_CHANNEL (d3dxof_dump)
 
static HRESULT IDirectXFileDataReferenceImpl_Create (IDirectXFileDataReferenceImpl **ppObj)
 
static HRESULT IDirectXFileEnumObjectImpl_Create (IDirectXFileEnumObjectImpl **ppObj)
 
static HRESULT IDirectXFileSaveObjectImpl_Create (IDirectXFileSaveObjectImpl **ppObj)
 
HRESULT IDirectXFileImpl_Create (IUnknown *pUnkOuter, LPVOID *ppObj)
 
static IDirectXFileImplimpl_from_IDirectXFile (IDirectXFile *iface)
 
static HRESULT WINAPI IDirectXFileImpl_QueryInterface (IDirectXFile *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileImpl_AddRef (IDirectXFile *iface)
 
static ULONG WINAPI IDirectXFileImpl_Release (IDirectXFile *iface)
 
static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject (IDirectXFile *iface, LPVOID pvSource, DXFILELOADOPTIONS dwLoadOptions, LPDIRECTXFILEENUMOBJECT *ppEnumObj)
 
static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject (IDirectXFile *iface, LPCSTR szFileName, DXFILEFORMAT dwFileFormat, LPDIRECTXFILESAVEOBJECT *ppSaveObj)
 
static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates (IDirectXFile *iface, LPVOID pvData, DWORD cbSize)
 
static HRESULT IDirectXFileBinaryImpl_Create (IDirectXFileBinaryImpl **ppObj)
 
static IDirectXFileBinaryImplimpl_from_IDirectXFileBinary (IDirectXFileBinary *iface)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface (IDirectXFileBinary *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileBinaryImpl_AddRef (IDirectXFileBinary *iface)
 
static ULONG WINAPI IDirectXFileBinaryImpl_Release (IDirectXFileBinary *iface)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_GetName (IDirectXFileBinary *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_GetId (IDirectXFileBinary *iface, LPGUID pGuid)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize (IDirectXFileBinary *iface, DWORD *pcbSize)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType (IDirectXFileBinary *iface, LPCSTR *pszMimeType)
 
static HRESULT WINAPI IDirectXFileBinaryImpl_Read (IDirectXFileBinary *iface, LPVOID pvData, DWORD cbSize, LPDWORD pcbRead)
 
static HRESULT IDirectXFileDataImpl_Create (IDirectXFileDataImpl **ppObj)
 
static IDirectXFileDataImplimpl_from_IDirectXFileData (IDirectXFileData *iface)
 
static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface (IDirectXFileData *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileDataImpl_AddRef (IDirectXFileData *iface)
 
static ULONG WINAPI IDirectXFileDataImpl_Release (IDirectXFileData *iface)
 
static HRESULT WINAPI IDirectXFileDataImpl_GetName (IDirectXFileData *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
 
static HRESULT WINAPI IDirectXFileDataImpl_GetId (IDirectXFileData *iface, LPGUID pGuid)
 
static HRESULT WINAPI IDirectXFileDataImpl_GetData (IDirectXFileData *iface, LPCSTR szMember, DWORD *pcbSize, void **ppvData)
 
static HRESULT WINAPI IDirectXFileDataImpl_GetType (IDirectXFileData *iface, const GUID **pguid)
 
static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject (IDirectXFileData *iface, LPDIRECTXFILEOBJECT *ppChildObj)
 
static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject (IDirectXFileData *iface, LPDIRECTXFILEDATA pDataObj)
 
static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference (IDirectXFileData *iface, LPCSTR szRef, const GUID *pguidRef)
 
static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject (IDirectXFileData *iface, LPCSTR szName, const GUID *pguid, LPCSTR szMimeType, LPVOID pvData, DWORD cbSize)
 
static IDirectXFileDataReferenceImplimpl_from_IDirectXFileDataReference (IDirectXFileDataReference *iface)
 
static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface (IDirectXFileDataReference *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef (IDirectXFileDataReference *iface)
 
static ULONG WINAPI IDirectXFileDataReferenceImpl_Release (IDirectXFileDataReference *iface)
 
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName (IDirectXFileDataReference *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
 
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId (IDirectXFileDataReference *iface, LPGUID pGuid)
 
static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve (IDirectXFileDataReference *iface, LPDIRECTXFILEDATA *ppDataObj)
 
static IDirectXFileEnumObjectImplimpl_from_IDirectXFileEnumObject (IDirectXFileEnumObject *iface)
 
static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface (IDirectXFileEnumObject *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef (IDirectXFileEnumObject *iface)
 
static ULONG WINAPI IDirectXFileEnumObjectImpl_Release (IDirectXFileEnumObject *iface)
 
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject (IDirectXFileEnumObject *iface, LPDIRECTXFILEDATA *ppDataObj)
 
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById (IDirectXFileEnumObject *iface, REFGUID rguid, LPDIRECTXFILEDATA *ppDataObj)
 
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectByName (IDirectXFileEnumObject *iface, LPCSTR szName, LPDIRECTXFILEDATA *ppDataObj)
 
static IDirectXFileSaveObjectImplimpl_from_IDirectXFileSaveObject (IDirectXFileSaveObject *iface)
 
static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface (IDirectXFileSaveObject *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef (IDirectXFileSaveObject *iface)
 
static ULONG WINAPI IDirectXFileSaveObjectImpl_Release (IDirectXFileSaveObject *iface)
 
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates (IDirectXFileSaveObject *iface, DWORD cTemplates, const GUID **ppguidTemplates)
 
static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject (IDirectXFileSaveObject *iface, REFGUID rguidTemplate, LPCSTR szName, const GUID *pguid, DWORD cbSize, LPVOID pvData, LPDIRECTXFILEDATA *ppDataObj)
 
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData (IDirectXFileSaveObject *iface, LPDIRECTXFILEDATA ppDataObj)
 

Variables

static const struct IDirectXFileVtbl IDirectXFile_Vtbl
 
static const struct IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl
 
static const struct IDirectXFileDataVtbl IDirectXFileData_Vtbl
 
static const struct IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl
 
static const struct IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl
 
static const struct IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file d3dxof.c.

◆ TOKEN_DWORD

#define TOKEN_DWORD   41

Definition at line 47 of file d3dxof.c.

◆ TOKEN_FLOAT

#define TOKEN_FLOAT   42

Definition at line 48 of file d3dxof.c.

Function Documentation

◆ IDirectXFileBinaryImpl_AddRef()

static ULONG WINAPI IDirectXFileBinaryImpl_AddRef ( IDirectXFileBinary *  iface)
static

Definition at line 411 of file d3dxof.c.

412{
415
416 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
417
418 return ref;
419}
#define InterlockedIncrement
Definition: armddk.h:53
static IDirectXFileBinaryImpl * impl_from_IDirectXFileBinary(IDirectXFileBinary *iface)
Definition: d3dxof.c:382
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ IDirectXFileBinaryImpl_Create()

static HRESULT IDirectXFileBinaryImpl_Create ( IDirectXFileBinaryImpl **  ppObj)
static

Definition at line 364 of file d3dxof.c.

365{
367
368 TRACE("(%p)\n", ppObj);
369
371 if (!object)
372 return DXFILEERR_BADALLOC;
373
374 object->IDirectXFileBinary_iface.lpVtbl = &IDirectXFileBinary_Vtbl;
375 object->ref = 1;
376
377 *ppObj = object;
378
379 return DXFILE_OK;
380}
static const struct IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl
Definition: d3dxof.c:37
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DXFILEERR_BADALLOC
Definition: dxfile.h:274
#define DXFILE_OK
Definition: dxfile.h:268

Referenced by IDirectXFileDataImpl_GetNextObject().

◆ IDirectXFileBinaryImpl_GetId()

static HRESULT WINAPI IDirectXFileBinaryImpl_GetId ( IDirectXFileBinary *  iface,
LPGUID  pGuid 
)
static

Definition at line 445 of file d3dxof.c.

446{
448
449 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid);
450
451 return DXFILEERR_BADVALUE;
452}
#define FIXME(fmt,...)
Definition: debug.h:111
#define DXFILEERR_BADVALUE
Definition: dxfile.h:271

◆ IDirectXFileBinaryImpl_GetMimeType()

static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType ( IDirectXFileBinary *  iface,
LPCSTR pszMimeType 
)
static

Definition at line 464 of file d3dxof.c.

465{
467
468 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pszMimeType);
469
470 return DXFILEERR_BADVALUE;
471}

◆ IDirectXFileBinaryImpl_GetName()

static HRESULT WINAPI IDirectXFileBinaryImpl_GetName ( IDirectXFileBinary *  iface,
LPSTR  pstrNameBuf,
LPDWORD  pdwBufLen 
)
static

Definition at line 435 of file d3dxof.c.

437{
439
440 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen);
441
442 return DXFILEERR_BADVALUE;
443}

◆ IDirectXFileBinaryImpl_GetSize()

static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize ( IDirectXFileBinary *  iface,
DWORD pcbSize 
)
static

Definition at line 455 of file d3dxof.c.

456{
458
459 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pcbSize);
460
461 return DXFILEERR_BADVALUE;
462}

◆ IDirectXFileBinaryImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface ( IDirectXFileBinary *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 388 of file d3dxof.c.

389{
391
392 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
393
395 || IsEqualGUID(riid, &IID_IDirectXFileObject)
396 || IsEqualGUID(riid, &IID_IDirectXFileBinary))
397 {
398 IUnknown_AddRef(iface);
399 *ppvObject = &This->IDirectXFileBinary_iface;
400 return S_OK;
401 }
402
403 /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
404 if (!IsEqualGUID(riid, &IID_IDirectXFileData)
405 && !IsEqualGUID(riid, &IID_IDirectXFileDataReference))
406 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
407
408 return E_NOINTERFACE;
409}
const GUID IID_IUnknown
#define ERR(fmt,...)
Definition: debug.h:110
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IDirectXFileBinaryImpl_Read()

static HRESULT WINAPI IDirectXFileBinaryImpl_Read ( IDirectXFileBinary *  iface,
LPVOID  pvData,
DWORD  cbSize,
LPDWORD  pcbRead 
)
static

Definition at line 473 of file d3dxof.c.

474{
476
477 FIXME("(%p/%p)->(%p, %d, %p) stub!\n", This, iface, pvData, cbSize, pcbRead);
478
479 return DXFILEERR_BADVALUE;
480}
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749

◆ IDirectXFileBinaryImpl_Release()

static ULONG WINAPI IDirectXFileBinaryImpl_Release ( IDirectXFileBinary *  iface)
static

Definition at line 421 of file d3dxof.c.

422{
425
426 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
427
428 if (!ref)
430
431 return ref;
432}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ IDirectXFileDataImpl_AddBinaryObject()

static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject ( IDirectXFileData *  iface,
LPCSTR  szName,
const GUID pguid,
LPCSTR  szMimeType,
LPVOID  pvData,
DWORD  cbSize 
)
static

Definition at line 745 of file d3dxof.c.

746{
748
749 FIXME("(%p/%p)->(%s,%p,%s,%p,%d) stub!\n", This, iface, szName, pguid, szMimeType, pvData, cbSize);
750
751 return DXFILEERR_BADVALUE;
752}
static IDirectXFileDataImpl * impl_from_IDirectXFileData(IDirectXFileData *iface)
Definition: d3dxof.c:512
static const WCHAR szName[]
Definition: powrprof.c:45

◆ IDirectXFileDataImpl_AddDataObject()

static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject ( IDirectXFileData *  iface,
LPDIRECTXFILEDATA  pDataObj 
)
static

Definition at line 727 of file d3dxof.c.

728{
730
731 FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDataObj);
732
733 return DXFILEERR_BADVALUE;
734}

◆ IDirectXFileDataImpl_AddDataReference()

static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference ( IDirectXFileData *  iface,
LPCSTR  szRef,
const GUID pguidRef 
)
static

Definition at line 736 of file d3dxof.c.

737{
739
740 FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szRef, pguidRef);
741
742 return DXFILEERR_BADVALUE;
743}

◆ IDirectXFileDataImpl_AddRef()

static ULONG WINAPI IDirectXFileDataImpl_AddRef ( IDirectXFileData *  iface)
static

Definition at line 541 of file d3dxof.c.

542{
545
546 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
547
548 return ref;
549}

◆ IDirectXFileDataImpl_Create()

static HRESULT IDirectXFileDataImpl_Create ( IDirectXFileDataImpl **  ppObj)
static

Definition at line 494 of file d3dxof.c.

495{
497
498 TRACE("(%p)\n", ppObj);
499
501 if (!object)
502 return DXFILEERR_BADALLOC;
503
504 object->IDirectXFileData_iface.lpVtbl = &IDirectXFileData_Vtbl;
505 object->ref = 1;
506
507 *ppObj = object;
508
509 return S_OK;
510}
static const struct IDirectXFileDataVtbl IDirectXFileData_Vtbl
Definition: d3dxof.c:38

Referenced by IDirectXFileDataImpl_GetNextObject(), IDirectXFileDataReferenceImpl_Resolve(), and IDirectXFileEnumObjectImpl_GetNextDataObject().

◆ IDirectXFileDataImpl_GetData()

static HRESULT WINAPI IDirectXFileDataImpl_GetData ( IDirectXFileData *  iface,
LPCSTR  szMember,
DWORD pcbSize,
void **  ppvData 
)
static

Definition at line 618 of file d3dxof.c.

619{
621
622 TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_a(szMember), pcbSize, ppvData);
623
624 if (!pcbSize || !ppvData)
625 return DXFILEERR_BADVALUE;
626
627 if (szMember)
628 {
629 ULONG i;
630 for (i = 0; i < This->pobj->nb_members; i++)
631 if (!strcmp(This->pobj->members[i].name, szMember))
632 break;
633 if (i == This->pobj->nb_members)
634 {
635 WARN("Unknown member '%s'\n", szMember);
637 }
638 *pcbSize = This->pobj->members[i].size;
639 *ppvData = This->pobj->root->pdata + This->pobj->members[i].start;
640 }
641 else
642 {
643 *pcbSize = This->pobj->size;
644 *ppvData = This->pobj->root->pdata + This->pobj->pos_data;
645 }
646
647 return DXFILE_OK;
648}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WARN(fmt,...)
Definition: debug.h:112
#define DXFILEERR_BADDATAREFERENCE
Definition: dxfile.h:289
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
#define debugstr_a
Definition: kernel32.h:31

◆ IDirectXFileDataImpl_GetId()

static HRESULT WINAPI IDirectXFileDataImpl_GetId ( IDirectXFileData *  iface,
LPGUID  pGuid 
)
static

Definition at line 603 of file d3dxof.c.

604{
606
607 TRACE("(%p/%p)->(%p)\n", This, iface, pGuid);
608
609 if (!pGuid)
610 return DXFILEERR_BADVALUE;
611
612 *pGuid = This->pobj->class_id;
613
614 return DXFILE_OK;
615}

◆ IDirectXFileDataImpl_GetName()

static HRESULT WINAPI IDirectXFileDataImpl_GetName ( IDirectXFileData *  iface,
LPSTR  pstrNameBuf,
LPDWORD  pdwBufLen 
)
static

Definition at line 576 of file d3dxof.c.

577{
579 DWORD len;
580
581 TRACE("(%p/%p)->(%p,%p)\n", This, iface, pstrNameBuf, pdwBufLen);
582
583 if (!pdwBufLen)
584 return DXFILEERR_BADVALUE;
585
586 len = strlen(This->pobj->name);
587 if (len)
588 len++;
589
590 if (pstrNameBuf) {
591 if (*pdwBufLen < len)
592 return DXFILEERR_BADVALUE;
593 CopyMemory(pstrNameBuf, This->pobj->name, len);
594 /* Even if we return a size of 0, an empty string with a null byte must be returned */
595 if (*pdwBufLen && !len)
596 pstrNameBuf[0] = 0;
597 }
598 *pdwBufLen = len;
599
600 return DXFILE_OK;
601}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define CopyMemory
Definition: winbase.h:1710

◆ IDirectXFileDataImpl_GetNextObject()

static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject ( IDirectXFileData *  iface,
LPDIRECTXFILEOBJECT ppChildObj 
)
static

Definition at line 666 of file d3dxof.c.

667{
668 HRESULT hr;
670
671 TRACE("(%p/%p)->(%p)\n", This, iface, ppChildObj);
672
673 if (This->cur_enum_object >= This->pobj->nb_children)
674 {
675 *ppChildObj = NULL;
677 }
678
679 if (This->from_ref && (This->level >= 1))
680 {
681 /* Only 2 levels can be enumerated if the object is obtained from a reference */
682 *ppChildObj = NULL;
684 }
685
686 if (This->pobj->children[This->cur_enum_object]->binary)
687 {
689
691 if (FAILED(hr))
692 return hr;
693
694 *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileBinary_iface;
695 }
696 else if (This->pobj->children[This->cur_enum_object]->ptarget)
697 {
699
701 if (FAILED(hr))
702 return hr;
703
704 object->ptarget = This->pobj->children[This->cur_enum_object++]->ptarget;
705
706 *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileDataReference_iface;
707 }
708 else
709 {
711
713 if (FAILED(hr))
714 return hr;
715
716 object->pobj = This->pobj->children[This->cur_enum_object++];
717 object->cur_enum_object = 0;
718 object->from_ref = This->from_ref;
719 object->level = This->level + 1;
720
721 *ppChildObj = (LPDIRECTXFILEOBJECT)&object->IDirectXFileData_iface;
722 }
723
724 return DXFILE_OK;
725}
static HRESULT IDirectXFileDataImpl_Create(IDirectXFileDataImpl **ppObj)
Definition: d3dxof.c:494
static HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImpl **ppObj)
Definition: d3dxof.c:769
static HRESULT IDirectXFileBinaryImpl_Create(IDirectXFileBinaryImpl **ppObj)
Definition: d3dxof.c:364
#define NULL
Definition: types.h:112
struct IDirectXFileObject * LPDIRECTXFILEOBJECT
Definition: dxfile.h:57
#define DXFILEERR_NOMOREOBJECTS
Definition: dxfile.h:291
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183

◆ IDirectXFileDataImpl_GetType()

static HRESULT WINAPI IDirectXFileDataImpl_GetType ( IDirectXFileData *  iface,
const GUID **  pguid 
)
static

Definition at line 650 of file d3dxof.c.

651{
653 static GUID guid;
654
655 TRACE("(%p/%p)->(%p)\n", This, iface, pguid);
656
657 if (!pguid)
658 return DXFILEERR_BADVALUE;
659
660 guid = This->pobj->type;
661 *pguid = &guid;
662
663 return DXFILE_OK;
664}
const GUID * guid

◆ IDirectXFileDataImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface ( IDirectXFileData *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 518 of file d3dxof.c.

519{
521
522 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
523
525 || IsEqualGUID(riid, &IID_IDirectXFileObject)
526 || IsEqualGUID(riid, &IID_IDirectXFileData))
527 {
528 IUnknown_AddRef(iface);
529 *ppvObject = &This->IDirectXFileData_iface;
530 return S_OK;
531 }
532
533 /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
534 if (!IsEqualGUID(riid, &IID_IDirectXFileBinary)
535 && !IsEqualGUID(riid, &IID_IDirectXFileDataReference))
536 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
537
538 return E_NOINTERFACE;
539}

◆ IDirectXFileDataImpl_Release()

static ULONG WINAPI IDirectXFileDataImpl_Release ( IDirectXFileData *  iface)
static

Definition at line 551 of file d3dxof.c.

552{
555
556 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
557
558 if (!ref)
559 {
560 if (!This->level && !This->from_ref)
561 {
562 HeapFree(GetProcessHeap(), 0, This->pstrings);
563 if (This->pobj)
564 {
565 HeapFree(GetProcessHeap(), 0, This->pobj->pdata);
566 HeapFree(GetProcessHeap(), 0, This->pobj);
567 }
568 }
570 }
571
572 return ref;
573}

◆ IDirectXFileDataReferenceImpl_AddRef()

static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef ( IDirectXFileDataReference *  iface)
static

Definition at line 816 of file d3dxof.c.

817{
820
821 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
822
823 return ref;
824}
static IDirectXFileDataReferenceImpl * impl_from_IDirectXFileDataReference(IDirectXFileDataReference *iface)
Definition: d3dxof.c:787

◆ IDirectXFileDataReferenceImpl_Create()

static HRESULT IDirectXFileDataReferenceImpl_Create ( IDirectXFileDataReferenceImpl **  ppObj)
static

Definition at line 769 of file d3dxof.c.

770{
772
773 TRACE("(%p)\n", ppObj);
774
776 if (!object)
777 return DXFILEERR_BADALLOC;
778
779 object->IDirectXFileDataReference_iface.lpVtbl = &IDirectXFileDataReference_Vtbl;
780 object->ref = 1;
781
782 *ppObj = object;
783
784 return S_OK;
785}
static const struct IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl
Definition: d3dxof.c:39

Referenced by IDirectXFileDataImpl_GetNextObject().

◆ IDirectXFileDataReferenceImpl_GetId()

static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId ( IDirectXFileDataReference *  iface,
LPGUID  pGuid 
)
static

Definition at line 867 of file d3dxof.c.

868{
870
871 TRACE("(%p/%p)->(%p)\n", This, iface, pGuid);
872
873 if (!pGuid)
874 return DXFILEERR_BADVALUE;
875
876 *pGuid = This->ptarget->class_id;
877
878 return DXFILE_OK;
879}

◆ IDirectXFileDataReferenceImpl_GetName()

static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName ( IDirectXFileDataReference *  iface,
LPSTR  pstrNameBuf,
LPDWORD  pdwBufLen 
)
static

Definition at line 840 of file d3dxof.c.

841{
843 DWORD len;
844
845 TRACE("(%p/%p)->(%p,%p)\n", This, iface, pstrNameBuf, pdwBufLen);
846
847 if (!pdwBufLen)
848 return DXFILEERR_BADVALUE;
849
850 len = strlen(This->ptarget->name);
851 if (len)
852 len++;
853
854 if (pstrNameBuf) {
855 if (*pdwBufLen < len)
856 return DXFILEERR_BADVALUE;
857 CopyMemory(pstrNameBuf, This->ptarget->name, len);
858 /* Even if we return a size of 0, an empty string with a null byte must be returned */
859 if (*pdwBufLen && !len)
860 pstrNameBuf[0] = 0;
861 }
862 *pdwBufLen = len;
863
864 return DXFILE_OK;
865}

◆ IDirectXFileDataReferenceImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface ( IDirectXFileDataReference *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 793 of file d3dxof.c.

794{
796
797 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
798
800 || IsEqualGUID(riid, &IID_IDirectXFileObject)
801 || IsEqualGUID(riid, &IID_IDirectXFileDataReference))
802 {
803 IUnknown_AddRef(iface);
804 *ppvObject = &This->IDirectXFileDataReference_iface;
805 return S_OK;
806 }
807
808 /* Do not print an error for interfaces that can be queried to retrieve the type of the object */
809 if (!IsEqualGUID(riid, &IID_IDirectXFileData)
810 && !IsEqualGUID(riid, &IID_IDirectXFileBinary))
811 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
812
813 return E_NOINTERFACE;
814}

◆ IDirectXFileDataReferenceImpl_Release()

static ULONG WINAPI IDirectXFileDataReferenceImpl_Release ( IDirectXFileDataReference *  iface)
static

Definition at line 826 of file d3dxof.c.

827{
830
831 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
832
833 if (!ref)
835
836 return ref;
837}

◆ IDirectXFileDataReferenceImpl_Resolve()

static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve ( IDirectXFileDataReference *  iface,
LPDIRECTXFILEDATA ppDataObj 
)
static

Definition at line 882 of file d3dxof.c.

883{
886 HRESULT hr;
887
888 TRACE("(%p/%p)->(%p)\n", This, iface, ppDataObj);
889
890 if (!ppDataObj)
891 return DXFILEERR_BADVALUE;
892
894 if (FAILED(hr))
895 return hr;
896
897 object->pobj = This->ptarget;
898 object->cur_enum_object = 0;
899 object->level = 0;
900 object->from_ref = TRUE;
901
902 *ppDataObj = &object->IDirectXFileData_iface;
903
904 return DXFILE_OK;
905}
#define TRUE
Definition: types.h:120

◆ IDirectXFileEnumObjectImpl_AddRef()

static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef ( IDirectXFileEnumObject *  iface)
static

Definition at line 959 of file d3dxof.c.

960{
963
964 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
965
966 return ref;
967}
static IDirectXFileEnumObjectImpl * impl_from_IDirectXFileEnumObject(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:935

◆ IDirectXFileEnumObjectImpl_Create()

static HRESULT IDirectXFileEnumObjectImpl_Create ( IDirectXFileEnumObjectImpl **  ppObj)
static

Definition at line 917 of file d3dxof.c.

918{
920
921 TRACE("(%p)\n", ppObj);
922
924 if (!object)
925 return DXFILEERR_BADALLOC;
926
927 object->IDirectXFileEnumObject_iface.lpVtbl = &IDirectXFileEnumObject_Vtbl;
928 object->ref = 1;
929
930 *ppObj = object;
931
932 return S_OK;
933}
static const struct IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl
Definition: d3dxof.c:40

Referenced by IDirectXFileImpl_CreateEnumObject().

◆ IDirectXFileEnumObjectImpl_GetDataObjectById()

static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById ( IDirectXFileEnumObject *  iface,
REFGUID  rguid,
LPDIRECTXFILEDATA ppDataObj 
)
static

Definition at line 1074 of file d3dxof.c.

1075{
1077
1078 FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, rguid, ppDataObj);
1079
1080 return DXFILEERR_BADVALUE;
1081}

◆ IDirectXFileEnumObjectImpl_GetDataObjectByName()

static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectByName ( IDirectXFileEnumObject *  iface,
LPCSTR  szName,
LPDIRECTXFILEDATA ppDataObj 
)
static

Definition at line 1083 of file d3dxof.c.

1084{
1086
1087 FIXME("(%p/%p)->(%s,%p) stub!\n", This, iface, szName, ppDataObj);
1088
1089 return DXFILEERR_BADVALUE;
1090}

◆ IDirectXFileEnumObjectImpl_GetNextDataObject()

static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject ( IDirectXFileEnumObject *  iface,
LPDIRECTXFILEDATA ppDataObj 
)
static

Definition at line 991 of file d3dxof.c.

992{
995 HRESULT hr;
996
997 if (!ppDataObj)
998 return E_POINTER;
999
1000 *ppDataObj = NULL;
1001
1002 TRACE("(%p/%p)->(%p)\n", This, iface, ppDataObj);
1003
1004 if (This->nb_xobjects >= MAX_OBJECTS)
1005 {
1006 ERR("Too many objects\n");
1008 }
1009
1010 /* Check if there are templates defined before the object */
1011 if (!parse_templates(&This->buf, TRUE))
1012 return DXFILEERR_PARSEERROR;
1013
1014 if (!This->buf.rem_bytes)
1016
1018 if (FAILED(hr))
1019 return hr;
1020
1021 object->pobj = HeapAlloc(GetProcessHeap(), 0, sizeof(xobject)*MAX_SUBOBJECTS);
1022 if (!object->pobj)
1023 {
1025 goto error;
1026 }
1027
1028 object->pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER);
1029 if (!object->pstrings)
1030 {
1032 goto error;
1033 }
1034
1035 object->cur_enum_object = 0;
1036 object->level = 0;
1037 object->from_ref = FALSE;
1038
1039 This->buf.pxo_globals = This->xobjects;
1040 This->buf.nb_pxo_globals = This->nb_xobjects;
1041 This->buf.level = 0;
1042 This->buf.pdata = NULL;
1043 This->buf.capacity = 0;
1044 This->buf.cur_pos_data = 0;
1045 This->buf.cur_pstrings = This->buf.pstrings = object->pstrings;
1046 This->buf.pxo = This->xobjects[This->nb_xobjects] = This->buf.pxo_tab = object->pobj;
1047 This->buf.pxo->pdata = NULL;
1048 This->buf.pxo->nb_subobjects = 1;
1049
1050 if (!parse_object(&This->buf))
1051 {
1052 WARN("Object is not correct\n");
1054 goto error;
1055 }
1056
1057 *ppDataObj = &object->IDirectXFileData_iface;
1058
1059 /* Get a reference to created object */
1060 This->pRefObjects[This->nb_xobjects] = &object->IDirectXFileData_iface;
1061 IDirectXFileData_AddRef(This->pRefObjects[This->nb_xobjects]);
1062
1063 This->nb_xobjects++;
1064
1065 return DXFILE_OK;
1066
1067error:
1068
1069 IDirectXFileData_Release(&object->IDirectXFileData_iface);
1070
1071 return hr;
1072}
BOOL parse_templates(parse_buffer *buf, BOOL templates_only) DECLSPEC_HIDDEN
Definition: parsing.c:1098
#define MAX_SUBOBJECTS
BOOL parse_object(parse_buffer *buf) DECLSPEC_HIDDEN
Definition: parsing.c:1379
#define MAX_STRINGS_BUFFER
#define MAX_OBJECTS
#define FALSE
Definition: types.h:117
#define IDirectXFileData_AddRef(p)
Definition: dxfile.h:184
#define DXFILEERR_PARSEERROR
Definition: dxfile.h:286
#define IDirectXFileData_Release(p)
Definition: dxfile.h:185
#define error(str)
Definition: mkdosfs.c:1605
#define E_POINTER
Definition: winerror.h:2365

◆ IDirectXFileEnumObjectImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface ( IDirectXFileEnumObject *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 941 of file d3dxof.c.

942{
944
945 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
946
948 || IsEqualGUID(riid, &IID_IDirectXFileEnumObject))
949 {
950 IUnknown_AddRef(iface);
951 *ppvObject = &This->IDirectXFileEnumObject_iface;
952 return S_OK;
953 }
954
955 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
956 return E_NOINTERFACE;
957}

◆ IDirectXFileEnumObjectImpl_Release()

static ULONG WINAPI IDirectXFileEnumObjectImpl_Release ( IDirectXFileEnumObject *  iface)
static

Definition at line 969 of file d3dxof.c.

970{
973
974 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
975
976 if (!ref)
977 {
978 ULONG i;
979 for (i = 0; i < This->nb_xobjects; i++)
980 IDirectXFileData_Release(This->pRefObjects[i]);
981 if (This->mapped_memory)
982 UnmapViewOfFile(This->mapped_memory);
983 HeapFree(GetProcessHeap(), 0, This->decomp_buffer);
985 }
986
987 return ref;
988}
#define UnmapViewOfFile
Definition: compat.h:746

◆ IDirectXFileImpl_AddRef()

static ULONG WINAPI IDirectXFileImpl_AddRef ( IDirectXFile *  iface)
static

Definition at line 103 of file d3dxof.c.

104{
107
108 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
109
110 return ref;
111}
static IDirectXFileImpl * impl_from_IDirectXFile(IDirectXFile *iface)
Definition: d3dxof.c:79

◆ IDirectXFileImpl_Create()

HRESULT IDirectXFileImpl_Create ( IUnknown pUnkOuter,
LPVOID ppObj 
)

Definition at line 50 of file d3dxof.c.

51{
53
54 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
55
57 if (!object)
58 return DXFILEERR_BADALLOC;
59
60 object->IDirectXFile_iface.lpVtbl = &IDirectXFile_Vtbl;
61 object->ref = 1;
62
63 /* Reserve first template to handle the case sensitive legacy type indexColor */
64 object->nb_xtemplates = 1;
65 strcpy(object->xtemplates[0].name, "indexColor");
66 object->xtemplates[0].nb_members = 2;
67 object->xtemplates[0].members[0].type = TOKEN_DWORD;
68 object->xtemplates[0].members[0].nb_dims = 0;
69 object->xtemplates[0].members[1].type = TOKEN_FLOAT;
70 object->xtemplates[0].members[1].nb_dims = 1;
71 object->xtemplates[0].members[1].dim_fixed[0] = TRUE;
72 object->xtemplates[0].members[1].dim_value[0] = 4;
73
74 *ppObj = &object->IDirectXFile_iface;
75
76 return S_OK;
77}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define TOKEN_FLOAT
Definition: d3dxof.c:48
#define TOKEN_DWORD
Definition: d3dxof.c:47
static const struct IDirectXFileVtbl IDirectXFile_Vtbl
Definition: d3dxof.c:36

Referenced by DirectXFileCreate().

◆ IDirectXFileImpl_CreateEnumObject()

static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject ( IDirectXFile *  iface,
LPVOID  pvSource,
DXFILELOADOPTIONS  dwLoadOptions,
LPDIRECTXFILEENUMOBJECT ppEnumObj 
)
static

Definition at line 127 of file d3dxof.c.

128{
131 HRESULT hr;
134 DWORD bytes_written;
135
136 TRACE("(%p/%p)->(%p,%x,%p)\n", This, iface, pvSource, dwLoadOptions, ppEnumObj);
137
138 if (!ppEnumObj)
139 return DXFILEERR_BADVALUE;
140
141 /* Only lowest 4 bits are relevant in DXFILELOADOPTIONS */
142 dwLoadOptions &= 0xF;
143
145 if (FAILED(hr))
146 return hr;
147
148 if (dwLoadOptions == DXFILELOAD_FROMFILE)
149 {
150 HANDLE hFile, file_mapping;
151
152 TRACE("Open source file '%s'\n", (char*)pvSource);
153
156 {
157 TRACE("File '%s' not found\n", (char*)pvSource);
159 }
160
162
163 file_mapping = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
165 if (!file_mapping)
166 {
168 goto error;
169 }
170
171 object->mapped_memory = MapViewOfFile(file_mapping, FILE_MAP_READ, 0, 0, 0);
172 CloseHandle(file_mapping);
173 if (!object->mapped_memory)
174 {
176 goto error;
177 }
178 file_buffer = object->mapped_memory;
179 }
180 else if (dwLoadOptions == DXFILELOAD_FROMRESOURCE)
181 {
182 HRSRC resource_info;
184 LPDXFILELOADRESOURCE lpdxflr = pvSource;
185
186 TRACE("Source in resource (module = %p, name = %s, type = %s)\n", lpdxflr->hModule, debugstr_a(lpdxflr->lpName), debugstr_a(lpdxflr->lpType));
187
188 resource_info = FindResourceA(lpdxflr->hModule, lpdxflr->lpName, lpdxflr->lpType);
189 if (!resource_info)
190 {
192 goto error;
193 }
194
195 file_size = SizeofResource(lpdxflr->hModule, resource_info);
196
197 resource_data = LoadResource(lpdxflr->hModule, resource_info);
198 if (!resource_data)
199 {
201 goto error;
202 }
203
205 if (!file_buffer)
206 {
208 goto error;
209 }
210 }
211 else if (dwLoadOptions == DXFILELOAD_FROMMEMORY)
212 {
213 LPDXFILELOADMEMORY lpdxflm = pvSource;
214
215 TRACE("Source in memory at %p with size %d\n", lpdxflm->lpMemory, lpdxflm->dSize);
216
217 file_buffer = lpdxflm->lpMemory;
218 file_size = lpdxflm->dSize;
219 }
220 else
221 {
222 FIXME("Source type %d is not handled yet\n", dwLoadOptions);
224 goto error;
225 }
226
227 TRACE("File size is %d bytes\n", file_size);
228
229 if (TRACE_ON(d3dxof_dump))
230 {
231 static USHORT num;
232 char tmp[12];
233 HANDLE file;
234 sprintf(tmp, "file%05u.x", num++);
235
238 {
239 WriteFile(file, file_buffer, file_size, &bytes_written, NULL);
241 }
242 }
243
244 object->pDirectXFile = This;
245
246 object->buf.pdxf = This;
247 object->buf.token_present = FALSE;
248 object->buf.buffer = file_buffer;
249 object->buf.rem_bytes = file_size;
250 hr = parse_header(&object->buf, &object->decomp_buffer);
251 if (FAILED(hr))
252 goto error;
253
254 /* Check if there are templates defined before the object */
255 if (!parse_templates(&object->buf, TRUE))
256 {
258 goto error;
259 }
260
261 if (TRACE_ON(d3dxof))
262 {
263 ULONG i;
264 TRACE("Registered templates (%d):\n", This->nb_xtemplates);
265 for (i = 1; i < This->nb_xtemplates; i++)
266 TRACE("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
267 }
268
269 *ppEnumObj = &object->IDirectXFileEnumObject_iface;
270
271 return DXFILE_OK;
272
273error:
274 IDirectXFileEnumObject_Release(&object->IDirectXFileEnumObject_iface);
275 *ppEnumObj = NULL;
276
277 return hr;
278}
static HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl **ppObj)
Definition: d3dxof.c:917
HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN
Definition: parsing.c:184
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define TRACE_ON(x)
Definition: compat.h:75
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define DXFILEERR_RESOURCENOTFOUND
Definition: dxfile.h:278
#define IDirectXFileEnumObject_Release(p)
Definition: dxfile.h:107
#define DXFILELOAD_FROMFILE
Definition: dxfile.h:37
#define DXFILEERR_FILENOTFOUND
Definition: dxfile.h:277
#define DXFILEERR_NOTDONEYET
Definition: dxfile.h:276
#define DXFILEERR_BADFILETYPE
Definition: dxfile.h:281
#define DXFILELOAD_FROMRESOURCE
Definition: dxfile.h:38
#define DXFILELOAD_FROMMEMORY
Definition: dxfile.h:39
#define DXFILEERR_BADRESOURCE
Definition: dxfile.h:280
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
GLuint GLuint num
Definition: glext.h:9618
#define CREATE_ALWAYS
Definition: disk.h:72
#define sprintf(buf, format,...)
Definition: sprintf.c:55
_In_ HANDLE hFile
Definition: mswsock.h:90
#define GENERIC_WRITE
Definition: nt_native.h:90
unsigned short USHORT
Definition: pedump.c:61
static unsigned int file_size
Definition: regtests2xml.c:47
static char * file_buffer
Definition: regtests2xml.c:46
LPVOID lpMemory
Definition: dxfile.h:50
HMODULE hModule
Definition: dxfile.h:44
Definition: fci.c:127
unsigned char * LPBYTE
Definition: typedefs.h:53

◆ IDirectXFileImpl_CreateSaveObject()

static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject ( IDirectXFile *  iface,
LPCSTR  szFileName,
DXFILEFORMAT  dwFileFormat,
LPDIRECTXFILESAVEOBJECT ppSaveObj 
)
static

Definition at line 280 of file d3dxof.c.

281{
284 HRESULT hr;
285
286 FIXME("(%p/%p)->(%s,%x,%p) partial stub!\n", This, iface, szFileName, dwFileFormat, ppSaveObj);
287
288 if (!szFileName || !ppSaveObj)
289 return E_POINTER;
290
292 if (SUCCEEDED(hr))
293 *ppSaveObj = &object->IDirectXFileSaveObject_iface;
294 return hr;
295}
static HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl **ppObj)
Definition: d3dxof.c:1102
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ IDirectXFileImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileImpl_QueryInterface ( IDirectXFile *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 85 of file d3dxof.c.

86{
88
89 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
90
92 || IsEqualGUID(riid, &IID_IDirectXFile))
93 {
94 IUnknown_AddRef(iface);
95 *ppvObject = &This->IDirectXFile_iface;
96 return S_OK;
97 }
98
99 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
100 return E_NOINTERFACE;
101}

◆ IDirectXFileImpl_RegisterTemplates()

static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates ( IDirectXFile *  iface,
LPVOID  pvData,
DWORD  cbSize 
)
static

Definition at line 297 of file d3dxof.c.

298{
301 HRESULT hr;
302 LPBYTE decomp_buffer = NULL;
303 DWORD bytes_written;
304
305 ZeroMemory(&buf, sizeof(buf));
306 buf.buffer = pvData;
307 buf.rem_bytes = cbSize;
308 buf.pdxf = This;
309
310 TRACE("(%p/%p)->(%p,%d)\n", This, iface, pvData, cbSize);
311
312 if (!pvData)
313 return DXFILEERR_BADVALUE;
314
315 if (TRACE_ON(d3dxof_dump))
316 {
317 static USHORT num;
318 char tmp[16];
319 HANDLE file;
320 sprintf(tmp, "template%05u.x", num++);
321
324 {
325 WriteFile(file, pvData, cbSize, &bytes_written, NULL);
327 }
328 }
329
330 hr = parse_header(&buf, &decomp_buffer);
331 if (FAILED(hr))
332 goto cleanup;
333
334 if (!parse_templates(&buf, FALSE))
335 {
337 goto cleanup;
338 }
339
340 if (TRACE_ON(d3dxof))
341 {
342 ULONG i;
343 TRACE("Registered templates (%d):\n", This->nb_xtemplates);
344 for (i = 1; i < This->nb_xtemplates; i++)
345 TRACE("%s - %s\n", This->xtemplates[i].name, debugstr_guid(&This->xtemplates[i].class_id));
346 }
347
348 hr = DXFILE_OK;
349cleanup:
350 HeapFree(GetProcessHeap(), 0, decomp_buffer);
351 return hr;
352}
static void cleanup(void)
Definition: main.c:1335
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ZeroMemory
Definition: winbase.h:1712

◆ IDirectXFileImpl_Release()

static ULONG WINAPI IDirectXFileImpl_Release ( IDirectXFile *  iface)
static

Definition at line 113 of file d3dxof.c.

114{
117
118 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
119
120 if (!ref)
122
123 return ref;
124}

◆ IDirectXFileSaveObjectImpl_AddRef()

static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef ( IDirectXFileSaveObject *  iface)
static

Definition at line 1144 of file d3dxof.c.

1145{
1148
1149 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
1150
1151 return ref;
1152}
static IDirectXFileSaveObjectImpl * impl_from_IDirectXFileSaveObject(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1120

◆ IDirectXFileSaveObjectImpl_Create()

static HRESULT IDirectXFileSaveObjectImpl_Create ( IDirectXFileSaveObjectImpl **  ppObj)
static

Definition at line 1102 of file d3dxof.c.

1103{
1105
1106 TRACE("(%p)\n", ppObj);
1107
1109 if (!object)
1110 return DXFILEERR_BADALLOC;
1111
1112 object->IDirectXFileSaveObject_iface.lpVtbl = &IDirectXFileSaveObject_Vtbl;
1113 object->ref = 1;
1114
1115 *ppObj = object;
1116
1117 return S_OK;
1118}
static const struct IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl
Definition: d3dxof.c:41

Referenced by IDirectXFileImpl_CreateSaveObject().

◆ IDirectXFileSaveObjectImpl_CreateDataObject()

static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject ( IDirectXFileSaveObject *  iface,
REFGUID  rguidTemplate,
LPCSTR  szName,
const GUID pguid,
DWORD  cbSize,
LPVOID  pvData,
LPDIRECTXFILEDATA ppDataObj 
)
static

Definition at line 1176 of file d3dxof.c.

1177{
1179
1180 FIXME("(%p/%p)->(%p,%s,%p,%d,%p,%p) stub!\n", This, iface, rguidTemplate, szName, pguid, cbSize, pvData, ppDataObj);
1181
1182 return DXFILEERR_BADVALUE;
1183}

◆ IDirectXFileSaveObjectImpl_QueryInterface()

static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface ( IDirectXFileSaveObject *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1126 of file d3dxof.c.

1127{
1129
1130 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
1131
1133 || IsEqualGUID(riid, &IID_IDirectXFileSaveObject))
1134 {
1135 IUnknown_AddRef(iface);
1136 *ppvObject = &This->IDirectXFileSaveObject_iface;
1137 return S_OK;
1138 }
1139
1140 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
1141 return E_NOINTERFACE;
1142}

◆ IDirectXFileSaveObjectImpl_Release()

static ULONG WINAPI IDirectXFileSaveObjectImpl_Release ( IDirectXFileSaveObject *  iface)
static

Definition at line 1154 of file d3dxof.c.

1155{
1158
1159 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
1160
1161 if (!ref)
1163
1164 return ref;
1165}

◆ IDirectXFileSaveObjectImpl_SaveData()

static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData ( IDirectXFileSaveObject *  iface,
LPDIRECTXFILEDATA  ppDataObj 
)
static

Definition at line 1185 of file d3dxof.c.

1186{
1188
1189 FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppDataObj);
1190
1191 return DXFILEERR_BADVALUE;
1192}

◆ IDirectXFileSaveObjectImpl_SaveTemplates()

static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates ( IDirectXFileSaveObject *  iface,
DWORD  cTemplates,
const GUID **  ppguidTemplates 
)
static

Definition at line 1167 of file d3dxof.c.

1168{
1170
1171 FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, cTemplates, ppguidTemplates);
1172
1173 return DXFILE_OK;
1174}

◆ impl_from_IDirectXFile()

static IDirectXFileImpl * impl_from_IDirectXFile ( IDirectXFile *  iface)
inlinestatic

◆ impl_from_IDirectXFileBinary()

◆ impl_from_IDirectXFileData()

◆ impl_from_IDirectXFileDataReference()

static IDirectXFileDataReferenceImpl * impl_from_IDirectXFileDataReference ( IDirectXFileDataReference *  iface)
inlinestatic

◆ impl_from_IDirectXFileEnumObject()

◆ impl_from_IDirectXFileSaveObject()

static IDirectXFileSaveObjectImpl * impl_from_IDirectXFileSaveObject ( IDirectXFileSaveObject *  iface)
inlinestatic

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( d3dxof_dump  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dxof  )

Variable Documentation

◆ IDirectXFile_Vtbl

static const IDirectXFileVtbl IDirectXFile_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileImpl_RegisterTemplates(IDirectXFile *iface, LPVOID pvData, DWORD cbSize)
Definition: d3dxof.c:297
static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject(IDirectXFile *iface, LPCSTR szFileName, DXFILEFORMAT dwFileFormat, LPDIRECTXFILESAVEOBJECT *ppSaveObj)
Definition: d3dxof.c:280
static HRESULT WINAPI IDirectXFileImpl_QueryInterface(IDirectXFile *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:85
static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile *iface, LPVOID pvSource, DXFILELOADOPTIONS dwLoadOptions, LPDIRECTXFILEENUMOBJECT *ppEnumObj)
Definition: d3dxof.c:127
static ULONG WINAPI IDirectXFileImpl_AddRef(IDirectXFile *iface)
Definition: d3dxof.c:103
static ULONG WINAPI IDirectXFileImpl_Release(IDirectXFile *iface)
Definition: d3dxof.c:113

Definition at line 36 of file d3dxof.c.

Referenced by IDirectXFileImpl_Create().

◆ IDirectXFileBinary_Vtbl

static const IDirectXFileBinaryVtbl IDirectXFileBinary_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileBinaryImpl_GetMimeType(IDirectXFileBinary *iface, LPCSTR *pszMimeType)
Definition: d3dxof.c:464
static ULONG WINAPI IDirectXFileBinaryImpl_Release(IDirectXFileBinary *iface)
Definition: d3dxof.c:421
static HRESULT WINAPI IDirectXFileBinaryImpl_GetName(IDirectXFileBinary *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:435
static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface(IDirectXFileBinary *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:388
static HRESULT WINAPI IDirectXFileBinaryImpl_GetId(IDirectXFileBinary *iface, LPGUID pGuid)
Definition: d3dxof.c:445
static ULONG WINAPI IDirectXFileBinaryImpl_AddRef(IDirectXFileBinary *iface)
Definition: d3dxof.c:411
static HRESULT WINAPI IDirectXFileBinaryImpl_Read(IDirectXFileBinary *iface, LPVOID pvData, DWORD cbSize, LPDWORD pcbRead)
Definition: d3dxof.c:473
static HRESULT WINAPI IDirectXFileBinaryImpl_GetSize(IDirectXFileBinary *iface, DWORD *pcbSize)
Definition: d3dxof.c:455

Definition at line 37 of file d3dxof.c.

Referenced by IDirectXFileBinaryImpl_Create().

◆ IDirectXFileData_Vtbl

static const IDirectXFileDataVtbl IDirectXFileData_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileDataImpl_GetName(IDirectXFileData *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:576
static HRESULT WINAPI IDirectXFileDataImpl_GetId(IDirectXFileData *iface, LPGUID pGuid)
Definition: d3dxof.c:603
static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData *iface, LPDIRECTXFILEOBJECT *ppChildObj)
Definition: d3dxof.c:666
static ULONG WINAPI IDirectXFileDataImpl_AddRef(IDirectXFileData *iface)
Definition: d3dxof.c:541
static HRESULT WINAPI IDirectXFileDataImpl_AddDataObject(IDirectXFileData *iface, LPDIRECTXFILEDATA pDataObj)
Definition: d3dxof.c:727
static HRESULT WINAPI IDirectXFileDataImpl_AddDataReference(IDirectXFileData *iface, LPCSTR szRef, const GUID *pguidRef)
Definition: d3dxof.c:736
static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData *iface)
Definition: d3dxof.c:551
static HRESULT WINAPI IDirectXFileDataImpl_GetType(IDirectXFileData *iface, const GUID **pguid)
Definition: d3dxof.c:650
static HRESULT WINAPI IDirectXFileDataImpl_AddBinaryObject(IDirectXFileData *iface, LPCSTR szName, const GUID *pguid, LPCSTR szMimeType, LPVOID pvData, DWORD cbSize)
Definition: d3dxof.c:745
static HRESULT WINAPI IDirectXFileDataImpl_QueryInterface(IDirectXFileData *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:518
static HRESULT WINAPI IDirectXFileDataImpl_GetData(IDirectXFileData *iface, LPCSTR szMember, DWORD *pcbSize, void **ppvData)
Definition: d3dxof.c:618

Definition at line 38 of file d3dxof.c.

Referenced by IDirectXFileDataImpl_Create().

◆ IDirectXFileDataReference_Vtbl

static const IDirectXFileDataReferenceVtbl IDirectXFileDataReference_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileDataReferenceImpl_QueryInterface(IDirectXFileDataReference *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:793
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetId(IDirectXFileDataReference *iface, LPGUID pGuid)
Definition: d3dxof.c:867
static ULONG WINAPI IDirectXFileDataReferenceImpl_AddRef(IDirectXFileDataReference *iface)
Definition: d3dxof.c:816
static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve(IDirectXFileDataReference *iface, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:882
static HRESULT WINAPI IDirectXFileDataReferenceImpl_GetName(IDirectXFileDataReference *iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen)
Definition: d3dxof.c:840
static ULONG WINAPI IDirectXFileDataReferenceImpl_Release(IDirectXFileDataReference *iface)
Definition: d3dxof.c:826

Definition at line 39 of file d3dxof.c.

Referenced by IDirectXFileDataReferenceImpl_Create().

◆ IDirectXFileEnumObject_Vtbl

static const IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileEnumObject *iface, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:991
static HRESULT WINAPI IDirectXFileEnumObjectImpl_QueryInterface(IDirectXFileEnumObject *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:941
static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:969
static ULONG WINAPI IDirectXFileEnumObjectImpl_AddRef(IDirectXFileEnumObject *iface)
Definition: d3dxof.c:959
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectById(IDirectXFileEnumObject *iface, REFGUID rguid, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1074
static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetDataObjectByName(IDirectXFileEnumObject *iface, LPCSTR szName, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1083

Definition at line 40 of file d3dxof.c.

Referenced by IDirectXFileEnumObjectImpl_Create().

◆ IDirectXFileSaveObject_Vtbl

static const IDirectXFileSaveObjectVtbl IDirectXFileSaveObject_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveData(IDirectXFileSaveObject *iface, LPDIRECTXFILEDATA ppDataObj)
Definition: d3dxof.c:1185
static HRESULT WINAPI IDirectXFileSaveObjectImpl_SaveTemplates(IDirectXFileSaveObject *iface, DWORD cTemplates, const GUID **ppguidTemplates)
Definition: d3dxof.c:1167
static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface(IDirectXFileSaveObject *iface, REFIID riid, void **ppvObject)
Definition: d3dxof.c:1126
static ULONG WINAPI IDirectXFileSaveObjectImpl_Release(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1154
static ULONG WINAPI IDirectXFileSaveObjectImpl_AddRef(IDirectXFileSaveObject *iface)
Definition: d3dxof.c:1144
static HRESULT WINAPI IDirectXFileSaveObjectImpl_CreateDataObject(IDirectXFileSaveObject *iface, REFGUID rguidTemplate, LPCSTR szName, const GUID *pguid, DWORD cbSize, LPVOID pvData, LPDIRECTXFILEDATA *ppDataObj)
Definition: d3dxof.c:1176

Definition at line 41 of file d3dxof.c.

Referenced by IDirectXFileSaveObjectImpl_Create().