dmloader: Make some functions static.
This commit is contained in:
parent
72f3e3d483
commit
02bfacff5a
|
@ -35,6 +35,46 @@ static ULONG WINAPI IDirectMusicContainerImpl_IPersistStream_AddRef (LPPERSISTST
|
||||||
* IDirectMusicContainerImpl implementation
|
* IDirectMusicContainerImpl implementation
|
||||||
*/
|
*/
|
||||||
/* IUnknown/IDirectMusicContainer part: */
|
/* IUnknown/IDirectMusicContainer part: */
|
||||||
|
|
||||||
|
static HRESULT DMUSIC_DestroyDirectMusicContainerImpl (LPDIRECTMUSICCONTAINER iface) {
|
||||||
|
ICOM_THIS_MULTI(IDirectMusicContainerImpl, ContainerVtbl, iface);
|
||||||
|
LPDIRECTMUSICLOADER pLoader;
|
||||||
|
LPDIRECTMUSICGETLOADER pGetLoader;
|
||||||
|
struct list *pEntry;
|
||||||
|
LPWINE_CONTAINER_ENTRY pContainedObject;
|
||||||
|
|
||||||
|
/* get loader (from stream we loaded from) */
|
||||||
|
TRACE(": getting loader\n");
|
||||||
|
IStream_QueryInterface (This->pStream, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader);
|
||||||
|
IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader);
|
||||||
|
IDirectMusicGetLoader_Release (pGetLoader);
|
||||||
|
|
||||||
|
/* release objects from loader's cache (if appropriate) */
|
||||||
|
TRACE(": releasing objects from loader's cache\n");
|
||||||
|
LIST_FOR_EACH (pEntry, This->pContainedObjects) {
|
||||||
|
pContainedObject = LIST_ENTRY (pEntry, WINE_CONTAINER_ENTRY, entry);
|
||||||
|
/* my tests indicate that container releases objects *only*
|
||||||
|
if they were loaded at its load-time (makes sense, it doesn't
|
||||||
|
have pointers to objects otherwise); BTW: native container seems
|
||||||
|
to ignore the flags (I won't) */
|
||||||
|
if (pContainedObject->pObject && !(pContainedObject->dwFlags & DMUS_CONTAINED_OBJF_KEEP)) {
|
||||||
|
/* flags say it shouldn't be kept in loader's cache */
|
||||||
|
IDirectMusicLoader_ReleaseObject (pLoader, pContainedObject->pObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IDirectMusicLoader_Release (pLoader);
|
||||||
|
|
||||||
|
/* release stream we loaded from */
|
||||||
|
IStream_Release (This->pStream);
|
||||||
|
|
||||||
|
/* FIXME: release allocated entries */
|
||||||
|
|
||||||
|
/* decrease number of instances */
|
||||||
|
InterlockedDecrement (&dwDirectMusicContainer);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface (LPDIRECTMUSICCONTAINER iface, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface (LPDIRECTMUSICCONTAINER iface, REFIID riid, LPVOID *ppobj) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicContainerImpl, ContainerVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicContainerImpl, ContainerVtbl, iface);
|
||||||
|
|
||||||
|
@ -904,42 +944,3 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID* p
|
||||||
|
|
||||||
return IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface ((LPDIRECTMUSICCONTAINER)&obj->ContainerVtbl, lpcGUID, ppobj);
|
return IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface ((LPDIRECTMUSICCONTAINER)&obj->ContainerVtbl, lpcGUID, ppobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DMUSIC_DestroyDirectMusicContainerImpl (LPDIRECTMUSICCONTAINER iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicContainerImpl, ContainerVtbl, iface);
|
|
||||||
LPDIRECTMUSICLOADER pLoader;
|
|
||||||
LPDIRECTMUSICGETLOADER pGetLoader;
|
|
||||||
struct list *pEntry;
|
|
||||||
LPWINE_CONTAINER_ENTRY pContainedObject;
|
|
||||||
|
|
||||||
/* get loader (from stream we loaded from) */
|
|
||||||
TRACE(": getting loader\n");
|
|
||||||
IStream_QueryInterface (This->pStream, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader);
|
|
||||||
IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader);
|
|
||||||
IDirectMusicGetLoader_Release (pGetLoader);
|
|
||||||
|
|
||||||
/* release objects from loader's cache (if appropriate) */
|
|
||||||
TRACE(": releasing objects from loader's cache\n");
|
|
||||||
LIST_FOR_EACH (pEntry, This->pContainedObjects) {
|
|
||||||
pContainedObject = LIST_ENTRY (pEntry, WINE_CONTAINER_ENTRY, entry);
|
|
||||||
/* my tests indicate that container releases objects *only*
|
|
||||||
if they were loaded at its load-time (makes sense, it doesn't
|
|
||||||
have pointers to objects otherwise); BTW: native container seems
|
|
||||||
to ignore the flags (I won't) */
|
|
||||||
if (pContainedObject->pObject && !(pContainedObject->dwFlags & DMUS_CONTAINED_OBJF_KEEP)) {
|
|
||||||
/* flags say it shouldn't be kept in loader's cache */
|
|
||||||
IDirectMusicLoader_ReleaseObject (pLoader, pContainedObject->pObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IDirectMusicLoader_Release (pLoader);
|
|
||||||
|
|
||||||
/* release stream we loaded from */
|
|
||||||
IStream_Release (This->pStream);
|
|
||||||
|
|
||||||
/* FIXME: release allocated entries */
|
|
||||||
|
|
||||||
/* decrease number of instances */
|
|
||||||
InterlockedDecrement (&dwDirectMusicContainer);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -68,10 +68,7 @@ extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderCF (LPCGUID lpcGUID, LPVOID
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerCF (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
||||||
|
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
||||||
extern HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderImpl (LPDIRECTMUSICLOADER8 iface);
|
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter);
|
||||||
extern HRESULT WINAPI DMUSIC_DestroyDirectMusicContainerImpl(LPDIRECTMUSICCONTAINER iface);
|
|
||||||
|
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj);
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj);
|
||||||
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
|
extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj);
|
||||||
|
@ -174,7 +171,6 @@ struct IDirectMusicLoaderFileStream {
|
||||||
|
|
||||||
/* Custom: */
|
/* Custom: */
|
||||||
extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
|
extern HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader);
|
||||||
extern void WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirectMusicLoaderResourceStream implementation structure
|
* IDirectMusicLoaderResourceStream implementation structure
|
||||||
|
@ -196,7 +192,6 @@ struct IDirectMusicLoaderResourceStream {
|
||||||
|
|
||||||
/* Custom: */
|
/* Custom: */
|
||||||
extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
|
extern HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader);
|
||||||
extern void WINAPI IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirectMusicLoaderGenericStream implementation structure
|
* IDirectMusicLoaderGenericStream implementation structure
|
||||||
|
@ -215,7 +210,6 @@ struct IDirectMusicLoaderGenericStream {
|
||||||
|
|
||||||
/* Custom: */
|
/* Custom: */
|
||||||
extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
|
extern HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader);
|
||||||
extern void WINAPI IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Misc.
|
* Misc.
|
||||||
|
@ -226,12 +220,6 @@ typedef struct _WINE_CHUNK {
|
||||||
DWORD dwSize; /* size of the chunk */
|
DWORD dwSize; /* size of the chunk */
|
||||||
} WINE_CHUNK, *LPWINE_CHUNK;
|
} WINE_CHUNK, *LPWINE_CHUNK;
|
||||||
|
|
||||||
extern HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]);
|
|
||||||
extern HRESULT WINAPI DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
|
|
||||||
extern HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface);
|
|
||||||
extern HRESULT WINAPI DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc);
|
|
||||||
extern BOOL WINAPI DMUSIC_IsValidLoadableClass (REFCLSID pClassID);
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#endif /* __WINE_DMLOADER_PRIVATE_H */
|
#endif /* __WINE_DMLOADER_PRIVATE_H */
|
||||||
|
|
|
@ -21,13 +21,53 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
|
||||||
|
|
||||||
|
static HRESULT DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface);
|
||||||
|
static HRESULT DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
|
||||||
static HRESULT DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
|
static HRESULT DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache);
|
||||||
|
|
||||||
|
static HRESULT DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc) {
|
||||||
|
TRACE(": copy \n%s", debugstr_DMUS_OBJECTDESC(pSrc));
|
||||||
|
/* copy field by field */
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_CLASS) pDst->guidClass = pSrc->guidClass;
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_OBJECT) pDst->guidObject = pSrc->guidObject;
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_DATE) pDst->ftDate = pSrc->ftDate;
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_VERSION) pDst->vVersion = pSrc->vVersion;
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_NAME) strcpyW (pDst->wszName, pSrc->wszName);
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_CATEGORY) strcpyW (pDst->wszCategory, pSrc->wszCategory);
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_FILENAME) strcpyW (pDst->wszFileName, pSrc->wszFileName);
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_STREAM) IStream_Clone (pSrc->pStream, &pDst->pStream);
|
||||||
|
if (pSrc->dwValidData & DMUS_OBJ_MEMORY) {
|
||||||
|
pDst->pbMemData = pSrc->pbMemData;
|
||||||
|
pDst->llMemLength = pSrc->llMemLength;
|
||||||
|
}
|
||||||
|
/* set flags */
|
||||||
|
pDst->dwValidData |= pSrc->dwValidData;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static BOOL DMUSIC_IsValidLoadableClass (REFCLSID pClassID) {
|
||||||
|
if (IsEqualCLSID(pClassID, &CLSID_DirectMusicAudioPathConfig) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicBand) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicContainer) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicCollection) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicChordMap) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicSegment) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicScript) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicSong) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicStyle) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectMusicGraph) ||
|
||||||
|
IsEqualCLSID(pClassID, &CLSID_DirectSoundWave) ||
|
||||||
|
IsEqualCLSID(pClassID, &GUID_DirectMusicAllTypes))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirectMusicLoaderImpl implementation
|
* IDirectMusicLoaderImpl implementation
|
||||||
*/
|
*/
|
||||||
/* IUnknown/IDirectMusicLoader(8) part: */
|
/* IUnknown/IDirectMusicLoader(8) part: */
|
||||||
static ULONG WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_AddRef (LPDIRECTMUSICLOADER8 iface);
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface (LPDIRECTMUSICLOADER8 iface, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface (LPDIRECTMUSICLOADER8 iface, REFIID riid, LPVOID *ppobj) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
||||||
|
@ -36,7 +76,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface (
|
||||||
if (IsEqualIID (riid, &IID_IUnknown) ||
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
||||||
IsEqualIID (riid, &IID_IDirectMusicLoader) ||
|
IsEqualIID (riid, &IID_IDirectMusicLoader) ||
|
||||||
IsEqualIID (riid, &IID_IDirectMusicLoader8)) {
|
IsEqualIID (riid, &IID_IDirectMusicLoader8)) {
|
||||||
IDirectMusicLoaderImpl_IDirectMusicLoader_AddRef (iface);
|
IDirectMusicLoader_AddRef (iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +97,16 @@ static ULONG WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_Release (LPDIRECTM
|
||||||
DWORD dwRef = InterlockedDecrement (&This->dwRef);
|
DWORD dwRef = InterlockedDecrement (&This->dwRef);
|
||||||
TRACE("(%p): ReleaseRef to %d\n", This, This->dwRef);
|
TRACE("(%p): ReleaseRef to %d\n", This, This->dwRef);
|
||||||
if (dwRef == 0) {
|
if (dwRef == 0) {
|
||||||
DMUSIC_DestroyDirectMusicLoaderImpl (iface);
|
/* firstly, release the cache */
|
||||||
|
IDirectMusicLoader8_ClearCache (iface, &GUID_DirectMusicAllTypes);
|
||||||
|
/* FIXME: release all allocated entries */
|
||||||
|
/* destroy critical section */
|
||||||
|
/*This->CritSect.DebugInfo->Spare[0] = 0;
|
||||||
|
DeleteCriticalSection (&This->CritSect); */
|
||||||
HeapFree (GetProcessHeap(), 0, This);
|
HeapFree (GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
|
/* decrease number of instances */
|
||||||
|
InterlockedDecrement (&dwDirectMusicLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dwRef;
|
return dwRef;
|
||||||
|
@ -788,6 +836,23 @@ static const IDirectMusicLoader8Vtbl DirectMusicLoader_Loader_Vtbl = {
|
||||||
IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFile
|
IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFile
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* help function for DMUSIC_SetDefaultDLS */
|
||||||
|
static HRESULT DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]) {
|
||||||
|
HKEY hkDM;
|
||||||
|
DWORD returnType, sizeOfReturnBuffer = MAX_PATH;
|
||||||
|
char szPath[MAX_PATH];
|
||||||
|
|
||||||
|
if ((RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic" , 0, KEY_READ, &hkDM) != ERROR_SUCCESS) ||
|
||||||
|
(RegQueryValueExA (hkDM, "GMFilePath", NULL, &returnType, (LPBYTE) szPath, &sizeOfReturnBuffer) != ERROR_SUCCESS)) {
|
||||||
|
WARN(": registry entry missing\n" );
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
||||||
|
MultiByteToWideChar (CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* for ClassFactory */
|
/* for ClassFactory */
|
||||||
HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
|
HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) {
|
||||||
IDirectMusicLoaderImpl *obj;
|
IDirectMusicLoaderImpl *obj;
|
||||||
|
@ -838,43 +903,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
|
||||||
return IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface ((LPDIRECTMUSICLOADER8)obj, lpcGUID, ppobj);
|
return IDirectMusicLoaderImpl_IDirectMusicLoader_QueryInterface ((LPDIRECTMUSICLOADER8)obj, lpcGUID, ppobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DMUSIC_DestroyDirectMusicLoaderImpl (LPDIRECTMUSICLOADER8 iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
/* firstly, release the cache */
|
|
||||||
IDirectMusicLoader8_ClearCache (iface, &GUID_DirectMusicAllTypes);
|
|
||||||
/* FIXME: release all allocated entries */
|
|
||||||
/* destroy critical section */
|
|
||||||
/*This->CritSect.DebugInfo->Spare[0] = 0;
|
|
||||||
DeleteCriticalSection (&This->CritSect); */
|
|
||||||
|
|
||||||
/* decrease number of instances */
|
|
||||||
InterlockedDecrement (&dwDirectMusicLoader);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* help function for DMUSIC_SetDefaultDLS */
|
|
||||||
HRESULT WINAPI DMUSIC_GetDefaultGMPath (WCHAR wszPath[MAX_PATH]) {
|
|
||||||
HKEY hkDM;
|
|
||||||
DWORD returnType, sizeOfReturnBuffer = MAX_PATH;
|
|
||||||
char szPath[MAX_PATH];
|
|
||||||
|
|
||||||
if ((RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic" , 0, KEY_READ, &hkDM) != ERROR_SUCCESS) ||
|
|
||||||
(RegQueryValueExA (hkDM, "GMFilePath", NULL, &returnType, (LPBYTE) szPath, &sizeOfReturnBuffer) != ERROR_SUCCESS)) {
|
|
||||||
WARN(": registry entry missing\n" );
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
/* FIXME: Check return types to ensure we're interpreting data right */
|
|
||||||
MultiByteToWideChar (CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* help function for retrieval of search path and caching option for certain class */
|
/* help function for retrieval of search path and caching option for certain class */
|
||||||
HRESULT WINAPI DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache) {
|
static HRESULT DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
||||||
struct list *pEntry;
|
struct list *pEntry;
|
||||||
TRACE(": (%p, %s, %p, %p)\n", This, debugstr_dmguid(pClassID), wszSearchPath, pbCache);
|
TRACE(": (%p, %s, %p, %p)\n", This, debugstr_dmguid(pClassID), wszSearchPath, pbCache);
|
||||||
|
@ -916,7 +946,7 @@ static HRESULT DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pCl
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
|
static HRESULT DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
|
||||||
|
|
||||||
/* hard-coded list of classes */
|
/* hard-coded list of classes */
|
||||||
|
@ -950,41 +980,3 @@ HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc) {
|
|
||||||
TRACE(": copy \n%s", debugstr_DMUS_OBJECTDESC(pSrc));
|
|
||||||
/* copy field by field */
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_CLASS) pDst->guidClass = pSrc->guidClass;
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_OBJECT) pDst->guidObject = pSrc->guidObject;
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_DATE) pDst->ftDate = pSrc->ftDate;
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_VERSION) pDst->vVersion = pSrc->vVersion;
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_NAME) strcpyW (pDst->wszName, pSrc->wszName);
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_CATEGORY) strcpyW (pDst->wszCategory, pSrc->wszCategory);
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_FILENAME) strcpyW (pDst->wszFileName, pSrc->wszFileName);
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_STREAM) IStream_Clone (pSrc->pStream, &pDst->pStream);
|
|
||||||
if (pSrc->dwValidData & DMUS_OBJ_MEMORY) {
|
|
||||||
pDst->pbMemData = pSrc->pbMemData;
|
|
||||||
pDst->llMemLength = pSrc->llMemLength;
|
|
||||||
}
|
|
||||||
/* set flags */
|
|
||||||
pDst->dwValidData |= pSrc->dwValidData;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DMUSIC_IsValidLoadableClass (REFCLSID pClassID) {
|
|
||||||
if (IsEqualCLSID(pClassID, &CLSID_DirectMusicAudioPathConfig) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicBand) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicContainer) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicCollection) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicChordMap) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicSegment) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicScript) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicSong) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicStyle) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectMusicGraph) ||
|
|
||||||
IsEqualCLSID(pClassID, &CLSID_DirectSoundWave) ||
|
|
||||||
IsEqualCLSID(pClassID, &GUID_DirectMusicAllTypes))
|
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -64,6 +64,14 @@ static ULONG WINAPI IDirectMusicLoaderGenericStream_IDirectMusicGetLoader_AddRef
|
||||||
* IDirectMusicLoaderFileStream implementation
|
* IDirectMusicLoaderFileStream implementation
|
||||||
*/
|
*/
|
||||||
/* Custom : */
|
/* Custom : */
|
||||||
|
|
||||||
|
static void IDirectMusicLoaderFileStream_Detach (LPSTREAM iface) {
|
||||||
|
ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
|
||||||
|
TRACE("(%p)\n", This);
|
||||||
|
if (This->hFile != INVALID_HANDLE_VALUE) CloseHandle(This->hFile);
|
||||||
|
This->wzFileName[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader) {
|
HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFile, LPDIRECTMUSICLOADER8 pLoader) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
|
||||||
TRACE("(%p, %s, %p)\n", This, debugstr_w(wzFile), pLoader);
|
TRACE("(%p, %s, %p)\n", This, debugstr_w(wzFile), pLoader);
|
||||||
|
@ -80,15 +88,6 @@ HRESULT WINAPI IDirectMusicLoaderFileStream_Attach (LPSTREAM iface, LPCWSTR wzFi
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
if (This->hFile != INVALID_HANDLE_VALUE) {
|
|
||||||
CloseHandle(This->hFile);
|
|
||||||
}
|
|
||||||
This->wzFileName[0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* IUnknown/IStream part: */
|
/* IUnknown/IStream part: */
|
||||||
static HRESULT WINAPI IDirectMusicLoaderFileStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
static HRESULT WINAPI IDirectMusicLoaderFileStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
||||||
|
@ -311,6 +310,15 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID* ppobj) {
|
||||||
* IDirectMusicLoaderResourceStream implementation
|
* IDirectMusicLoaderResourceStream implementation
|
||||||
*/
|
*/
|
||||||
/* Custom : */
|
/* Custom : */
|
||||||
|
|
||||||
|
static void IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface) {
|
||||||
|
ICOM_THIS_MULTI(IDirectMusicLoaderResourceStream, StreamVtbl, iface);
|
||||||
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
This->pbMemData = NULL;
|
||||||
|
This->llMemLength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader) {
|
HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE pbMemData, LONGLONG llMemLength, LONGLONG llPos, LPDIRECTMUSICLOADER8 pLoader) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderResourceStream, StreamVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderResourceStream, StreamVtbl, iface);
|
||||||
|
|
||||||
|
@ -328,14 +336,6 @@ HRESULT WINAPI IDirectMusicLoaderResourceStream_Attach (LPSTREAM iface, LPBYTE p
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirectMusicLoaderResourceStream_Detach (LPSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderResourceStream, StreamVtbl, iface);
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
This->pbMemData = NULL;
|
|
||||||
This->llMemLength = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* IUnknown/IStream part: */
|
/* IUnknown/IStream part: */
|
||||||
static HRESULT WINAPI IDirectMusicLoaderResourceStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
static HRESULT WINAPI IDirectMusicLoaderResourceStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
||||||
|
@ -567,6 +567,15 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID* ppobj) {
|
||||||
* IDirectMusicLoaderGenericStream implementation
|
* IDirectMusicLoaderGenericStream implementation
|
||||||
*/
|
*/
|
||||||
/* Custom : */
|
/* Custom : */
|
||||||
|
|
||||||
|
static void IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface) {
|
||||||
|
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
|
||||||
|
|
||||||
|
if (This->pStream)
|
||||||
|
IStream_Release (This->pStream);
|
||||||
|
This->pStream = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader) {
|
HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM pStream, LPDIRECTMUSICLOADER8 pLoader) {
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
|
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
|
||||||
|
|
||||||
|
@ -587,14 +596,6 @@ HRESULT WINAPI IDirectMusicLoaderGenericStream_Attach (LPSTREAM iface, LPSTREAM
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirectMusicLoaderGenericStream_Detach (LPSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
|
|
||||||
|
|
||||||
if (This->pStream)
|
|
||||||
IStream_Release (This->pStream);
|
|
||||||
This->pStream = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* IUnknown/IStream part: */
|
/* IUnknown/IStream part: */
|
||||||
static HRESULT WINAPI IDirectMusicLoaderGenericStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
static HRESULT WINAPI IDirectMusicLoaderGenericStream_IStream_QueryInterface (LPSTREAM iface, REFIID riid, void** ppobj) {
|
||||||
|
|
Loading…
Reference in New Issue