quartz: Implement stop position in the filtergraph.
[wine] / dlls / msxml3 / regsvr.c
1 /*
2  *      MSXML3 self-registerable dll functions
3  *
4  * Copyright (C) 2003 John K. Hohm
5  * Copyright (C) 2006 Robert Shearman
6  * Copyright (C) 2008 Alistair Leslie-Hughes
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "config.h"
24
25 #include <stdarg.h>
26 #include <string.h>
27
28 #define COBJMACROS
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winuser.h"
33 #include "winreg.h"
34 #include "winerror.h"
35 #include "ole2.h"
36 #include "msxml.h"
37 #include "xmldom.h"
38 #include "xmldso.h"
39 #include "msxml2.h"
40
41 /* undef the #define in msxml2 so that we can access the v.2 version
42    independent CLSID as well as the v.3 one. */
43 #undef CLSID_DOMDocument
44
45 #include "msxml_private.h"
46
47 #include "wine/debug.h"
48
49 WINE_DEFAULT_DEBUG_CHANNEL(ole);
50
51 /*
52  * Near the bottom of this file are the exported DllRegisterServer and
53  * DllUnregisterServer, which make all this worthwhile.
54  */
55
56 /***********************************************************************
57  *              interface for self-registering
58  */
59 struct regsvr_interface
60 {
61     IID const *iid;             /* NULL for end of list */
62     LPCSTR name;                /* can be NULL to omit */
63     IID const *base_iid;        /* can be NULL to omit */
64     int num_methods;            /* can be <0 to omit */
65     CLSID const *ps_clsid;      /* can be NULL to omit */
66     CLSID const *ps_clsid32;    /* can be NULL to omit */
67 };
68
69 static HRESULT register_interfaces(struct regsvr_interface const *list);
70 static HRESULT unregister_interfaces(struct regsvr_interface const *list);
71
72 struct regsvr_coclass
73 {
74     CLSID const *clsid;         /* NULL for end of list */
75     LPCSTR name;                /* 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 */
79     LPCSTR progid;              /* can be NULL to omit */
80     LPCSTR version;             /* can be NULL to omit */
81 };
82
83 static HRESULT register_coclasses(struct regsvr_coclass const *list);
84 static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
85
86 struct progid
87 {
88     LPCSTR name;                /* NULL for end of list */
89     LPCSTR description;         /* can be NULL to omit */
90     CLSID const *clsid;
91     LPCSTR curver;              /* can be NULL to omit */
92 };
93
94 static HRESULT register_progids(struct progid const *list);
95 static HRESULT unregister_progids(struct progid const *list);
96
97 /***********************************************************************
98  *              static string constants
99  */
100 static WCHAR const interface_keyname[10] = {
101     'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
102 static WCHAR const base_ifa_keyname[14] = {
103     'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
104     'e', 0 };
105 static WCHAR const num_methods_keyname[11] = {
106     'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
107 static WCHAR const ps_clsid_keyname[15] = {
108     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
109     'i', 'd', 0 };
110 static WCHAR const ps_clsid32_keyname[17] = {
111     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
112     'i', 'd', '3', '2', 0 };
113 static WCHAR const clsid_keyname[6] = {
114     'C', 'L', 'S', 'I', 'D', 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 versionindependentprogid_keyname[] = {
124     'V', 'e', 'r', 's', 'i', 'o', 'n',
125     'I', 'n', 'd', 'e', 'p', 'e', 'n', 'd', 'e', 'n', 't',
126     'P', 'r', 'o', 'g', 'I', 'D', 0 };
127 static WCHAR const version_keyname[] = {
128     'V', 'e', 'r', 's', 'i', 'o', 'n', 0 };
129 static WCHAR const curver_keyname[] = {
130     'C', 'u', 'r', 'V', 'e', 'r', 0 };
131 static char const tmodel_valuename[] = "ThreadingModel";
132
133 /***********************************************************************
134  *              static helper functions
135  */
136 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
137 static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
138                                    WCHAR const *value);
139 static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
140                                    char const *value);
141
142 /***********************************************************************
143  *              register_interfaces
144  */
145 static HRESULT register_interfaces(struct regsvr_interface const *list)
146 {
147     LONG res = ERROR_SUCCESS;
148     HKEY interface_key;
149
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;
153
154     for (; res == ERROR_SUCCESS && list->iid; ++list) {
155         WCHAR buf[39];
156         HKEY iid_key;
157
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;
162
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;
168         }
169
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;
173         }
174
175         if (0 <= list->num_methods) {
176             static WCHAR const fmt[3] = { '%', 'd', 0 };
177             HKEY key;
178
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;
182
183             wsprintfW(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);
188
189             if (res != ERROR_SUCCESS) goto error_close_iid_key;
190         }
191
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;
195         }
196
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;
200         }
201
202     error_close_iid_key:
203         RegCloseKey(iid_key);
204     }
205
206 error_close_interface_key:
207     RegCloseKey(interface_key);
208 error_return:
209     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
210 }
211
212 /***********************************************************************
213  *              unregister_interfaces
214  */
215 static HRESULT unregister_interfaces(struct regsvr_interface const *list)
216 {
217     LONG res = ERROR_SUCCESS;
218     HKEY interface_key;
219
220     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
221                         KEY_READ | KEY_WRITE, &interface_key);
222     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
223     if (res != ERROR_SUCCESS) goto error_return;
224
225     for (; res == ERROR_SUCCESS && list->iid; ++list) {
226         WCHAR buf[39];
227
228         StringFromGUID2(list->iid, buf, 39);
229         res = RegDeleteTreeW(interface_key, buf);
230         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
231     }
232
233     RegCloseKey(interface_key);
234 error_return:
235     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
236 }
237
238 /***********************************************************************
239  *              register_coclasses
240  */
241 static HRESULT register_coclasses(struct regsvr_coclass const *list)
242 {
243     LONG res = ERROR_SUCCESS;
244     HKEY coclass_key;
245
246     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
247                           KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
248     if (res != ERROR_SUCCESS) goto error_return;
249
250     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
251         WCHAR buf[39];
252         HKEY clsid_key;
253
254         StringFromGUID2(list->clsid, buf, 39);
255         res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
256                               KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
257         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
258
259         if (list->name) {
260             res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
261                                  (CONST BYTE*)(list->name),
262                                  strlen(list->name) + 1);
263             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
264         }
265
266         if (list->ips) {
267             res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
268             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
269         }
270
271         if (list->ips32) {
272             HKEY ips32_key;
273
274             res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
275                                   KEY_READ | KEY_WRITE, NULL,
276                                   &ips32_key, NULL);
277             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
278
279             res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
280                                  (CONST BYTE*)list->ips32,
281                                  lstrlenA(list->ips32) + 1);
282             if (res == ERROR_SUCCESS && list->ips32_tmodel)
283                 res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
284                                      (CONST BYTE*)list->ips32_tmodel,
285                                      strlen(list->ips32_tmodel) + 1);
286             RegCloseKey(ips32_key);
287             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
288         }
289
290         if (list->progid) {
291             char *buffer = NULL;
292             LPCSTR progid;
293
294             if (list->version) {
295                 buffer = HeapAlloc(GetProcessHeap(), 0, strlen(list->progid) + strlen(list->version) + 2);
296                 if (!buffer) {
297                     res = ERROR_OUTOFMEMORY;
298                     goto error_close_clsid_key;
299                 }
300                 strcpy(buffer, list->progid);
301                 strcat(buffer, ".");
302                 strcat(buffer, list->version);
303                 progid = buffer;
304             } else
305                 progid = list->progid;
306             res = register_key_defvalueA(clsid_key, progid_keyname,
307                                          progid);
308             HeapFree(GetProcessHeap(), 0, buffer);
309             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
310
311             if (list->version) {
312                 res = register_key_defvalueA(clsid_key, versionindependentprogid_keyname,
313                                              list->progid);
314                 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
315             }
316         }
317
318         if (list->version) {
319             res = register_key_defvalueA(clsid_key, version_keyname,
320                                          list->version);
321             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
322         }
323
324     error_close_clsid_key:
325         RegCloseKey(clsid_key);
326     }
327
328 error_close_coclass_key:
329     RegCloseKey(coclass_key);
330 error_return:
331     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
332 }
333
334 /***********************************************************************
335  *              unregister_coclasses
336  */
337 static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
338 {
339     LONG res = ERROR_SUCCESS;
340     HKEY coclass_key;
341
342     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
343                         KEY_READ | KEY_WRITE, &coclass_key);
344     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
345     if (res != ERROR_SUCCESS) goto error_return;
346
347     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
348         WCHAR buf[39];
349
350         StringFromGUID2(list->clsid, buf, 39);
351         res = RegDeleteTreeW(coclass_key, buf);
352         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
353         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
354     }
355
356 error_close_coclass_key:
357     RegCloseKey(coclass_key);
358 error_return:
359     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
360 }
361
362 /***********************************************************************
363  *              register_progids
364  */
365 static HRESULT register_progids(struct progid const *list)
366 {
367     LONG res = ERROR_SUCCESS;
368
369     for (; res == ERROR_SUCCESS && list->name; ++list) {
370         WCHAR buf[39];
371         HKEY progid_key;
372
373         res = RegCreateKeyExA(HKEY_CLASSES_ROOT, list->name, 0,
374                           NULL, 0, KEY_READ | KEY_WRITE, NULL,
375                           &progid_key, NULL);
376         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
377
378         res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
379                          (CONST BYTE*)list->description,
380                          strlen(list->description) + 1);
381         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
382
383         StringFromGUID2(list->clsid, buf, 39);
384
385         res = register_key_defvalueW(progid_key, clsid_keyname, buf);
386         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
387
388         if (list->curver) {
389             res = register_key_defvalueA(progid_key, curver_keyname, list->curver);
390             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
391         }
392
393     error_close_clsid_key:
394         RegCloseKey(progid_key);
395     }
396
397     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
398 }
399
400 /***********************************************************************
401  *              unregister_progids
402  */
403 static HRESULT unregister_progids(struct progid const *list)
404 {
405     LONG res = ERROR_SUCCESS;
406
407     for (; res == ERROR_SUCCESS && list->name; ++list) {
408         res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->name);
409         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
410     }
411
412     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
413 }
414
415 /***********************************************************************
416  *              regsvr_key_guid
417  */
418 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
419 {
420     WCHAR buf[39];
421
422     StringFromGUID2(guid, buf, 39);
423     return register_key_defvalueW(base, name, buf);
424 }
425
426 /***********************************************************************
427  *              regsvr_key_defvalueW
428  */
429 static LONG register_key_defvalueW(
430     HKEY base,
431     WCHAR const *name,
432     WCHAR const *value)
433 {
434     LONG res;
435     HKEY key;
436
437     res = RegCreateKeyExW(base, name, 0, NULL, 0,
438                           KEY_READ | KEY_WRITE, NULL, &key, NULL);
439     if (res != ERROR_SUCCESS) return res;
440     res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
441                          (lstrlenW(value) + 1) * sizeof(WCHAR));
442     RegCloseKey(key);
443     return res;
444 }
445
446 /***********************************************************************
447  *              regsvr_key_defvalueA
448  */
449 static LONG register_key_defvalueA(
450     HKEY base,
451     WCHAR const *name,
452     char const *value)
453 {
454     LONG res;
455     HKEY key;
456
457     res = RegCreateKeyExW(base, name, 0, NULL, 0,
458                           KEY_READ | KEY_WRITE, NULL, &key, NULL);
459     if (res != ERROR_SUCCESS) return res;
460     res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
461                          lstrlenA(value) + 1);
462     RegCloseKey(key);
463     return res;
464 }
465
466 /***********************************************************************
467  *              coclass list
468  */
469 static struct regsvr_coclass const coclass_list[] = {
470     {   &CLSID_DOMDocument,
471         "XML DOM Document",
472         NULL,
473         "msxml3.dll",
474         "Both",
475         "Microsoft.XMLDOM",
476         "1.0"
477     },
478     {   &CLSID_DOMDocument2,
479         "XML DOM Document",
480         NULL,
481         "msxml3.dll",
482         "Both",
483         "Msxml2.DOMDocument",
484         "3.0"
485     },
486     {   &CLSID_DOMDocument30,
487         "XML DOM Document 3.0",
488         NULL,
489         "msxml3.dll",
490         "Both",
491         "Msxml2.DOMDocument",
492         "3.0"
493     },
494     {   &CLSID_DOMFreeThreadedDocument,
495         "Free threaded XML DOM Document",
496         NULL,
497         "msxml3.dll",
498         "Both",
499         "Microsoft.FreeThreadedXMLDOM",
500         "1.0"
501     },
502     {   &CLSID_DOMFreeThreadedDocument,
503         "Free threaded XML DOM Document",
504         NULL,
505         "msxml3.dll",
506         "Both",
507         "Microsoft.FreeThreadedXMLDOM",
508         NULL
509     },
510     {   &CLSID_FreeThreadedDOMDocument,
511         "Free Threaded XML DOM Document",
512         NULL,
513         "msxml3.dll",
514         "Both",
515         "Microsoft.FreeThreadedXMLDOM.1.0",
516         "1.0"
517      },
518
519     {   &CLSID_XMLHTTPRequest,
520         "XML HTTP Request",
521         NULL,
522         "msxml3.dll",
523         "Apartment",
524         "Microsoft.XMLHTTP",
525         "1.0"
526     },
527     {   &CLSID_XMLDSOControl,
528         "XML Data Source Object",
529         NULL,
530         "msxml3.dll",
531         "Apartment",
532         "Microsoft.XMLDSO",
533         "1.0"
534     },
535     {   &CLSID_XMLDocument,
536         "Msxml",
537         NULL,
538         "msxml3.dll",
539         "Both",
540         "Msxml"
541     },
542     {   &CLSID_XMLSchemaCache,
543         "XML Schema Cache",
544         NULL,
545         "msxml3.dll",
546         "Both",
547         "Msxml2.XMLSchemaCache",
548         "3.0"
549     },
550     {   &CLSID_XMLSchemaCache30,
551         "XML Schema Cache 3.0",
552         NULL,
553         "msxml3.dll",
554         "Both",
555         "Msxml2.XMLSchemaCache",
556         "3.0"
557     },
558     {   &CLSID_SAXXMLReader,
559         "SAX XML Reader",
560         NULL,
561         "msxml3.dll",
562         "Both",
563         "Msxml2.SAXXMLReader",
564         "3.0"
565     },
566     { NULL }                    /* list terminator */
567 };
568
569 /***********************************************************************
570  *              interface list
571  */
572 static struct regsvr_interface const interface_list[] = {
573     { NULL }                    /* list terminator */
574 };
575
576 /***********************************************************************
577  *              progid list
578  */
579 static struct progid const progid_list[] = {
580     {   "Microsoft.XMLDOM",
581         "XML DOM Document",
582         &CLSID_DOMDocument,
583         "Microsoft.XMLDOM.1.0"
584     },
585     {   "Microsoft.XMLDOM.1.0",
586         "XML DOM Document",
587         &CLSID_DOMDocument,
588         NULL
589     },
590     {   "MSXML.DOMDocument",
591         "XML DOM Document",
592         &CLSID_DOMDocument,
593         "Microsoft.XMLDOM.1.0"
594     },
595     {   "Msxml2.DOMDocument",
596         "XML DOM Document",
597         &CLSID_DOMDocument2,
598         "Msxml2.DOMDocument.3.0"
599     },
600     {   "Msxml2.DOMDocument.3.0",
601         "XML DOM Document 3.0",
602         &CLSID_DOMDocument30,
603         NULL
604     },
605     {   "Microsoft.FreeThreadedXMLDOM",
606         "Free threaded XML DOM Document",
607         &CLSID_DOMFreeThreadedDocument,
608         "Microsoft.FreeThreadedXMLDOM.1.0"
609     },
610     {   "Microsoft.FreeThreadedXMLDOM.1.0",
611         "Free threaded XML DOM Document",
612         &CLSID_DOMFreeThreadedDocument,
613         NULL
614     },
615     {   "MSXML.FreeThreadedDOMDocument",
616         "Free threaded XML DOM Document",
617         &CLSID_DOMFreeThreadedDocument,
618         "Microsoft.FreeThreadedXMLDOM.1.0"
619     },
620     {   "Microsoft.XMLHTTP",
621         "XML HTTP Request",
622         &CLSID_XMLHTTPRequest,
623         "Microsoft.XMLHTTP.1.0"
624     },
625     {   "Microsoft.XMLHTTP.1.0",
626         "XML HTTP Request",
627         &CLSID_XMLHTTPRequest,
628         NULL
629     },
630     {   "Microsoft.XMLDSO",
631         "XML Data Source Object",
632         &CLSID_XMLDSOControl,
633         "Microsoft.XMLDSO.1.0"
634     },
635     {   "Microsoft.XMLDSO.1.0",
636         "XML Data Source Object",
637         &CLSID_XMLDSOControl,
638         NULL
639     },
640     {   "Msxml",
641         "Msxml",
642         &CLSID_XMLDocument,
643         NULL
644     },
645     {   "Msxml2.XMLSchemaCache",
646         "XML Schema Cache",
647         &CLSID_XMLSchemaCache,
648         "Msxml2.XMLSchemaCache.3.0"
649     },
650     {   "Msxml2.XMLSchemaCache.3.0",
651         "XML Schema Cache 3.0",
652         &CLSID_XMLSchemaCache30,
653         NULL
654     },
655
656     { NULL }                    /* list terminator */
657 };
658
659 /***********************************************************************
660  *              DllRegisterServer (OLEAUT32.@)
661  */
662 HRESULT WINAPI DllRegisterServer(void)
663 {
664     HRESULT hr;
665     ITypeLib *tl;
666     LPWSTR path = NULL;
667
668     TRACE("\n");
669
670     hr = register_coclasses(coclass_list);
671     if (SUCCEEDED(hr))
672         hr = register_interfaces(interface_list);
673     if (SUCCEEDED(hr))
674         hr = register_progids(progid_list);
675
676     tl = get_msxml3_typelib( &path );
677     if (tl)
678     {
679         hr = RegisterTypeLib( tl, path, NULL );
680         ITypeLib_Release( tl );
681     }
682     else
683         hr = E_FAIL;
684
685     return hr;
686 }
687
688 /***********************************************************************
689  *              DllUnregisterServer (OLEAUT32.@)
690  */
691 HRESULT WINAPI DllUnregisterServer(void)
692 {
693     HRESULT hr;
694
695     TRACE("\n");
696
697     hr = unregister_coclasses(coclass_list);
698     if (SUCCEEDED(hr))
699         hr = unregister_interfaces(interface_list);
700     if (SUCCEEDED(hr))
701         hr = unregister_progids(progid_list);
702         if (SUCCEEDED(hr))
703             hr = UnRegisterTypeLib(&LIBID_MSXML2, 3, 0, LOCALE_SYSTEM_DEFAULT, SYS_WIN32);
704
705     return hr;
706 }