d3dxof: Release properly all allocated resources.
[wine/wine64.git] / dlls / d3dxof / d3dxof_private.h
blob58b0416cb4292fe8cabf869c352a567ce9ce8088
1 /*
2 * DirectX File private interfaces (D3DXOF.DLL)
4 * Copyright 2004, 2008 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #ifndef __D3DXOF_PRIVATE_INCLUDED__
25 #define __D3DXOF_PRIVATE_INCLUDED__
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wtypes.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "dxfile.h"
36 #define MAX_NAME_LEN 32
37 #define MAX_ARRAY_DIM 4
38 #define MAX_MEMBERS 50
39 #define MAX_CHILDS 100
40 #define MAX_TEMPLATES 200
41 #define MAX_OBJECTS 500
42 #define MAX_SUBOBJECTS 500
43 #define MAX_STRINGS_BUFFER 10000
45 typedef struct {
46 DWORD type;
47 LONG idx_template;
48 char name[MAX_NAME_LEN];
49 ULONG nb_dims;
50 BOOL dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
51 ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
52 } member;
54 typedef struct {
55 char name[MAX_NAME_LEN];
56 GUID class_id;
57 BOOL open;
58 BOOL binary;
59 ULONG nb_childs;
60 char childs[MAX_CHILDS][MAX_NAME_LEN];
61 ULONG nb_members;
62 member members[MAX_MEMBERS];
63 } xtemplate;
65 typedef struct {
66 char name[MAX_NAME_LEN];
67 LPBYTE start;
68 ULONG size;
69 } xobject_member;
71 struct _xobject {
72 BOOL binary;
73 struct _xobject* ptarget;
74 char name[MAX_NAME_LEN];
75 GUID class_id;
76 GUID type;
77 LPBYTE pdata;
78 DWORD size;
79 ULONG nb_members;
80 xobject_member members[MAX_MEMBERS];
81 ULONG nb_childs;
82 ULONG nb_subobjects;
83 struct _xobject * childs[MAX_CHILDS];
86 typedef struct _xobject xobject;
88 typedef struct {
89 IDirectXFile lpVtbl;
90 LONG ref;
91 ULONG nb_xtemplates;
92 xtemplate xtemplates[MAX_TEMPLATES];
93 } IDirectXFileImpl;
95 typedef struct {
96 IDirectXFileBinary lpVtbl;
97 LONG ref;
98 } IDirectXFileBinaryImpl;
100 typedef struct {
101 IDirectXFileData lpVtbl;
102 LONG ref;
103 xobject* pobj;
104 int cur_enum_object;
105 BOOL from_ref;
106 ULONG level;
107 LPBYTE pdata;
108 LPBYTE pstrings;
109 } IDirectXFileDataImpl;
111 typedef struct {
112 IDirectXFileDataReference lpVtbl;
113 LONG ref;
114 xobject* ptarget;
115 } IDirectXFileDataReferenceImpl;
117 typedef struct {
118 IDirectXFileObject lpVtbl;
119 LONG ref;
120 } IDirectXFileObjectImpl;
122 typedef struct {
123 /* Buffer to parse */
124 LPBYTE buffer;
125 DWORD rem_bytes;
126 /* Misc info */
127 WORD current_token;
128 BOOL token_present;
129 BOOL txt;
130 ULONG cur_subobject;
131 LPBYTE cur_pdata;
132 LPBYTE cur_pstrings;
133 BYTE value[100];
134 xobject** pxo_globals;
135 ULONG nb_pxo_globals;
136 xobject* pxo_tab;
137 IDirectXFileImpl* pdxf;
138 xobject* pxo;
139 xtemplate* pxt[MAX_SUBOBJECTS];
140 ULONG level;
141 LPBYTE pdata;
142 LPBYTE pstrings;
143 } parse_buffer;
145 typedef struct {
146 IDirectXFileEnumObject lpVtbl;
147 LONG ref;
148 DXFILELOADOPTIONS source;
149 HANDLE hFile;
150 parse_buffer buf;
151 IDirectXFileImpl* pDirectXFile;
152 ULONG nb_xobjects;
153 xobject* xobjects[MAX_OBJECTS];
154 } IDirectXFileEnumObjectImpl;
156 typedef struct {
157 IDirectXFileSaveObject lpVtbl;
158 LONG ref;
159 } IDirectXFileSaveObjectImpl;
161 HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj);
162 HRESULT IDirectXFileFileObjectImpl_Create(IDirectXFileObjectImpl** ppObj);
163 HRESULT IDirectXFileFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj);
165 #endif /* __D3DXOF_PRIVATE_INCLUDED__ */