DIB Engine:dont use now missing winex11.drv BitBlt and PatBlt funcs
[wine/hacks.git] / dlls / msi / regsvr.c
blob11a296524bbdc33e78a7c8566cff9d82aa0bac7c
1 /*
2 * self-registerable dll functions for msi.dll
4 * Copyright (C) 2004 Raphael Junqueira
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 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include <string.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "winreg.h"
32 #include "winerror.h"
34 #include "ole2.h"
35 #include "olectl.h"
36 #include "oleauto.h"
38 #include "wine/debug.h"
39 #include "wine/unicode.h"
41 #include "msi.h"
42 #include "initguid.h"
43 #include "msipriv.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(msi);
48 * Near the bottom of this file are the exported DllRegisterServer and
49 * DllUnregisterServer, which make all this worthwhile.
52 /***********************************************************************
53 * interface for self-registering
55 struct regsvr_interface {
56 IID const *iid; /* NULL for end of list */
57 LPCSTR name; /* can be NULL to omit */
58 IID const *base_iid; /* can be NULL to omit */
59 int num_methods; /* can be <0 to omit */
60 CLSID const *ps_clsid; /* can be NULL to omit */
61 CLSID const *ps_clsid32; /* can be NULL to omit */
64 static HRESULT register_interfaces(struct regsvr_interface const *list);
65 static HRESULT unregister_interfaces(struct regsvr_interface const *list);
67 /**
68 * @todo: maybe adding typelibs support here
69 * [Software\\Classes\\CLSID\\{000C1090-0000-0000-C000-000000000046}\\TypeLib] 1080380217
70 * @="{000C1092-0000-0000-C000-000000000046}"
72 struct regsvr_coclass {
73 CLSID const *clsid; /* NULL for end of list */
74 LPCSTR name; /* can be NULL to omit */
75 LPCSTR iph32; /* can be NULL to omit */
76 LPCSTR ips; /* can be NULL to omit */
77 LPCSTR ips32; /* can be NULL to omit */
78 LPCSTR ips32_tmodel; /* can be NULL to omit, if apartment, iph32 must be set */
79 DWORD flags;
80 LPCSTR progid; /* can be NULL to omit */
81 LPCSTR viprogid; /* can be NULL to omit */
82 LPCSTR progid_extra; /* can be NULL to omit */
83 LPCSTR dllversion; /* can be NULL to omit */
86 /* flags for regsvr_coclass.flags */
87 #define PROGID_CLSID 0x00000010
89 static HRESULT register_coclasses(struct regsvr_coclass const *list);
90 static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
92 /***********************************************************************
93 * static string constants
95 static WCHAR const interface_keyname[10] = {
96 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
97 static WCHAR const base_ifa_keyname[14] = {
98 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
99 'e', 0 };
100 static WCHAR const num_methods_keyname[11] = {
101 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
102 static WCHAR const ps_clsid_keyname[15] = {
103 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
104 'i', 'd', 0 };
105 static WCHAR const ps_clsid32_keyname[17] = {
106 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
107 'i', 'd', '3', '2', 0 };
108 static WCHAR const clsid_keyname[6] = {
109 'C', 'L', 'S', 'I', 'D', 0 };
110 static WCHAR const curver_keyname[7] = {
111 'C', 'u', 'r', 'V', 'e', 'r', 0 };
112 static WCHAR const iph32_keyname[] = {
113 'I', 'n', 'P', 'r', 'o', 'c', 'H', 'a', 'n', 'd', 'l', 'e', 'r',
114 '3', '2', 0 };
115 static WCHAR const ips_keyname[13] = {
116 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
117 0 };
118 static WCHAR const ips32_keyname[15] = {
119 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
120 '3', '2', 0 };
121 static WCHAR const progid_keyname[7] = {
122 'P', 'r', 'o', 'g', 'I', 'D', 0 };
123 static WCHAR const viprogid_keyname[25] = {
124 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
125 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
126 0 };
127 static WCHAR const dllversion_keyname[11] = {
128 'D', 'l', 'l', 'V', 'e', 'r', 's', 'i', 'o', 'n', 0 };
129 static char const tmodel_valuename[] = "ThreadingModel";
131 /***********************************************************************
132 * static helper functions
134 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
135 static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
136 WCHAR const *value);
137 static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
138 char const *value);
139 static LONG register_progid(WCHAR const *clsid,
140 char const *progid, char const *curver_progid,
141 char const *name, char const *extra);
143 /***********************************************************************
144 * register_interfaces
146 static HRESULT register_interfaces(struct regsvr_interface const *list) {
147 LONG res = ERROR_SUCCESS;
148 HKEY interface_key;
150 res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
151 KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
152 if (res != ERROR_SUCCESS) goto error_return;
154 for (; res == ERROR_SUCCESS && list->iid; ++list) {
155 WCHAR buf[39];
156 HKEY iid_key;
158 StringFromGUID2(list->iid, buf, 39);
159 res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
160 KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
161 if (res != ERROR_SUCCESS) goto error_close_interface_key;
163 if (list->name) {
164 res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
165 (CONST BYTE*)(list->name),
166 strlen(list->name) + 1);
167 if (res != ERROR_SUCCESS) goto error_close_iid_key;
170 if (list->base_iid) {
171 res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
172 if (res != ERROR_SUCCESS) goto error_close_iid_key;
175 if (0 <= list->num_methods) {
176 static WCHAR const fmt[3] = { '%', 'd', 0 };
177 HKEY key;
179 res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
180 KEY_READ | KEY_WRITE, NULL, &key, NULL);
181 if (res != ERROR_SUCCESS) goto error_close_iid_key;
183 sprintfW(buf, fmt, list->num_methods);
184 res = RegSetValueExW(key, NULL, 0, REG_SZ,
185 (CONST BYTE*)buf,
186 (lstrlenW(buf) + 1) * sizeof(WCHAR));
187 RegCloseKey(key);
189 if (res != ERROR_SUCCESS) goto error_close_iid_key;
192 if (list->ps_clsid) {
193 res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
194 if (res != ERROR_SUCCESS) goto error_close_iid_key;
197 if (list->ps_clsid32) {
198 res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
199 if (res != ERROR_SUCCESS) goto error_close_iid_key;
202 error_close_iid_key:
203 RegCloseKey(iid_key);
206 error_close_interface_key:
207 RegCloseKey(interface_key);
208 error_return:
209 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
212 /***********************************************************************
213 * unregister_interfaces
215 static HRESULT unregister_interfaces(struct regsvr_interface const *list) {
216 LONG res = ERROR_SUCCESS;
217 HKEY interface_key;
219 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
220 KEY_READ | KEY_WRITE, &interface_key);
221 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
222 if (res != ERROR_SUCCESS) goto error_return;
224 for (; res == ERROR_SUCCESS && list->iid; ++list) {
225 WCHAR buf[39];
227 StringFromGUID2(list->iid, buf, 39);
228 res = RegDeleteTreeW(interface_key, buf);
229 if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
232 RegCloseKey(interface_key);
233 error_return:
234 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
237 /***********************************************************************
238 * register_coclasses
240 static HRESULT register_coclasses(struct regsvr_coclass const *list) {
241 LONG res = ERROR_SUCCESS;
242 HKEY coclass_key;
244 res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
245 KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
246 if (res != ERROR_SUCCESS) goto error_return;
248 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
249 WCHAR buf[39];
250 HKEY clsid_key;
252 StringFromGUID2(list->clsid, buf, 39);
253 res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
254 KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
255 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
257 if (list->name) {
258 res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
259 (CONST BYTE*)(list->name),
260 strlen(list->name) + 1);
261 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
264 if (list->iph32) {
265 HKEY iph32_key;
267 res = RegCreateKeyExW(clsid_key, iph32_keyname, 0, NULL, 0,
268 KEY_READ | KEY_WRITE, NULL,
269 &iph32_key, NULL);
270 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
272 res = RegSetValueExA(iph32_key, NULL, 0, REG_SZ,
273 (CONST BYTE*)list->iph32,
274 lstrlenA(list->iph32) + 1);
275 RegCloseKey(iph32_key);
276 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
279 if (list->ips) {
280 res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
281 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
284 if (list->ips32) {
285 HKEY ips32_key;
287 res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
288 KEY_READ | KEY_WRITE, NULL,
289 &ips32_key, NULL);
290 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
292 res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
293 (CONST BYTE*)list->ips32,
294 lstrlenA(list->ips32) + 1);
295 if (res == ERROR_SUCCESS && list->ips32_tmodel)
296 res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
297 (CONST BYTE*)list->ips32_tmodel,
298 strlen(list->ips32_tmodel) + 1);
299 RegCloseKey(ips32_key);
300 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
303 if (list->progid) {
304 res = register_key_defvalueA(clsid_key, progid_keyname,
305 list->progid);
306 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
308 res = register_progid(list->flags & PROGID_CLSID ? buf : NULL,
309 list->progid, NULL,
310 list->name, list->progid_extra);
311 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
314 if (list->viprogid) {
315 res = register_key_defvalueA(clsid_key, viprogid_keyname,
316 list->viprogid);
317 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
319 res = register_progid(list->flags & PROGID_CLSID ? buf : NULL,
320 list->viprogid, list->progid,
321 list->name, list->progid_extra);
322 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
325 if (list->dllversion) {
326 HKEY dllver_key;
328 res = RegCreateKeyExW(clsid_key, dllversion_keyname, 0, NULL, 0,
329 KEY_READ | KEY_WRITE, NULL,
330 &dllver_key, NULL);
331 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
333 res = RegSetValueExA(dllver_key, NULL, 0, REG_SZ,
334 (CONST BYTE*)list->dllversion,
335 lstrlenA(list->dllversion) + 1);
336 RegCloseKey(dllver_key);
337 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
341 error_close_clsid_key:
342 RegCloseKey(clsid_key);
345 error_close_coclass_key:
346 RegCloseKey(coclass_key);
347 error_return:
348 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
351 /***********************************************************************
352 * unregister_coclasses
354 static HRESULT unregister_coclasses(struct regsvr_coclass const *list) {
355 LONG res = ERROR_SUCCESS;
356 HKEY coclass_key;
358 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
359 KEY_READ | KEY_WRITE, &coclass_key);
360 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
361 if (res != ERROR_SUCCESS) goto error_return;
363 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
364 WCHAR buf[39];
366 StringFromGUID2(list->clsid, buf, 39);
367 res = RegDeleteTreeW(coclass_key, buf);
368 if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
369 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
371 if (list->progid) {
372 res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
373 if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
374 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
377 if (list->viprogid) {
378 res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
379 if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
380 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
384 error_close_coclass_key:
385 RegCloseKey(coclass_key);
386 error_return:
387 return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
390 /***********************************************************************
391 * regsvr_key_guid
393 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) {
394 WCHAR buf[39];
396 StringFromGUID2(guid, buf, 39);
397 return register_key_defvalueW(base, name, buf);
400 /***********************************************************************
401 * regsvr_key_defvalueW
403 static LONG register_key_defvalueW(
404 HKEY base,
405 WCHAR const *name,
406 WCHAR const *value) {
407 LONG res;
408 HKEY key;
410 res = RegCreateKeyExW(base, name, 0, NULL, 0,
411 KEY_READ | KEY_WRITE, NULL, &key, NULL);
412 if (res != ERROR_SUCCESS) return res;
413 res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
414 (lstrlenW(value) + 1) * sizeof(WCHAR));
415 RegCloseKey(key);
416 return res;
419 /***********************************************************************
420 * regsvr_key_defvalueA
422 static LONG register_key_defvalueA(
423 HKEY base,
424 WCHAR const *name,
425 char const *value) {
426 LONG res;
427 HKEY key;
429 res = RegCreateKeyExW(base, name, 0, NULL, 0,
430 KEY_READ | KEY_WRITE, NULL, &key, NULL);
431 if (res != ERROR_SUCCESS) return res;
432 res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
433 lstrlenA(value) + 1);
434 RegCloseKey(key);
435 return res;
438 /***********************************************************************
439 * regsvr_progid
441 static LONG register_progid(
442 WCHAR const *clsid,
443 char const *progid,
444 char const *curver_progid,
445 char const *name,
446 char const *extra) {
447 LONG res;
448 HKEY progid_key;
450 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
451 NULL, 0, KEY_READ | KEY_WRITE, NULL,
452 &progid_key, NULL);
453 if (res != ERROR_SUCCESS) return res;
455 if (name) {
456 res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
457 (CONST BYTE*)name, strlen(name) + 1);
458 if (res != ERROR_SUCCESS) goto error_close_progid_key;
461 if (clsid) {
462 res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
463 if (res != ERROR_SUCCESS) goto error_close_progid_key;
466 if (curver_progid) {
467 res = register_key_defvalueA(progid_key, curver_keyname,
468 curver_progid);
469 if (res != ERROR_SUCCESS) goto error_close_progid_key;
472 if (extra) {
473 HKEY extra_key;
475 res = RegCreateKeyExA(progid_key, extra, 0,
476 NULL, 0, KEY_READ | KEY_WRITE, NULL,
477 &extra_key, NULL);
478 if (res == ERROR_SUCCESS)
479 RegCloseKey(extra_key);
482 error_close_progid_key:
483 RegCloseKey(progid_key);
484 return res;
487 /***********************************************************************
488 * coclass list
490 static struct regsvr_coclass const coclass_list[] = {
492 &CLSID_IMsiServer,
493 "Msi install server",
494 "ole32.dll",
495 NULL,
496 "msi.dll",
497 "Apartment",
498 PROGID_CLSID,
499 "IMsiServer",
500 NULL,
501 NULL,
502 NULL
505 &CLSID_IMsiServerMessage,
506 "Wine Installer Message RPC",
507 NULL,
508 NULL,
509 "msi.dll",
510 NULL,
511 PROGID_CLSID,
512 "WindowsInstaller.Message",
513 NULL,
514 NULL,
515 "3.1.4000"
518 &CLSID_IMsiServerX1,
519 "Msi install server",
520 "ole32.dll",
521 NULL,
522 "msi.dll",
523 "Apartment",
525 "WindowsInstaller.Installer",
526 NULL,
527 NULL,
528 NULL
531 &CLSID_IMsiServerX2,
532 "Msi install server",
533 "ole32.dll",
534 NULL,
535 "msi.dll",
536 "Apartment",
537 PROGID_CLSID,
538 "WindowsInstaller.Installer",
539 NULL,
540 NULL,
541 NULL
544 &CLSID_IMsiServerX3,
545 "Msi install server",
546 "ole32.dll",
547 NULL,
548 "msi.dll",
549 "Apartment",
551 "WindowsInstaller.Installer",
552 NULL,
553 NULL,
554 NULL
556 { NULL } /* list terminator */
559 /***********************************************************************
560 * interface list
563 * we should declare: (@see ole32/regsvr.c for examples)
564 [-HKEY_CLASSES_ROOT\Interface\{000C101D-0000-0000-C000-000000000046}]
565 [-HKEY_CLASSES_ROOT\Interface\{000C1025-0000-0000-C000-000000000046}]
566 [-HKEY_CLASSES_ROOT\Interface\{000C1033-0000-0000-C000-000000000046}]
567 [-HKEY_CLASSES_ROOT\Interface\{000C1090-0000-0000-C000-000000000046}]
568 [-HKEY_CLASSES_ROOT\Interface\{000C1093-0000-0000-C000-000000000046}]
569 [-HKEY_CLASSES_ROOT\Interface\{000C1095-0000-0000-C000-000000000046}]
570 [-HKEY_CLASSES_ROOT\Interface\{000C109A-0000-0000-C000-000000000046}]
571 [-HKEY_CLASSES_ROOT\Interface\{000C109B-0000-0000-C000-000000000046}]
572 [-HKEY_CLASSES_ROOT\Interface\{000C109C-0000-0000-C000-000000000046}]
573 [-HKEY_CLASSES_ROOT\Interface\{000C109D-0000-0000-C000-000000000046}]
574 [-HKEY_CLASSES_ROOT\Interface\{000C109E-0000-0000-C000-000000000046}]
575 [-HKEY_CLASSES_ROOT\Interface\{000C109F-0000-0000-C000-000000000046}]
578 static struct regsvr_interface const interface_list[] = {
579 { &CLSID_IMsiServer,
580 "IMsiServer",
581 NULL,
583 NULL,
584 NULL },
585 { NULL } /* list terminator */
588 static HRESULT register_msiexec(void)
590 static const WCHAR key[] = {
591 'S','o','f','t','w','a','r','e',
592 '\\','M','i','c','r','o','s','o','f','t',
593 '\\','W','i','n','d','o','w','s',
594 '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
595 '\\','I','n','s','t','a','l','l','e','r',0 };
596 static const WCHAR val[] = {
597 'I','n','s','t','a','l','l','e','r','L','o','c','a','t','i','o','n',0 };
598 WCHAR path[MAX_PATH];
599 HKEY hkey;
600 LONG res;
601 INT len;
603 len = GetSystemDirectoryW(path, MAX_PATH);
604 if (!len || len > MAX_PATH)
605 return E_FAIL;
607 res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, key, 0,
608 NULL, 0, KEY_READ | KEY_WRITE, NULL,
609 &hkey, NULL);
610 if (res != ERROR_SUCCESS)
611 return E_FAIL;
613 res = RegSetValueExW(hkey, val, 0, REG_SZ,
614 (BYTE*)path, (len + 1)*sizeof(WCHAR));
616 RegCloseKey(hkey);
618 return (res == ERROR_SUCCESS) ? S_OK : E_FAIL;
621 /***********************************************************************
622 * DllRegisterServer (MSI.@)
624 HRESULT WINAPI DllRegisterServer(void)
626 LPWSTR path = NULL;
627 ITypeLib *tl;
628 HRESULT hr;
630 TRACE("\n");
632 hr = register_coclasses(coclass_list);
633 if (SUCCEEDED(hr))
634 hr = register_interfaces(interface_list);
635 if (SUCCEEDED(hr))
636 hr = register_msiexec();
638 tl = get_msi_typelib( &path );
639 if (tl)
641 hr = RegisterTypeLib( tl, path, NULL );
642 ITypeLib_Release( tl );
644 else
645 hr = E_FAIL;
647 return hr;
650 /***********************************************************************
651 * DllUnregisterServer (MSI.@)
653 HRESULT WINAPI DllUnregisterServer(void)
655 HRESULT hr;
657 TRACE("\n");
659 hr = unregister_coclasses(coclass_list);
660 if (SUCCEEDED(hr))
661 hr = unregister_interfaces(interface_list);
662 return hr;