* Import from Wine 1.7.1.

svn path=/trunk/; revision=60094
This commit is contained in:
Amine Khaldi 2013-09-14 10:13:29 +00:00
parent fb0811a01f
commit ba3d6d39e7
13 changed files with 4186 additions and 144 deletions

View file

@ -22,5 +22,6 @@ add_subdirectory(d3dx9_39)
add_subdirectory(d3dx9_40)
add_subdirectory(d3dx9_41)
add_subdirectory(d3dx9_42)
add_subdirectory(d3dxof)
add_subdirectory(ddraw)
add_subdirectory(wined3d)

View file

@ -0,0 +1,18 @@
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(d3dxof.dll d3dxof.spec ADD_IMPORTLIB)
list(APPEND SOURCE
d3dxof.c
main.c
mszip.c
parsing.c
${CMAKE_CURRENT_BINARY_DIR}/d3dxof.def)
add_library(d3dxof SHARED ${SOURCE} version.rc)
set_module_type(d3dxof win32dll)
target_link_libraries(d3dxof dxguid uuid wine)
add_importlibs(d3dxof msvcrt kernel32 ntdll)
add_cd_file(TARGET d3dxof DESTINATION reactos/system32 FOR all)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
/*
* COM Classes for d3dxof
*
* Copyright 2010 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
[
helpstring("DirectX File"),
threading(both),
uuid(4516ec43-8f20-11d0-9b6d-0000c0781bc3)
]
coclass CDirectXFile { interface IDirectXFile; }

View file

@ -0,0 +1,5 @@
@ stdcall DirectXFileCreate(ptr)
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View file

@ -0,0 +1,171 @@
/*
* DirectX File private interfaces (D3DXOF.DLL)
*
* Copyright 2004, 2008 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DXOF_PRIVATE_INCLUDED__
#define __D3DXOF_PRIVATE_INCLUDED__
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "wingdi.h"
#include "winuser.h"
#include "dxfile.h"
#define MAX_NAME_LEN 40
#define MAX_ARRAY_DIM 4
#define MAX_MEMBERS 50
#define MAX_CHILDREN 200
#define MAX_TEMPLATES 200
#define MAX_OBJECTS 500
#define MAX_SUBOBJECTS 2000
#define MAX_STRINGS_BUFFER 10000
typedef struct {
DWORD type;
LONG idx_template;
char name[MAX_NAME_LEN];
ULONG nb_dims;
BOOL dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
} member;
typedef struct {
char name[MAX_NAME_LEN];
GUID class_id;
BOOL open;
BOOL binary;
ULONG nb_children;
char children[MAX_CHILDREN][MAX_NAME_LEN];
ULONG nb_members;
member members[MAX_MEMBERS];
} xtemplate;
typedef struct {
char* name;
ULONG start;
ULONG size;
} xobject_member;
struct _xobject {
BOOL binary;
struct _xobject* ptarget;
char name[MAX_NAME_LEN];
GUID class_id;
GUID type;
LPBYTE pdata;
ULONG pos_data;
DWORD size;
ULONG nb_members;
xobject_member members[MAX_MEMBERS];
ULONG nb_children;
ULONG nb_subobjects;
struct _xobject * children[MAX_CHILDREN];
struct _xobject * root;
};
typedef struct _xobject xobject;
typedef struct {
IDirectXFile IDirectXFile_iface;
LONG ref;
ULONG nb_xtemplates;
xtemplate xtemplates[MAX_TEMPLATES];
} IDirectXFileImpl;
typedef struct {
IDirectXFileBinary IDirectXFileBinary_iface;
LONG ref;
} IDirectXFileBinaryImpl;
typedef struct {
IDirectXFileData IDirectXFileData_iface;
LONG ref;
xobject* pobj;
int cur_enum_object;
BOOL from_ref;
ULONG level;
LPBYTE pstrings;
} IDirectXFileDataImpl;
typedef struct {
IDirectXFileDataReference IDirectXFileDataReference_iface;
LONG ref;
xobject* ptarget;
} IDirectXFileDataReferenceImpl;
typedef struct {
IDirectXFileObject IDirectXFileObject_iface;
LONG ref;
} IDirectXFileObjectImpl;
typedef struct {
/* Buffer to parse */
LPBYTE buffer;
DWORD rem_bytes;
/* Misc info */
WORD current_token;
BOOL token_present;
BOOL txt;
DWORD list_nb_elements;
BOOL list_type_float;
BOOL list_separator;
ULONG cur_pos_data;
LPBYTE cur_pstrings;
BYTE value[100];
xobject** pxo_globals;
ULONG nb_pxo_globals;
xobject* pxo_tab;
IDirectXFileImpl* pdxf;
xobject* pxo;
xtemplate* pxt[MAX_SUBOBJECTS];
ULONG level;
LPBYTE pdata;
ULONG capacity;
LPBYTE pstrings;
} parse_buffer;
typedef struct {
IDirectXFileEnumObject IDirectXFileEnumObject_iface;
LONG ref;
LPBYTE mapped_memory;
LPBYTE decomp_buffer;
parse_buffer buf;
IDirectXFileImpl* pDirectXFile;
ULONG nb_xobjects;
xobject* xobjects[MAX_OBJECTS];
IDirectXFileData* pRefObjects[MAX_OBJECTS];
} IDirectXFileEnumObjectImpl;
typedef struct {
IDirectXFileSaveObject IDirectXFileSaveObject_iface;
LONG ref;
} IDirectXFileSaveObjectImpl;
HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN;
BOOL parse_object(parse_buffer * buf) DECLSPEC_HIDDEN;
BOOL parse_templates(parse_buffer * buf, BOOL templates_only) DECLSPEC_HIDDEN;
int mszip_decompress(int inlen, int outlen, char* inbuffer, char* outbuffer) DECLSPEC_HIDDEN;
#endif /* __D3DXOF_PRIVATE_INCLUDED__ */

View file

@ -0,0 +1,245 @@
/*
* DirectX Files Functions (D3DXOF.DLL)
*
* Copyright 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <string.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "uuids.h"
#include "d3dxof_private.h"
#include "dxfile.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dxof);
static HINSTANCE instance;
static LONG dll_ref = 0;
/* For the moment, do nothing here. */
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
}
return TRUE;
}
/******************************************************************************
* DirectX File ClassFactory
*/
typedef struct {
IClassFactory IClassFactory_iface;
LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
} IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
struct object_creation_info
{
const CLSID *clsid;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
};
static const struct object_creation_info object_creation[] =
{
{ &CLSID_CDirectXFile, IDirectXFileImpl_Create },
};
static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IClassFactory))
{
IClassFactory_AddRef(iface);
*ppobj = &This->IClassFactory_iface;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres;
LPUNKNOWN punk;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
*ppobj = NULL;
hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
if (SUCCEEDED(hres)) {
hres = IUnknown_QueryInterface(punk, riid, ppobj);
IUnknown_Release(punk);
}
return hres;
}
static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl XFCF_Vtbl =
{
XFCF_QueryInterface,
XFCF_AddRef,
XFCF_Release,
XFCF_CreateInstance,
XFCF_LockServer
};
/***********************************************************************
* DirectXFileCreate (D3DXOF.@)
*/
HRESULT WINAPI DirectXFileCreate(LPDIRECTXFILE* lplpDirectXFile)
{
HRESULT hr;
TRACE("(%p)\n", lplpDirectXFile);
if (!lplpDirectXFile)
return DXFILEERR_BADVALUE;
hr = IDirectXFileImpl_Create(NULL, (LPVOID)lplpDirectXFile);
if (FAILED(hr))
return DXFILEERR_BADALLOC;
return S_OK;
}
/*******************************************************************************
* DllGetClassObject [D3DXOF.@]
* Retrieves class object from a DLL object
*
* NOTES
* Docs say returns STDAPI
*
* PARAMS
* rclsid [I] CLSID for the class object
* riid [I] Reference to identifier of interface for class object
* ppv [O] Address of variable to receive interface pointer for riid
*
* RETURNS
* Success: S_OK
* Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
* E_UNEXPECTED
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
unsigned int i;
IClassFactoryImpl *factory;
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if ( !IsEqualGUID( &IID_IClassFactory, riid )
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
if (i == sizeof(object_creation)/sizeof(object_creation[0]))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
factory->IClassFactory_iface.lpVtbl = &XFCF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = &(factory->IClassFactory_iface);
return S_OK;
}
/***********************************************************************
* DllCanUnloadNow (D3DXOF.@)
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
return dll_ref != 0 ? S_FALSE : S_OK;
}
/***********************************************************************
* DllRegisterServer (D3DXOF.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (D3DXOF.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}

View file

@ -0,0 +1,645 @@
/*
* MSZIP decompression (taken from fdi.c of cabinet dll)
*
* Copyright 2000-2002 Stuart Caie
* Copyright 2002 Patrik Stridvall
* Copyright 2003 Greg Turner
* Copyright 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
#include "mszip.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dxof);
THOSE_ZIP_CONSTS;
/********************************************************
* Ziphuft_free (internal)
*/
static void fdi_Ziphuft_free(HFDI hfdi, struct Ziphuft *t)
{
register struct Ziphuft *p, *q;
/* Go through linked list, freeing from the allocated (t[-1]) address. */
p = t;
while (p != NULL)
{
q = (--p)->v.t;
PFDI_FREE(hfdi, p);
p = q;
}
}
/*********************************************************
* fdi_Ziphuft_build (internal)
*/
static cab_LONG fdi_Ziphuft_build(cab_ULONG *b, cab_ULONG n, cab_ULONG s, const cab_UWORD *d, const cab_UWORD *e,
struct Ziphuft **t, cab_LONG *m, fdi_decomp_state *decomp_state)
{
cab_ULONG a; /* counter for codes of length k */
cab_ULONG el; /* length of EOB code (value 256) */
cab_ULONG f; /* i repeats in table every f entries */
cab_LONG g; /* maximum code length */
cab_LONG h; /* table level */
register cab_ULONG i; /* counter, current code */
register cab_ULONG j; /* counter */
register cab_LONG k; /* number of bits in current code */
cab_LONG *l; /* stack of bits per table */
register cab_ULONG *p; /* pointer into ZIP(c)[],ZIP(b)[],ZIP(v)[] */
register struct Ziphuft *q; /* points to current table */
struct Ziphuft r; /* table entry for structure assignment */
register cab_LONG w; /* bits before this table == (l * h) */
cab_ULONG *xp; /* pointer into x */
cab_LONG y; /* number of dummy codes added */
cab_ULONG z; /* number of entries in current table */
l = ZIP(lx)+1;
/* Generate counts for each bit length */
el = n > 256 ? b[256] : ZIPBMAX; /* set length of EOB code, if any */
for(i = 0; i < ZIPBMAX+1; ++i)
ZIP(c)[i] = 0;
p = b; i = n;
do
{
ZIP(c)[*p]++; p++; /* assume all entries <= ZIPBMAX */
} while (--i);
if (ZIP(c)[0] == n) /* null input--all zero length codes */
{
*t = NULL;
*m = 0;
return 0;
}
/* Find minimum and maximum length, bound *m by those */
for (j = 1; j <= ZIPBMAX; j++)
if (ZIP(c)[j])
break;
k = j; /* minimum code length */
if ((cab_ULONG)*m < j)
*m = j;
for (i = ZIPBMAX; i; i--)
if (ZIP(c)[i])
break;
g = i; /* maximum code length */
if ((cab_ULONG)*m > i)
*m = i;
/* Adjust last length count to fill out codes, if needed */
for (y = 1 << j; j < i; j++, y <<= 1)
if ((y -= ZIP(c)[j]) < 0)
return 2; /* bad input: more codes than bits */
if ((y -= ZIP(c)[i]) < 0)
return 2;
ZIP(c)[i] += y;
/* Generate starting offsets LONGo the value table for each length */
ZIP(x)[1] = j = 0;
p = ZIP(c) + 1; xp = ZIP(x) + 2;
while (--i)
{ /* note that i == g from above */
*xp++ = (j += *p++);
}
/* Make a table of values in order of bit lengths */
p = b; i = 0;
do{
if ((j = *p++) != 0)
ZIP(v)[ZIP(x)[j]++] = i;
} while (++i < n);
/* Generate the Huffman codes and for each, make the table entries */
ZIP(x)[0] = i = 0; /* first Huffman code is zero */
p = ZIP(v); /* grab values in bit order */
h = -1; /* no tables yet--level -1 */
w = l[-1] = 0; /* no bits decoded yet */
ZIP(u)[0] = NULL; /* just to keep compilers happy */
q = NULL; /* ditto */
z = 0; /* ditto */
/* go through the bit lengths (k already is bits in shortest code) */
for (; k <= g; k++)
{
a = ZIP(c)[k];
while (a--)
{
/* here i is the Huffman code of length k bits for value *p */
/* make tables up to required level */
while (k > w + l[h])
{
w += l[h++]; /* add bits already decoded */
/* compute minimum size table less than or equal to *m bits */
if ((z = g - w) > (cab_ULONG)*m) /* upper limit */
z = *m;
if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
{ /* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */
xp = ZIP(c) + k;
while (++j < z) /* try smaller tables up to z bits */
{
if ((f <<= 1) <= *++xp)
break; /* enough codes to use up j bits */
f -= *xp; /* else deduct codes from patterns */
}
}
if ((cab_ULONG)w + j > el && (cab_ULONG)w < el)
j = el - w; /* make EOB code end at table */
z = 1 << j; /* table entries for j-bit table */
l[h] = j; /* set table size in stack */
/* allocate and link in new table */
if (!(q = PFDI_ALLOC(CAB(hfdi), (z + 1)*sizeof(struct Ziphuft))))
{
if(h)
fdi_Ziphuft_free(CAB(hfdi), ZIP(u)[0]);
return 3; /* not enough memory */
}
*t = q + 1; /* link to list for Ziphuft_free() */
*(t = &(q->v.t)) = NULL;
ZIP(u)[h] = ++q; /* table starts after link */
/* connect to last table, if there is one */
if (h)
{
ZIP(x)[h] = i; /* save pattern for backing up */
r.b = (cab_UBYTE)l[h-1]; /* bits to dump before this table */
r.e = (cab_UBYTE)(16 + j); /* bits in this table */
r.v.t = q; /* pointer to this table */
j = (i & ((1 << w) - 1)) >> (w - l[h-1]);
ZIP(u)[h-1][j] = r; /* connect to last table */
}
}
/* set up table entry in r */
r.b = (cab_UBYTE)(k - w);
if (p >= ZIP(v) + n)
r.e = 99; /* out of values--invalid code */
else if (*p < s)
{
r.e = (cab_UBYTE)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */
r.v.n = *p++; /* simple code is just the value */
}
else
{
r.e = (cab_UBYTE)e[*p - s]; /* non-simple--look up in lists */
r.v.n = d[*p++ - s];
}
/* fill code-like entries with r */
f = 1 << (k - w);
for (j = i >> w; j < z; j += f)
q[j] = r;
/* backwards increment the k-bit code i */
for (j = 1 << (k - 1); i & j; j >>= 1)
i ^= j;
i ^= j;
/* backup over finished tables */
while ((i & ((1 << w) - 1)) != ZIP(x)[h])
w -= l[--h]; /* don't need to update q */
}
}
/* return actual size of base table */
*m = l[0];
/* Return true (1) if we were given an incomplete table */
return y != 0 && g != 1;
}
/*********************************************************
* fdi_Zipinflate_codes (internal)
*/
static cab_LONG fdi_Zipinflate_codes(const struct Ziphuft *tl, const struct Ziphuft *td,
cab_LONG bl, cab_LONG bd, fdi_decomp_state *decomp_state)
{
register cab_ULONG e; /* table entry flag/number of extra bits */
cab_ULONG n, d; /* length and index for copy */
cab_ULONG w; /* current window position */
const struct Ziphuft *t; /* pointer to table entry */
cab_ULONG ml, md; /* masks for bl and bd bits */
register cab_ULONG b; /* bit buffer */
register cab_ULONG k; /* number of bits in bit buffer */
/* make local copies of globals */
b = ZIP(bb); /* initialize bit buffer */
k = ZIP(bk);
w = ZIP(window_posn); /* initialize window position */
/* inflate the coded data */
ml = Zipmask[bl]; /* precompute masks for speed */
md = Zipmask[bd];
for(;;)
{
ZIPNEEDBITS((cab_ULONG)bl)
if((e = (t = tl + (b & ml))->e) > 16)
do
{
if (e == 99)
return 1;
ZIPDUMPBITS(t->b)
e -= 16;
ZIPNEEDBITS(e)
} while ((e = (t = t->v.t + (b & Zipmask[e]))->e) > 16);
ZIPDUMPBITS(t->b)
if (e == 16) /* then it's a literal */
CAB(outbuf)[w++] = (cab_UBYTE)t->v.n;
else /* it's an EOB or a length */
{
/* exit if end of block */
if(e == 15)
break;
/* get length of block to copy */
ZIPNEEDBITS(e)
n = t->v.n + (b & Zipmask[e]);
ZIPDUMPBITS(e);
/* decode distance of block to copy */
ZIPNEEDBITS((cab_ULONG)bd)
if ((e = (t = td + (b & md))->e) > 16)
do {
if (e == 99)
return 1;
ZIPDUMPBITS(t->b)
e -= 16;
ZIPNEEDBITS(e)
} while ((e = (t = t->v.t + (b & Zipmask[e]))->e) > 16);
ZIPDUMPBITS(t->b)
ZIPNEEDBITS(e)
d = w - t->v.n - (b & Zipmask[e]);
ZIPDUMPBITS(e)
do
{
d &= ZIPWSIZE - 1;
e = ZIPWSIZE - max(d, w);
e = min(e, n);
n -= e;
do
{
CAB(outbuf)[w++] = CAB(outbuf)[d++];
} while (--e);
} while (n);
}
}
/* restore the globals from the locals */
ZIP(window_posn) = w; /* restore global window pointer */
ZIP(bb) = b; /* restore global bit buffer */
ZIP(bk) = k;
/* done */
return 0;
}
/***********************************************************
* Zipinflate_stored (internal)
*/
static cab_LONG fdi_Zipinflate_stored(fdi_decomp_state *decomp_state)
/* "decompress" an inflated type 0 (stored) block. */
{
cab_ULONG n; /* number of bytes in block */
cab_ULONG w; /* current window position */
register cab_ULONG b; /* bit buffer */
register cab_ULONG k; /* number of bits in bit buffer */
/* make local copies of globals */
b = ZIP(bb); /* initialize bit buffer */
k = ZIP(bk);
w = ZIP(window_posn); /* initialize window position */
/* go to byte boundary */
n = k & 7;
ZIPDUMPBITS(n);
/* get the length and its complement */
ZIPNEEDBITS(16)
n = (b & 0xffff);
ZIPDUMPBITS(16)
ZIPNEEDBITS(16)
if (n != ((~b) & 0xffff))
return 1; /* error in compressed data */
ZIPDUMPBITS(16)
/* read and output the compressed data */
while(n--)
{
ZIPNEEDBITS(8)
CAB(outbuf)[w++] = (cab_UBYTE)b;
ZIPDUMPBITS(8)
}
/* restore the globals from the locals */
ZIP(window_posn) = w; /* restore global window pointer */
ZIP(bb) = b; /* restore global bit buffer */
ZIP(bk) = k;
return 0;
}
/******************************************************
* fdi_Zipinflate_fixed (internal)
*/
static cab_LONG fdi_Zipinflate_fixed(fdi_decomp_state *decomp_state)
{
struct Ziphuft *fixed_tl;
struct Ziphuft *fixed_td;
cab_LONG fixed_bl, fixed_bd;
cab_LONG i; /* temporary variable */
cab_ULONG *l;
l = ZIP(ll);
/* literal table */
for(i = 0; i < 144; i++)
l[i] = 8;
for(; i < 256; i++)
l[i] = 9;
for(; i < 280; i++)
l[i] = 7;
for(; i < 288; i++) /* make a complete, but wrong code set */
l[i] = 8;
fixed_bl = 7;
if((i = fdi_Ziphuft_build(l, 288, 257, Zipcplens, Zipcplext, &fixed_tl, &fixed_bl, decomp_state)))
return i;
/* distance table */
for(i = 0; i < 30; i++) /* make an incomplete code set */
l[i] = 5;
fixed_bd = 5;
if((i = fdi_Ziphuft_build(l, 30, 0, Zipcpdist, Zipcpdext, &fixed_td, &fixed_bd, decomp_state)) > 1)
{
fdi_Ziphuft_free(CAB(hfdi), fixed_tl);
return i;
}
/* decompress until an end-of-block code */
i = fdi_Zipinflate_codes(fixed_tl, fixed_td, fixed_bl, fixed_bd, decomp_state);
fdi_Ziphuft_free(CAB(hfdi), fixed_td);
fdi_Ziphuft_free(CAB(hfdi), fixed_tl);
return i;
}
/**************************************************************
* fdi_Zipinflate_dynamic (internal)
*/
static cab_LONG fdi_Zipinflate_dynamic(fdi_decomp_state *decomp_state)
/* decompress an inflated type 2 (dynamic Huffman codes) block. */
{
cab_LONG i; /* temporary variables */
cab_ULONG j;
cab_ULONG *ll;
cab_ULONG l; /* last length */
cab_ULONG m; /* mask for bit lengths table */
cab_ULONG n; /* number of lengths to get */
struct Ziphuft *tl; /* literal/length code table */
struct Ziphuft *td; /* distance code table */
cab_LONG bl; /* lookup bits for tl */
cab_LONG bd; /* lookup bits for td */
cab_ULONG nb; /* number of bit length codes */
cab_ULONG nl; /* number of literal/length codes */
cab_ULONG nd; /* number of distance codes */
register cab_ULONG b; /* bit buffer */
register cab_ULONG k; /* number of bits in bit buffer */
/* make local bit buffer */
b = ZIP(bb);
k = ZIP(bk);
ll = ZIP(ll);
/* read in table lengths */
ZIPNEEDBITS(5)
nl = 257 + (b & 0x1f); /* number of literal/length codes */
ZIPDUMPBITS(5)
ZIPNEEDBITS(5)
nd = 1 + (b & 0x1f); /* number of distance codes */
ZIPDUMPBITS(5)
ZIPNEEDBITS(4)
nb = 4 + (b & 0xf); /* number of bit length codes */
ZIPDUMPBITS(4)
if(nl > 288 || nd > 32)
return 1; /* bad lengths */
/* read in bit-length-code lengths */
for(j = 0; j < nb; j++)
{
ZIPNEEDBITS(3)
ll[Zipborder[j]] = b & 7;
ZIPDUMPBITS(3)
}
for(; j < 19; j++)
ll[Zipborder[j]] = 0;
/* build decoding table for trees--single level, 7 bit lookup */
bl = 7;
if((i = fdi_Ziphuft_build(ll, 19, 19, NULL, NULL, &tl, &bl, decomp_state)) != 0)
{
if(i == 1)
fdi_Ziphuft_free(CAB(hfdi), tl);
return i; /* incomplete code set */
}
/* read in literal and distance code lengths */
n = nl + nd;
m = Zipmask[bl];
i = l = 0;
while((cab_ULONG)i < n)
{
ZIPNEEDBITS((cab_ULONG)bl)
j = (td = tl + (b & m))->b;
ZIPDUMPBITS(j)
j = td->v.n;
if (j < 16) /* length of code in bits (0..15) */
ll[i++] = l = j; /* save last length in l */
else if (j == 16) /* repeat last length 3 to 6 times */
{
ZIPNEEDBITS(2)
j = 3 + (b & 3);
ZIPDUMPBITS(2)
if((cab_ULONG)i + j > n)
return 1;
while (j--)
ll[i++] = l;
}
else if (j == 17) /* 3 to 10 zero length codes */
{
ZIPNEEDBITS(3)
j = 3 + (b & 7);
ZIPDUMPBITS(3)
if ((cab_ULONG)i + j > n)
return 1;
while (j--)
ll[i++] = 0;
l = 0;
}
else /* j == 18: 11 to 138 zero length codes */
{
ZIPNEEDBITS(7)
j = 11 + (b & 0x7f);
ZIPDUMPBITS(7)
if ((cab_ULONG)i + j > n)
return 1;
while (j--)
ll[i++] = 0;
l = 0;
}
}
/* free decoding table for trees */
fdi_Ziphuft_free(CAB(hfdi), tl);
/* restore the global bit buffer */
ZIP(bb) = b;
ZIP(bk) = k;
/* build the decoding tables for literal/length and distance codes */
bl = ZIPLBITS;
if((i = fdi_Ziphuft_build(ll, nl, 257, Zipcplens, Zipcplext, &tl, &bl, decomp_state)) != 0)
{
if(i == 1)
fdi_Ziphuft_free(CAB(hfdi), tl);
return i; /* incomplete code set */
}
bd = ZIPDBITS;
fdi_Ziphuft_build(ll + nl, nd, 0, Zipcpdist, Zipcpdext, &td, &bd, decomp_state);
/* decompress until an end-of-block code */
if(fdi_Zipinflate_codes(tl, td, bl, bd, decomp_state))
return 1;
/* free the decoding tables, return */
fdi_Ziphuft_free(CAB(hfdi), tl);
fdi_Ziphuft_free(CAB(hfdi), td);
return 0;
}
/*****************************************************
* fdi_Zipinflate_block (internal)
*/
static cab_LONG fdi_Zipinflate_block(cab_LONG *e, fdi_decomp_state *decomp_state) /* e == last block flag */
{ /* decompress an inflated block */
cab_ULONG t; /* block type */
register cab_ULONG b; /* bit buffer */
register cab_ULONG k; /* number of bits in bit buffer */
/* make local bit buffer */
b = ZIP(bb);
k = ZIP(bk);
/* read in last block bit */
ZIPNEEDBITS(1)
*e = (cab_LONG)b & 1;
ZIPDUMPBITS(1)
/* read in block type */
ZIPNEEDBITS(2)
t = b & 3;
ZIPDUMPBITS(2)
/* restore the global bit buffer */
ZIP(bb) = b;
ZIP(bk) = k;
/* inflate that block type */
if(t == 2)
return fdi_Zipinflate_dynamic(decomp_state);
if(t == 0)
return fdi_Zipinflate_stored(decomp_state);
if(t == 1)
return fdi_Zipinflate_fixed(decomp_state);
/* bad block type */
return 2;
}
/****************************************************
* ZIPfdi_decomp(internal)
*/
static int ZIPfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state)
{
cab_LONG e; /* last block flag */
TRACE("(inlen == %d, outlen == %d)\n", inlen, outlen);
ZIP(inpos) = CAB(inbuf);
ZIP(bb) = ZIP(bk) = ZIP(window_posn) = 0;
if(outlen > ZIPWSIZE)
return DECR_DATAFORMAT;
/* CK = Chris Kirmse, official Microsoft purloiner */
if(ZIP(inpos)[0] != 0x43 || ZIP(inpos)[1] != 0x4B)
return DECR_ILLEGALDATA;
ZIP(inpos) += 2;
do {
if(fdi_Zipinflate_block(&e, decomp_state))
return DECR_ILLEGALDATA;
} while(!e);
/* return success */
return DECR_OK;
}
static void * __cdecl fdi_alloc(ULONG cb)
{
return HeapAlloc(GetProcessHeap(), 0, cb);
}
static void __cdecl fdi_free(void *pv)
{
HeapFree(GetProcessHeap(), 0, pv);
}
int mszip_decompress(unsigned int inlen, unsigned int outlen, char* inbuffer, char* outbuffer)
{
int ret;
fdi_decomp_state decomp_state;
FDI_Int fdi;
TRACE("(%u, %u, %p, %p)\n", inlen, outlen, inbuffer, outbuffer);
if ((inlen > CAB_INPUTMAX) || (outlen > CAB_BLOCKMAX))
{
FIXME("Big file not supported yet (inlen = %u, outlen = %u)\n", inlen, outlen);
return DECR_DATAFORMAT;
}
fdi.pfnalloc = fdi_alloc;
fdi.pfnfree = fdi_free;
decomp_state.hfdi = (void*)&fdi;
memcpy(decomp_state.inbuf, inbuffer, inlen);
ret = ZIPfdi_decomp(inlen, outlen, &decomp_state);
memcpy(outbuffer, decomp_state.outbuf, outlen);
return ret;
}

View file

@ -0,0 +1,130 @@
/*
* MSZIP decompression header (taken from cabinet.h of cabinet dll)
*
* Copyright 2002 Greg Turner
* Copyright 2005 Gerold Jens Wucherpfennig
* Copyright 2010 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "fdi.h"
typedef unsigned char cab_UBYTE; /* 8 bits */
typedef UINT16 cab_UWORD; /* 16 bits */
typedef UINT32 cab_ULONG; /* 32 bits */
typedef INT32 cab_LONG; /* 32 bits */
typedef struct {
unsigned int FDI_Intmagic;
PFNALLOC pfnalloc;
PFNFREE pfnfree;
PFNOPEN pfnopen;
PFNREAD pfnread;
PFNWRITE pfnwrite;
PFNCLOSE pfnclose;
PFNSEEK pfnseek;
PERF perf;
} FDI_Int, *PFDI_Int;
/* cast an HFDI into a PFDI_Int */
#define PFDI_INT(hfdi) ((PFDI_Int)(hfdi))
#define PFDI_ALLOC(hfdi, size) ((*PFDI_INT(hfdi)->pfnalloc) (size))
#define PFDI_FREE(hfdi, ptr) ((*PFDI_INT(hfdi)->pfnfree) (ptr))
/* MSZIP stuff */
#define ZIPWSIZE 0x8000 /* window size */
#define ZIPLBITS 9 /* bits in base literal/length lookup table */
#define ZIPDBITS 6 /* bits in base distance lookup table */
#define ZIPBMAX 16 /* maximum bit length of any code */
#define ZIPN_MAX 288 /* maximum number of codes in any set */
struct Ziphuft {
cab_UBYTE e; /* number of extra bits or operation */
cab_UBYTE b; /* number of bits in this code or subcode */
union {
cab_UWORD n; /* literal, length base, or distance base */
struct Ziphuft *t; /* pointer to next level of table */
} v;
};
struct ZIPstate {
cab_ULONG window_posn; /* current offset within the window */
cab_ULONG bb; /* bit buffer */
cab_ULONG bk; /* bits in bit buffer */
cab_ULONG ll[288+32]; /* literal/length and distance code lengths */
cab_ULONG c[ZIPBMAX+1]; /* bit length count table */
cab_LONG lx[ZIPBMAX+1]; /* memory for l[-1..ZIPBMAX-1] */
struct Ziphuft *u[ZIPBMAX]; /* table stack */
cab_ULONG v[ZIPN_MAX]; /* values in order of bit length */
cab_ULONG x[ZIPBMAX+1]; /* bit offsets, then code stack */
cab_UBYTE *inpos;
};
#define CAB(x) (decomp_state->x)
#define ZIP(x) (decomp_state->methods.zip.x)
#define DECR_OK (0)
#define DECR_DATAFORMAT (1)
#define DECR_ILLEGALDATA (2)
#define DECR_NOMEMORY (3)
#define DECR_CHECKSUM (4)
#define DECR_INPUT (5)
#define DECR_OUTPUT (6)
#define DECR_USERABORT (7)
#define ZIPNEEDBITS(n) {while(k<(n)){cab_LONG c=*(ZIP(inpos)++);\
b|=((cab_ULONG)c)<<k;k+=8;}}
#define ZIPDUMPBITS(n) {b>>=(n);k-=(n);}
/* CAB data blocks are <= 32768 bytes in uncompressed form. Uncompressed
* blocks have zero growth. MSZIP guarantees that it won't grow above
* uncompressed size by more than 12 bytes. LZX guarantees it won't grow
* more than 6144 bytes.
*/
#define CAB_BLOCKMAX (32768)
#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
typedef struct fdi_cds_fwd {
void *hfdi; /* the hfdi we are using */
cab_UBYTE inbuf[CAB_INPUTMAX+2]; /* +2 for lzx bitbuffer overflows! */
cab_UBYTE outbuf[CAB_BLOCKMAX];
union {
struct ZIPstate zip;
} methods;
} fdi_decomp_state;
/* Tables for deflate from PKZIP's appnote.txt. */
#define THOSE_ZIP_CONSTS \
static const cab_UBYTE Zipborder[] = /* Order of the bit length code lengths */ \
{ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; \
static const cab_UWORD Zipcplens[] = /* Copy lengths for literal codes 257..285 */ \
{ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, \
59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; \
static const cab_UWORD Zipcplext[] = /* Extra bits for literal codes 257..285 */ \
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, \
4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ \
static const cab_UWORD Zipcpdist[] = /* Copy offsets for distance codes 0..29 */ \
{ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, \
513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; \
static const cab_UWORD Zipcpdext[] = /* Extra bits for distance codes */ \
{ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, \
10, 11, 11, 12, 12, 13, 13}; \
/* And'ing with Zipmask[n] masks the lower n bits */ \
static const cab_UWORD Zipmask[17] = { \
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, \
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff \
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "DirectX Files dll"
#define WINE_FILENAME_STR "d3dxof.dll"
#define WINE_FILEVERSION 5,0,2135,1
#define WINE_FILEVERSION_STR "5.0.2135.1"
#define WINE_PRODUCTVERSION 5,0,2135,1
#define WINE_PRODUCTVERSION_STR "5.0.2135.1"
#include "wine/wine_common_ver.rc"

View file

@ -1,180 +1,299 @@
#ifndef __DXFILE_H__
#define __DXFILE_H__
/*
* Copyright 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DXFILE_H
#define __WINE_DXFILE_H
#include <objbase.h>
#include <winnt.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* defined(__cplusplus) */
typedef DWORD DXFILEFORMAT;
#define DXFILEFORMAT_BINARY 0
#define DXFILEFORMAT_TEXT 1
#define DXFILEFORMAT_COMPRESSED 2
typedef DWORD DXFILELOADOPTIONS;
DEFINE_GUID(IID_IDirectXFile, 0x3D82AB40, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3D82AB41, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3D82AB42, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileObject, 0x3D82AB43, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileData, 0x3D82AB44, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileDataReference, 0x3D82AB45, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(IID_IDirectXFileBinary, 0x3D82AB46, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(TID_DXFILEHeader, 0x3D82AB43, 0x62DA, 0x11CF, 0xAB, 0x39, 0x00, 0x20, 0xAF, 0x71, 0xE4, 0x33);
DEFINE_GUID(CLSID_CDirectXFile, 0x4516EC43, 0x8F20, 0x11D0, 0x9B, 0x6D, 0x00, 0x00, 0xC0, 0x78, 0x1B, 0xC3);
#define DXFILELOAD_FROMFILE 0x00L
#define DXFILELOAD_FROMRESOURCE 0x01L
#define DXFILELOAD_FROMMEMORY 0x02L
#define DXFILELOAD_FROMSTREAM 0x04L
#define DXFILELOAD_FROMURL 0x08L
#ifndef WIN_TYPES
#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
#endif
typedef struct _DXFILELOADRESOURCE {
HMODULE hModule;
LPCSTR /*LPCTSTR*/ lpName;
LPCSTR /*LPCTSTR*/ lpType;
} DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
#define DXFILEFORMAT_BINARY 0
#define DXFILEFORMAT_TEXT 1
#define DXFILEFORMAT_COMPRESSED 2
#define DXFILELOAD_FROMFILE 0x00L
#define DXFILELOAD_FROMRESOURCE 0x01L
#define DXFILELOAD_FROMMEMORY 0x02L
#define DXFILELOAD_FROMSTREAM 0x04L
#define DXFILELOAD_FROMURL 0x08L
typedef struct _DXFILELOADMEMORY {
LPVOID lpMemory;
DWORD dSize;
} DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
#define _FACDD 0x876
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
#define DXFILE_OK 0
#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850)
#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851)
#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852)
#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853)
#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854)
#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855)
#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856)
#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857)
#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858)
#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859)
#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860)
#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861)
#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862)
#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863)
#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864)
#define DXFILEERR_BADFILE MAKE_DDHRESULT(865)
#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866)
#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867)
#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868)
#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869)
#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870)
#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871)
#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872)
#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873)
#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874)
#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875)
#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876)
WIN_TYPES(IDirectXFile, DIRECTXFILE);
WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT);
WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT);
WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT);
WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA);
WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE);
WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY);
typedef struct _DXFILELOADRESOURCE
{
HMODULE hModule;
LPCTSTR lpName;
LPCTSTR lpType;
}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE;
typedef struct _DXFILELOADMEMORY
{
LPVOID lpMemory;
DWORD dSize;
}DXFILELOADMEMORY, *LPDXFILELOADMEMORY;
typedef struct IDirectXFile *LPDIRECTXFILE;
typedef struct IDirectXFileEnumObject *LPDIRECTXFILEENUMOBJECT;
typedef struct IDirectXFileSaveObject *LPDIRECTXFILESAVEOBJECT;
typedef struct IDirectXFileObject *LPDIRECTXFILEOBJECT;
typedef struct IDirectXFileData *LPDIRECTXFILEDATA;
typedef struct IDirectXFileDataReference *LPDIRECTXFILEDATAREFERENCE;
typedef struct IDirectXFileBinary *LPDIRECTXFILEBINARY;
STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile);
#define INTERFACE IDirectXFile
DECLARE_INTERFACE_(IDirectXFile,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFile methods ***/
STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, LPDIRECTXFILEENUMOBJECT *) PURE;
STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, LPDIRECTXFILESAVEOBJECT *) PURE;
STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFile_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFile_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFile_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFile methods ***/
#define IDirectXFile_CreateEnumObject(p,a,b,c) (p)->lpVtbl->CreateEnumObject(p,a,b,c)
#define IDirectXFile_CreateSaveObject(p,a,b,c) (p)->lpVtbl->CreateSaveObject(p,a,b,c)
#define IDirectXFile_RegisterTemplates(p,a,b) (p)->lpVtbl->RegisterTemplates(p,a,b)
#endif
#define INTERFACE IDirectXFileEnumObject
DECLARE_INTERFACE_(IDirectXFileEnumObject,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFileEnumObject methods ***/
STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileEnumObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileEnumObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileEnumObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileEnumObject methods ***/
#define IDirectXFileEnumObject_GetNextDataObject(p,a) (p)->lpVtbl->GetNextDataObject(p,a)
#define IDirectXFileEnumObject_GetDataObjectById(p,a,b) (p)->lpVtbl->GetDataObjectById(p,a,b)
#define IDirectXFileEnumObject_GetDataObjectByName(p,a,b) (p)->lpVtbl->GetDataObjectByName(p,a,b)
#endif
#define INTERFACE IDirectXFileSaveObject
DECLARE_INTERFACE_(IDirectXFileSaveObject,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectXFileSaveObject methods ***/
STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE;
STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileSaveObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileSaveObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileSaveObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileSaveObject methods ***/
#define IDirectXFileSaveObject_SaveTemplates(p,a,b) (p)->lpVtbl->SaveTemplates(p,a,b)
#define IDirectXFileSaveObject_CreateDataObject(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDataObject(p,a,b,c,d,e,f)
#define IDirectXFileSaveObject_SaveData(p,a) (p)->lpVtbl->SaveData(p,a)
#endif
#define IUNKNOWN_METHODS(kind) \
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) kind; \
STDMETHOD_(ULONG,AddRef)(THIS) kind; \
STDMETHOD_(ULONG,Release)(THIS) kind
#define IDIRECTXFILEOBJECT_METHODS(kind) \
STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \
STDMETHOD(GetId) (THIS_ LPGUID) kind
#define IUNKNOWN_METHODS(kind) \
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \
STDMETHOD_(ULONG, AddRef) (THIS) kind; \
STDMETHOD_(ULONG, Release) (THIS) kind
#undef INTERFACE
#define INTERFACE IDirectXFile
DECLARE_INTERFACE_(IDirectXFile, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, LPDIRECTXFILEENUMOBJECT *) PURE;
STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, LPDIRECTXFILESAVEOBJECT *) PURE;
STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileEnumObject
DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectXFileSaveObject
DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown)
#define INTERFACE IDirectXFileObject
DECLARE_INTERFACE_(IDirectXFileObject,IUnknown)
{
IUNKNOWN_METHODS(PURE);
STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE;
STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *,
DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE;
STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE;
IDIRECTXFILEOBJECT_METHODS(PURE);
};
#undef INTERFACE
#define INTERFACE IDirectXFileObject
DECLARE_INTERFACE_(IDirectXFileObject, IUnknown)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
};
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileObject_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileObject_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileObject_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileObject_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileObject_GetId(p,a) (p)->lpVtbl->GetId(p,a)
#endif
#undef INTERFACE
#define INTERFACE IDirectXFileData
DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject)
DECLARE_INTERFACE_(IDirectXFileData,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE;
STDMETHOD(GetType) (THIS_ const GUID **) PURE;
STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE;
STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE;
STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE;
STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE;
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileData methods ***/
STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE;
STDMETHOD(GetType) (THIS_ const GUID **) PURE;
STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE;
STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE;
STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE;
STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileData_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileData_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileData_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileData_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileData_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileData methods ***/
#define IDirectXFileData_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c)
#define IDirectXFileData_GetType(p,a) (p)->lpVtbl->GetType(p,a)
#define IDirectXFileData_GetNextObject(p,a) (p)->lpVtbl->GetNextObject(p,a)
#define IDirectXFileData_AddDataObject(p,a) (p)->lpVtbl->AddDataObject(p,a)
#define IDirectXFileData_AddDataReference(p,a,b) (p)->lpVtbl->AddDataReference(p,a,b)
#define IDirectXFileData_AddBinaryObject(p,a,b,c,d,e) (p)->lpVtbl->AddBinaryObject(p,a,b,c,d,e)
#endif
#define INTERFACE IDirectXFileDataReference
DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject)
DECLARE_INTERFACE_(IDirectXFileDataReference,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE;
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileDataReference methods ***/
STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileDataReference_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileDataReference_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileDataReference_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileDataReference_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileDataReference_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileDataReference methods ***/
#define IDirectXFileDataReference_Resolve(p,a) (p)->lpVtbl->Resolve(p,a)
#endif
#define INTERFACE IDirectXFileBinary
DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject)
DECLARE_INTERFACE_(IDirectXFileBinary,IDirectXFileObject)
{
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
STDMETHOD(GetSize) (THIS_ DWORD *) PURE;
STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE;
STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE;
IUNKNOWN_METHODS(PURE);
IDIRECTXFILEOBJECT_METHODS(PURE);
/*** IDirectXFileBinary methods ***/
STDMETHOD(GetSize) (THIS_ DWORD *) PURE;
STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE;
STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectXFileBinary_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectXFileBinary_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectXFileBinary_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectXFileObject methods ***/
#define IDirectXFileBinary_GetName(p,a,b) (p)->lpVtbl->GetName(p,a,b)
#define IDirectXFileBinary_GetId(p,a) (p)->lpVtbl->GetId(p,a)
/*** IDirectXFileBinary methods ***/
#define IDirectXFileBinary_GetSize(p,a) (p)->lpVtbl->GetSize(p,a)
#define IDirectXFileBinary_GetMimeType(p,a) (p)->lpVtbl->GetMimeType(p,a)
#define IDirectXFileBinary_Read(p,a,b,c) (p)->lpVtbl->Read(p,a,b,c)
#endif
/* DirectXFile Object CLSID */
DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
/* DirectX File Interface GUIDs */
DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/* DirectX File Header template's GUID */
DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33);
/* DirectX File errors */
#define _FACDD 0x876
#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
#define DXFILE_OK 0
#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850)
#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851)
#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852)
#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853)
#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854)
#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855)
#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856)
#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857)
#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858)
#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859)
#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860)
#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861)
#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862)
#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863)
#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864)
#define DXFILEERR_BADFILE MAKE_DDHRESULT(865)
#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866)
#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867)
#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868)
#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869)
#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870)
#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871)
#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872)
#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873)
#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874)
#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875)
#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876)
#ifdef __cplusplus
};
#endif
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif
#endif /* __WINE_DXFILE_H */

View file

@ -41,6 +41,7 @@ reactos/dll/directx/qedit # Autosync
reactos/dll/directx/quartz # Synced to Wine-1.5.26
reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.1
reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.1
reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.1
reactos/dll/win32/activeds # Synced to Wine-1.1.43?