Break out all the file related actions and helper functions into
[wine/multimedia.git] / dlls / dmscript / dmscript_private.h
blobce81fb629a84a837212742d52c0d66508b0cf8e8
1 /* DirectMusicScript Private Include
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __WINE_DMSCRIPT_PRIVATE_H
21 #define __WINE_DMSCRIPT_PRIVATE_H
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnt.h"
32 #include "wingdi.h"
33 #include "winuser.h"
35 #include "wine/debug.h"
36 #include "wine/list.h"
37 #include "wine/unicode.h"
38 #include "winreg.h"
39 #include "objbase.h"
41 #include "dmusici.h"
42 #include "dmusicf.h"
43 #include "dmusics.h"
45 /*****************************************************************************
46 * Interfaces
48 typedef struct IDirectMusicScriptImpl IDirectMusicScriptImpl;
50 typedef struct IDirectMusicScriptTrack IDirectMusicScriptTrack;
52 /*****************************************************************************
53 * ClassFactory
55 extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
57 extern HRESULT WINAPI DMUSIC_CreateDirectMusicScriptTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
59 /*****************************************************************************
60 * IDirectMusicScriptImpl implementation structure
62 struct IDirectMusicScriptImpl {
63 /* IUnknown fields */
64 const IUnknownVtbl *UnknownVtbl;
65 const IDirectMusicScriptVtbl *ScriptVtbl;
66 const IDirectMusicObjectVtbl *ObjectVtbl;
67 const IPersistStreamVtbl *PersistStreamVtbl;
68 DWORD ref;
70 /* IDirectMusicScriptImpl fields */
71 IDirectMusicPerformance* pPerformance;
72 LPDMUS_OBJECTDESC pDesc;
73 DMUS_IO_SCRIPT_HEADER* pHeader;
74 DMUS_IO_VERSION* pVersion;
75 WCHAR* pwzLanguage;
76 WCHAR* pwzSource;
79 /* IUnknown: */
80 extern HRESULT WINAPI IDirectMusicScriptImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj);
81 extern ULONG WINAPI IDirectMusicScriptImpl_IUnknown_AddRef (LPUNKNOWN iface);
82 /* IDirectMusicScript: */
83 extern ULONG WINAPI IDirectMusicScriptImpl_IDirectMusicScript_AddRef (LPDIRECTMUSICSCRIPT iface);
84 /* IDirectMusicObject: */
85 extern ULONG WINAPI IDirectMusicScriptImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface);
86 /* IPersistStream: */
87 extern ULONG WINAPI IDirectMusicScriptImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface);
89 /*****************************************************************************
90 * IDirectMusicScriptTrack implementation structure
92 struct IDirectMusicScriptTrack {
93 /* IUnknown fields */
94 const IUnknownVtbl *UnknownVtbl;
95 const IDirectMusicTrack8Vtbl *TrackVtbl;
96 const IPersistStreamVtbl *PersistStreamVtbl;
97 DWORD ref;
99 /* IDirectMusicScriptTrack fields */
100 LPDMUS_OBJECTDESC pDesc;
103 /* IUnknown: */
104 extern HRESULT WINAPI IDirectMusicScriptTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj);
105 extern ULONG WINAPI IDirectMusicScriptTrack_IUnknown_AddRef (LPUNKNOWN iface);
106 /* IDirectMusicTrack(8): */
107 extern ULONG WINAPI IDirectMusicScriptTrack_IDirectMusicTrack_AddRef (LPDIRECTMUSICTRACK8 iface);
108 /* IPersistStream: */
109 extern ULONG WINAPI IDirectMusicScriptTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface);
111 /**********************************************************************
112 * Dll lifetime tracking declaration for dmscript.dll
114 extern LONG DMSCRIPT_refCount;
115 static inline void DMSCRIPT_LockModule() { InterlockedIncrement( &DMSCRIPT_refCount ); }
116 static inline void DMSCRIPT_UnlockModule() { InterlockedDecrement( &DMSCRIPT_refCount ); }
118 /*****************************************************************************
119 * Misc.
121 /* for simpler reading */
122 typedef struct _DMUS_PRIVATE_CHUNK {
123 FOURCC fccID; /* FOURCC ID of the chunk */
124 DWORD dwSize; /* size of the chunk */
125 } DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
127 /* used for generic dumping (copied from ddraw) */
128 typedef struct {
129 DWORD val;
130 const char* name;
131 } flag_info;
133 typedef struct {
134 const GUID *guid;
135 const char* name;
136 } guid_info;
138 /* used for initialising structs (primarily for DMUS_OBJECTDESC) */
139 #define DM_STRUCT_INIT(x) \
140 do { \
141 memset((x), 0, sizeof(*(x))); \
142 (x)->dwSize = sizeof(*x); \
143 } while (0)
145 #define FE(x) { x, #x }
146 #define GE(x) { &x, #x }
148 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
150 /* check whether the given DWORD is even (return 0) or odd (return 1) */
151 extern int even_or_odd (DWORD number);
152 /* FOURCC to string conversion for debug messages */
153 extern const char *debugstr_fourcc (DWORD fourcc);
154 /* DMUS_VERSION struct to string conversion for debug messages */
155 extern const char *debugstr_dmversion (LPDMUS_VERSION version);
156 /* returns name of given GUID */
157 extern const char *debugstr_dmguid (const GUID *id);
158 /* returns name of given error code */
159 extern const char *debugstr_dmreturn (DWORD code);
160 /* generic flags-dumping function */
161 extern const char *debugstr_flags (DWORD flags, const flag_info* names, size_t num_names);
162 extern const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask);
163 /* dump whole DMUS_OBJECTDESC struct */
164 extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
166 #endif /* __WINE_DMSCRIPT_PRIVATE_H */