[PATCH] Fix the implementation of IEnumMoniker::Skip(), to match the MSDN specs.

Peter Dons Tychsen (none) donpedro at dhcppc4.
Fri Jan 4 17:05:34 CST 2008


This fixes a hang in the MacroMedia Flash settings box if you push the Camera tab.
Detected and fixed on a game using Flash version 7 called "Maple Story".
---
 dlls/devenum/mediacatenum.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c
index d230ce1..331130b 100644
--- a/dlls/devenum/mediacatenum.c
+++ b/dlls/devenum/mediacatenum.c
@@ -800,9 +800,21 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt,
 static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(LPENUMMONIKER iface, ULONG celt)
 {
     EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+    DWORD subKeys;
 
     TRACE("(%p)->(%d)\n", iface, celt);
 
+    /* Before incrementing, check if there are any more values to run thru.
+       Some programs use the Skip() function to get the amount of devices */
+    if(RegQueryInfoKeyW(This->hkey, NULL, NULL, NULL, &subKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
+    {
+        return S_FALSE;
+    }
+    if((This->index + celt) >= subKeys)
+    {
+        return S_FALSE;
+    }
+
     This->index += celt;
 
     return S_OK;
-- 
1.5.3.6


--=-6BD61tPkMMq4jowOaTOf--




More information about the wine-patches mailing list