Commit 49c6e57d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmloader: Remove invalid default DLS collection check.

parent 767c5ddb
...@@ -40,7 +40,6 @@ struct cache_entry { ...@@ -40,7 +40,6 @@ struct cache_entry {
struct list entry; struct list entry;
DMUS_OBJECTDESC Desc; DMUS_OBJECTDESC Desc;
IDirectMusicObject *pObject; IDirectMusicObject *pObject;
BOOL bInvalidDefaultDLS; /* workaround for enabling caching of "faulty" default dls collection */
}; };
struct loader struct loader
...@@ -276,12 +275,6 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE ...@@ -276,12 +275,6 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
TRACE(": looking if we have object in the cache or if it can be found via alias\n"); TRACE(": looking if we have object in the cache or if it can be found via alias\n");
pExistingEntry = find_cache_object(This, pDesc); pExistingEntry = find_cache_object(This, pDesc);
if (pExistingEntry) { if (pExistingEntry) {
if (pExistingEntry->bInvalidDefaultDLS) {
TRACE(": found faulty default DLS collection... enabling M$ compliant behaviour\n");
return DMUS_E_LOADER_NOFILENAME;
}
if (pExistingEntry->Desc.dwValidData & DMUS_OBJ_LOADED) { if (pExistingEntry->Desc.dwValidData & DMUS_OBJ_LOADED) {
TRACE(": already loaded\n"); TRACE(": already loaded\n");
return IDirectMusicObject_QueryInterface(pExistingEntry->pObject, riid, ppv); return IDirectMusicObject_QueryInterface(pExistingEntry->pObject, riid, ppv);
...@@ -404,23 +397,26 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE ...@@ -404,23 +397,26 @@ static HRESULT WINAPI loader_GetObject(IDirectMusicLoader8 *iface, DMUS_OBJECTDE
IStream_Release (pStream); IStream_Release (pStream);
IPersistStream_Release (pPersistStream); IPersistStream_Release (pPersistStream);
/* add object to cache/overwrite existing info (if cache is enabled) */ /* add object to cache/overwrite existing info (if cache is enabled) */
bCache = is_cache_enabled(This, &pDesc->guidClass); bCache = is_cache_enabled(This, &pDesc->guidClass);
if (bCache) { if (!bCache) TRACE(": caching disabled\n");
if (!pObjectEntry) { else
{
if (!pObjectEntry)
{
pObjectEntry = calloc(1, sizeof(*pObjectEntry)); pObjectEntry = calloc(1, sizeof(*pObjectEntry));
DM_STRUCT_INIT(&pObjectEntry->Desc); DM_STRUCT_INIT(&pObjectEntry->Desc);
DMUSIC_CopyDescriptor (&pObjectEntry->Desc, &GotDesc); DMUSIC_CopyDescriptor (&pObjectEntry->Desc, &GotDesc);
pObjectEntry->pObject = pObject; pObjectEntry->pObject = pObject;
pObjectEntry->bInvalidDefaultDLS = FALSE; list_add_head(&This->cache, &pObjectEntry->entry);
list_add_head(&This->cache, &pObjectEntry->entry); }
} else { else
DMUSIC_CopyDescriptor (&pObjectEntry->Desc, &GotDesc); {
pObjectEntry->pObject = pObject; DMUSIC_CopyDescriptor (&pObjectEntry->Desc, &GotDesc);
pObjectEntry->bInvalidDefaultDLS = FALSE; pObjectEntry->pObject = pObject;
} }
TRACE(": filled in cache entry\n"); TRACE(": filled in cache entry\n");
} else TRACE(": caching disabled\n"); }
result = IDirectMusicObject_QueryInterface (pObject, riid, ppv); result = IDirectMusicObject_QueryInterface (pObject, riid, ppv);
if (!bCache) IDirectMusicObject_Release (pObject); /* since loader's reference is not needed */ if (!bCache) IDirectMusicObject_Release (pObject); /* since loader's reference is not needed */
...@@ -873,8 +869,6 @@ HRESULT create_dmloader(REFIID lpcGUID, void **ppobj) ...@@ -873,8 +869,6 @@ HRESULT create_dmloader(REFIID lpcGUID, void **ppobj)
{ {
struct loader *obj; struct loader *obj;
DMUS_OBJECTDESC Desc; DMUS_OBJECTDESC Desc;
struct cache_entry *dls;
struct list *pEntry;
HRESULT hr; HRESULT hr;
TRACE("(%s, %p)\n", debugstr_dmguid(lpcGUID), ppobj); TRACE("(%s, %p)\n", debugstr_dmguid(lpcGUID), ppobj);
...@@ -895,16 +889,6 @@ HRESULT create_dmloader(REFIID lpcGUID, void **ppobj) ...@@ -895,16 +889,6 @@ HRESULT create_dmloader(REFIID lpcGUID, void **ppobj)
DMUSIC_GetDefaultGMPath(Desc.wszFileName); DMUSIC_GetDefaultGMPath(Desc.wszFileName);
IDirectMusicLoader_SetObject(&obj->IDirectMusicLoader8_iface, &Desc); IDirectMusicLoader_SetObject(&obj->IDirectMusicLoader8_iface, &Desc);
/* and now the workaroundTM for "invalid" default DLS; basically,
my tests showed that if GUID chunk is present in default DLS
collection, loader treats it as "invalid" and returns
DMUS_E_LOADER_NOFILENAME for all requests for it; basically, we check
if out input guidObject was overwritten */
pEntry = list_head(&obj->cache);
dls = LIST_ENTRY(pEntry, struct cache_entry, entry);
if (!IsEqualGUID(&Desc.guidObject, &GUID_DefaultGMCollection))
dls->bInvalidDefaultDLS = TRUE;
hr = IDirectMusicLoader_QueryInterface(&obj->IDirectMusicLoader8_iface, lpcGUID, ppobj); hr = IDirectMusicLoader_QueryInterface(&obj->IDirectMusicLoader8_iface, lpcGUID, ppobj);
IDirectMusicLoader_Release(&obj->IDirectMusicLoader8_iface); IDirectMusicLoader_Release(&obj->IDirectMusicLoader8_iface);
return hr; return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment