ole32: Copy/paste a stripped down version of register_progid() and use it so that StaticDib and StaticMetafile get proper names.

Francois Gouget fgouget at codeweavers.com
Wed Aug 9 12:16:32 CDT 2006


---
 dlls/ole32/regsvr.c |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/dlls/ole32/regsvr.c b/dlls/ole32/regsvr.c
index 474929d..fad8f8a 100644
--- a/dlls/ole32/regsvr.c
+++ b/dlls/ole32/regsvr.c
@@ -110,6 +110,8 @@ 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);
 
@@ -273,19 +275,11 @@ static HRESULT register_coclasses(struct
 	}
 
 	if (list->progid) {
-	    HKEY progid_key;
-
 	    res = register_key_defvalueA(clsid_key, progid_keyname,
 					 list->progid);
 	    if (res != ERROR_SUCCESS) goto error_close_clsid_key;
 
-	    res = RegCreateKeyExA(HKEY_CLASSES_ROOT, list->progid, 0,
-				  NULL, 0, KEY_READ | KEY_WRITE, NULL,
-				  &progid_key, NULL);
-	    if (res != ERROR_SUCCESS) goto error_close_clsid_key;
-
-	    res = register_key_defvalueW(progid_key, clsid_keyname, buf);
-	    RegCloseKey(progid_key);
+	    res = register_progid(buf, list->progid, list->name);
 	    if (res != ERROR_SUCCESS) goto error_close_clsid_key;
 	}
 
@@ -392,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)
-- 
1.4.1




More information about the wine-patches mailing list