PATCH: CoGetTreatAsClass

Marcus Meissner meissner at suse.de
Fri Jan 10 09:58:23 CST 2003


Hi,

MSDN is a bit strange explaining "TreatAs" and "AutoTreatAs", however, for
CoGetTreatAsClass it is clearly saying that it returns "TreatAs".

Ciao, Marcus

Changelog:
	Implemented CoGetTreatAsClass.

Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.71
diff -u -r1.71 compobj.c
--- dlls/ole32/compobj.c	7 Jan 2003 20:36:28 -0000	1.71
+++ dlls/ole32/compobj.c	10 Jan 2003 15:57:06 -0000
@@ -1863,6 +1867,40 @@
     return res;
 }
 
+/******************************************************************************
+ *              CoGetTreatAsClass        [OLE32.25]
+ *
+ * Reads the TreatAs value from a class.
+ */
+HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew)
+{
+    HKEY hkey = 0;
+    char buf[200], szClsidNew[200];
+    HRESULT res = S_OK;
+    LONG len = sizeof(szClsidNew);
+
+    FIXME("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
+    sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
+    memcpy(clsidNew,clsidOld,sizeof(CLSID)); /* copy over old value */
+
+    if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
+    {
+        res = REGDB_E_CLASSNOTREG;
+	goto done;
+    }
+    if (RegQueryValueA(hkey, "TreatAs", szClsidNew, &len))
+    {
+        res = S_FALSE;
+	goto done;
+    }
+    res = __CLSIDFromStringA(szClsidNew,clsidNew);
+    if (FAILED(res))
+    	FIXME("Failed CLSIDFromStringA(%s), hres %lx?\n",szClsidNew,res);
+done:
+    if (hkey) RegCloseKey(hkey);
+    return res;
+    
+}
 
 /***********************************************************************
  *           IsEqualGUID [OLE32.76]
Index: dlls/ole32/ole32.spec
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole32.spec,v
retrieving revision 1.42
diff -u -r1.42 ole32.spec
--- dlls/ole32/ole32.spec	12 Dec 2002 02:17:39 -0000	1.42
+++ dlls/ole32/ole32.spec	10 Jan 2003 15:57:06 -0000
@@ -22,7 +22,7 @@
  22 stdcall CoGetPSClsid(ptr ptr) CoGetPSClsid
  23 stdcall CoGetStandardMarshal(ptr ptr long ptr long ptr) CoGetStandardMarshal
  24 stdcall CoGetState(ptr) CoGetState
- 25 stub CoGetTreatAsClass          # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
+ 25 stdcall CoGetTreatAsClass(ptr ptr) CoGetTreatAsClass
  26 stdcall CoInitialize(ptr) CoInitialize
  27 stdcall CoInitializeWOW(long long) CoInitializeWOW
  28 stub CoIsHandlerConnected       # stdcall (ptr) return 0,ERR_NOTIMPLEMENTED



More information about the wine-patches mailing list