2 * IEnumMoniker implementation for DEVENUM.dll
4 * Copyright (C) 2002 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * - Implements IEnumMoniker interface which enumerates through moniker
22 * objects created from HKEY_CLASSES/CLSID/{DEVICE_CLSID}/Instance
25 #include "devenum_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(devenum);
33 static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface);
34 static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(LPMONIKER iface);
35 static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface);
39 const IPropertyBagVtbl *lpVtbl;
45 static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface(
50 RegPropBagImpl *This = (RegPropBagImpl *)iface;
52 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj);
54 if (This == NULL || ppvObj == NULL) return E_POINTER;
56 if (IsEqualGUID(riid, &IID_IUnknown) ||
57 IsEqualGUID(riid, &IID_IPropertyBag))
59 *ppvObj = (LPVOID)iface;
60 DEVENUM_IPropertyBag_AddRef(iface);
64 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
68 /**********************************************************************
69 * DEVENUM_IPropertyBag_AddRef (also IUnknown)
71 static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface)
73 RegPropBagImpl *This = (RegPropBagImpl *)iface;
75 TRACE("(%p)->() AddRef from %d\n", iface, This->ref);
77 return InterlockedIncrement(&This->ref);
80 /**********************************************************************
81 * DEVENUM_IPropertyBag_Release (also IUnknown)
83 static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface)
85 RegPropBagImpl *This = (RegPropBagImpl *)iface;
88 TRACE("(%p)->() ReleaseThis->ref from %d\n", iface, This->ref);
90 ref = InterlockedDecrement(&This->ref);
92 RegCloseKey(This->hkey);
94 DEVENUM_UnlockModule();
99 static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
101 LPCOLESTR pszPropName,
103 IErrorLog* pErrorLog)
108 RegPropBagImpl *This = (RegPropBagImpl *)iface;
112 TRACE("(%p)->(%s, %p, %p)\n", This, debugstr_w(pszPropName), pVar, pErrorLog);
114 if (!pszPropName || !pVar)
117 reswin32 = RegQueryValueExW(This->hkey, pszPropName, NULL, NULL, NULL, &received);
118 res = HRESULT_FROM_WIN32(reswin32);
122 pData = HeapAlloc(GetProcessHeap(), 0, received);
124 /* work around a GCC bug that occurs here unless we use the reswin32 variable as well */
125 reswin32 = RegQueryValueExW(This->hkey, pszPropName, NULL, &type, (LPBYTE)pData, &received);
126 res = HRESULT_FROM_WIN32(reswin32);
131 res = E_INVALIDARG; /* assume we cannot coerce into right type */
133 TRACE("Read %d bytes (%s)\n", received, type == REG_SZ ? debugstr_w((LPWSTR)pData) : "binary data");
141 V_UNION(pVar, bstrVal) = CoTaskMemAlloc(received);
142 memcpy(V_UNION(pVar, bstrVal), (LPWSTR)pData, received);
146 V_VT(pVar) = VT_BSTR;
149 V_UNION(pVar, bstrVal) = SysAllocStringLen((LPWSTR)pData, received/sizeof(WCHAR) - 1);
155 TRACE("REG_DWORD: %x\n", *(DWORD *)pData);
163 V_UNION(pVar, ulVal) = *(DWORD *)pData;
170 SAFEARRAYBOUND bound;
171 void * pArrayElements;
173 bound.cElements = received;
174 TRACE("REG_BINARY: len = %d\n", received);
178 V_VT(pVar) = VT_ARRAY | VT_UI1;
180 case VT_ARRAY | VT_UI1:
181 if (!(V_UNION(pVar, parray) = SafeArrayCreate(VT_UI1, 1, &bound)))
188 if (res == E_INVALIDARG)
191 res = SafeArrayAccessData(V_UNION(pVar, parray), &pArrayElements);
195 CopyMemory(pArrayElements, pData, received);
196 res = SafeArrayUnaccessData(V_UNION(pVar, parray));
200 if (res == E_INVALIDARG)
201 FIXME("Variant type %x not supported for regtype %x\n", V_VT(pVar), type);
204 HeapFree(GetProcessHeap(), 0, pData);
206 TRACE("<- %x\n", res);
210 static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
212 LPCOLESTR pszPropName,
215 RegPropBagImpl *This = (RegPropBagImpl *)iface;
216 LPVOID lpData = NULL;
221 TRACE("(%p)->(%s, %p)\n", This, debugstr_w(pszPropName), pVar);
226 TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal)));
227 lpData = (LPVOID)V_UNION(pVar, bstrVal);
229 cbData = (lstrlenW(V_UNION(pVar, bstrVal)) + 1) * sizeof(WCHAR);
233 TRACE("writing %u\n", V_UNION(pVar, ulVal));
234 lpData = (LPVOID)&V_UNION(pVar, ulVal);
236 cbData = sizeof(DWORD);
238 case VT_ARRAY | VT_UI1:
243 res = SafeArrayGetLBound(V_UNION(pVar, parray), 1, &lLbound);
244 res = SafeArrayGetUBound(V_UNION(pVar, parray), 1, &lUbound);
245 cbData = (lUbound - lLbound + 1) /* * sizeof(BYTE)*/;
246 TRACE("cbData: %d\n", cbData);
247 res = SafeArrayAccessData(V_UNION(pVar, parray), &lpData);
251 FIXME("Variant type %d not handled\n", V_VT(pVar));
255 if (RegSetValueExW(This->hkey,
257 dwType, lpData, cbData) != ERROR_SUCCESS)
260 if (V_VT(pVar) & VT_ARRAY)
261 res = SafeArrayUnaccessData(V_UNION(pVar, parray));
266 static const IPropertyBagVtbl IPropertyBag_Vtbl =
268 DEVENUM_IPropertyBag_QueryInterface,
269 DEVENUM_IPropertyBag_AddRef,
270 DEVENUM_IPropertyBag_Release,
271 DEVENUM_IPropertyBag_Read,
272 DEVENUM_IPropertyBag_Write
275 static HRESULT DEVENUM_IPropertyBag_Construct(HANDLE hkey, IPropertyBag **ppBag)
277 RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl));
279 return E_OUTOFMEMORY;
280 rpb->lpVtbl = &IPropertyBag_Vtbl;
283 *ppBag = (IPropertyBag*)rpb;
284 DEVENUM_LockModule();
289 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface(
294 MediaCatMoniker *This = (MediaCatMoniker *)iface;
295 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
297 if (This == NULL || ppvObj == NULL) return E_POINTER;
301 if (IsEqualGUID(riid, &IID_IUnknown) ||
302 IsEqualGUID(riid, &IID_IPersist) ||
303 IsEqualGUID(riid, &IID_IPersistStream) ||
304 IsEqualGUID(riid, &IID_IMoniker))
306 *ppvObj = (LPVOID)iface;
307 DEVENUM_IMediaCatMoniker_AddRef(iface);
311 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
312 return E_NOINTERFACE;
315 /**********************************************************************
316 * DEVENUM_IMediaCatMoniker_AddRef (also IUnknown)
318 static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(LPMONIKER iface)
320 MediaCatMoniker *This = (MediaCatMoniker *)iface;
323 return InterlockedIncrement(&This->ref);
326 /**********************************************************************
327 * DEVENUM_IMediaCatMoniker_Release (also IUnknown)
329 static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(LPMONIKER iface)
331 MediaCatMoniker *This = (MediaCatMoniker *)iface;
335 ref = InterlockedDecrement(&This->ref);
337 RegCloseKey(This->hkey);
339 DEVENUM_UnlockModule();
344 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(
348 MediaCatMoniker *This = (MediaCatMoniker *)iface;
349 FIXME("(%p)->(%p): stub\n", This, pClassID);
351 if (pClassID == NULL)
357 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsDirty(LPMONIKER iface)
359 FIXME("(%p)->(): stub\n", iface);
364 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Load(LPMONIKER iface, IStream* pStm)
366 FIXME("(%p)->(%p): stub\n", iface, pStm);
371 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Save(LPMONIKER iface, IStream* pStm, BOOL fClearDirty)
373 FIXME("(%p)->(%p, %s): stub\n", iface, pStm, fClearDirty ? "true" : "false");
375 return STG_E_CANTSAVE;
378 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(
380 ULARGE_INTEGER* pcbSize)
382 FIXME("(%p)->(%p): stub\n", iface, pcbSize);
384 ZeroMemory(pcbSize, sizeof(*pcbSize));
389 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(
396 IUnknown * pObj = NULL;
397 IPropertyBag * pProp = NULL;
400 HRESULT res = E_FAIL;
402 MediaCatMoniker *This = (MediaCatMoniker *)iface;
406 TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riidResult), ppvResult);
412 /* first activation of this class */
414 res=IMoniker_BindToStorage(iface, NULL, NULL, &IID_IPropertyBag, &pvptr);
415 pProp = (IPropertyBag*)pvptr;
418 V_VT(&var) = VT_LPWSTR;
419 res = IPropertyBag_Read(pProp, clsid_keyname, &var, NULL);
423 res = CLSIDFromString(V_UNION(&var,bstrVal), &clsID);
424 CoTaskMemFree(V_UNION(&var, bstrVal));
428 res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IUnknown,&pvptr);
429 pObj = (IUnknown*)pvptr;
435 /* get the requested interface from the loaded class */
440 res2 = IUnknown_QueryInterface(pObj, &IID_IPersistPropertyBag, &ppv);
441 if (SUCCEEDED(res2)) {
442 res = IPersistPropertyBag_Load((IPersistPropertyBag *) ppv, pProp, NULL);
443 IPersistPropertyBag_Release((IPersistPropertyBag *) ppv);
447 res= IUnknown_QueryInterface(pObj,riidResult,ppvResult);
448 IUnknown_Release(pObj);
453 IPropertyBag_Release(pProp);
456 TRACE("<- 0x%x\n", res);
461 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(
468 MediaCatMoniker *This = (MediaCatMoniker *)iface;
469 TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
473 if (pbc || pmkToLeft)
474 return MK_E_NOSTORAGE;
476 if (IsEqualGUID(riid, &IID_IPropertyBag))
479 DuplicateHandle(GetCurrentProcess(), This->hkey, GetCurrentProcess(), &hkey, 0, 0, DUPLICATE_SAME_ACCESS);
480 return DEVENUM_IPropertyBag_Construct(hkey, (IPropertyBag**)ppvObj);
483 return MK_E_NOSTORAGE;
486 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(
489 DWORD dwReduceHowFar,
490 IMoniker** ppmkToLeft,
491 IMoniker** ppmkReduced)
493 TRACE("(%p)->(%p, %d, %p, %p)\n", iface, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
497 *ppmkReduced = iface;
499 return MK_S_REDUCED_TO_SELF;
502 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(
505 BOOL fOnlyIfNotGeneric,
506 IMoniker** ppmkComposite)
508 FIXME("(%p)->(%p, %s, %p): stub\n", iface, pmkRight, fOnlyIfNotGeneric ? "true" : "false", ppmkComposite);
510 /* FIXME: use CreateGenericComposite? */
511 *ppmkComposite = NULL;
516 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(
519 IEnumMoniker** ppenumMoniker)
521 FIXME("(%p)->(%s, %p): stub\n", iface, fForward ? "true" : "false", ppenumMoniker);
523 *ppenumMoniker = NULL;
528 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsEqual(
530 IMoniker* pmkOtherMoniker)
532 FIXME("(%p)->(%p): stub\n", iface, pmkOtherMoniker);
537 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(
541 TRACE("(%p)->(%p)\n", iface, pdwHash);
548 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsRunning(
552 IMoniker* pmkNewlyRunning)
554 FIXME("(%p)->(%p, %p, %p): stub\n", iface, pbc, pmkToLeft, pmkNewlyRunning);
559 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(
565 TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, pFileTime);
567 pFileTime->dwLowDateTime = 0xFFFFFFFF;
568 pFileTime->dwHighDateTime = 0x7FFFFFFF;
570 return MK_E_UNAVAILABLE;
573 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(
577 TRACE("(%p)->(%p)\n", iface, ppmk);
581 return MK_E_NOINVERSE;
584 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(
586 IMoniker* pmkOtherMoniker,
587 IMoniker** ppmkPrefix)
589 TRACE("(%p)->(%p, %p)\n", iface, pmkOtherMoniker, ppmkPrefix);
593 return MK_E_NOPREFIX;
596 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(
599 IMoniker** ppmkRelPath)
601 TRACE("(%p)->(%p, %p)\n", iface, pmkOther, ppmkRelPath);
603 *ppmkRelPath = pmkOther;
608 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(
612 LPOLESTR* ppszDisplayName)
614 MediaCatMoniker *This = (MediaCatMoniker *)iface;
615 WCHAR wszBuffer[MAX_PATH];
616 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
617 LONG received = sizeof(wszFriendlyName);
619 TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, ppszDisplayName);
621 *ppszDisplayName = NULL;
623 /* FIXME: should this be the weird stuff we have to parse in IParseDisplayName? */
624 if (RegQueryValueW(This->hkey, wszFriendlyName, wszBuffer, &received) == ERROR_SUCCESS)
626 *ppszDisplayName = CoTaskMemAlloc(received);
627 strcpyW(*ppszDisplayName, wszBuffer);
634 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(
638 LPOLESTR pszDisplayName,
642 FIXME("(%p)->(%p, %p, %s, %p, %p)\n", iface, pbc, pmkToLeft, debugstr_w(pszDisplayName), pchEaten, ppmkOut);
650 static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsSystemMoniker(
654 TRACE("(%p)->(%p)\n", iface, pdwMksys);
659 static const IMonikerVtbl IMoniker_Vtbl =
661 DEVENUM_IMediaCatMoniker_QueryInterface,
662 DEVENUM_IMediaCatMoniker_AddRef,
663 DEVENUM_IMediaCatMoniker_Release,
664 DEVENUM_IMediaCatMoniker_GetClassID,
665 DEVENUM_IMediaCatMoniker_IsDirty,
666 DEVENUM_IMediaCatMoniker_Load,
667 DEVENUM_IMediaCatMoniker_Save,
668 DEVENUM_IMediaCatMoniker_GetSizeMax,
669 DEVENUM_IMediaCatMoniker_BindToObject,
670 DEVENUM_IMediaCatMoniker_BindToStorage,
671 DEVENUM_IMediaCatMoniker_Reduce,
672 DEVENUM_IMediaCatMoniker_ComposeWith,
673 DEVENUM_IMediaCatMoniker_Enum,
674 DEVENUM_IMediaCatMoniker_IsEqual,
675 DEVENUM_IMediaCatMoniker_Hash,
676 DEVENUM_IMediaCatMoniker_IsRunning,
677 DEVENUM_IMediaCatMoniker_GetTimeOfLastChange,
678 DEVENUM_IMediaCatMoniker_Inverse,
679 DEVENUM_IMediaCatMoniker_CommonPrefixWith,
680 DEVENUM_IMediaCatMoniker_RelativePathTo,
681 DEVENUM_IMediaCatMoniker_GetDisplayName,
682 DEVENUM_IMediaCatMoniker_ParseDisplayName,
683 DEVENUM_IMediaCatMoniker_IsSystemMoniker
686 MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void)
688 MediaCatMoniker * pMoniker = NULL;
689 pMoniker = CoTaskMemAlloc(sizeof(MediaCatMoniker));
693 pMoniker->lpVtbl = &IMoniker_Vtbl;
695 pMoniker->hkey = NULL;
697 DEVENUM_IMediaCatMoniker_AddRef((LPMONIKER)pMoniker);
699 DEVENUM_LockModule();
704 /**********************************************************************
705 * DEVENUM_IEnumMoniker_QueryInterface (also IUnknown)
707 static HRESULT WINAPI DEVENUM_IEnumMoniker_QueryInterface(
712 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
714 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj);
716 if (This == NULL || ppvObj == NULL) return E_POINTER;
718 if (IsEqualGUID(riid, &IID_IUnknown) ||
719 IsEqualGUID(riid, &IID_IEnumMoniker))
721 *ppvObj = (LPVOID)iface;
722 DEVENUM_IEnumMoniker_AddRef(iface);
726 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
727 return E_NOINTERFACE;
730 /**********************************************************************
731 * DEVENUM_IEnumMoniker_AddRef (also IUnknown)
733 static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface)
735 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
736 ULONG ref = InterlockedIncrement(&This->ref);
738 TRACE("(%p)->() AddRef from %d\n", iface, ref - 1);
743 /**********************************************************************
744 * DEVENUM_IEnumMoniker_Release (also IUnknown)
746 static ULONG WINAPI DEVENUM_IEnumMoniker_Release(LPENUMMONIKER iface)
748 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
749 ULONG ref = InterlockedDecrement(&This->ref);
751 TRACE("(%p)->() Release from %d\n", iface, ref + 1);
755 RegCloseKey(This->hkey);
757 DEVENUM_UnlockModule();
763 static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
765 WCHAR buffer[MAX_PATH + 1];
768 MediaCatMoniker * pMoniker;
769 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
771 TRACE("(%p)->(%d, %p, %p)\n", iface, celt, rgelt, pceltFetched);
773 while (fetched < celt)
775 res = RegEnumKeyW(This->hkey, This->index, buffer, sizeof(buffer) / sizeof(WCHAR));
776 if (res != ERROR_SUCCESS)
780 pMoniker = DEVENUM_IMediaCatMoniker_Construct();
782 return E_OUTOFMEMORY;
784 if (RegOpenKeyW(This->hkey, buffer, &pMoniker->hkey) != ERROR_SUCCESS)
786 DEVENUM_IMediaCatMoniker_Release((LPMONIKER)pMoniker);
789 rgelt[fetched] = (LPMONIKER)pMoniker;
793 This->index += fetched;
795 TRACE("-- fetched %d\n", fetched);
798 *pceltFetched = fetched;
806 static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(LPENUMMONIKER iface, ULONG celt)
808 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
811 TRACE("(%p)->(%d)\n", iface, celt);
813 /* Before incrementing, check if there are any more values to run thru.
814 Some programs use the Skip() function to get the amount of devices */
815 if(RegQueryInfoKeyW(This->hkey, NULL, NULL, NULL, &subKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
819 if((This->index + celt) >= subKeys)
829 static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(LPENUMMONIKER iface)
831 EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
833 TRACE("(%p)->()\n", iface);
840 static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum)
842 FIXME("(%p)->(%p): stub\n", iface, ppenum);
847 /**********************************************************************
850 static const IEnumMonikerVtbl IEnumMoniker_Vtbl =
852 DEVENUM_IEnumMoniker_QueryInterface,
853 DEVENUM_IEnumMoniker_AddRef,
854 DEVENUM_IEnumMoniker_Release,
855 DEVENUM_IEnumMoniker_Next,
856 DEVENUM_IEnumMoniker_Skip,
857 DEVENUM_IEnumMoniker_Reset,
858 DEVENUM_IEnumMoniker_Clone
861 HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker)
863 EnumMonikerImpl * pEnumMoniker = CoTaskMemAlloc(sizeof(EnumMonikerImpl));
865 return E_OUTOFMEMORY;
867 pEnumMoniker->lpVtbl = &IEnumMoniker_Vtbl;
868 pEnumMoniker->ref = 1;
869 pEnumMoniker->index = 0;
870 pEnumMoniker->hkey = hkey;
872 *ppEnumMoniker = (IEnumMoniker *)pEnumMoniker;
874 DEVENUM_LockModule();