[PATCH] dmloader: Only use the GUID when looking for cached objects.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Thu Nov 21 16:15:59 CST 2019


Hi Micheal,

Game LegoLand.

This game loads about 40 objects (sgt,sty) into the cache, and when it's looping
over the cache it's selecting the wrong object.

Simple example, of 3 objects.

1. GUID XX, Name "Trans" category "chord"   (filename trans.sgt)
2. GUID YY, Name "Other" category "tempo"
3. GUID ZZ, Name "Trans" category "chord"   (filename trans.sty)

Using IDirectMusicLoader8_GetObject

Processing element 3, searching for an object with GUID = XX, Name = "Trans" and category = "chord".
We find the object 1 (correct)
We continue searching and find object 3 (wrong that's ourself).
Then we attempt to resolve object 3 by calling _GetObject again, causing a stack overflow.

Snippet of the log.
0030:trace:dmloader:dump_DMUS_OBJECTDESC  - wszFileName = L"WLtran2.sty"
0030:trace:dmloader:IDirectMusicLoaderImpl_GetObject : looking if we have object in the cache or if it can be found via alias
0030:trace:dmloader:IDirectMusicLoaderImpl_GetObject : found it by object GUID
0030:trace:dmloader:IDirectMusicLoaderImpl_GetObject : not loaded yet
0030:trace:dmloader:IDirectMusicLoaderImpl_GetObject : found it by name and category
0030:trace:dmloader:IDirectMusicLoaderImpl_GetObject : not loaded yet

The unique identifiers in this structure are GUID, filename.

Also the loop has bad logic.

These are the same, so the second if will never be hit.
else if ((pDesc->dwValidData & (DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH)) &&
...
else if ((pDesc->dwValidData & DMUS_OBJ_FILENAME) &&


If we want to keep all conditions, then we could do something beflow, so
weight is given each flag. (simplify logic).
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
{
    if(IsEqualGUID (&pDesc->guidObject, &pExistingEntry->Desc.guidObject))
        pObjectEntry = pExistingEntry;
    break;
}

Regards
Alistair.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20191121/0dfd5724/attachment.htm>


More information about the wine-devel mailing list