Hoi Joris,

On 16-03-10 21:31, Joris Huizer wrote:
Hello, Maarten Lankhorst,

I was browsing through the recent patches in git, I noticed some possible issue 
in this code:

+    for (i = 0; i<  MMDevice_count; ++i)
+    {
+        WCHAR *str;
+        dev = (IMMDevice*)MMDevice_head[i];
+        IMMDevice_GetId(dev,&str);
+
+        if (str&&  !lstrcmpW(str, name))
+        {
+            CoTaskMemFree(str);
+            break;
+        }
+        CoTaskMemFree(str);
+    }
+    if (dev)
+    {
+        IUnknown_AddRef(dev);
+        *device = dev;
+        return S_OK;
+    }

I'm not sure whether this can happen, but in case the name isn't found at all, 
this will assign the last device in the MMDevice_head[] array (as far as I can 
see?)
In case this is an issue, a simple fix would be, to make the check look like 
this instead:
You're right, it's a bug. But don't worry about fixing it, at the moment it's not an issue, since nobody is creating a device, unless you create the registry keys for it manually.

I have a real fix, where I'm starting to implement IMMDevice by populating it with the results from OpenAL library, but I'm waiting with implementing mmdevapi until the next wine release is out. There will likely be some fallout from merging that code. :)

Please CC wine-devel in the future

Cheers,
Maarten


Reply via email to