ReactOS 0.4.17-dev-934-g091855f
dmloader_private.h File Reference
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "winreg.h"
#include "objbase.h"
#include "dmusici.h"
#include "dmusicf.h"
#include "dmusics.h"
#include "dmobject.h"
#include "debug.h"
Include dependency graph for dmloader_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IDirectMusicLoaderResourceStream
 

Macros

#define COBJMACROS
 
#define ICOM_THIS_MULTI(impl, field, iface)   impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
 

Typedefs

typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF
 
typedef struct IDirectMusicContainerCF IDirectMusicContainerCF
 
typedef struct IDirectMusicLoaderFileStream IDirectMusicLoaderFileStream
 
typedef struct IDirectMusicLoaderResourceStream IDirectMusicLoaderResourceStream
 
typedef struct IDirectMusicLoaderGenericStream IDirectMusicLoaderGenericStream
 

Functions

HRESULT create_dmloader (REFIID riid, void **ret_iface)
 
HRESULT create_dmcontainer (REFIID riid, void **ret_iface)
 
HRESULT DMUSIC_CreateDirectMusicLoaderResourceStream (void **ppobj)
 
HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos)
 
HRESULT loader_stream_create (IDirectMusicLoader *loader, IStream *stream, IStream **ret_iface)
 
HRESULT file_stream_create (const WCHAR *path, IStream **ret_iface)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file dmloader_private.h.

◆ ICOM_THIS_MULTI

#define ICOM_THIS_MULTI (   impl,
  field,
  iface 
)    impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))

Definition at line 45 of file dmloader_private.h.

Typedef Documentation

◆ IDirectMusicContainerCF

◆ IDirectMusicLoaderCF

◆ IDirectMusicLoaderFileStream

◆ IDirectMusicLoaderGenericStream

◆ IDirectMusicLoaderResourceStream

Function Documentation

◆ create_dmcontainer()

HRESULT create_dmcontainer ( REFIID  riid,
void **  ret_iface 
)

Definition at line 649 of file container.c.

650{
652 HRESULT hr;
653
654 *ppobj = NULL;
655 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
656 obj->IDirectMusicContainer_iface.lpVtbl = &dmcontainer_vtbl;
657 obj->ref = 1;
658 dmobject_init(&obj->dmobj, &CLSID_DirectMusicContainer,
659 (IUnknown*)&obj->IDirectMusicContainer_iface);
660 obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
661 obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
662 obj->pContainedObjects = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(struct list));
663 list_init (obj->pContainedObjects);
664
665 hr = IDirectMusicContainer_QueryInterface(&obj->IDirectMusicContainer_iface, lpcGUID, ppobj);
666 IDirectMusicContainer_Release(&obj->IDirectMusicContainer_iface);
667
668 return hr;
669}
static void list_init(struct list_entry *head)
Definition: list.h:51
Definition: list.h:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
static const IDirectMusicContainerVtbl dmcontainer_vtbl
Definition: container.c:186
static const IDirectMusicObjectVtbl dmobject_vtbl
Definition: container.c:228
static const IPersistStreamVtbl persiststream_vtbl
Definition: container.c:637
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
Definition: dmobject.c:749
#define IDirectMusicContainer_Release(p)
Definition: dmusici.h:1726
#define IDirectMusicContainer_QueryInterface(p, a, b)
Definition: dmusici.h:1724
#define calloc
Definition: rosglue.h:14

◆ create_dmloader()

HRESULT create_dmloader ( REFIID  riid,
void **  ret_iface 
)

Definition at line 910 of file loader.c.

911{
912 struct loader *obj;
913 DMUS_OBJECTDESC Desc;
914 HRESULT hr;
915
916 TRACE("(%s, %p)\n", debugstr_dmguid(lpcGUID), ppobj);
917
918 *ppobj = NULL;
919 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
920 obj->IDirectMusicLoader8_iface.lpVtbl = &loader_vtbl;
921 obj->ref = 1;
922 list_init(&obj->cache);
923 /* Caching is enabled by default for all classes */
924 obj->cache_class = ~0;
925
926 /* set default DLS collection (via SetObject... so that loading via DMUS_OBJ_OBJECT is possible) */
927 DM_STRUCT_INIT(&Desc);
929 Desc.guidClass = CLSID_DirectMusicCollection;
930 Desc.guidObject = GUID_DefaultGMCollection;
932 hr = IDirectMusicLoader_SetObject(&obj->IDirectMusicLoader8_iface, &Desc);
933 if (FAILED(hr)) WARN("Failed to load the default collection, hr %#lx\n", hr);
934
935 hr = IDirectMusicLoader_QueryInterface(&obj->IDirectMusicLoader8_iface, lpcGUID, ppobj);
936 IDirectMusicLoader_Release(&obj->IDirectMusicLoader8_iface);
937 return hr;
938}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define WARN(fmt,...)
Definition: precomp.h:61
#define DM_STRUCT_INIT(x)
Definition: debug.h:30
static const IDirectMusicLoader8Vtbl loader_vtbl
Definition: loader.c:870
static HRESULT get_default_gm_path(WCHAR *path, DWORD max_len)
Definition: loader.c:889
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
#define DMUS_OBJ_FULLPATH
Definition: dmusici.h:270
#define IDirectMusicLoader_QueryInterface(p, a, b)
Definition: dmusici.h:877
#define IDirectMusicLoader_Release(p)
Definition: dmusici.h:879
#define IDirectMusicLoader_SetObject(p, a)
Definition: dmusici.h:882
#define DMUS_OBJ_FILENAME
Definition: dmusici.h:269
#define DMUS_OBJ_CLASS
Definition: dmusici.h:266
#define DMUS_OBJ_OBJECT
Definition: dmusici.h:265
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwValidData
Definition: dmusici.h:743
WCHAR wszFileName[DMUS_MAX_FILENAME]
Definition: dmusici.h:750
Definition: loader.c:72

◆ DMUSIC_CreateDirectMusicLoaderResourceStream()

HRESULT DMUSIC_CreateDirectMusicLoaderResourceStream ( void **  ppobj)

Definition at line 661 of file loaderstream.c.

661 {
663
664 TRACE("(%p)\n", ppobj);
665
666 *ppobj = NULL;
667 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
669 obj->dwRef = 0; /* will be inited with QueryInterface */
670
671 return IDirectMusicLoaderResourceStream_IStream_QueryInterface ((LPSTREAM)&obj->StreamVtbl, &IID_IStream, ppobj);
672}
static HRESULT WINAPI IDirectMusicLoaderResourceStream_IStream_QueryInterface(LPSTREAM iface, REFIID riid, void **ppobj)
Definition: loaderstream.c:490
static const IStreamVtbl DirectMusicLoaderResourceStream_Stream_Vtbl
Definition: loaderstream.c:644
interface IStream * LPSTREAM
Definition: objfwd.h:10

Referenced by IDirectMusicLoaderResourceStream_IStream_Clone(), loader_GetObject(), and loader_SetObject().

◆ file_stream_create()

HRESULT file_stream_create ( const WCHAR *  path,
IStream **  ret_iface 
)

Definition at line 435 of file loaderstream.c.

436{
437 struct file_stream *stream;
438
439 *ret_iface = NULL;
440 if (!(stream = calloc(1, sizeof(*stream)))) return E_OUTOFMEMORY;
442 stream->ref = 1;
443
444 wcscpy(stream->path, path);
447 if (stream->file == INVALID_HANDLE_VALUE)
448 {
449 free(stream);
451 }
452
453 *ret_iface = &stream->IStream_iface;
454 return S_OK;
455}
#define free
Definition: debug_ros.c:5
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
#define DMUS_E_LOADER_FAILEDOPEN
Definition: dmerror.h:119
#define S_OK
Definition: intsafe.h:52
static const IStreamVtbl file_stream_vtbl
Definition: loaderstream.c:417
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
wcscpy
Definition: parse.h:23
IStream IStream_iface
Definition: request.c:5732

Referenced by file_stream_Clone(), loader_GetObject(), and loader_SetObject().

◆ IDirectMusicLoaderResourceStream_Attach()

HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach ( LPSTREAM  iface,
LPBYTE  pbMemData,
LONGLONG  llMemLength,
LONGLONG  llPos 
)

Definition at line 472 of file loaderstream.c.

472 {
474
475 TRACE("(%p, %p, %s, %s)\n", This, pbMemData, wine_dbgstr_longlong(llMemLength), wine_dbgstr_longlong(llPos));
476 if (!pbMemData || !llMemLength) {
477 WARN(": invalid pbMemData or llMemLength\n");
478 return E_FAIL;
479 }
481 This->pbMemData = pbMemData;
482 This->llMemLength = llMemLength;
483 This->llPos = llPos;
484
485 return S_OK;
486}
#define E_FAIL
Definition: ddrawi.h:102
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define ICOM_THIS_MULTI(impl, field, iface)
static void IDirectMusicLoaderResourceStream_Detach(LPSTREAM iface)
Definition: loaderstream.c:464
static const IStreamVtbl StreamVtbl
Definition: mimeole.c:416

Referenced by IDirectMusicLoaderResourceStream_IStream_Clone(), loader_GetObject(), and loader_SetObject().

◆ loader_stream_create()

HRESULT loader_stream_create ( IDirectMusicLoader *  loader,
IStream *  stream,
IStream **  ret_iface 
)

Definition at line 240 of file loaderstream.c.

242{
243 struct loader_stream *obj;
244
245 *ret_iface = NULL;
246 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
247 obj->IStream_iface.lpVtbl = &loader_stream_vtbl;
248 obj->IDirectMusicGetLoader_iface.lpVtbl = &loader_stream_getter_vtbl;
249 obj->ref = 1;
250
251 obj->stream = stream;
252 IStream_AddRef(stream);
253 obj->loader = loader;
255
256 *ret_iface = &obj->IStream_iface;
257 return S_OK;
258}
#define IDirectMusicLoader_AddRef(p)
Definition: dmusici.h:878
static const IDirectMusicGetLoaderVtbl loader_stream_getter_vtbl
Definition: loaderstream.c:232
static const IStreamVtbl loader_stream_vtbl
Definition: loaderstream.c:180
IDirectMusicLoader * loader
Definition: loaderstream.c:32
IStream * stream
Definition: loaderstream.c:31

Referenced by loader_GetObject(), loader_SetObject(), and loader_stream_Clone().