2003-07-22 00:10:14 +02:00
|
|
|
/* DirectMusicLoader Private Include
|
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* This program 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.
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_DMLOADER_PRIVATE_H
|
|
|
|
#define __WINE_DMLOADER_PRIVATE_H
|
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
#include <stdio.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2004-02-25 02:30:03 +01:00
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
2004-08-11 21:43:45 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnt.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2003-09-22 21:37:33 +02:00
|
|
|
#include "wine/list.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "winreg.h"
|
2004-08-22 23:38:46 +02:00
|
|
|
#include "objbase.h"
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
#include "dmusici.h"
|
|
|
|
#include "dmusicf.h"
|
|
|
|
#include "dmusics.h"
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2004-08-13 02:44:22 +02:00
|
|
|
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
|
|
|
|
2004-05-13 02:00:22 +02:00
|
|
|
/* dmloader.dll global (for DllCanUnloadNow) */
|
2011-08-02 10:28:16 +02:00
|
|
|
extern LONG module_ref DECLSPEC_HIDDEN;
|
|
|
|
static inline void lock_module(void) { InterlockedIncrement( &module_ref ); }
|
|
|
|
static inline void unlock_module(void) { InterlockedDecrement( &module_ref ); }
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Interfaces
|
|
|
|
*/
|
2004-05-13 02:00:22 +02:00
|
|
|
typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF;
|
|
|
|
typedef struct IDirectMusicContainerCF IDirectMusicContainerCF;
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2004-05-13 02:00:22 +02:00
|
|
|
typedef struct IDirectMusicLoaderImpl IDirectMusicLoaderImpl;
|
|
|
|
typedef struct IDirectMusicContainerImpl IDirectMusicContainerImpl;
|
|
|
|
|
|
|
|
typedef struct IDirectMusicLoaderFileStream IDirectMusicLoaderFileStream;
|
|
|
|
typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream;
|
|
|
|
typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2004-05-13 02:00:22 +02:00
|
|
|
* Creation helpers
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
2014-03-12 22:58:17 +01:00
|
|
|
extern HRESULT WINAPI create_dmloader(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI create_dmcontainer(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN;
|
2011-05-13 16:57:22 +02:00
|
|
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj) DECLSPEC_HIDDEN;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-05-13 02:00:22 +02:00
|
|
|
/* cache/alias entry */
|
|
|
|
typedef struct _WINE_LOADER_ENTRY {
|
|
|
|
struct list entry; /* for listing elements */
|
|
|
|
DMUS_OBJECTDESC Desc;
|
|
|
|
LPDIRECTMUSICOBJECT pObject; /* pointer to object */
|
|
|
|
BOOL bInvalidDefaultDLS; /* my workaround for enabling caching of "faulty" default dls collection */
|
|
|
|
} WINE_LOADER_ENTRY, *LPWINE_LOADER_ENTRY;
|
|
|
|
|
|
|
|
/* cache options, search paths for specific types of objects */
|
|
|
|
typedef struct _WINE_LOADER_OPTION {
|
|
|
|
struct list entry; /* for listing elements */
|
|
|
|
GUID guidClass; /* ID of object type */
|
|
|
|
WCHAR wszSearchPath[MAX_PATH]; /* look for objects of certain type in here */
|
|
|
|
BOOL bCache; /* cache objects of certain type */
|
|
|
|
} WINE_LOADER_OPTION, *LPWINE_LOADER_OPTION;
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicLoaderImpl implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectMusicLoaderImpl {
|
2012-12-18 09:05:39 +01:00
|
|
|
IDirectMusicLoader8 IDirectMusicLoader8_iface;
|
|
|
|
LONG ref;
|
|
|
|
/* simple cache (linked list) */
|
|
|
|
struct list *pObjects;
|
|
|
|
/* settings for certain object classes */
|
|
|
|
struct list *pClassSettings;
|
2003-07-22 00:10:14 +02:00
|
|
|
};
|
|
|
|
|
2004-05-13 02:00:22 +02:00
|
|
|
/* contained object entry */
|
|
|
|
typedef struct _WINE_CONTAINER_ENTRY {
|
|
|
|
struct list entry; /* for listing elements */
|
|
|
|
DMUS_OBJECTDESC Desc;
|
|
|
|
BOOL bIsRIFF;
|
|
|
|
DWORD dwFlags; /* DMUS_CONTAINED_OBJF_KEEP: keep object in loader's cache, even when container is released */
|
|
|
|
WCHAR* wszAlias;
|
|
|
|
LPDIRECTMUSICOBJECT pObject; /* needed when releasing from loader's cache on container release */
|
|
|
|
} WINE_CONTAINER_ENTRY, *LPWINE_CONTAINER_ENTRY;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicContainerImpl implementation structure
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
struct IDirectMusicContainerImpl {
|
2004-05-13 02:00:22 +02:00
|
|
|
/* VTABLEs */
|
2005-05-30 12:01:08 +02:00
|
|
|
const IDirectMusicContainerVtbl *ContainerVtbl;
|
|
|
|
const IDirectMusicObjectVtbl *ObjectVtbl;
|
|
|
|
const IPersistStreamVtbl *PersistStreamVtbl;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* reference counter */
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG dwRef;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* stream */
|
|
|
|
LPSTREAM pStream;
|
|
|
|
/* header */
|
|
|
|
DMUS_IO_CONTAINER_HEADER Header;
|
|
|
|
/* data */
|
|
|
|
struct list *pContainedObjects;
|
|
|
|
/* descriptor */
|
|
|
|
DMUS_OBJECTDESC Desc;
|
2003-08-23 01:53:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2004-05-13 02:00:22 +02:00
|
|
|
* IDirectMusicLoaderFileStream implementation structure
|
2003-08-23 01:53:27 +02:00
|
|
|
*/
|
2004-05-13 02:00:22 +02:00
|
|
|
struct IDirectMusicLoaderFileStream {
|
|
|
|
/* VTABLEs */
|
2005-05-30 12:01:08 +02:00
|
|
|
const IStreamVtbl *StreamVtbl;
|
|
|
|
const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* reference counter */
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG dwRef;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* file */
|
|
|
|
WCHAR wzFileName[MAX_PATH]; /* for clone */
|
|
|
|
HANDLE hFile;
|
|
|
|
/* loader */
|
|
|
|
LPDIRECTMUSICLOADER8 pLoader;
|
2003-08-23 01:53:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Custom: */
|
2011-05-13 16:57:22 +02:00
|
|
|
extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
|
2004-05-13 02:00:22 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicLoaderResourceStream implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectMusicLoaderResourceStream {
|
|
|
|
/* IUnknown fields */
|
2005-05-30 12:01:08 +02:00
|
|
|
const IStreamVtbl *StreamVtbl;
|
|
|
|
const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* reference counter */
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG dwRef;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* data */
|
|
|
|
LPBYTE pbMemData;
|
|
|
|
LONGLONG llMemLength;
|
|
|
|
/* current position */
|
|
|
|
LONGLONG llPos;
|
|
|
|
/* loader */
|
|
|
|
LPDIRECTMUSICLOADER8 pLoader;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Custom: */
|
2011-05-13 16:57:22 +02:00
|
|
|
extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
|
2004-05-13 02:00:22 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectMusicLoaderGenericStream implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectMusicLoaderGenericStream {
|
|
|
|
/* IUnknown fields */
|
2005-05-30 12:01:08 +02:00
|
|
|
const IStreamVtbl *StreamVtbl;
|
|
|
|
const IDirectMusicGetLoaderVtbl *GetLoaderVtbl;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* reference counter */
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG dwRef;
|
2004-05-13 02:00:22 +02:00
|
|
|
/* stream */
|
|
|
|
LPSTREAM pStream;
|
|
|
|
/* loader */
|
|
|
|
LPDIRECTMUSICLOADER8 pLoader;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Custom: */
|
2011-05-13 16:57:22 +02:00
|
|
|
extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader) DECLSPEC_HIDDEN;
|
2004-01-20 01:21:40 +01:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Misc.
|
|
|
|
*/
|
|
|
|
/* for simpler reading */
|
2004-05-13 02:00:22 +02:00
|
|
|
typedef struct _WINE_CHUNK {
|
2004-01-20 01:21:40 +01:00
|
|
|
FOURCC fccID; /* FOURCC ID of the chunk */
|
|
|
|
DWORD dwSize; /* size of the chunk */
|
2004-05-13 02:00:22 +02:00
|
|
|
} WINE_CHUNK, *LPWINE_CHUNK;
|
|
|
|
|
|
|
|
#include "debug.h"
|
2004-01-20 01:21:40 +01:00
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
#endif /* __WINE_DMLOADER_PRIVATE_H */
|