ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

regsvr.c
Go to the documentation of this file.
00001 /*
00002  *  self-registerable dll functions for quartz.dll
00003  *
00004  * Copyright (C) 2003 John K. Hohm
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #define NONAMELESSUNION
00022 #define NONAMELESSSTRUCT
00023 #define COBJMACROS
00024 #include <stdarg.h>
00025 #include <string.h>
00026 
00027 #include "windef.h"
00028 #include "winbase.h"
00029 #include "wingdi.h"
00030 #include "winuser.h"
00031 #include "winreg.h"
00032 #include "winerror.h"
00033 
00034 #include "ole2.h"
00035 #include "uuids.h"
00036 #include "strmif.h"
00037 
00038 #include "wine/debug.h"
00039 #include "wine/unicode.h"
00040 
00041 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
00042 
00043 /*
00044  * Near the bottom of this file are the exported DllRegisterServer and
00045  * DllUnregisterServer, which make all this worthwhile.
00046  */
00047 
00048 /***********************************************************************
00049  *      interface for self-registering
00050  */
00051 struct regsvr_interface
00052 {
00053     IID const *iid;     /* NULL for end of list */
00054     LPCSTR name;        /* can be NULL to omit */
00055     IID const *base_iid;    /* can be NULL to omit */
00056     int num_methods;        /* can be <0 to omit */
00057     CLSID const *ps_clsid;  /* can be NULL to omit */
00058     CLSID const *ps_clsid32;    /* can be NULL to omit */
00059 };
00060 
00061 static HRESULT register_interfaces(struct regsvr_interface const *list);
00062 static HRESULT unregister_interfaces(struct regsvr_interface const *list);
00063 
00064 struct regsvr_coclass
00065 {
00066     CLSID const *clsid;     /* NULL for end of list */
00067     LPCSTR name;        /* can be NULL to omit */
00068     LPCSTR ips;         /* can be NULL to omit */
00069     LPCSTR ips32;       /* can be NULL to omit */
00070     LPCSTR ips32_tmodel;    /* can be NULL to omit */
00071     LPCSTR progid;      /* can be NULL to omit */
00072     LPCSTR viprogid;        /* can be NULL to omit */
00073     LPCSTR progid_extra;    /* can be NULL to omit */
00074 };
00075 
00076 static HRESULT register_coclasses(struct regsvr_coclass const *list);
00077 static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
00078 
00079 struct regsvr_mediatype_parsing
00080 {
00081     CLSID const *majortype; /* NULL for end of list */
00082     CLSID const *subtype;
00083     LPCSTR line[11];        /* NULL for end of list */
00084 };
00085 
00086 static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const *list);
00087 static HRESULT unregister_mediatypes_parsing(struct regsvr_mediatype_parsing const *list);
00088 
00089 struct regsvr_mediatype_extension
00090 {
00091     CLSID const *majortype; /* NULL for end of list */
00092     CLSID const *subtype;
00093     LPCSTR extension;
00094 };
00095 
00096 struct mediatype
00097 {
00098     CLSID const *majortype; /* NULL for end of list */
00099     CLSID const *subtype;
00100     DWORD fourcc;
00101 };
00102 
00103 struct pin
00104 {
00105     DWORD flags;        /* 0xFFFFFFFF for end of list */
00106     struct mediatype mediatypes[11];
00107 };
00108 
00109 struct regsvr_filter
00110 {
00111     CLSID const *clsid;     /* NULL for end of list */
00112     CLSID const *category;
00113     WCHAR name[50];
00114     DWORD merit;
00115     struct pin pins[11];
00116 };
00117 
00118 static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension const *list);
00119 static HRESULT unregister_mediatypes_extension(struct regsvr_mediatype_extension const *list);
00120 
00121 static HRESULT register_filters(struct regsvr_filter const *list);
00122 static HRESULT unregister_filters(struct regsvr_filter const *list);
00123 
00124 /***********************************************************************
00125  *      static string constants
00126  */
00127 static WCHAR const interface_keyname[10] = {
00128     'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
00129 static WCHAR const base_ifa_keyname[14] = {
00130     'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
00131     'e', 0 };
00132 static WCHAR const num_methods_keyname[11] = {
00133     'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
00134 static WCHAR const ps_clsid_keyname[15] = {
00135     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
00136     'i', 'd', 0 };
00137 static WCHAR const ps_clsid32_keyname[17] = {
00138     'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
00139     'i', 'd', '3', '2', 0 };
00140 static WCHAR const clsid_keyname[6] = {
00141     'C', 'L', 'S', 'I', 'D', 0 };
00142 static WCHAR const curver_keyname[7] = {
00143     'C', 'u', 'r', 'V', 'e', 'r', 0 };
00144 static WCHAR const ips_keyname[13] = {
00145     'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
00146     0 };
00147 static WCHAR const ips32_keyname[15] = {
00148     'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
00149     '3', '2', 0 };
00150 static WCHAR const progid_keyname[7] = {
00151     'P', 'r', 'o', 'g', 'I', 'D', 0 };
00152 static WCHAR const viprogid_keyname[25] = {
00153     'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
00154     'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
00155     0 };
00156 static char const tmodel_valuename[] = "ThreadingModel";
00157 static WCHAR const mediatype_name[11] = {
00158     'M', 'e', 'd', 'i', 'a', ' ', 'T', 'y', 'p', 'e', 0 };
00159 static WCHAR const subtype_valuename[8] = {
00160     'S', 'u', 'b', 't', 'y', 'p', 'e', 0 };
00161 static WCHAR const sourcefilter_valuename[14] = {
00162     'S', 'o', 'u', 'r', 'c', 'e', ' ', 'F', 'i', 'l', 't', 'e', 'r', 0 };
00163 static WCHAR const extensions_keyname[11] = {
00164     'E', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', 0 };
00165 
00166 /***********************************************************************
00167  *      static helper functions
00168  */
00169 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
00170 static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
00171                    WCHAR const *value);
00172 static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
00173                    char const *value);
00174 static LONG register_progid(WCHAR const *clsid,
00175                 char const *progid, char const *curver_progid,
00176                 char const *name, char const *extra);
00177 
00178 /***********************************************************************
00179  *      register_interfaces
00180  */
00181 static HRESULT register_interfaces(struct regsvr_interface const *list)
00182 {
00183     LONG res = ERROR_SUCCESS;
00184     HKEY interface_key;
00185 
00186     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
00187               KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
00188     if (res != ERROR_SUCCESS) goto error_return;
00189 
00190     for (; res == ERROR_SUCCESS && list->iid; ++list) {
00191     WCHAR buf[39];
00192     HKEY iid_key;
00193 
00194     StringFromGUID2(list->iid, buf, 39);
00195     res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
00196                   KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
00197     if (res != ERROR_SUCCESS) goto error_close_interface_key;
00198 
00199     if (list->name) {
00200         res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
00201                  (CONST BYTE*)(list->name),
00202                  strlen(list->name) + 1);
00203         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00204     }
00205 
00206     if (list->base_iid) {
00207         res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
00208         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00209     }
00210 
00211     if (0 <= list->num_methods) {
00212         static WCHAR const fmt[3] = { '%', 'd', 0 };
00213         HKEY key;
00214 
00215         res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
00216                   KEY_READ | KEY_WRITE, NULL, &key, NULL);
00217         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00218 
00219         sprintfW(buf, fmt, list->num_methods);
00220         res = RegSetValueExW(key, NULL, 0, REG_SZ,
00221                  (CONST BYTE*)buf,
00222                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
00223         RegCloseKey(key);
00224 
00225         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00226     }
00227 
00228     if (list->ps_clsid) {
00229         res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
00230         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00231     }
00232 
00233     if (list->ps_clsid32) {
00234         res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
00235         if (res != ERROR_SUCCESS) goto error_close_iid_key;
00236     }
00237 
00238     error_close_iid_key:
00239     RegCloseKey(iid_key);
00240     }
00241 
00242 error_close_interface_key:
00243     RegCloseKey(interface_key);
00244 error_return:
00245     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00246 }
00247 
00248 /***********************************************************************
00249  *      unregister_interfaces
00250  */
00251 static HRESULT unregister_interfaces(struct regsvr_interface const *list)
00252 {
00253     LONG res = ERROR_SUCCESS;
00254     HKEY interface_key;
00255 
00256     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
00257             KEY_READ | KEY_WRITE, &interface_key);
00258     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
00259     if (res != ERROR_SUCCESS) goto error_return;
00260 
00261     for (; res == ERROR_SUCCESS && list->iid; ++list) {
00262     WCHAR buf[39];
00263 
00264     StringFromGUID2(list->iid, buf, 39);
00265     res = RegDeleteTreeW(interface_key, buf);
00266     if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00267     }
00268 
00269     RegCloseKey(interface_key);
00270 error_return:
00271     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00272 }
00273 
00274 /***********************************************************************
00275  *      register_coclasses
00276  */
00277 static HRESULT register_coclasses(struct regsvr_coclass const *list)
00278 {
00279     LONG res = ERROR_SUCCESS;
00280     HKEY coclass_key;
00281 
00282     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
00283               KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
00284     if (res != ERROR_SUCCESS) goto error_return;
00285 
00286     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
00287     WCHAR buf[39];
00288     HKEY clsid_key;
00289 
00290     StringFromGUID2(list->clsid, buf, 39);
00291     res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
00292                   KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
00293     if (res != ERROR_SUCCESS) goto error_close_coclass_key;
00294 
00295     if (list->name) {
00296         res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
00297                  (CONST BYTE*)(list->name),
00298                  strlen(list->name) + 1);
00299         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00300     }
00301 
00302     if (list->ips) {
00303         res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
00304         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00305     }
00306 
00307     if (list->ips32) {
00308         HKEY ips32_key;
00309 
00310         res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
00311                   KEY_READ | KEY_WRITE, NULL,
00312                   &ips32_key, NULL);
00313         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00314 
00315         res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
00316                  (CONST BYTE*)list->ips32,
00317                  lstrlenA(list->ips32) + 1);
00318         if (res == ERROR_SUCCESS && list->ips32_tmodel)
00319         res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
00320                      (CONST BYTE*)list->ips32_tmodel,
00321                      strlen(list->ips32_tmodel) + 1);
00322         RegCloseKey(ips32_key);
00323         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00324     }
00325 
00326     if (list->progid) {
00327         res = register_key_defvalueA(clsid_key, progid_keyname,
00328                      list->progid);
00329         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00330 
00331         res = register_progid(buf, list->progid, NULL,
00332                   list->name, list->progid_extra);
00333         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00334     }
00335 
00336     if (list->viprogid) {
00337         res = register_key_defvalueA(clsid_key, viprogid_keyname,
00338                      list->viprogid);
00339         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00340 
00341         res = register_progid(buf, list->viprogid, list->progid,
00342                   list->name, list->progid_extra);
00343         if (res != ERROR_SUCCESS) goto error_close_clsid_key;
00344     }
00345 
00346     error_close_clsid_key:
00347     RegCloseKey(clsid_key);
00348     }
00349 
00350 error_close_coclass_key:
00351     RegCloseKey(coclass_key);
00352 error_return:
00353     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00354 }
00355 
00356 /***********************************************************************
00357  *      unregister_coclasses
00358  */
00359 static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
00360 {
00361     LONG res = ERROR_SUCCESS;
00362     HKEY coclass_key;
00363 
00364     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
00365             KEY_READ | KEY_WRITE, &coclass_key);
00366     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
00367     if (res != ERROR_SUCCESS) goto error_return;
00368 
00369     for (; res == ERROR_SUCCESS && list->clsid; ++list) {
00370     WCHAR buf[39];
00371 
00372     StringFromGUID2(list->clsid, buf, 39);
00373     res = RegDeleteTreeW(coclass_key, buf);
00374     if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00375     if (res != ERROR_SUCCESS) goto error_close_coclass_key;
00376 
00377     if (list->progid) {
00378         res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
00379         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00380         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
00381     }
00382 
00383     if (list->viprogid) {
00384         res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
00385         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00386         if (res != ERROR_SUCCESS) goto error_close_coclass_key;
00387     }
00388     }
00389 
00390 error_close_coclass_key:
00391     RegCloseKey(coclass_key);
00392 error_return:
00393     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00394 }
00395 
00396 /***********************************************************************
00397  *      register_mediatypes_parsing
00398  */
00399 static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
00400 {
00401     LONG res = ERROR_SUCCESS;
00402     HKEY mediatype_key;
00403     WCHAR buf[39];
00404     int i;
00405 
00406     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0, NULL, 0,
00407               KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
00408     if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
00409 
00410     for (; res == ERROR_SUCCESS && list->majortype; ++list) {
00411     HKEY majortype_key = NULL;
00412     HKEY subtype_key = NULL;
00413 
00414     StringFromGUID2(list->majortype, buf, 39);
00415     res = RegCreateKeyExW(mediatype_key, buf, 0, NULL, 0,
00416                   KEY_READ | KEY_WRITE, NULL, &majortype_key, NULL);
00417     if (res != ERROR_SUCCESS) goto error_close_keys;
00418 
00419     StringFromGUID2(list->subtype, buf, 39);
00420     res = RegCreateKeyExW(majortype_key, buf, 0, NULL, 0,
00421                   KEY_READ | KEY_WRITE, NULL, &subtype_key, NULL);
00422     if (res != ERROR_SUCCESS) goto error_close_keys;
00423 
00424     StringFromGUID2(&CLSID_AsyncReader, buf, 39);
00425     res = RegSetValueExW(subtype_key, sourcefilter_valuename, 0, REG_SZ, (CONST BYTE*)buf,
00426                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
00427     if (res != ERROR_SUCCESS) goto error_close_keys;
00428 
00429     for(i = 0; list->line[i]; i++) {
00430         char buffer[3];
00431         wsprintfA(buffer, "%d", i);
00432         res = RegSetValueExA(subtype_key, buffer, 0, REG_SZ, (CONST BYTE*)list->line[i],
00433                  lstrlenA(list->line[i]));
00434         if (res != ERROR_SUCCESS) goto error_close_keys;
00435     }
00436 
00437 error_close_keys:
00438     if (majortype_key)
00439         RegCloseKey(majortype_key);
00440     if (subtype_key)
00441         RegCloseKey(subtype_key);
00442     }
00443 
00444     RegCloseKey(mediatype_key);
00445 
00446     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00447 }
00448 
00449 /***********************************************************************
00450  *      register_mediatypes_extension
00451  */
00452 static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension const *list)
00453 {
00454     LONG res = ERROR_SUCCESS;
00455     HKEY mediatype_key;
00456     HKEY extensions_root_key = NULL;
00457     WCHAR buf[39];
00458 
00459     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0, NULL, 0,
00460               KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
00461     if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
00462 
00463     res = RegCreateKeyExW(mediatype_key, extensions_keyname, 0, NULL, 0,
00464               KEY_READ | KEY_WRITE, NULL, &extensions_root_key, NULL);
00465     if (res != ERROR_SUCCESS) goto error_return;
00466 
00467     for (; res == ERROR_SUCCESS && list->majortype; ++list) {
00468     HKEY extension_key;
00469 
00470     res = RegCreateKeyExA(extensions_root_key, list->extension, 0, NULL, 0,
00471                   KEY_READ | KEY_WRITE, NULL, &extension_key, NULL);
00472     if (res != ERROR_SUCCESS) break;
00473 
00474     StringFromGUID2(list->majortype, buf, 39);
00475     res = RegSetValueExW(extension_key, mediatype_name, 0, REG_SZ, (CONST BYTE*)buf,
00476                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
00477     if (res != ERROR_SUCCESS) goto error_close_key;
00478 
00479     StringFromGUID2(list->subtype, buf, 39);
00480     res = RegSetValueExW(extension_key, subtype_valuename, 0, REG_SZ, (CONST BYTE*)buf,
00481                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
00482     if (res != ERROR_SUCCESS) goto error_close_key;
00483 
00484     StringFromGUID2(&CLSID_AsyncReader, buf, 39);
00485     res = RegSetValueExW(extension_key, sourcefilter_valuename, 0, REG_SZ, (CONST BYTE*)buf,
00486                  (lstrlenW(buf) + 1) * sizeof(WCHAR));
00487     if (res != ERROR_SUCCESS) goto error_close_key;
00488 
00489 error_close_key:
00490     RegCloseKey(extension_key);
00491     }
00492 
00493 error_return:
00494     RegCloseKey(mediatype_key);
00495     if (extensions_root_key)
00496     RegCloseKey(extensions_root_key);
00497 
00498     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00499 }
00500 
00501 /***********************************************************************
00502  *      unregister_mediatypes_parsing
00503  */
00504 static HRESULT unregister_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
00505 {
00506     LONG res;
00507     HKEY mediatype_key;
00508     HKEY majortype_key;
00509     WCHAR buf[39];
00510 
00511     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0,
00512             KEY_READ | KEY_WRITE, &mediatype_key);
00513     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
00514     if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
00515 
00516     for (; res == ERROR_SUCCESS && list->majortype; ++list) {
00517     StringFromGUID2(list->majortype, buf, 39);
00518     res = RegOpenKeyExW(mediatype_key, buf, 0,
00519             KEY_READ | KEY_WRITE, &majortype_key);
00520     if (res == ERROR_FILE_NOT_FOUND) {
00521         res = ERROR_SUCCESS;
00522         continue;
00523     }
00524     if (res != ERROR_SUCCESS) break;
00525 
00526     StringFromGUID2(list->subtype, buf, 39);
00527     res = RegDeleteTreeW(majortype_key, buf);
00528         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00529 
00530     /* Removed majortype key if there is no more subtype key */
00531     res = RegDeleteKeyW(majortype_key, 0);
00532     if (res == ERROR_ACCESS_DENIED) res = ERROR_SUCCESS;
00533 
00534     RegCloseKey(majortype_key);
00535     }
00536 
00537     RegCloseKey(mediatype_key);
00538 
00539     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00540 }
00541 
00542 /***********************************************************************
00543  *      unregister_mediatypes_extension
00544  */
00545 static HRESULT unregister_mediatypes_extension(struct regsvr_mediatype_extension const *list)
00546 {
00547     LONG res;
00548     HKEY mediatype_key;
00549     HKEY extensions_root_key = NULL;
00550 
00551     res = RegOpenKeyExW(HKEY_CLASSES_ROOT, mediatype_name, 0,
00552             KEY_READ | KEY_WRITE, &mediatype_key);
00553     if (res == ERROR_FILE_NOT_FOUND) return S_OK;
00554     if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
00555 
00556     res = RegOpenKeyExW(mediatype_key, extensions_keyname, 0,
00557             KEY_READ | KEY_WRITE, &extensions_root_key);
00558     if (res == ERROR_FILE_NOT_FOUND)
00559     res = ERROR_SUCCESS;
00560     else if (res == ERROR_SUCCESS)
00561     for (; res == ERROR_SUCCESS && list->majortype; ++list) {
00562         res = RegDeleteTreeA(extensions_root_key, list->extension);
00563         if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
00564     }
00565 
00566     RegCloseKey(mediatype_key);
00567     if (extensions_root_key)
00568     RegCloseKey(extensions_root_key);
00569 
00570     return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
00571 }
00572 
00573 /***********************************************************************
00574  *      register_filters
00575  */
00576 static HRESULT register_filters(struct regsvr_filter const *list)
00577 {
00578     HRESULT hr;
00579     IFilterMapper2* pFM2 = NULL;
00580 
00581     CoInitialize(NULL);
00582     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
00583 
00584     if (SUCCEEDED(hr)) {
00585     for (; SUCCEEDED(hr) && list->clsid; ++list) {
00586         REGFILTER2 rf2;
00587         REGFILTERPINS2* prfp2;
00588         int i;
00589 
00590         for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) ;
00591         rf2.dwVersion = 2;
00592         rf2.dwMerit = list->merit;
00593         rf2.u.s1.cPins2 = i;
00594         rf2.u.s1.rgPins2 = prfp2 = CoTaskMemAlloc(i*sizeof(REGFILTERPINS2));
00595         if (!prfp2) {
00596         hr = E_OUTOFMEMORY;
00597         break;
00598         }
00599         for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) {
00600         REGPINTYPES* lpMediatype;
00601         CLSID* lpClsid;
00602         int j, nbmt;
00603                 
00604         for (nbmt = 0; list->pins[i].mediatypes[nbmt].majortype; nbmt++) ;
00605         /* Allocate a single buffer for regpintypes struct and clsids */
00606         lpMediatype = CoTaskMemAlloc(nbmt*(sizeof(REGPINTYPES) + 2*sizeof(CLSID)));
00607         if (!lpMediatype) {
00608             hr = E_OUTOFMEMORY;
00609             break;
00610         }
00611         lpClsid = (CLSID*) (lpMediatype + nbmt);
00612         for (j = 0; j < nbmt; j++) {
00613             (lpMediatype + j)->clsMajorType = lpClsid + j*2;
00614             memcpy(lpClsid + j*2, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
00615             (lpMediatype + j)->clsMinorType = lpClsid + j*2 + 1;
00616             if (list->pins[i].mediatypes[j].subtype)
00617             memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].subtype, sizeof(CLSID));
00618             else {
00619             /* Subtype are often a combination of major type + fourcc/tag */
00620             memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
00621             *(DWORD*)(lpClsid + j*2 + 1) = list->pins[i].mediatypes[j].fourcc;
00622             }
00623         }
00624         prfp2[i].dwFlags = list->pins[i].flags;
00625         prfp2[i].cInstances = 0;
00626         prfp2[i].nMediaTypes = j;
00627         prfp2[i].lpMediaType = lpMediatype;
00628         prfp2[i].nMediums = 0;
00629         prfp2[i].lpMedium = NULL;
00630         prfp2[i].clsPinCategory = NULL;
00631         }
00632 
00633         if (FAILED(hr)) {
00634         ERR("failed to register with hresult 0x%x\n", hr);
00635         CoTaskMemFree(prfp2);
00636         break;
00637         }
00638 
00639         hr = IFilterMapper2_RegisterFilter(pFM2, list->clsid, list->name, NULL, list->category, NULL, &rf2);
00640 
00641         while (i) {
00642         CoTaskMemFree((REGPINTYPES*)prfp2[i-1].lpMediaType);
00643         i--;
00644         }
00645         CoTaskMemFree(prfp2);
00646     }
00647     }
00648 
00649     if (pFM2)
00650     IFilterMapper2_Release(pFM2);
00651 
00652     CoUninitialize();
00653 
00654     return hr;
00655 }
00656 
00657 /***********************************************************************
00658  *      unregister_filters
00659  */
00660 static HRESULT unregister_filters(struct regsvr_filter const *list)
00661 {
00662     HRESULT hr;
00663     IFilterMapper2* pFM2;
00664 
00665     CoInitialize(NULL);
00666     
00667     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
00668 
00669     if (SUCCEEDED(hr)) {
00670     for (; SUCCEEDED(hr) && list->clsid; ++list)
00671         hr = IFilterMapper2_UnregisterFilter(pFM2, list->category, NULL, list->clsid);
00672     IFilterMapper2_Release(pFM2);
00673     }
00674 
00675     CoUninitialize();
00676     
00677     return hr;
00678 }
00679 
00680 /***********************************************************************
00681  *      regsvr_key_guid
00682  */
00683 static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
00684 {
00685     WCHAR buf[39];
00686 
00687     StringFromGUID2(guid, buf, 39);
00688     return register_key_defvalueW(base, name, buf);
00689 }
00690 
00691 /***********************************************************************
00692  *      regsvr_key_defvalueW
00693  */
00694 static LONG register_key_defvalueW(
00695     HKEY base,
00696     WCHAR const *name,
00697     WCHAR const *value)
00698 {
00699     LONG res;
00700     HKEY key;
00701 
00702     res = RegCreateKeyExW(base, name, 0, NULL, 0,
00703               KEY_READ | KEY_WRITE, NULL, &key, NULL);
00704     if (res != ERROR_SUCCESS) return res;
00705     res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
00706              (lstrlenW(value) + 1) * sizeof(WCHAR));
00707     RegCloseKey(key);
00708     return res;
00709 }
00710 
00711 /***********************************************************************
00712  *      regsvr_key_defvalueA
00713  */
00714 static LONG register_key_defvalueA(
00715     HKEY base,
00716     WCHAR const *name,
00717     char const *value)
00718 {
00719     LONG res;
00720     HKEY key;
00721 
00722     res = RegCreateKeyExW(base, name, 0, NULL, 0,
00723               KEY_READ | KEY_WRITE, NULL, &key, NULL);
00724     if (res != ERROR_SUCCESS) return res;
00725     res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
00726              lstrlenA(value) + 1);
00727     RegCloseKey(key);
00728     return res;
00729 }
00730 
00731 /***********************************************************************
00732  *      regsvr_progid
00733  */
00734 static LONG register_progid(
00735     WCHAR const *clsid,
00736     char const *progid,
00737     char const *curver_progid,
00738     char const *name,
00739     char const *extra)
00740 {
00741     LONG res;
00742     HKEY progid_key;
00743 
00744     res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
00745               NULL, 0, KEY_READ | KEY_WRITE, NULL,
00746               &progid_key, NULL);
00747     if (res != ERROR_SUCCESS) return res;
00748 
00749     if (name) {
00750     res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
00751                  (CONST BYTE*)name, strlen(name) + 1);
00752     if (res != ERROR_SUCCESS) goto error_close_progid_key;
00753     }
00754 
00755     if (clsid) {
00756     res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
00757     if (res != ERROR_SUCCESS) goto error_close_progid_key;
00758     }
00759 
00760     if (curver_progid) {
00761     res = register_key_defvalueA(progid_key, curver_keyname,
00762                      curver_progid);
00763     if (res != ERROR_SUCCESS) goto error_close_progid_key;
00764     }
00765 
00766     if (extra) {
00767     HKEY extra_key;
00768 
00769     res = RegCreateKeyExA(progid_key, extra, 0,
00770                   NULL, 0, KEY_READ | KEY_WRITE, NULL,
00771                   &extra_key, NULL);
00772     if (res == ERROR_SUCCESS)
00773         RegCloseKey(extra_key);
00774     }
00775 
00776 error_close_progid_key:
00777     RegCloseKey(progid_key);
00778     return res;
00779 }
00780 
00781 static GUID const CLSID_PSFactoryBuffer = {
00782     0x92a3a302, 0xda7c, 0x4a1f, {0xba,0x7e,0x18,0x02,0xbb,0x5d,0x2d,0x02} };
00783 
00784 /***********************************************************************
00785  *      coclass list
00786  */
00787 static struct regsvr_coclass const coclass_list[] = {
00788     {   &CLSID_FilterGraph,
00789     "Filter Graph",
00790     NULL,
00791     "quartz.dll",
00792     "Both"
00793     },
00794     {   &CLSID_FilterGraphNoThread,
00795     "Filter Graph",
00796     NULL,
00797     "quartz.dll",
00798     "Both"
00799     },
00800     {   &CLSID_FilterMapper,
00801     "Filter Mapper",
00802     NULL,
00803     "quartz.dll",
00804     "Both"
00805     },
00806     {   &CLSID_FilterMapper2,
00807     "Filter Mapper2",
00808     NULL,
00809     "quartz.dll",
00810     "Both"
00811     },
00812     {   &CLSID_SystemClock,
00813     "System Clock",
00814     NULL,
00815     "quartz.dll",
00816     "Both"
00817     },
00818     {   &CLSID_MemoryAllocator,
00819     "Memory Allocator",
00820     NULL,
00821     "quartz.dll",
00822     "Both"
00823     },
00824     {   &CLSID_SeekingPassThru,
00825        "Seeking",
00826        NULL,
00827        "quartz.dll",
00828        "Both"
00829     },
00830     {   &CLSID_AsyncReader,
00831     "File Source Filter",
00832     NULL,
00833     "quartz.dll",
00834     "Both"
00835     },
00836     {   &CLSID_AviSplitter,
00837     "AVI Splitter",
00838     NULL,
00839     "quartz.dll",
00840     "Both"
00841     },
00842     {   &CLSID_MPEG1Splitter,
00843         "MPEG-I Stream Splitter",
00844         NULL,
00845         "quartz.dll",
00846         "Both"
00847     },
00848     {   &CLSID_AVIDec,
00849     "AVI Decompressor",
00850     NULL,
00851     "quartz.dll",
00852     "Both"
00853     },
00854     {   &CLSID_DSoundRender,
00855     "DirectSound Audio Renderer",
00856     NULL,
00857     "quartz.dll",
00858     "Both"
00859     },
00860     {   &CLSID_AudioRender,
00861     "Wave Audio Renderer",
00862     NULL,
00863     "quartz.dll",
00864     "Both"
00865     },
00866     {   &CLSID_NullRenderer,
00867         "Null Renderer",
00868         NULL,
00869         "quartz.dll",
00870         "Both"
00871     },
00872     {   &CLSID_VideoRenderer,
00873     "Video Renderer",
00874     NULL,
00875     "quartz.dll",
00876     "Both"
00877     },
00878     {   &CLSID_VideoRendererDefault,
00879         "Default Video Renderer",
00880         NULL,
00881         "quartz.dll",
00882         "Both"
00883     },
00884     {   &CLSID_ACMWrapper,
00885     "ACM wrapper",
00886     NULL,
00887     "quartz.dll",
00888     "Both"
00889     },
00890     {   &CLSID_WAVEParser,
00891     "Wave Parser",
00892     NULL,
00893     "quartz.dll",
00894     "Both"
00895     },
00896     { NULL }            /* list terminator */
00897 };
00898 
00899 /***********************************************************************
00900  *      interface list
00901  */
00902 
00903 static struct regsvr_interface const interface_list[] = {
00904     { NULL }            /* list terminator */
00905 };
00906 
00907 /***********************************************************************
00908  *      mediatype list
00909  */
00910 
00911 static struct regsvr_mediatype_parsing const mediatype_parsing_list[] = {
00912     {   &MEDIATYPE_Stream,
00913     &MEDIASUBTYPE_Avi,
00914     {   "0,4,,52494646,8,4,,41564920",
00915         NULL }
00916     },
00917     {   &MEDIATYPE_Stream,
00918     &MEDIASUBTYPE_MPEG1System,
00919     {   "0, 16, FFFFFFFFF100010001800001FFFFFFFF, 000001BA2100010001800001000001BB",
00920         NULL }
00921     },
00922     {   &MEDIATYPE_Stream,
00923     &MEDIASUBTYPE_MPEG1VideoCD,
00924     {   "0, 4, , 52494646, 8, 8, , 43445841666D7420, 36, 20, FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFF, 646174610000000000FFFFFFFFFFFFFFFFFFFF00",
00925         NULL }
00926     },
00927     {   &MEDIATYPE_Stream,
00928     &MEDIASUBTYPE_MPEG1Video,
00929     {   "0, 4, , 000001B3",
00930         NULL }
00931     },
00932     {   &MEDIATYPE_Stream,
00933     &MEDIASUBTYPE_MPEG1Audio,
00934     {   "0, 2, FFE0, FFE0",
00935             "0, 10, FFFFFF00000080808080, 494433000000000000",
00936         NULL }
00937     },
00938     {   &MEDIATYPE_Stream,
00939     &MEDIASUBTYPE_QTMovie,
00940     {   "4, 4, , 6d646174",
00941         "4, 4, , 6d6f6f76",
00942         NULL }
00943     },
00944     {   &MEDIATYPE_Stream,
00945     &MEDIASUBTYPE_WAVE,
00946     {   "0,4,,52494646,8,4,,57415645",
00947         NULL }
00948     },
00949     {   &MEDIATYPE_Stream,
00950     &MEDIASUBTYPE_AU,
00951     {   "0,4,,2e736e64",
00952         NULL }
00953     },
00954     {   &MEDIATYPE_Stream,
00955     &MEDIASUBTYPE_AIFF,
00956     {   "0,4,,464f524d,8,4,,41494646",
00957         "0,4,,464f524d,8,4,,41494643",
00958         NULL }
00959     },
00960     {   &MEDIATYPE_Stream,
00961     &MEDIATYPE_Text,
00962     {   "0,4,,4C595249",
00963         "0,4,,6C797269",
00964         NULL }
00965     },
00966     {   &MEDIATYPE_Stream,
00967     &MEDIATYPE_Midi,
00968     {   "0,4,,52494646,8,4,,524D4944",
00969         "0,4,,4D546864",
00970         NULL }
00971     },
00972     { NULL }            /* list terminator */
00973 };
00974 
00975 /***********************************************************************
00976  *      mediatype list
00977  */
00978 
00979 static struct regsvr_mediatype_extension const mediatype_extension_list[] = {
00980     {   &MEDIATYPE_Stream,
00981     &MEDIASUBTYPE_MPEG1Audio,
00982     ".mp3"
00983     },
00984     { NULL }            /* list terminator */
00985 };
00986 
00987 /***********************************************************************
00988  *      filter list
00989  */
00990 
00991 static struct regsvr_filter const filter_list[] = {
00992     {   &CLSID_AviSplitter,
00993     &CLSID_LegacyAmFilterCategory,
00994     {'A','V','I',' ','S','p','l','i','t','t','e','r',0},
00995     0x600000,
00996     {   {   0,
00997         {   { &MEDIATYPE_Stream, &MEDIASUBTYPE_Avi },
00998             { NULL }
00999         },
01000         },
01001         {   REG_PINFLAG_B_OUTPUT,
01002         {   { &MEDIATYPE_Video, &GUID_NULL },
01003             { NULL }
01004         },
01005         },
01006         { 0xFFFFFFFF },
01007     }
01008     },
01009     {   &CLSID_MPEG1Splitter,
01010         &CLSID_LegacyAmFilterCategory,
01011         {'M','P','E','G','-','I',' ','S','t','r','e','a','m',' ','S','p','l','i','t','t','e','r',0},
01012         0x600000,
01013         {   {   0,
01014                 {   { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio },
01015                     { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Video },
01016                     { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System },
01017                     { &MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD },
01018                     { NULL }
01019                 },
01020             },
01021             {   REG_PINFLAG_B_OUTPUT,
01022                 {   { &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet },
01023                     { &MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload },
01024                     { NULL }
01025                 },
01026             },
01027             {   REG_PINFLAG_B_OUTPUT,
01028                 {   { &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet },
01029                     { &MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload },
01030                     { NULL }
01031                 },
01032             },
01033             { 0xFFFFFFFF },
01034         }
01035     },
01036     {   &CLSID_NullRenderer,
01037         &CLSID_LegacyAmFilterCategory,
01038         {'N','u','l','l',' ','R','e','n','d','e','r','e','r',0},
01039         0x200000,
01040         {   {   REG_PINFLAG_B_RENDERER,
01041                 {   { &MEDIATYPE_NULL, &GUID_NULL },
01042                     { NULL }
01043                 },
01044             },
01045             { 0xFFFFFFFF },
01046         }
01047     },
01048     {   &CLSID_VideoRenderer,
01049     &CLSID_LegacyAmFilterCategory,
01050     {'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0},
01051     0x800000,
01052     {   {   REG_PINFLAG_B_RENDERER,
01053         {   { &MEDIATYPE_Video, &GUID_NULL },
01054             { NULL }
01055         },
01056         },
01057         { 0xFFFFFFFF },
01058     }
01059     },
01060     {   &CLSID_VideoRendererDefault,
01061         &CLSID_LegacyAmFilterCategory,
01062         {'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0},
01063         0x800000,
01064         {   {   REG_PINFLAG_B_RENDERER,
01065                 {   { &MEDIATYPE_Video, &GUID_NULL },
01066                     { NULL }
01067                 },
01068             },
01069             { 0xFFFFFFFF },
01070         }
01071     },
01072     {   &CLSID_DSoundRender,
01073         &CLSID_LegacyAmFilterCategory,
01074         {'A','u','d','i','o',' ','R','e','n','d','e','r','e','r',0},
01075         0x800000,
01076         {   {   REG_PINFLAG_B_RENDERER,
01077                 {   { &MEDIATYPE_Audio, &MEDIASUBTYPE_PCM },
01078 /*                  { &MEDIATYPE_Audio, &MEDIASUBTYPE_IEEE_FLOAT }, */
01079                     { NULL }
01080                 },
01081             },
01082             { 0xFFFFFFFF },
01083         }
01084     },
01085     {   &CLSID_AudioRender,
01086         &CLSID_LegacyAmFilterCategory,
01087         {'A','u','d','i','o',' ','R','e','n','d','e','r','e','r',0},
01088         0x800000,
01089         {   {   REG_PINFLAG_B_RENDERER,
01090                 {   { &MEDIATYPE_Audio, &MEDIASUBTYPE_PCM },
01091 /*                  { &MEDIATYPE_Audio, &MEDIASUBTYPE_IEEE_FLOAT }, */
01092                     { NULL }
01093                 },
01094             },
01095             { 0xFFFFFFFF },
01096         }
01097     },
01098     {   &CLSID_AVIDec,
01099     &CLSID_LegacyAmFilterCategory,
01100     {'A','V','I',' ','D','e','c','o','m','p','r','e','s','s','o','r',0},
01101     0x600000,
01102     {   {   0,
01103         {   { &MEDIATYPE_Video, &GUID_NULL },
01104             { NULL }
01105         },
01106         },
01107         {   REG_PINFLAG_B_OUTPUT,
01108         {   { &MEDIATYPE_Video, &GUID_NULL },
01109             { NULL }
01110         },
01111         },
01112         { 0xFFFFFFFF },
01113     }
01114     },
01115     {   &CLSID_AsyncReader,
01116     &CLSID_LegacyAmFilterCategory,
01117     {'F','i','l','e',' ','S','o','u','r','c','e',' ','(','A','s','y','n','c','.',')',0},
01118     0x400000,
01119     {   {   REG_PINFLAG_B_OUTPUT,
01120         {   { &MEDIATYPE_Stream, &GUID_NULL },
01121             { NULL }
01122         },
01123         },
01124         { 0xFFFFFFFF },
01125     }
01126     },
01127     {   &CLSID_ACMWrapper,
01128     &CLSID_LegacyAmFilterCategory,
01129     {'A','C','M',' ','W','r','a','p','p','e','r',0},
01130     0x600000,
01131     {   {   0,
01132         {   { &MEDIATYPE_Audio, &GUID_NULL },
01133             { NULL }
01134         },
01135         },
01136         {   REG_PINFLAG_B_OUTPUT,
01137         {   { &MEDIATYPE_Audio, &GUID_NULL },
01138             { NULL }
01139         },
01140         },
01141         { 0xFFFFFFFF },
01142     }
01143     },
01144     {   &CLSID_WAVEParser,
01145     &CLSID_LegacyAmFilterCategory,
01146     {'W','a','v','e',' ','P','a','r','s','e','r',0},
01147     0x400000,
01148     {   {   0,
01149         {   { &MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE },
01150             { &MEDIATYPE_Stream, &MEDIASUBTYPE_AU },
01151             { &MEDIATYPE_Stream, &MEDIASUBTYPE_AIFF },
01152             { NULL }
01153         },
01154         },
01155         {   REG_PINFLAG_B_OUTPUT,
01156         {   { &MEDIATYPE_Audio, &GUID_NULL },
01157             { NULL }
01158         },
01159         },
01160         { 0xFFFFFFFF },
01161     }
01162     },
01163     { NULL }        /* list terminator */
01164 };
01165 
01166 extern HRESULT WINAPI QUARTZ_DllRegisterServer(void) DECLSPEC_HIDDEN;
01167 extern HRESULT WINAPI QUARTZ_DllUnregisterServer(void) DECLSPEC_HIDDEN;
01168 
01169 /***********************************************************************
01170  *      DllRegisterServer (QUARTZ.@)
01171  */
01172 HRESULT WINAPI DllRegisterServer(void)
01173 {
01174     HRESULT hr;
01175 
01176     TRACE("\n");
01177 
01178     hr = QUARTZ_DllRegisterServer();
01179     if (SUCCEEDED(hr))
01180         hr = register_coclasses(coclass_list);
01181     if (SUCCEEDED(hr))
01182     hr = register_interfaces(interface_list);
01183     if (SUCCEEDED(hr))
01184         hr = register_mediatypes_parsing(mediatype_parsing_list);
01185     if (SUCCEEDED(hr))
01186         hr = register_mediatypes_extension(mediatype_extension_list);
01187     if (SUCCEEDED(hr))
01188         hr = register_filters(filter_list);
01189     return hr;
01190 }
01191 
01192 /***********************************************************************
01193  *      DllUnregisterServer (QUARTZ.@)
01194  */
01195 HRESULT WINAPI DllUnregisterServer(void)
01196 {
01197     HRESULT hr;
01198 
01199     TRACE("\n");
01200 
01201     hr = unregister_filters(filter_list);
01202     if (SUCCEEDED(hr))
01203     hr = unregister_coclasses(coclass_list);
01204     if (SUCCEEDED(hr))
01205     hr = unregister_interfaces(interface_list);
01206     if (SUCCEEDED(hr))
01207     hr = unregister_mediatypes_parsing(mediatype_parsing_list);
01208     if (SUCCEEDED(hr))
01209     hr = unregister_mediatypes_extension(mediatype_extension_list);
01210     if (SUCCEEDED(hr))
01211         hr = QUARTZ_DllUnregisterServer();
01212     return hr;
01213 }

Generated on Sun May 27 2012 04:21:33 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.