ReactOS 0.4.15-dev-7788-g1ad9096
regsvr.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "ole2.h"
#include "uuids.h"
#include "strmif.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for regsvr.c:

Go to the source code of this file.

Classes

struct  regsvr_interface
 
struct  regsvr_coclass
 
struct  regsvr_mediatype_parsing
 
struct  regsvr_mediatype_extension
 
struct  mediatype
 
struct  pin
 
struct  regsvr_filter
 

Macros

#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static HRESULT register_interfaces (struct regsvr_interface const *list)
 
static HRESULT unregister_interfaces (struct regsvr_interface const *list)
 
static HRESULT register_coclasses (struct regsvr_coclass const *list)
 
static HRESULT unregister_coclasses (struct regsvr_coclass const *list)
 
static HRESULT register_mediatypes_parsing (struct regsvr_mediatype_parsing const *list)
 
static HRESULT unregister_mediatypes_parsing (struct regsvr_mediatype_parsing const *list)
 
static HRESULT register_mediatypes_extension (struct regsvr_mediatype_extension const *list)
 
static HRESULT unregister_mediatypes_extension (struct regsvr_mediatype_extension const *list)
 
static HRESULT register_filters (struct regsvr_filter const *list)
 
static HRESULT unregister_filters (struct regsvr_filter const *list)
 
static LONG register_key_guid (HKEY base, WCHAR const *name, GUID const *guid)
 
static LONG register_key_defvalueW (HKEY base, WCHAR const *name, WCHAR const *value)
 
static LONG register_key_defvalueA (HKEY base, WCHAR const *name, char const *value)
 
static LONG register_progid (WCHAR const *clsid, char const *progid, char const *curver_progid, char const *name, char const *extra)
 
HRESULT WINAPI QUARTZ_DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

static const WCHAR interface_keyname []
 
static const WCHAR base_ifa_keyname []
 
static const WCHAR num_methods_keyname []
 
static const WCHAR ps_clsid_keyname []
 
static const WCHAR ps_clsid32_keyname []
 
static const WCHAR clsid_keyname []
 
static const WCHAR curver_keyname []
 
static const WCHAR ips_keyname []
 
static const WCHAR ips32_keyname []
 
static const WCHAR progid_keyname []
 
static const WCHAR viprogid_keyname []
 
static const char tmodel_valuename [] = "ThreadingModel"
 
static const WCHAR mediatype_name []
 
static const WCHAR subtype_valuename []
 
static const WCHAR sourcefilter_valuename []
 
static const WCHAR extensions_keyname []
 
static struct regsvr_coclass const coclass_list []
 
static struct regsvr_interface const interface_list []
 
static struct regsvr_mediatype_parsing const mediatype_parsing_list []
 
static struct regsvr_mediatype_extension const mediatype_extension_list []
 
static struct regsvr_filter const filter_list []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file regsvr.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 22 of file regsvr.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 21 of file regsvr.c.

Function Documentation

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 1107 of file regsvr.c.

1108{
1109 HRESULT hr;
1110
1111 TRACE("\n");
1112
1114 if (SUCCEEDED(hr))
1116 if (SUCCEEDED(hr))
1118 if (SUCCEEDED(hr))
1120 if (SUCCEEDED(hr))
1122 if (SUCCEEDED(hr))
1123 hr = QUARTZ_DllUnregisterServer();
1124 return hr;
1125}
static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
Definition: regsvr.c:289
static HRESULT unregister_interfaces(struct regsvr_interface const *list)
Definition: regsvr.c:181
static struct regsvr_interface const interface_list[]
Definition: regsvr.c:477
static struct regsvr_coclass const coclass_list[]
Definition: regsvr.c:433
static HRESULT unregister_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
Definition: regsvr.c:500
static struct regsvr_filter const filter_list[]
Definition: regsvr.c:879
static HRESULT unregister_filters(struct regsvr_filter const *list)
Definition: regsvr.c:656
static HRESULT unregister_mediatypes_extension(struct regsvr_mediatype_extension const *list)
Definition: regsvr.c:541
static struct regsvr_mediatype_extension const mediatype_extension_list[]
Definition: regsvr.c:867
static struct regsvr_mediatype_parsing const mediatype_parsing_list[]
Definition: regsvr.c:794
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4

◆ QUARTZ_DllRegisterServer()

HRESULT WINAPI QUARTZ_DllRegisterServer ( void  )

Definition at line 1078 of file regsvr.c.

1085{
1086 HRESULT hr;
1087
1088 TRACE("\n");
1089
1091 if (SUCCEEDED(hr))
1093 if (SUCCEEDED(hr))
1095 if (SUCCEEDED(hr))
1097 if (SUCCEEDED(hr))
1099 if (SUCCEEDED(hr))
1101 return hr;
1102}
static HRESULT register_interfaces(struct regsvr_interface const *list)
Definition: regsvr.c:111
static HRESULT register_coclasses(struct regsvr_coclass const *list)
Definition: regsvr.c:207
static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const *list)
Definition: regsvr.c:395
static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension const *list)
Definition: regsvr.c:448
HRESULT WINAPI QUARTZ_DllRegisterServer(void)
Definition: regsvr.c:1078
static HRESULT register_filters(struct regsvr_filter const *list)
Definition: regsvr.c:572

Referenced by QUARTZ_DllRegisterServer().

◆ register_coclasses()

static HRESULT register_coclasses ( struct regsvr_coclass const list)
static

Definition at line 275 of file regsvr.c.

276{
278 HKEY coclass_key;
279
281 KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
282 if (res != ERROR_SUCCESS) goto error_return;
283
284 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
285 WCHAR buf[39];
286 HKEY clsid_key;
287
288 StringFromGUID2(list->clsid, buf, 39);
289 res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
290 KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
291 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
292
293 if (list->name) {
294 res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, (const BYTE*)list->name,
295 strlen(list->name) + 1);
296 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
297 }
298
299 if (list->ips) {
300 res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
301 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
302 }
303
304 if (list->ips32) {
305 HKEY ips32_key;
306
307 res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
309 &ips32_key, NULL);
310 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
311
312 res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, (const BYTE*)list->ips32,
313 lstrlenA(list->ips32) + 1);
314 if (res == ERROR_SUCCESS && list->ips32_tmodel)
315 res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
316 (const BYTE*)list->ips32_tmodel,
317 strlen(list->ips32_tmodel) + 1);
318 RegCloseKey(ips32_key);
319 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
320 }
321
322 if (list->progid) {
324 list->progid);
325 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
326
327 res = register_progid(buf, list->progid, NULL,
328 list->name, list->progid_extra);
329 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
330 }
331
332 if (list->viprogid) {
334 list->viprogid);
335 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
336
337 res = register_progid(buf, list->viprogid, list->progid,
338 list->name, list->progid_extra);
339 if (res != ERROR_SUCCESS) goto error_close_clsid_key;
340 }
341
342 error_close_clsid_key:
343 RegCloseKey(clsid_key);
344 }
345
346error_close_coclass_key:
347 RegCloseKey(coclass_key);
348error_return:
350}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:37
#define ERROR_SUCCESS
Definition: deptool.c:10
static char const tmodel_valuename[]
Definition: regsvr.c:94
static LONG register_progid(WCHAR const *clsid, char const *progid, char const *curver_progid, char const *name, char const *extra)
Definition: regsvr.c:380
static WCHAR const ips_keyname[13]
Definition: regsvr.c:82
static WCHAR const ips32_keyname[15]
Definition: regsvr.c:85
static WCHAR const clsid_keyname[6]
Definition: regsvr.c:78
static WCHAR const progid_keyname[7]
Definition: regsvr.c:88
static WCHAR const viprogid_keyname[25]
Definition: regsvr.c:90
static LONG register_key_defvalueA(HKEY base, WCHAR const *name, char const *value)
Definition: regsvr.c:360
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4828
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
GLuint res
Definition: glext.h:9613
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define S_OK
Definition: intsafe.h:52
#define REG_SZ
Definition: layer.c:22
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
long LONG
Definition: pedump.c:60
#define list
Definition: rosglue.h:35
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

◆ register_filters()

static HRESULT register_filters ( struct regsvr_filter const list)
static

Definition at line 572 of file regsvr.c.

573{
574 HRESULT hr;
575 IFilterMapper2* pFM2 = NULL;
576
578 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
579
580 if (SUCCEEDED(hr)) {
581 for (; SUCCEEDED(hr) && list->clsid; ++list) {
582 REGFILTER2 rf2;
583 REGFILTERPINS2* prfp2;
584 int i;
585
586 for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) ;
587 rf2.dwVersion = 2;
588 rf2.dwMerit = list->merit;
589 rf2.u.s2.cPins2 = i;
590 rf2.u.s2.rgPins2 = prfp2 = CoTaskMemAlloc(i*sizeof(REGFILTERPINS2));
591 if (!prfp2) {
593 break;
594 }
595 for (i = 0; list->pins[i].flags != 0xFFFFFFFF; i++) {
596 REGPINTYPES* lpMediatype;
597 CLSID* lpClsid;
598 int j, nbmt;
599
600 for (nbmt = 0; list->pins[i].mediatypes[nbmt].majortype; nbmt++) ;
601 /* Allocate a single buffer for regpintypes struct and clsids */
602 lpMediatype = CoTaskMemAlloc(nbmt*(sizeof(REGPINTYPES) + 2*sizeof(CLSID)));
603 if (!lpMediatype) {
605 break;
606 }
607 lpClsid = (CLSID*) (lpMediatype + nbmt);
608 for (j = 0; j < nbmt; j++) {
609 (lpMediatype + j)->clsMajorType = lpClsid + j*2;
610 memcpy(lpClsid + j*2, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
611 (lpMediatype + j)->clsMinorType = lpClsid + j*2 + 1;
612 if (list->pins[i].mediatypes[j].subtype)
613 memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].subtype, sizeof(CLSID));
614 else {
615 /* Subtypes are often a combination of major type + fourcc/tag */
616 memcpy(lpClsid + j*2 + 1, list->pins[i].mediatypes[j].majortype, sizeof(CLSID));
617 *(DWORD*)(lpClsid + j*2 + 1) = list->pins[i].mediatypes[j].fourcc;
618 }
619 }
620 prfp2[i].dwFlags = list->pins[i].flags;
621 prfp2[i].cInstances = 0;
622 prfp2[i].nMediaTypes = j;
623 prfp2[i].lpMediaType = lpMediatype;
624 prfp2[i].nMediums = 0;
625 prfp2[i].lpMedium = NULL;
626 prfp2[i].clsPinCategory = NULL;
627 }
628
629 if (FAILED(hr)) {
630 ERR("failed to register with hresult 0x%x\n", hr);
631 CoTaskMemFree(prfp2);
632 break;
633 }
634
635 hr = IFilterMapper2_RegisterFilter(pFM2, list->clsid, list->name, NULL, list->category, NULL, &rf2);
636
637 while (i) {
638 CoTaskMemFree((REGPINTYPES*)prfp2[i-1].lpMediaType);
639 i--;
640 }
641 CoTaskMemFree(prfp2);
642 }
643 }
644
645 if (pFM2)
646 IFilterMapper2_Release(pFM2);
647
649
650 return hr;
651}
REGPINTYPES
Definition: axextend.idl:192
const CLSID * clsMinorType
Definition: axextend.idl:191
#define ERR(fmt,...)
Definition: debug.h:110
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define FAILED(hr)
Definition: intsafe.h:51
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD dwVersion
Definition: axextend.idl:236
DWORD dwMerit
Definition: axextend.idl:237
const REGFILTERPINS2 * rgPins2
Definition: axextend.idl:251
ULONG cPins2
Definition: axextend.idl:250
const CLSID * clsPinCategory
Definition: axextend.idl:231
const REGPINMEDIUM * lpMedium
Definition: axextend.idl:230
const REGPINTYPES * lpMediaType
Definition: axextend.idl:228

Referenced by QUARTZ_DllRegisterServer().

◆ register_interfaces()

static HRESULT register_interfaces ( struct regsvr_interface const list)
static

Definition at line 181 of file regsvr.c.

182{
184 HKEY interface_key;
185
187 KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
188 if (res != ERROR_SUCCESS) goto error_return;
189
190 for (; res == ERROR_SUCCESS && list->iid; ++list) {
191 WCHAR buf[39];
192 HKEY iid_key;
193
194 StringFromGUID2(list->iid, buf, 39);
195 res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
196 KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
197 if (res != ERROR_SUCCESS) goto error_close_interface_key;
198
199 if (list->name) {
200 res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, (const BYTE*)list->name,
201 strlen(list->name) + 1);
202 if (res != ERROR_SUCCESS) goto error_close_iid_key;
203 }
204
205 if (list->base_iid) {
206 res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
207 if (res != ERROR_SUCCESS) goto error_close_iid_key;
208 }
209
210 if (0 <= list->num_methods) {
211 static const WCHAR fmt[] = { '%', 'd', 0 };
212 HKEY key;
213
216 if (res != ERROR_SUCCESS) goto error_close_iid_key;
217
218 sprintfW(buf, fmt, list->num_methods);
219 res = RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE*)buf,
220 (lstrlenW(buf) + 1) * sizeof(WCHAR));
222
223 if (res != ERROR_SUCCESS) goto error_close_iid_key;
224 }
225
226 if (list->ps_clsid) {
227 res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
228 if (res != ERROR_SUCCESS) goto error_close_iid_key;
229 }
230
231 if (list->ps_clsid32) {
232 res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
233 if (res != ERROR_SUCCESS) goto error_close_iid_key;
234 }
235
236 error_close_iid_key:
237 RegCloseKey(iid_key);
238 }
239
240error_close_interface_key:
241 RegCloseKey(interface_key);
242error_return:
244}
static WCHAR const interface_keyname[10]
Definition: regsvr.c:65
static WCHAR const num_methods_keyname[11]
Definition: regsvr.c:70
static WCHAR const ps_clsid_keyname[15]
Definition: regsvr.c:72
static WCHAR const base_ifa_keyname[14]
Definition: regsvr.c:67
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
Definition: regsvr.c:329
static WCHAR const ps_clsid32_keyname[17]
Definition: regsvr.c:75
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4911
#define lstrlenW
Definition: compat.h:750
#define sprintfW
Definition: unicode.h:58
Definition: dsound.c:943
Definition: copy.c:22

◆ register_key_defvalueA()

static LONG register_key_defvalueA ( HKEY  base,
WCHAR const name,
char const value 
)
static

Definition at line 710 of file regsvr.c.

714{
715 LONG res;
716 HKEY key;
717
718 res = RegCreateKeyExW(base, name, 0, NULL, 0,
720 if (res != ERROR_SUCCESS) return res;
721 res = RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE*)value, lstrlenA(value) + 1);
723 return res;
724}
Definition: name.c:39
Definition: pdh_main.c:94

◆ register_key_defvalueW()

static LONG register_key_defvalueW ( HKEY  base,
WCHAR const name,
WCHAR const value 
)
static

Definition at line 690 of file regsvr.c.

694{
695 LONG res;
696 HKEY key;
697
698 res = RegCreateKeyExW(base, name, 0, NULL, 0,
700 if (res != ERROR_SUCCESS) return res;
701 res = RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE*)value,
702 (lstrlenW(value) + 1) * sizeof(WCHAR));
704 return res;
705}

◆ register_key_guid()

static LONG register_key_guid ( HKEY  base,
WCHAR const name,
GUID const guid 
)
static

Definition at line 679 of file regsvr.c.

680{
681 WCHAR buf[39];
682
685}
static LONG register_key_defvalueW(HKEY base, WCHAR const *name, WCHAR const *value)
Definition: regsvr.c:340
const GUID * guid

◆ register_mediatypes_extension()

static HRESULT register_mediatypes_extension ( struct regsvr_mediatype_extension const list)
static

Definition at line 448 of file regsvr.c.

449{
451 HKEY mediatype_key;
452 HKEY extensions_root_key = NULL;
453 WCHAR buf[39];
454
456 KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
457 if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
458
459 res = RegCreateKeyExW(mediatype_key, extensions_keyname, 0, NULL, 0,
460 KEY_READ | KEY_WRITE, NULL, &extensions_root_key, NULL);
461 if (res != ERROR_SUCCESS) goto error_return;
462
463 for (; res == ERROR_SUCCESS && list->majortype; ++list) {
464 HKEY extension_key;
465
466 res = RegCreateKeyExA(extensions_root_key, list->extension, 0, NULL, 0,
467 KEY_READ | KEY_WRITE, NULL, &extension_key, NULL);
468 if (res != ERROR_SUCCESS) break;
469
470 StringFromGUID2(list->majortype, buf, 39);
471 res = RegSetValueExW(extension_key, mediatype_name, 0, REG_SZ, (const BYTE*)buf,
472 (lstrlenW(buf) + 1) * sizeof(WCHAR));
473 if (res != ERROR_SUCCESS) goto error_close_key;
474
475 StringFromGUID2(list->subtype, buf, 39);
476 res = RegSetValueExW(extension_key, subtype_valuename, 0, REG_SZ, (const BYTE*)buf,
477 (lstrlenW(buf) + 1) * sizeof(WCHAR));
478 if (res != ERROR_SUCCESS) goto error_close_key;
479
480 StringFromGUID2(&CLSID_AsyncReader, buf, 39);
481 res = RegSetValueExW(extension_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf,
482 (lstrlenW(buf) + 1) * sizeof(WCHAR));
483 if (res != ERROR_SUCCESS) goto error_close_key;
484
485error_close_key:
486 RegCloseKey(extension_key);
487 }
488
489error_return:
490 RegCloseKey(mediatype_key);
491 if (extensions_root_key)
492 RegCloseKey(extensions_root_key);
493
495}
static const WCHAR subtype_valuename[]
Definition: regsvr.c:159
static const WCHAR sourcefilter_valuename[]
Definition: regsvr.c:161
static const WCHAR mediatype_name[]
Definition: regsvr.c:157
static const WCHAR extensions_keyname[]
Definition: regsvr.c:163
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034

Referenced by QUARTZ_DllRegisterServer().

◆ register_mediatypes_parsing()

static HRESULT register_mediatypes_parsing ( struct regsvr_mediatype_parsing const list)
static

Definition at line 395 of file regsvr.c.

396{
398 HKEY mediatype_key;
399 WCHAR buf[39];
400 int i;
401
403 KEY_READ | KEY_WRITE, NULL, &mediatype_key, NULL);
404 if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
405
406 for (; res == ERROR_SUCCESS && list->majortype; ++list) {
407 HKEY majortype_key = NULL;
408 HKEY subtype_key = NULL;
409
410 StringFromGUID2(list->majortype, buf, 39);
411 res = RegCreateKeyExW(mediatype_key, buf, 0, NULL, 0,
412 KEY_READ | KEY_WRITE, NULL, &majortype_key, NULL);
413 if (res != ERROR_SUCCESS) goto error_close_keys;
414
415 StringFromGUID2(list->subtype, buf, 39);
416 res = RegCreateKeyExW(majortype_key, buf, 0, NULL, 0,
417 KEY_READ | KEY_WRITE, NULL, &subtype_key, NULL);
418 if (res != ERROR_SUCCESS) goto error_close_keys;
419
420 StringFromGUID2(&CLSID_AsyncReader, buf, 39);
421 res = RegSetValueExW(subtype_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf,
422 (lstrlenW(buf) + 1) * sizeof(WCHAR));
423 if (res != ERROR_SUCCESS) goto error_close_keys;
424
425 for(i = 0; list->line[i]; i++) {
426 char buffer[3];
427 wsprintfA(buffer, "%d", i);
428 res = RegSetValueExA(subtype_key, buffer, 0, REG_SZ, (const BYTE*)list->line[i],
429 lstrlenA(list->line[i]));
430 if (res != ERROR_SUCCESS) goto error_close_keys;
431 }
432
433error_close_keys:
434 if (majortype_key)
435 RegCloseKey(majortype_key);
436 if (subtype_key)
437 RegCloseKey(subtype_key);
438 }
439
440 RegCloseKey(mediatype_key);
441
443}
GLuint buffer
Definition: glext.h:5915
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)

Referenced by QUARTZ_DllRegisterServer().

◆ register_progid()

static LONG register_progid ( WCHAR const clsid,
char const progid,
char const curver_progid,
char const name,
char const extra 
)
static

Definition at line 729 of file regsvr.c.

735{
736 LONG res;
737 HKEY progid_key;
738
741 &progid_key, NULL);
742 if (res != ERROR_SUCCESS) return res;
743
744 if (name) {
745 res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, (const BYTE*)name, strlen(name) + 1);
746 if (res != ERROR_SUCCESS) goto error_close_progid_key;
747 }
748
749 if (clsid) {
751 if (res != ERROR_SUCCESS) goto error_close_progid_key;
752 }
753
754 if (curver_progid) {
756 curver_progid);
757 if (res != ERROR_SUCCESS) goto error_close_progid_key;
758 }
759
760 if (extra) {
761 HKEY extra_key;
762
763 res = RegCreateKeyExA(progid_key, extra, 0,
765 &extra_key, NULL);
766 if (res == ERROR_SUCCESS)
767 RegCloseKey(extra_key);
768 }
769
770error_close_progid_key:
771 RegCloseKey(progid_key);
772 return res;
773}
static WCHAR const curver_keyname[7]
Definition: regsvr.c:80
#define progid(str)
Definition: exdisp.idl:31
@ extra
Definition: id3.c:95
REFCLSID clsid
Definition: msctf.c:82

◆ unregister_coclasses()

static HRESULT unregister_coclasses ( struct regsvr_coclass const list)
static

Definition at line 355 of file regsvr.c.

356{
358 HKEY coclass_key;
359
361 KEY_READ | KEY_WRITE, &coclass_key);
362 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
363 if (res != ERROR_SUCCESS) goto error_return;
364
365 for (; res == ERROR_SUCCESS && list->clsid; ++list) {
366 WCHAR buf[39];
367
368 StringFromGUID2(list->clsid, buf, 39);
369 res = RegDeleteTreeW(coclass_key, buf);
371 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
372
373 if (list->progid) {
376 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
377 }
378
379 if (list->viprogid) {
382 if (res != ERROR_SUCCESS) goto error_close_coclass_key;
383 }
384 }
385
386error_close_coclass_key:
387 RegCloseKey(coclass_key);
388error_return:
390}
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LONG WINAPI RegDeleteTreeA(IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL)
Definition: reg.c:1843
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79

◆ unregister_filters()

static HRESULT unregister_filters ( struct regsvr_filter const list)
static

Definition at line 656 of file regsvr.c.

657{
658 HRESULT hr;
659 IFilterMapper2* pFM2;
660
662
663 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (LPVOID*)&pFM2);
664
665 if (SUCCEEDED(hr)) {
666 for (; SUCCEEDED(hr) && list->clsid; ++list)
667 hr = IFilterMapper2_UnregisterFilter(pFM2, list->category, NULL, list->clsid);
668 IFilterMapper2_Release(pFM2);
669 }
670
672
673 return hr;
674}

Referenced by DllUnregisterServer().

◆ unregister_interfaces()

static HRESULT unregister_interfaces ( struct regsvr_interface const list)
static

Definition at line 249 of file regsvr.c.

250{
252 HKEY interface_key;
253
255 KEY_READ | KEY_WRITE, &interface_key);
256 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
257 if (res != ERROR_SUCCESS) goto error_return;
258
259 for (; res == ERROR_SUCCESS && list->iid; ++list) {
260 WCHAR buf[39];
261
262 StringFromGUID2(list->iid, buf, 39);
263 res = RegDeleteTreeW(interface_key, buf);
265 }
266
267 RegCloseKey(interface_key);
268error_return:
270}

◆ unregister_mediatypes_extension()

static HRESULT unregister_mediatypes_extension ( struct regsvr_mediatype_extension const list)
static

Definition at line 541 of file regsvr.c.

542{
543 LONG res;
544 HKEY mediatype_key;
545 HKEY extensions_root_key = NULL;
546
548 KEY_READ | KEY_WRITE, &mediatype_key);
549 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
550 if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
551
552 res = RegOpenKeyExW(mediatype_key, extensions_keyname, 0,
553 KEY_READ | KEY_WRITE, &extensions_root_key);
556 else if (res == ERROR_SUCCESS)
557 for (; res == ERROR_SUCCESS && list->majortype; ++list) {
558 res = RegDeleteTreeA(extensions_root_key, list->extension);
560 }
561
562 RegCloseKey(mediatype_key);
563 if (extensions_root_key)
564 RegCloseKey(extensions_root_key);
565
567}

Referenced by DllUnregisterServer().

◆ unregister_mediatypes_parsing()

static HRESULT unregister_mediatypes_parsing ( struct regsvr_mediatype_parsing const list)
static

Definition at line 500 of file regsvr.c.

501{
502 LONG res;
503 HKEY mediatype_key;
504 HKEY majortype_key;
505 WCHAR buf[39];
506
508 KEY_READ | KEY_WRITE, &mediatype_key);
509 if (res == ERROR_FILE_NOT_FOUND) return S_OK;
510 if (res != ERROR_SUCCESS) return HRESULT_FROM_WIN32(res);
511
512 for (; res == ERROR_SUCCESS && list->majortype; ++list) {
513 StringFromGUID2(list->majortype, buf, 39);
514 res = RegOpenKeyExW(mediatype_key, buf, 0,
515 KEY_READ | KEY_WRITE, &majortype_key);
516 if (res == ERROR_FILE_NOT_FOUND) {
518 continue;
519 }
520 if (res != ERROR_SUCCESS) break;
521
522 StringFromGUID2(list->subtype, buf, 39);
523 res = RegDeleteTreeW(majortype_key, buf);
525
526 /* Removed majortype key if there is no more subtype key */
527 res = RegDeleteKeyW(majortype_key, 0);
529
530 RegCloseKey(majortype_key);
531 }
532
533 RegCloseKey(mediatype_key);
534
536}
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
#define ERROR_ACCESS_DENIED
Definition: compat.h:97

Referenced by DllUnregisterServer().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ base_ifa_keyname

const WCHAR base_ifa_keyname[]
static
Initial value:
= {
'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
'e', 0 }

Definition at line 129 of file regsvr.c.

◆ clsid_keyname

const WCHAR clsid_keyname[]
static
Initial value:
= {
'C', 'L', 'S', 'I', 'D', 0 }

Definition at line 140 of file regsvr.c.

◆ coclass_list

struct regsvr_coclass const coclass_list[]
static
Initial value:
= {
{ NULL }
}

Definition at line 778 of file regsvr.c.

◆ curver_keyname

const WCHAR curver_keyname[]
static
Initial value:
= {
'C', 'u', 'r', 'V', 'e', 'r', 0 }

Definition at line 142 of file regsvr.c.

◆ extensions_keyname

const WCHAR extensions_keyname[]
static
Initial value:
= {
'E', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', 0 }

Definition at line 163 of file regsvr.c.

Referenced by register_mediatypes_extension(), and unregister_mediatypes_extension().

◆ filter_list

struct regsvr_filter const filter_list[]
static

Definition at line 879 of file regsvr.c.

Referenced by DllUnregisterServer(), and QUARTZ_DllRegisterServer().

◆ interface_keyname

const WCHAR interface_keyname[]
static
Initial value:
= {
'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }

Definition at line 127 of file regsvr.c.

◆ interface_list

struct regsvr_interface const interface_list[]
static
Initial value:
= {
{ NULL }
}

Definition at line 786 of file regsvr.c.

◆ ips32_keyname

const WCHAR ips32_keyname[]
static
Initial value:
= {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
'3', '2', 0 }

Definition at line 147 of file regsvr.c.

◆ ips_keyname

const WCHAR ips_keyname[]
static
Initial value:
= {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
0 }

Definition at line 144 of file regsvr.c.

◆ mediatype_extension_list

struct regsvr_mediatype_extension const mediatype_extension_list[]
static
Initial value:
= {
{ &MEDIATYPE_Stream,
&MEDIASUBTYPE_MPEG1Audio,
".mp3"
},
{ NULL }
}

Definition at line 867 of file regsvr.c.

Referenced by DllUnregisterServer(), and QUARTZ_DllRegisterServer().

◆ mediatype_name

const WCHAR mediatype_name[]
static
Initial value:
= {
'M', 'e', 'd', 'i', 'a', ' ', 'T', 'y', 'p', 'e', 0 }

Definition at line 157 of file regsvr.c.

Referenced by register_mediatypes_extension(), register_mediatypes_parsing(), unregister_mediatypes_extension(), and unregister_mediatypes_parsing().

◆ mediatype_parsing_list

struct regsvr_mediatype_parsing const mediatype_parsing_list[]
static

Definition at line 794 of file regsvr.c.

Referenced by DllUnregisterServer(), and QUARTZ_DllRegisterServer().

◆ num_methods_keyname

const WCHAR num_methods_keyname[]
static
Initial value:
= {
'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }

Definition at line 132 of file regsvr.c.

◆ progid_keyname

const WCHAR progid_keyname[]
static
Initial value:
= {
'P', 'r', 'o', 'g', 'I', 'D', 0 }

Definition at line 150 of file regsvr.c.

◆ ps_clsid32_keyname

const WCHAR ps_clsid32_keyname[]
static
Initial value:
= {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', '3', '2', 0 }

Definition at line 137 of file regsvr.c.

◆ ps_clsid_keyname

const WCHAR ps_clsid_keyname[]
static
Initial value:
= {
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
'i', 'd', 0 }

Definition at line 134 of file regsvr.c.

◆ sourcefilter_valuename

const WCHAR sourcefilter_valuename[]
static
Initial value:
= {
'S', 'o', 'u', 'r', 'c', 'e', ' ', 'F', 'i', 'l', 't', 'e', 'r', 0 }

Definition at line 161 of file regsvr.c.

Referenced by register_mediatypes_extension(), and register_mediatypes_parsing().

◆ subtype_valuename

const WCHAR subtype_valuename[]
static
Initial value:
= {
'S', 'u', 'b', 't', 'y', 'p', 'e', 0 }

Definition at line 159 of file regsvr.c.

Referenced by register_mediatypes_extension().

◆ tmodel_valuename

const char tmodel_valuename[] = "ThreadingModel"
static

Definition at line 156 of file regsvr.c.

◆ viprogid_keyname

const WCHAR viprogid_keyname[]
static
Initial value:
= {
'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
0 }

Definition at line 152 of file regsvr.c.