Changeset 6952 for trunk/src/quartz/devenum.c
- Timestamp:
- Oct 6, 2001, 10:56:18 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/quartz/devenum.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/quartz/devenum.c
r6710 r6952 2 2 * Implementation of CLSID_SystemDeviceEnum. 3 3 * 4 * FIXME - stub.4 * FIXME - not tested enough. 5 5 * 6 6 * hidenori@a2.ctktv.ne.jp … … 12 12 #include "winbase.h" 13 13 #include "wingdi.h" 14 #include "winuser.h" 15 #include "winreg.h" 14 16 #include "winerror.h" 15 17 #include "wine/obj_base.h" 16 #include "wine/obj_oleaut.h" 18 #include "objidl.h" 19 #include "oleidl.h" 20 #include "ocidl.h" 17 21 #include "strmif.h" 18 22 #include "control.h" 19 23 #include "uuids.h" 24 #include "wine/unicode.h" 20 25 21 26 #include "debugtools.h" … … 24 29 #include "quartz_private.h" 25 30 #include "devenum.h" 31 #include "regsvr.h" 32 #include "enumunk.h" 33 #include "complist.h" 34 #include "devmon.h" 35 36 37 /*************************************************************************** 38 * 39 * new/delete for CLSID_SystemDeviceEnum 40 * 41 */ 26 42 27 43 /* can I use offsetof safely? - FIXME? */ … … 68 84 } 69 85 86 87 /*************************************************************************** 88 * 89 * CSysDevEnum::ICreateDevEnum 90 * 91 */ 92 93 94 static HRESULT WINAPI 95 ICreateDevEnum_fnQueryInterface(ICreateDevEnum* iface,REFIID riid,void** ppobj) 96 { 97 CSysDevEnum_THIS(iface,createdevenum); 98 99 TRACE("(%p)->()\n",This); 100 101 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 102 } 103 104 static ULONG WINAPI 105 ICreateDevEnum_fnAddRef(ICreateDevEnum* iface) 106 { 107 CSysDevEnum_THIS(iface,createdevenum); 108 109 TRACE("(%p)->()\n",This); 110 111 return IUnknown_AddRef(This->unk.punkControl); 112 } 113 114 static ULONG WINAPI 115 ICreateDevEnum_fnRelease(ICreateDevEnum* iface) 116 { 117 CSysDevEnum_THIS(iface,createdevenum); 118 119 TRACE("(%p)->()\n",This); 120 121 return IUnknown_Release(This->unk.punkControl); 122 } 123 124 static HRESULT WINAPI 125 ICreateDevEnum_fnCreateClassEnumerator(ICreateDevEnum* iface,REFCLSID rclsidDeviceClass,IEnumMoniker** ppobj, DWORD dwFlags) 126 { 127 CSysDevEnum_THIS(iface,createdevenum); 128 HRESULT hr; 129 HKEY hKey; 130 QUARTZ_CompList* pMonList; 131 IMoniker* pMon; 132 DWORD dwIndex; 133 LONG lr; 134 WCHAR wszPath[ 1024 ]; 135 DWORD dwLen; 136 DWORD dwNameMax; 137 DWORD cbName; 138 FILETIME ftLastWrite; 139 140 TRACE("(%p)->(%s,%p,%08lx)\n",This, 141 debugstr_guid(rclsidDeviceClass),ppobj,dwFlags); 142 if ( dwFlags != 0 ) 143 { 144 FIXME("unknown flags %08lx\n",dwFlags); 145 return E_NOTIMPL; 146 } 147 148 if ( ppobj == NULL ) 149 return E_POINTER; 150 *ppobj = NULL; 151 152 hr = QUARTZ_CreateCLSIDPath( 153 wszPath, sizeof(wszPath)/sizeof(wszPath[0]), 154 rclsidDeviceClass, QUARTZ_wszInstance ); 155 if ( FAILED(hr) ) 156 return hr; 157 158 if ( RegOpenKeyExW( HKEY_CLASSES_ROOT, wszPath, 159 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) 160 return E_FAIL; 161 162 dwLen = strlenW(wszPath); 163 wszPath[dwLen++] = '\\'; wszPath[dwLen] = 0; 164 dwNameMax = sizeof(wszPath)/sizeof(wszPath[0]) - dwLen - 8; 165 166 pMonList = QUARTZ_CompList_Alloc(); 167 if ( pMonList == NULL ) 168 { 169 hr = E_OUTOFMEMORY; 170 goto err; 171 } 172 173 /* enumerate all subkeys. */ 174 dwIndex = 0; 175 while ( 1 ) 176 { 177 cbName = dwNameMax; 178 lr = RegEnumKeyExW( 179 hKey, dwIndex, &wszPath[dwLen], &cbName, 180 NULL, NULL, NULL, &ftLastWrite ); 181 if ( lr == ERROR_NO_MORE_ITEMS ) 182 break; 183 if ( lr != ERROR_SUCCESS ) 184 { 185 hr = E_FAIL; 186 goto err; 187 } 188 189 hr = QUARTZ_CreateDeviceMoniker( 190 HKEY_CLASSES_ROOT, wszPath, &pMon ); 191 if ( FAILED(hr) ) 192 goto err; 193 194 hr = QUARTZ_CompList_AddComp( 195 pMonList, (IUnknown*)pMon, NULL, 0 ); 196 IMoniker_Release( pMon ); 197 198 if ( FAILED(hr) ) 199 goto err; 200 201 dwIndex ++; 202 } 203 204 /* create an enumerator. */ 205 hr = QUARTZ_CreateEnumUnknown( 206 &IID_IEnumMoniker, (void**)ppobj, pMonList ); 207 if ( FAILED(hr) ) 208 goto err; 209 210 hr = S_OK; 211 err: 212 if ( pMonList != NULL ) 213 QUARTZ_CompList_Free( pMonList ); 214 RegCloseKey( hKey ); 215 216 return hr; 217 } 218 219 static ICOM_VTABLE(ICreateDevEnum) icreatedevenum = 220 { 221 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 222 /* IUnknown fields */ 223 ICreateDevEnum_fnQueryInterface, 224 ICreateDevEnum_fnAddRef, 225 ICreateDevEnum_fnRelease, 226 /* ICreateDevEnum fields */ 227 ICreateDevEnum_fnCreateClassEnumerator, 228 }; 229 230 HRESULT CSysDevEnum_InitICreateDevEnum( CSysDevEnum* psde ) 231 { 232 TRACE("(%p)\n",psde); 233 ICOM_VTBL(&psde->createdevenum) = &icreatedevenum; 234 235 return NOERROR; 236 } 237 238 void CSysDevEnum_UninitICreateDevEnum( CSysDevEnum* psde ) 239 { 240 TRACE("(%p)\n",psde); 241 }
Note:
See TracChangeset
for help on using the changeset viewer.
