Fix ShellExecute("\"foo.doc\"") for Internet Explorer 6.
[wine] / dlls / shell32 / regsvr.c
1 /*
2  *      self-registerable dll functions for shell32.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 #include <stdarg.h>
22 #include <string.h>
23 #include <stdio.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "winreg.h"
29 #include "winerror.h"
30
31 #include "ole2.h"
32 #include "shlguid.h"
33 #include "shell32_main.h"
34 #include "shfldr.h"
35
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(ole);
39
40 /*
41  * Near the bottom of this file are the exported DllRegisterServer and
42  * DllUnregisterServer, which make all this worthwhile.
43  */
44
45 /***********************************************************************
46  *              interface for self-registering
47  */
48 struct regsvr_interface
49 {
50     IID const *iid;             /* NULL for end of list */
51     LPCSTR name;                /* can be NULL to omit */
52     IID const *base_iid;        /* can be NULL to omit */
53     int num_methods;            /* can be <0 to omit */
54     CLSID const *ps_clsid;      /* can be NULL to omit */
55     CLSID const *ps_clsid32;    /* can be NULL to omit */
56 };
57
58 static HRESULT register_interfaces(struct regsvr_interface const *list);
59 static HRESULT unregister_interfaces(struct regsvr_interface const *list);
60
61 struct regsvr_coclass
62 {
63     CLSID const *clsid;         /* NULL for end of list */
64     LPCSTR name;                /* can be NULL to omit */
65     LPCSTR ips;                 /* can be NULL to omit */
66     LPCSTR ips32;               /* can be NULL to omit */
67     LPCSTR ips32_tmodel;        /* can be NULL to omit */
68     DWORD flags;
69     DWORD dwAttributes;
70     DWORD dwCallForAttributes;
71     LPCSTR clsid_str;           /* can be NULL to omit */
72     LPCSTR progid;              /* can be NULL to omit */
73 };
74
75 /* flags for regsvr_coclass.flags */
76 #define SHELLEX_MAYCHANGEDEFAULTMENU  0x00000001
77 #define SHELLFOLDER_WANTSFORPARSING   0x00000002
78 #define SHELLFOLDER_ATTRIBUTES        0x00000004
79 #define SHELLFOLDER_CALLFORATTRIBUTES 0x00000008
80
81 static HRESULT register_coclasses(struct regsvr_coclass const *list);
82 static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
83
84 struct regsvr_namespace
85 {
86     CLSID const *clsid; /* CLSID of the namespace extension. NULL for end of list */
87     LPCWSTR parent;     /* Mount point (MyComputer, Desktop, ..). */
88     LPCWSTR value;      /* Display name of the extension. */
89 };
90
91 static HRESULT register_namespace_extensions(struct regsvr_namespace const *list);
92 static HRESULT unregister_namespace_extensions(struct regsvr_namespace const *list);
93
94 /***********************************************************************
95  *              static string constants
96  */
97 static WCHAR const interface_keyname[10] = {
98     'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
99 static WCHAR const base_ifa_keyname[14] = {
100     'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
101     'e', 0 };
102 static WCHAR const num_methods_keyname[11] = {
103     'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
104 static WCHAR const ps_clsid_keyname[15] = {
105     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
106     'i', 'd', 0 };
107 static WCHAR const ps_clsid32_keyname[17] = {
108     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
109     'i', 'd', '3', '2', 0 };
110 static WCHAR const clsid_keyname[6] = {
111     'C', 'L', 'S', 'I', 'D', 0 };
112 static WCHAR const ips_keyname[13] = {
113     'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
114     0 };
115 static WCHAR const ips32_keyname[15] = {
116     'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
117     '3', '2', 0 };
118 static WCHAR const progid_keyname[7] = {
119     'P', 'r', 'o', 'g', 'I', 'D', 0 };
120 static WCHAR const shellex_keyname[8] = {
121     's', 'h', 'e', 'l', 'l', 'e', 'x', 0 };
122 static WCHAR const shellfolder_keyname[12] = {
123     'S', 'h', 'e', 'l', 'l', 'F', 'o', 'l', 'd', 'e', 'r', 0 };
124 static WCHAR const mcdm_keyname[21] = {
125     'M', 'a', 'y', 'C', 'h', 'a', 'n', 'g', 'e', 'D', 'e', 'f',
126     'a', 'u', 'l', 't', 'M', 'e', 'n', 'u', 0 };
127 static char const tmodel_valuename[] = "ThreadingModel";
128 static char const wfparsing_valuename[] = "WantsFORPARSING";
129 static char const attributes_valuename[] = "Attributes";
130 static char const cfattributes_valuename[] = "CallForAttributes";
131
132 /***********************************************************************
133  *              static helper functions
134  */
135 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
136 static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
137                                    WCHAR const *value);
138 static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
139                                    char const *value);
140 static LONG recursive_delete_key(HKEY key);
141 static LONG recursive_delete_keyA(HKEY base, char const *name);
142 static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
143
144 /***********************************************************************
145  *              register_interfaces
146  */
147 static HRESULT register_interfaces(struct regsvr_interface const *list)
148 {
149     LONG res = ERROR_SUCCESS;
150     HKEY interface_key;
151
152     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
153                           KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
154     if (res != ERROR_SUCCESS) goto error_return;
155
156     for (; res == ERROR_SUCCESS && list->iid; ++list) {
157         WCHAR buf[39];
158         HKEY iid_key;
159
160         StringFromGUID2(list->iid, buf, 39);
161         res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
162                               KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
163         if (res != ERROR_SUCCESS) goto error_close_interface_key;
164
165         if (list->name) {
166             res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
167                                  (CONST BYTE*)(list->name),
168                                  strlen(list->name) + 1);
169             if (res != ERROR_SUCCESS) goto error_close_iid_key;
170         }
171
172         if (list->base_iid) {
173             register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
174             if (res != ERROR_SUCCESS) goto error_close_iid_key;
175         }
176
177         if (0 <= list->num_methods) {
178             static WCHAR const fmt[3] = { '%', 'd', 0 };
179             HKEY key;
180
181             res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
182                                   KEY_READ | KEY_WRITE, NULL, &key, NULL);
183             if (res != ERROR_SUCCESS) goto error_close_iid_key;
184
185             wsprintfW(buf, fmt, list->num_methods);
186             res = RegSetValueExW(key, NULL, 0, REG_SZ,
187                                  (CONST BYTE*)buf,
188                                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
189             RegCloseKey(key);
190
191             if (res != ERROR_SUCCESS) goto error_close_iid_key;
192         }
193
194         if (list->ps_clsid) {
195             register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
196             if (res != ERROR_SUCCESS) goto error_close_iid_key;
197         }
198
199         if (list->ps_clsid32) {
200             register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
201             if (res != ERROR_SUCCESS) goto error_close_iid_key;
202         }
203
204     error_close_iid_key:
205         RegCloseKey(iid_key);
206     }
207
208 error_close_interface_key:
209     RegCloseKey(interface_key);
210 error_return:
211     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
212 }
213
214 /***********************************************************************
215  *              unregister_interfaces
216  */
217 static HRESULT unregister_interfaces(struct regsvr_interface const *list)
218 {
219     LONG res = ERROR_SUCCESS;
220     HKEY interface_key;
221
222     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
223                         KEY_READ | KEY_WRITE, &interface_key);
224     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
225     if (res != ERROR_SUCCESS) goto error_return;
226
227     for (; res == ERROR_SUCCESS && list->iid; ++list) {
228         WCHAR buf[39];
229
230         StringFromGUID2(list->iid, buf, 39);
231         res = recursive_delete_keyW(interface_key, buf);
232     }
233
234     RegCloseKey(interface_key);
235 error_return:
236     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
237 }
238
239 /***********************************************************************
240  *              register_coclasses
241  */
242 static HRESULT register_coclasses(struct regsvr_coclass const *list)
243 {
244     LONG res = ERROR_SUCCESS;
245     HKEY coclass_key;
246
247     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
248                           KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
249     if (res != ERROR_SUCCESS) goto error_return;
250
251     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
252         WCHAR buf[39];
253         HKEY clsid_key;
254
255         StringFromGUID2(list->clsid, buf, 39);
256         res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
257                               KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
258         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
259
260         if (list->name) {
261             res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
262                                  (CONST BYTE*)(list->name),
263                                  strlen(list->name) + 1);
264             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
265         }
266
267         if (list->ips) {
268             res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
269             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
270         }
271
272         if (list->ips32) {
273             HKEY ips32_key;
274
275             res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
276                                   KEY_READ | KEY_WRITE, NULL,
277                                   &ips32_key, NULL);
278             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
279
280             res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
281                                  (CONST BYTE*)list->ips32,
282                                  lstrlenA(list->ips32) + 1);
283             if (res == ERROR_SUCCESS && list->ips32_tmodel)
284                 res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
285                                      (CONST BYTE*)list->ips32_tmodel,
286                                      strlen(list->ips32_tmodel) + 1);
287             RegCloseKey(ips32_key);
288             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
289         }
290
291         if (list->flags & SHELLEX_MAYCHANGEDEFAULTMENU) {
292             HKEY shellex_key, mcdm_key;
293
294             res = RegCreateKeyExW(clsid_key, shellex_keyname, 0, NULL, 0,
295                                   KEY_READ | KEY_WRITE, NULL,
296                                   &shellex_key, NULL);
297             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
298             res = RegCreateKeyExW(shellex_key, mcdm_keyname, 0, NULL, 0,
299                                   KEY_READ | KEY_WRITE, NULL,
300                                   &mcdm_key, NULL);
301             RegCloseKey(shellex_key);
302             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
303             RegCloseKey(mcdm_key);
304         }
305
306         if (list->flags & 
307                 (SHELLFOLDER_WANTSFORPARSING|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES))
308         {
309             HKEY shellfolder_key;
310
311             res = RegCreateKeyExW(clsid_key, shellfolder_keyname, 0, NULL, 0,
312                                   KEY_READ | KEY_WRITE, NULL,
313                                   &shellfolder_key, NULL);
314             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
315             if (list->flags & SHELLFOLDER_WANTSFORPARSING)
316                 res = RegSetValueExA(shellfolder_key, wfparsing_valuename, 0, REG_SZ, "", 1);
317             if (list->flags & SHELLFOLDER_ATTRIBUTES) 
318                 res = RegSetValueExA(shellfolder_key, attributes_valuename, 0, REG_DWORD, 
319                                      (LPBYTE)&list->dwAttributes, sizeof(DWORD));
320             if (list->flags & SHELLFOLDER_CALLFORATTRIBUTES) 
321                 res = RegSetValueExA(shellfolder_key, cfattributes_valuename, 0, REG_DWORD,
322                                      (LPBYTE)&list->dwCallForAttributes, sizeof(DWORD));
323             RegCloseKey(shellfolder_key);
324             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
325         }
326
327         if (list->clsid_str) {
328             res = register_key_defvalueA(clsid_key, clsid_keyname,
329                                          list->clsid_str);
330             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
331         }
332
333         if (list->progid) {
334             HKEY progid_key;
335
336             res = register_key_defvalueA(clsid_key, progid_keyname,
337                                          list->progid);
338             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
339
340             res = RegCreateKeyExA(HKEY_CLASSES_ROOT, list->progid, 0,
341                                   NULL, 0, KEY_READ | KEY_WRITE, NULL,
342                                   &progid_key, NULL);
343             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
344
345             res = register_key_defvalueW(progid_key, clsid_keyname, buf);
346             RegCloseKey(progid_key);
347             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
348         }
349
350     error_close_clsid_key:
351         RegCloseKey(clsid_key);
352     }
353
354 error_close_coclass_key:
355     RegCloseKey(coclass_key);
356 error_return:
357     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
358 }
359
360 /***********************************************************************
361  *              unregister_coclasses
362  */
363 static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
364 {
365     LONG res = ERROR_SUCCESS;
366     HKEY coclass_key;
367
368     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
369                         KEY_READ | KEY_WRITE, &coclass_key);
370     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
371     if (res != ERROR_SUCCESS) goto error_return;
372
373     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
374         WCHAR buf[39];
375
376         StringFromGUID2(list->clsid, buf, 39);
377         res = recursive_delete_keyW(coclass_key, buf);
378         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
379
380         if (list->progid) {
381             res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
382             if (res != ERROR_SUCCESS) goto error_close_coclass_key;
383         }
384     }
385
386 error_close_coclass_key:
387     RegCloseKey(coclass_key);
388 error_return:
389     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
390 }
391
392 /**********************************************************************
393  * register_namespace_extensions
394  */
395 static WCHAR *get_namespace_key(struct regsvr_namespace const *list) {
396     static const WCHAR wszExplorerKey[] = {
397         'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
398         'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
399         'E','x','p','l','o','r','e','r','\\',0 };
400     static const WCHAR wszNamespace[] = { '\\','N','a','m','e','s','p','a','c','e','\\',0 };
401     WCHAR *pwszKey, *pwszCLSID;
402
403     pwszKey = HeapAlloc(GetProcessHeap(), 0, sizeof(wszExplorerKey)+sizeof(wszNamespace)+
404                                              sizeof(WCHAR)*(lstrlenW(list->parent)+CHARS_IN_GUID));
405     if (!pwszKey)
406         return NULL;
407
408     lstrcpyW(pwszKey, wszExplorerKey);
409     lstrcatW(pwszKey, list->parent);
410     lstrcatW(pwszKey, wszNamespace);
411     if (FAILED(StringFromCLSID(list->clsid, &pwszCLSID))) {
412         HeapFree(GetProcessHeap(), 0, pwszKey);
413         return NULL;
414     }
415     lstrcatW(pwszKey, pwszCLSID);
416     CoTaskMemFree(pwszCLSID);
417
418     return pwszKey;
419 }
420
421 static HRESULT register_namespace_extensions(struct regsvr_namespace const *list) {
422     WCHAR *pwszKey;
423     HKEY hKey;
424     
425     for (; list->clsid; list++) {
426         pwszKey = get_namespace_key(list);
427             
428         /* Create the key and set the value. */
429         if (pwszKey && ERROR_SUCCESS == 
430             RegCreateKeyExW(HKEY_LOCAL_MACHINE, pwszKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL)) 
431         {
432             RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)list->value, sizeof(WCHAR)*(lstrlenW(list->value)+1));
433             RegCloseKey(hKey);
434         }
435
436         HeapFree(GetProcessHeap(), 0, pwszKey);
437     }
438     return S_OK;
439 }
440
441 static HRESULT unregister_namespace_extensions(struct regsvr_namespace const *list) {
442     WCHAR *pwszKey;
443     
444     for (; list->clsid; list++) {
445         pwszKey = get_namespace_key(list);
446         RegDeleteKeyW(HKEY_LOCAL_MACHINE, pwszKey);
447         HeapFree(GetProcessHeap(), 0, pwszKey);
448     }
449     return S_OK;
450 }
451
452 /***********************************************************************
453  *              regsvr_key_guid
454  */
455 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
456 {
457     WCHAR buf[39];
458
459     StringFromGUID2(guid, buf, 39);
460     return register_key_defvalueW(base, name, buf);
461 }
462
463 /***********************************************************************
464  *              regsvr_key_defvalueW
465  */
466 static LONG register_key_defvalueW(
467     HKEY base,
468     WCHAR const *name,
469     WCHAR const *value)
470 {
471     LONG res;
472     HKEY key;
473
474     res = RegCreateKeyExW(base, name, 0, NULL, 0,
475                           KEY_READ | KEY_WRITE, NULL, &key, NULL);
476     if (res != ERROR_SUCCESS) return res;
477     res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
478                          (lstrlenW(value) + 1) * sizeof(WCHAR));
479     RegCloseKey(key);
480     return res;
481 }
482
483 /***********************************************************************
484  *              regsvr_key_defvalueA
485  */
486 static LONG register_key_defvalueA(
487     HKEY base,
488     WCHAR const *name,
489     char const *value)
490 {
491     LONG res;
492     HKEY key;
493
494     res = RegCreateKeyExW(base, name, 0, NULL, 0,
495                           KEY_READ | KEY_WRITE, NULL, &key, NULL);
496     if (res != ERROR_SUCCESS) return res;
497     res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
498                          lstrlenA(value) + 1);
499     RegCloseKey(key);
500     return res;
501 }
502
503 /***********************************************************************
504  *              recursive_delete_key
505  */
506 static LONG recursive_delete_key(HKEY key)
507 {
508     LONG res;
509     WCHAR subkey_name[MAX_PATH];
510     DWORD cName;
511     HKEY subkey;
512
513     for (;;) {
514         cName = sizeof(subkey_name) / sizeof(WCHAR);
515         res = RegEnumKeyExW(key, 0, subkey_name, &cName,
516                             NULL, NULL, NULL, NULL);
517         if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
518             res = ERROR_SUCCESS; /* presumably we're done enumerating */
519             break;
520         }
521         res = RegOpenKeyExW(key, subkey_name, 0,
522                             KEY_READ | KEY_WRITE, &subkey);
523         if (res == ERROR_FILE_NOT_FOUND) continue;
524         if (res != ERROR_SUCCESS) break;
525
526         res = recursive_delete_key(subkey);
527         RegCloseKey(subkey);
528         if (res != ERROR_SUCCESS) break;
529     }
530
531     if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
532     return res;
533 }
534
535 /***********************************************************************
536  *              recursive_delete_keyA
537  */
538 static LONG recursive_delete_keyA(HKEY base, char const *name)
539 {
540     LONG res;
541     HKEY key;
542
543     res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
544     if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
545     if (res != ERROR_SUCCESS) return res;
546     res = recursive_delete_key(key);
547     RegCloseKey(key);
548     return res;
549 }
550
551 /***********************************************************************
552  *              recursive_delete_keyW
553  */
554 static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
555 {
556     LONG res;
557     HKEY key;
558
559     res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
560     if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
561     if (res != ERROR_SUCCESS) return res;
562     res = recursive_delete_key(key);
563     RegCloseKey(key);
564     return res;
565 }
566
567 /***********************************************************************
568  *              coclass list
569  */
570 static GUID const CLSID_Desktop = {
571     0x00021400, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };
572
573 static GUID const CLSID_Shortcut = {
574     0x00021401, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };
575
576 static struct regsvr_coclass const coclass_list[] = {
577     {   &CLSID_Desktop,
578         "Desktop",
579         NULL,
580         "shell32.dll",
581         "Apartment"
582     },
583     {   &CLSID_DragDropHelper,
584         "Shell Drag and Drop Helper",
585         NULL,
586         "shell32.dll",
587         "Apartment"
588     },
589     {   &CLSID_MyComputer,
590         "My Computer",
591         NULL,
592         "shell32.dll",
593         "Apartment"
594     },
595     {   &CLSID_Shortcut,
596         "Shortcut",
597         NULL,
598         "shell32.dll",
599         "Apartment",
600         SHELLEX_MAYCHANGEDEFAULTMENU
601     },
602     {   &CLSID_AutoComplete,
603         "AutoComplete",
604         NULL,
605         "shell32.dll",
606         "Apartment",
607     },
608     {   &CLSID_UnixFolder,
609         "/",
610         NULL,
611         "shell32.dll",
612         "Apartment",
613         SHELLFOLDER_WANTSFORPARSING
614     },
615     {   &CLSID_UnixDosFolder,
616         "/",
617         NULL,
618         "shell32.dll",
619         "Apartment",
620         SHELLFOLDER_WANTSFORPARSING|SHELLFOLDER_ATTRIBUTES|SHELLFOLDER_CALLFORATTRIBUTES,
621         SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER,
622         SFGAO_FILESYSTEM
623     },
624     { NULL }                    /* list terminator */
625 };
626
627 /***********************************************************************
628  *              interface list
629  */
630
631 static struct regsvr_interface const interface_list[] = {
632     { NULL }                    /* list terminator */
633 };
634
635 /***********************************************************************
636  *              namespace extensions list
637  */
638 static const WCHAR wszDesktop[] = { 'D','e','s','k','t','o','p',0 };
639 static const WCHAR wszSlash[] = { '/', 0 };
640
641 static struct regsvr_namespace const namespace_extensions_list[] = {
642     {   
643         &CLSID_UnixDosFolder,
644         wszDesktop,
645         wszSlash
646     },
647     { NULL }
648 };
649
650 /***********************************************************************
651  *              DllRegisterServer (SHELL32.@)
652  */
653 HRESULT WINAPI DllRegisterServer(void)
654 {
655     HRESULT hr;
656
657     TRACE("\n");
658
659     hr = register_coclasses(coclass_list);
660     if (SUCCEEDED(hr))
661         hr = register_interfaces(interface_list);
662     if (SUCCEEDED(hr))
663         hr = SHELL_RegisterShellFolders();
664     if (SUCCEEDED(hr))
665         hr = register_namespace_extensions(namespace_extensions_list);
666     return hr;
667 }
668
669 /***********************************************************************
670  *              DllUnregisterServer (SHELL32.@)
671  */
672 HRESULT WINAPI DllUnregisterServer(void)
673 {
674     HRESULT hr;
675
676     TRACE("\n");
677
678     hr = unregister_coclasses(coclass_list);
679     if (SUCCEEDED(hr))
680         hr = unregister_interfaces(interface_list);
681     if (SUCCEEDED(hr))
682         hr = unregister_namespace_extensions(namespace_extensions_list);
683     return hr;
684 }