ole32: Register the CLSID_Picture_Metafile and CLSID_Picture_Dib
ProgIDs.
Francois Gouget
fgouget at codeweavers.com
Wed Aug 9 12:54:02 CDT 2006
This time with the complete patch.
---
dlls/ole32/regsvr.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/regsvr.c b/dlls/ole32/regsvr.c
index 21474d6..fad8f8a 100644
--- a/dlls/ole32/regsvr.c
+++ b/dlls/ole32/regsvr.c
@@ -68,6 +68,7 @@ struct regsvr_coclass
LPCSTR ips; /* can be NULL to omit */
LPCSTR ips32; /* can be NULL to omit */
LPCSTR ips32_tmodel; /* can be NULL to omit */
+ LPCSTR progid; /* can be NULL to omit */
};
static HRESULT register_coclasses(struct regsvr_coclass const *list);
@@ -97,6 +98,8 @@ static WCHAR const ips_keyname[13] = {
static WCHAR const ips32_keyname[15] = {
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
'3', '2', 0 };
+static WCHAR const progid_keyname[7] = {
+ 'P', 'r', 'o', 'g', 'I', 'D', 0 };
static char const tmodel_valuename[] = "ThreadingModel";
/***********************************************************************
@@ -107,7 +110,10 @@ static LONG register_key_defvalueW(HKEY
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 *name);
static LONG recursive_delete_key(HKEY key);
+static LONG recursive_delete_keyA(HKEY base, char const *name);
/***********************************************************************
@@ -268,6 +274,15 @@ static HRESULT register_coclasses(struct
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
+ if (list->progid) {
+ res = register_key_defvalueA(clsid_key, progid_keyname,
+ list->progid);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+
+ res = register_progid(buf, list->progid, list->name);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
error_close_clsid_key:
RegCloseKey(clsid_key);
}
@@ -306,6 +321,11 @@ static HRESULT unregister_coclasses(stru
res = recursive_delete_key(clsid_key);
RegCloseKey(clsid_key);
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+
+ if (list->progid) {
+ res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
+ if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+ }
}
error_close_coclass_key:
@@ -366,6 +386,38 @@ static LONG register_key_defvalueA(
}
/***********************************************************************
+ * regsvr_progid
+ */
+static LONG register_progid(
+ WCHAR const *clsid,
+ char const *progid,
+ char const *name)
+{
+ LONG res;
+ HKEY progid_key;
+
+ res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
+ NULL, 0, KEY_READ | KEY_WRITE, NULL,
+ &progid_key, NULL);
+ if (res != ERROR_SUCCESS) return res;
+
+ if (name) {
+ res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
+ (CONST BYTE*)name, strlen(name) + 1);
+ if (res != ERROR_SUCCESS) goto error_close_progid_key;
+ }
+
+ if (clsid) {
+ res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
+ if (res != ERROR_SUCCESS) goto error_close_progid_key;
+ }
+
+error_close_progid_key:
+ RegCloseKey(progid_key);
+ return res;
+}
+
+/***********************************************************************
* recursive_delete_key
*/
static LONG recursive_delete_key(HKEY key)
@@ -398,6 +450,22 @@ static LONG recursive_delete_key(HKEY ke
}
/***********************************************************************
+ * recursive_delete_keyA
+ */
+static LONG recursive_delete_keyA(HKEY base, char const *name)
+{
+ LONG res;
+ HKEY key;
+
+ res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
+ if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
+ if (res != ERROR_SUCCESS) return res;
+ res = recursive_delete_key(key);
+ RegCloseKey(key);
+ return res;
+}
+
+/***********************************************************************
* coclass list
*/
static GUID const CLSID_StdOleLink = {
@@ -465,13 +533,15 @@ static struct regsvr_coclass const cocla
"Picture (Metafile)",
NULL,
"ole32.dll",
- NULL
+ NULL,
+ "StaticMetafile"
},
{ &CLSID_Picture_Dib,
"Picture (Device Independent Bitmap)",
NULL,
"ole32.dll",
- NULL
+ NULL,
+ "StaticDib"
},
{ &CLSID_ClassMoniker,
"ClassMoniker",
--
1.4.1
More information about the wine-patches
mailing list