af5333a2fc2afdf210efc965b3752522baf6a5b8
[reactos.git] / reactos / lib / urlmon / regsvr.c
1 /*
2 * self-registerable dll functions for urlmon.dll
3 *
4 * Copyright (C) 2003 John K. Hohm
5 *
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.
10 *
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.
15 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #define COM_NO_WINDOWS_H
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <string.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "wingdi.h"
30 #include "winreg.h"
31 #include "winerror.h"
32 #include "advpub.h"
33
34 #include "objbase.h"
35
36 #include "urlmon.h"
37
38 #include "wine/debug.h"
39
40 #include "initguid.h"
41 #include "urlmon_main.h"
42
43 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
44
45 /*
46 * Near the bottom of this file are the exported DllRegisterServer and
47 * DllUnregisterServer, which make all this worthwhile.
48 */
49
50 /***********************************************************************
51 * interface for self-registering
52 */
53 struct regsvr_interface
54 {
55 IID const *iid; /* NULL for end of list */
56 LPCSTR name; /* can be NULL to omit */
57 IID const *base_iid; /* can be NULL to omit */
58 int num_methods; /* can be <0 to omit */
59 CLSID const *ps_clsid; /* can be NULL to omit */
60 CLSID const *ps_clsid32; /* can be NULL to omit */
61 };
62
63 static HRESULT register_interfaces(struct regsvr_interface const *list);
64 static HRESULT unregister_interfaces(struct regsvr_interface const *list);
65
66 struct regsvr_coclass
67 {
68 CLSID const *clsid; /* NULL for end of list */
69 LPCSTR name; /* can be NULL to omit */
70 LPCSTR ips; /* can be NULL to omit */
71 LPCSTR ips32; /* can be NULL to omit */
72 LPCSTR ips32_tmodel; /* can be NULL to omit */
73 LPCSTR progid; /* can be NULL to omit */
74 LPCSTR viprogid; /* can be NULL to omit */
75 LPCSTR progid_extra; /* can be NULL to omit */
76 };
77
78 static HRESULT register_coclasses(struct regsvr_coclass const *list);
79 static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
80
81 /***********************************************************************
82 * static string constants
83 */
84 static WCHAR const interface_keyname[10] = {
85 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
86 static WCHAR const base_ifa_keyname[14] = {
87 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
88 'e', 0 };
89 static WCHAR const num_methods_keyname[11] = {
90 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
91 static WCHAR const ps_clsid_keyname[15] = {
92 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
93 'i', 'd', 0 };
94 static WCHAR const ps_clsid32_keyname[17] = {
95 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
96 'i', 'd', '3', '2', 0 };
97 static WCHAR const clsid_keyname[6] = {
98 'C', 'L', 'S', 'I', 'D', 0 };
99 static WCHAR const curver_keyname[7] = {
100 'C', 'u', 'r', 'V', 'e', 'r', 0 };
101 static WCHAR const ips_keyname[13] = {
102 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
103 0 };
104 static WCHAR const ips32_keyname[15] = {
105 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
106 '3', '2', 0 };
107 static WCHAR const progid_keyname[7] = {
108 'P', 'r', 'o', 'g', 'I', 'D', 0 };
109 static WCHAR const viprogid_keyname[25] = {
110 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
111 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
112 0 };
113 static char const tmodel_valuename[] = "ThreadingModel";
114
115 /***********************************************************************
116 * static helper functions
117 */
118 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
119 static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
120 WCHAR const *value);
121 static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
122 char const *value);
123 static LONG register_progid(WCHAR const *clsid,
124 char const *progid, char const *curver_progid,
125 char const *name, char const *extra);
126 static LONG recursive_delete_key(HKEY key);
127 static LONG recursive_delete_keyA(HKEY base, char const *name);
128 static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
129
130 /***********************************************************************
131 * register_interfaces
132 */
133 static HRESULT register_interfaces(struct regsvr_interface const *list)
134 {
135 LONG res = ERROR_SUCCESS;
136 HKEY interface_key;
137
138 res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
139 KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
140 if (res != ERROR_SUCCESS) goto error_return;
141
142 for (; res == ERROR_SUCCESS && list->iid; ++list) {
143 WCHAR buf[39];
144 HKEY iid_key;
145
146 StringFromGUID2(list->iid, buf, 39);
147 res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
148 KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
149 if (res != ERROR_SUCCESS) goto error_close_interface_key;
150
151 if (list->name) {
152 res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
153 (CONST BYTE*)(list->name),
154 strlen(list->name) + 1);
155 if (res != ERROR_SUCCESS) goto error_close_iid_key;
156 }
157
158 if (list->base_iid) {
159 register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
160 if (res != ERROR_SUCCESS) goto error_close_iid_key;
161 }
162
163 if (0 <= list->num_methods) {
164 static WCHAR const fmt[3] = { '%', 'd', 0 };
165 HKEY key;
166
167 res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
168 KEY_READ | KEY_WRITE, NULL, &key, NULL);
169 if (res != ERROR_SUCCESS) goto error_close_iid_key;
170
171 wsprintfW(buf, fmt, list->num_methods);
172 res = RegSetValueExW(key, NULL, 0, REG_SZ,
173 (CONST BYTE*)buf,
174 (lstrlenW(buf) + 1) * sizeof(WCHAR));
175 RegCloseKey(key);
176
177 if (res != ERROR_SUCCESS) goto error_close_iid_key;
178 }
179
180 if (list->ps_clsid) {
181 register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
182 if (res != ERROR_SUCCESS) goto error_close_iid_key;
183 }
184
185 if (list->ps_clsid32) {
186 register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
187 if (res != ERROR_SUCCESS) goto error_close_iid_key;
188 }
189
190 error_close_iid_key:
191 RegCloseKey(iid_key);
192 }
193
194 error_close_interface_key:
195 RegCloseKey(interface_key);
196 error_return:
197 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
198 }
199
200 /***********************************************************************
201 * unregister_interfaces
202 */
203 static HRESULT unregister_interfaces(struct regsvr_interface const *list)
204 {
205 LONG res = ERROR_SUCCESS;
206 HKEY interface_key;
207
208 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
209 KEY_READ | KEY_WRITE, &interface_key);
210 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
211 if (res != ERROR_SUCCESS) goto error_return;
212
213 for (; res == ERROR_SUCCESS && list->iid; ++list) {
214 WCHAR buf[39];
215
216 StringFromGUID2(list->iid, buf, 39);
217 res = recursive_delete_keyW(interface_key, buf);
218 }
219
220 RegCloseKey(interface_key);
221 error_return:
222 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
223 }
224
225 /***********************************************************************
226 * register_coclasses
227 */
228 static HRESULT register_coclasses(struct regsvr_coclass const *list)
229 {
230 LONG res = ERROR_SUCCESS;
231 HKEY coclass_key;
232
233 res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
234 KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
235 if (res != ERROR_SUCCESS) goto error_return;
236
237 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
238 WCHAR buf[39];
239 HKEY clsid_key;
240
241 StringFromGUID2(list->clsid, buf, 39);
242 res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
243 KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
244 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
245
246 if (list->name) {
247 res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
248 (CONST BYTE*)(list->name),
249 strlen(list->name) + 1);
250 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
251 }
252
253 if (list->ips) {
254 res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
255 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
256 }
257
258 if (list->ips32) {
259 HKEY ips32_key;
260
261 res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
262 KEY_READ | KEY_WRITE, NULL,
263 &ips32_key, NULL);
264 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
265
266 res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
267 (CONST BYTE*)list->ips32,
268 lstrlenA(list->ips32) + 1);
269 if (res == ERROR_SUCCESS && list->ips32_tmodel)
270 res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
271 (CONST BYTE*)list->ips32_tmodel,
272 strlen(list->ips32_tmodel) + 1);
273 RegCloseKey(ips32_key);
274 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
275 }
276
277 if (list->progid) {
278 res = register_key_defvalueA(clsid_key, progid_keyname,
279 list->progid);
280 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
281
282 res = register_progid(buf, list->progid, NULL,
283 list->name, list->progid_extra);
284 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
285 }
286
287 if (list->viprogid) {
288 res = register_key_defvalueA(clsid_key, viprogid_keyname,
289 list->viprogid);
290 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
291
292 res = register_progid(buf, list->viprogid, list->progid,
293 list->name, list->progid_extra);
294 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
295 }
296
297 error_close_clsid_key:
298 RegCloseKey(clsid_key);
299 }
300
301 error_close_coclass_key:
302 RegCloseKey(coclass_key);
303 error_return:
304 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
305 }
306
307 /***********************************************************************
308 * unregister_coclasses
309 */
310 static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
311 {
312 LONG res = ERROR_SUCCESS;
313 HKEY coclass_key;
314
315 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
316 KEY_READ | KEY_WRITE, &coclass_key);
317 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
318 if (res != ERROR_SUCCESS) goto error_return;
319
320 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
321 WCHAR buf[39];
322
323 StringFromGUID2(list->clsid, buf, 39);
324 res = recursive_delete_keyW(coclass_key, buf);
325 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
326
327 if (list->progid) {
328 res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
329 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
330 }
331
332 if (list->viprogid) {
333 res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid);
334 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
335 }
336 }
337
338 error_close_coclass_key:
339 RegCloseKey(coclass_key);
340 error_return:
341 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
342 }
343
344 /***********************************************************************
345 * regsvr_key_guid
346 */
347 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
348 {
349 WCHAR buf[39];
350
351 StringFromGUID2(guid, buf, 39);
352 return register_key_defvalueW(base, name, buf);
353 }
354
355 /***********************************************************************
356 * regsvr_key_defvalueW
357 */
358 static LONG register_key_defvalueW(
359 HKEY base,
360 WCHAR const *name,
361 WCHAR const *value)
362 {
363 LONG res;
364 HKEY key;
365
366 res = RegCreateKeyExW(base, name, 0, NULL, 0,
367 KEY_READ | KEY_WRITE, NULL, &key, NULL);
368 if (res != ERROR_SUCCESS) return res;
369 res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
370 (lstrlenW(value) + 1) * sizeof(WCHAR));
371 RegCloseKey(key);
372 return res;
373 }
374
375 /***********************************************************************
376 * regsvr_key_defvalueA
377 */
378 static LONG register_key_defvalueA(
379 HKEY base,
380 WCHAR const *name,
381 char const *value)
382 {
383 LONG res;
384 HKEY key;
385
386 res = RegCreateKeyExW(base, name, 0, NULL, 0,
387 KEY_READ | KEY_WRITE, NULL, &key, NULL);
388 if (res != ERROR_SUCCESS) return res;
389 res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
390 lstrlenA(value) + 1);
391 RegCloseKey(key);
392 return res;
393 }
394
395 /***********************************************************************
396 * regsvr_progid
397 */
398 static LONG register_progid(
399 WCHAR const *clsid,
400 char const *progid,
401 char const *curver_progid,
402 char const *name,
403 char const *extra)
404 {
405 LONG res;
406 HKEY progid_key;
407
408 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
409 NULL, 0, KEY_READ | KEY_WRITE, NULL,
410 &progid_key, NULL);
411 if (res != ERROR_SUCCESS) return res;
412
413 if (name) {
414 res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
415 (CONST BYTE*)name, strlen(name) + 1);
416 if (res != ERROR_SUCCESS) goto error_close_progid_key;
417 }
418
419 if (clsid) {
420 res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
421 if (res != ERROR_SUCCESS) goto error_close_progid_key;
422 }
423
424 if (curver_progid) {
425 res = register_key_defvalueA(progid_key, curver_keyname,
426 curver_progid);
427 if (res != ERROR_SUCCESS) goto error_close_progid_key;
428 }
429
430 if (extra) {
431 HKEY extra_key;
432
433 res = RegCreateKeyExA(progid_key, extra, 0,
434 NULL, 0, KEY_READ | KEY_WRITE, NULL,
435 &extra_key, NULL);
436 if (res == ERROR_SUCCESS)
437 RegCloseKey(extra_key);
438 }
439
440 error_close_progid_key:
441 RegCloseKey(progid_key);
442 return res;
443 }
444
445 /***********************************************************************
446 * recursive_delete_key
447 */
448 static LONG recursive_delete_key(HKEY key)
449 {
450 LONG res;
451 WCHAR subkey_name[MAX_PATH];
452 DWORD cName;
453 HKEY subkey;
454
455 for (;;) {
456 cName = sizeof(subkey_name) / sizeof(WCHAR);
457 res = RegEnumKeyExW(key, 0, subkey_name, &cName,
458 NULL, NULL, NULL, NULL);
459 if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
460 res = ERROR_SUCCESS; /* presumably we're done enumerating */
461 break;
462 }
463 res = RegOpenKeyExW(key, subkey_name, 0,
464 KEY_READ | KEY_WRITE, &subkey);
465 if (res == ERROR_FILE_NOT_FOUND) continue;
466 if (res != ERROR_SUCCESS) break;
467
468 res = recursive_delete_key(subkey);
469 RegCloseKey(subkey);
470 if (res != ERROR_SUCCESS) break;
471 }
472
473 if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
474 return res;
475 }
476
477 /***********************************************************************
478 * recursive_delete_keyA
479 */
480 static LONG recursive_delete_keyA(HKEY base, char const *name)
481 {
482 LONG res;
483 HKEY key;
484
485 res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
486 if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
487 if (res != ERROR_SUCCESS) return res;
488 res = recursive_delete_key(key);
489 RegCloseKey(key);
490 return res;
491 }
492
493 /***********************************************************************
494 * recursive_delete_keyW
495 */
496 static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
497 {
498 LONG res;
499 HKEY key;
500
501 res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
502 if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
503 if (res != ERROR_SUCCESS) return res;
504 res = recursive_delete_key(key);
505 RegCloseKey(key);
506 return res;
507 }
508
509 /***********************************************************************
510 * coclass list
511 */
512 static struct regsvr_coclass const coclass_list[] = {
513 { &CLSID_StdURLMoniker,
514 "URL Moniker",
515 NULL,
516 "urlmon.dll",
517 "Apartment"
518 },
519 { &CLSID_CdlProtocol,
520 "CDL: Asynchronous Pluggable Protocol Handler",
521 NULL,
522 "urlmon.dll",
523 "Apartment"
524 },
525 { &CLSID_FileProtocol,
526 "file:, local: Asynchronous Pluggable Protocol Handler",
527 NULL,
528 "urlmon.dll",
529 "Apartment"
530 },
531 { &CLSID_FtpProtocol,
532 "ftp: Asynchronous Pluggable Protocol Handler",
533 NULL,
534 "urlmon.dll",
535 "Apartment"
536 },
537 { &CLSID_GopherProtocol,
538 "gopher: Asynchronous Pluggable Protocol Handler",
539 NULL,
540 "urlmon.dll",
541 "Apartment"
542 },
543 { &CLSID_HttpProtocol,
544 "http: Asynchronous Pluggable Protocol Handler",
545 NULL,
546 "urlmon.dll",
547 "Apartment"
548 },
549 { &CLSID_HttpsProtocol,
550 "https: Asynchronous Pluggable Protocol Handler",
551 NULL,
552 "urlmon.dll",
553 "Apartment"
554 },
555 { &CLSID_MkProtocol,
556 "mk: Asynchronous Pluggable Protocol Handler",
557 NULL,
558 "urlmon.dll",
559 "Apartment"
560 },
561 { NULL } /* list terminator */
562 };
563
564 /***********************************************************************
565 * interface list
566 */
567
568 static struct regsvr_interface const interface_list[] = {
569 { NULL } /* list terminator */
570 };
571
572 /***********************************************************************
573 * register_inf
574 */
575
576 #define INF_SET_CLSID(clsid) \
577 pse[i].pszName = "CLSID_" #clsid; \
578 clsids[i++] = &CLSID_ ## clsid;
579
580 static HRESULT register_inf(BOOL doregister)
581 {
582 HRESULT hres;
583 HMODULE hAdvpack;
584 typeof(RegInstall) *pRegInstall;
585 STRTABLE strtable;
586 STRENTRY pse[7];
587 static CLSID const *clsids[34];
588 int i = 0;
589
590 static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
591
592 INF_SET_CLSID(CdlProtocol);
593 INF_SET_CLSID(FileProtocol);
594 INF_SET_CLSID(FtpProtocol);
595 INF_SET_CLSID(GopherProtocol);
596 INF_SET_CLSID(HttpProtocol);
597 INF_SET_CLSID(HttpsProtocol);
598 INF_SET_CLSID(MkProtocol);
599
600 for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) {
601 pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39);
602 sprintf(pse[i].pszValue, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
603 clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0],
604 clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4],
605 clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]);
606 }
607
608 strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
609 strtable.pse = pse;
610
611 hAdvpack = LoadLibraryW(wszAdvpack);
612 pRegInstall = (typeof(RegInstall)*)GetProcAddress(hAdvpack, "RegInstall");
613
614 hres = pRegInstall(URLMON_hInstance, doregister ? "RegisterDll" : "UnregisterDll", &strtable);
615
616 for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
617 HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
618
619 return hres;
620 }
621
622 #undef INF_SET_CLSID
623
624 /***********************************************************************
625 * DllRegisterServer (URLMON.@)
626 */
627 HRESULT WINAPI URLMON_DllRegisterServer(void)
628 {
629 HRESULT hr;
630
631 TRACE("\n");
632
633 hr = register_coclasses(coclass_list);
634 if (SUCCEEDED(hr))
635 hr = register_interfaces(interface_list);
636 if(FAILED(hr))
637 return hr;
638 return register_inf(TRUE);
639 }
640
641 /***********************************************************************
642 * DllUnregisterServer (URLMON.@)
643 */
644 HRESULT WINAPI URLMON_DllUnregisterServer(void)
645 {
646 HRESULT hr;
647
648 TRACE("\n");
649
650 hr = unregister_coclasses(coclass_list);
651 if (SUCCEEDED(hr))
652 hr = unregister_interfaces(interface_list);
653 if(FAILED(hr))
654 return hr;
655 return register_inf(FALSE);
656 }