From 787ccc8032f986477b69a340d877ff0a80ffa5b3 Mon Sep 17 00:00:00 2001 From: Peter Dons Tychsen Date: Sat, 5 Jan 2008 00:05:34 +0100 Subject: [PATCH] devenum: Fix the implementation of IEnumMoniker::Skip(), to match the MSDN specs. --- dlls/devenum/mediacatenum.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index d230ce168c3..331130bad76 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;