2 * Implementation of ICreateDevEnum for CLSID_SystemDeviceEnum.
6 * hidenori@a2.ctktv.ne.jp
17 #include "wine/obj_base.h"
24 #include "wine/unicode.h"
26 #include "debugtools.h"
27 DEFAULT_DEBUG_CHANNEL(quartz
);
29 #include "quartz_private.h"
38 ICreateDevEnum_fnQueryInterface(ICreateDevEnum
* iface
,REFIID riid
,void** ppobj
)
40 CSysDevEnum_THIS(iface
,createdevenum
);
42 TRACE("(%p)->()\n",This
);
44 return IUnknown_QueryInterface(This
->unk
.punkControl
,riid
,ppobj
);
48 ICreateDevEnum_fnAddRef(ICreateDevEnum
* iface
)
50 CSysDevEnum_THIS(iface
,createdevenum
);
52 TRACE("(%p)->()\n",This
);
54 return IUnknown_AddRef(This
->unk
.punkControl
);
58 ICreateDevEnum_fnRelease(ICreateDevEnum
* iface
)
60 CSysDevEnum_THIS(iface
,createdevenum
);
62 TRACE("(%p)->()\n",This
);
64 return IUnknown_Release(This
->unk
.punkControl
);
68 ICreateDevEnum_fnCreateClassEnumerator(ICreateDevEnum
* iface
,REFCLSID rclsidDeviceClass
,IEnumMoniker
** ppobj
, DWORD dwFlags
)
70 CSysDevEnum_THIS(iface
,createdevenum
);
73 QUARTZ_CompList
* pMonList
;
77 WCHAR wszPath
[ 1024 ];
83 TRACE("(%p)->(%s,%p,%08lx)\n",This
,
84 debugstr_guid(rclsidDeviceClass
),ppobj
,dwFlags
);
87 FIXME("unknown flags %08lx\n",dwFlags
);
95 hr
= QUARTZ_CreateCLSIDPath(
96 wszPath
, sizeof(wszPath
)/sizeof(wszPath
[0]),
97 rclsidDeviceClass
, QUARTZ_wszInstance
);
101 if ( RegOpenKeyExW( HKEY_CLASSES_ROOT
, wszPath
,
102 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
105 dwLen
= strlenW(wszPath
);
106 wszPath
[dwLen
++] = '\\'; wszPath
[dwLen
] = 0;
107 dwNameMax
= sizeof(wszPath
)/sizeof(wszPath
[0]) - dwLen
- 8;
109 pMonList
= QUARTZ_CompList_Alloc();
110 if ( pMonList
== NULL
)
116 /* enumerate all subkeys. */
122 hKey
, dwIndex
, &wszPath
[dwLen
], &cbName
,
123 NULL
, NULL
, NULL
, &ftLastWrite
);
124 if ( lr
== ERROR_NO_MORE_ITEMS
)
126 if ( lr
!= ERROR_SUCCESS
)
132 hr
= QUARTZ_CreateDeviceMoniker(
133 HKEY_CLASSES_ROOT
, wszPath
, &pMon
);
137 hr
= QUARTZ_CompList_AddComp(
138 pMonList
, (IUnknown
*)pMon
, NULL
, 0 );
139 IMoniker_Release( pMon
);
147 /* create an enumerator. */
148 hr
= QUARTZ_CreateEnumUnknown(
149 &IID_IEnumMoniker
, (void**)ppobj
, pMonList
);
155 if ( pMonList
!= NULL
)
156 QUARTZ_CompList_Free( pMonList
);
162 static ICOM_VTABLE(ICreateDevEnum
) icreatedevenum
=
164 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
165 /* IUnknown fields */
166 ICreateDevEnum_fnQueryInterface
,
167 ICreateDevEnum_fnAddRef
,
168 ICreateDevEnum_fnRelease
,
169 /* ICreateDevEnum fields */
170 ICreateDevEnum_fnCreateClassEnumerator
,
173 HRESULT
CSysDevEnum_InitICreateDevEnum( CSysDevEnum
* psde
)
175 TRACE("(%p)\n",psde
);
176 ICOM_VTBL(&psde
->createdevenum
) = &icreatedevenum
;
181 void CSysDevEnum_UninitICreateDevEnum( CSysDevEnum
* psde
)
183 TRACE("(%p)\n",psde
);