[PATCH] Add missing classes for DOMDocument in msxml, and add test-cases back it up. Tested with WinXP and Linux.

Peter Dons Tychsen (none) donpedro at dhcppc4.
Fri Dec 28 06:41:32 CST 2007


---
 dlls/msxml3/factory.c      |    5 ++-
 dlls/msxml3/regsvr.c       |   26 ++++++++++++++++
 dlls/msxml3/tests/domdoc.c |   69 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/msxml3/tests/xmldoc.c |   39 +++++++++++++++++++++++++
 4 files changed, 138 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c
index a973b04..4109f35 100644
--- a/dlls/msxml3/factory.c
+++ b/dlls/msxml3/factory.c
@@ -158,7 +158,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
     {
         cf = (IClassFactory*) &xmldoccf.lpVtbl;
     }
-    else if( IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument ) )
+    else if( IsEqualCLSID( rclsid, &CLSID_DOMFreeThreadedDocument ) ||   /* Version indep. v 2.x */
+             IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument ) ||   /* Version indep. v 2.x */
+             IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument26 ) || /* Version indep. v 3.0 */
+             IsEqualCLSID( rclsid, &CLSID_FreeThreadedDOMDocument30 ) )  /* Version dep.   v 3.0 */
     {
         cf = (IClassFactory*) &domdoccf.lpVtbl;
     }
diff --git a/dlls/msxml3/regsvr.c b/dlls/msxml3/regsvr.c
index 3a0c6bd..578aecc 100644
--- a/dlls/msxml3/regsvr.c
+++ b/dlls/msxml3/regsvr.c
@@ -512,6 +512,22 @@ static struct regsvr_coclass const coclass_list[] = {
         "Microsoft.FreeThreadedXMLDOM.1.0",
         "1.0"
      },
+     {   &CLSID_FreeThreadedDOMDocument30,
+        "Free Threaded XML DOM Document",
+        NULL,
+        "msxml3.dll",
+        "Both",
+        "MSXML2.FreeThreadedDOMDocument.3.0",
+        "3.0"
+     },
+     {   &CLSID_FreeThreadedDOMDocument26,
+        "Free Threaded XML DOM Document",
+        NULL,
+        "msxml3.dll",
+        "Both",
+        "MSXML2.FreeThreadedDOMDocument",
+        NULL
+     },
 
     {   &CLSID_XMLHTTPRequest,
 	"XML HTTP Request",
@@ -606,6 +622,16 @@ static struct progid const progid_list[] = {
 	&CLSID_DOMFreeThreadedDocument,
 	"Microsoft.FreeThreadedXMLDOM.1.0"
     },
+    {   "MSXML.FreeThreadedDOMDocument",
+	"Free threaded XML DOM Document",
+	&CLSID_FreeThreadedDOMDocument30,
+	"MSXML2.FreeThreadedDOMDocument.3.0"
+    },
+    {   "MSXML.FreeThreadedDOMDocument",
+	"Free threaded XML DOM Document",
+	&CLSID_FreeThreadedDOMDocument26,
+	"MSXML2.FreeThreadedDOMDocument"
+    },
     {   "Microsoft.XMLHTTP",
 	"XML HTTP Request",
 	&CLSID_XMLHTTPRequest,
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 8b4f546..179844d 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -33,6 +33,11 @@
 const CLSID CLSID_DOMDocument2 = {0xf6d90f11, 0x9c73, 0x11d3, {0xb3, 0x2e, 0x00, 0xc0, 0x4f, 0x99, 0x0b, 0xb4}};
 const IID IID_IXMLDOMDocument2 = {0x2933bf95, 0x7b36, 0x11d2, {0xb2, 0x0e, 0x00, 0xc0, 0x4f, 0x98, 0x3e, 0x60}};
 
+const CLSID CLSID_DOMDocument30 = {0xf5078f32, 0xc551, 0x11d3, {0x89,0xb9, 0x00,0x00,0xf8,0x1f,0xe2,0x21}};
+const CLSID CLSID_FreeThreadedDOMDocument30 = {0xf5078f33, 0xc551, 0x11d3, {0x89,0xb9, 0x00,0x00,0xf8,0x1f,0xe2,0x21}};
+const CLSID CLSID_FreeThreadedDOMDocument26 = {0xf5078f1c, 0xc551, 0x11d3, {0x89,0xb9, 0x00,0x00,0xf8,0x1f,0xe2,0x21}};
+const CLSID CLSID_FreeThreadedDOMDocument = {0xf6d90f12, 0x9c73, 0x11d3, {0xb3,0x2e, 0x00,0xc0,0x4f,0x99,0x0b,0xb4}};
+
 static const WCHAR szEmpty[] = { 0 };
 static const WCHAR szIncomplete[] = {
     '<','?','x','m','l',' ',
@@ -326,6 +331,69 @@ static char *list_to_string(IXMLDOMNodeList *list)
 #define expect_node(node, expstr) { char str[4096]; node_to_string(node, str); ok(strcmp(str, expstr)==0, "Invalid node: %s, exptected %s\n", str, expstr); }
 #define expect_list_and_release(list, expstr) { char *str = list_to_string(list); ok(strcmp(str, expstr)==0, "Invalid node list: %s, exptected %s\n", str, expstr); if (list) IXMLDOMNodeList_Release(list); }
 
+static void test_ifaces( void )
+{
+    HRESULT hr;
+    IXMLDOMDocument *doc = NULL;
+    
+    /* Test that we can actually obtain all the class variants */
+    hr = CoCreateInstance(&CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER,
+        &IID_IXMLDOMDocument, (LPVOID*)&doc);
+    ok( hr == S_OK, "Class CLSID_DOMDocument failed\n");  
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance( &CLSID_DOMDocument2, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_DOMDocument2 failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance( &CLSID_DOMDocument30, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_DOMDocument30 failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance(&CLSID_DOMFreeThreadedDocument, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_DOMFreeThreadedDocument failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance(&CLSID_FreeThreadedDOMDocument, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_FreeThreadedDOMDocument failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance(&CLSID_FreeThreadedDOMDocument26, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_FreeThreadedDOMDocument26 failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+
+    hr = CoCreateInstance(&CLSID_FreeThreadedDOMDocument30, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_FreeThreadedDOMDocument30 failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+}
+
 static void test_domdoc( void )
 {
     HRESULT r;
@@ -1731,6 +1799,7 @@ START_TEST(domdoc)
     r = CoInitialize( NULL );
     ok( r == S_OK, "failed to init com\n");
 
+    test_ifaces();
     test_domdoc();
     test_domnode();
     test_refs();
diff --git a/dlls/msxml3/tests/xmldoc.c b/dlls/msxml3/tests/xmldoc.c
index 1186c9b..4af39a7 100644
--- a/dlls/msxml3/tests/xmldoc.c
+++ b/dlls/msxml3/tests/xmldoc.c
@@ -28,6 +28,20 @@
 
 #include "wine/test.h"
 
+/* These UUIDs are not declared in the headers, so just declare them here */
+const CLSID CLSID_XMLDocument2 = {0x2b8de2fe, 0x8d2d, 0x11d1, {0xb2,0xfc, 0x00,0xc0,0x4f,0xd9,0x15,0xa9}};
+
+/* The UUIDs below are declared in uuid.dll, but are missing in the Mingw packages currently (libuuid.lib) 
+ * If cross compilation is desired, enable these constants to compile. These can be removed when the Mingw
+ * packages are fixed. 
+ */
+#if 0
+const IID IID_IXMLDocument2 = {0x2b8de2fe, 0x8d2d, 0x11d1, {0xb2,0xfc, 0x00,0xc0,0x4f,0xd9,0x15,0xa9}};
+const IID IID_IXMLDocument = {0xf52e2b61, 0x18a1, 0x11d1, {0xb1,0x05, 0x00,0x80,0x5f,0x49,0x91,0x6b}};
+const CLSID CLSID_XMLDocument = {0xcfc399af, 0xd876, 0x11d0, {0x9c,0x10, 0x00,0xc0,0x4f,0xc9,0x9c,0x8e}};
+const IID IID_IXMLElement = {0x3f7f31ac, 0xe15f, 0x11d0, {0x9c,0x25, 0x00,0xc0,0x4f,0xc9,0x9c,0x8e}};
+#endif
+
 static void append_str(char **str, const char *data)
 {
     sprintf(*str, data);
@@ -52,6 +66,30 @@ static void create_xml_file(LPCSTR filename)
     CloseHandle(hf);
 }
 
+static void test_ifaces( void )
+{
+    HRESULT hr;
+    IXMLDOMDocument *doc = NULL;
+    
+    /* Test that we can actually obtain all the class variants */
+    hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
+        &IID_IXMLDocument, (LPVOID*)&doc);
+    ok( hr == S_OK, "Class CLSID_XMLDocument failed\n");  
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }    
+
+    hr = CoCreateInstance( &CLSID_XMLDocument2, NULL,
+        CLSCTX_INPROC_SERVER, &IID_IXMLDocument2, (LPVOID*)&doc );
+    ok( hr == S_OK, "Class CLSID_XMLDocument failed\n");
+    if( hr == S_OK)
+    {
+      IXMLDocument_Release( doc );
+    }
+} 
+
+
 static void test_xmldoc(void)
 {
     HRESULT hr;
@@ -332,6 +370,7 @@ START_TEST(xmldoc)
     hr = CoInitialize(NULL);
     ok(hr == S_OK, "failed to init com\n");
 
+    test_ifaces();
     test_xmldoc();
     test_createElement();
 }
-- 
1.5.3.6


--=-rtiaRjj90/wdiOgBGWI2--




More information about the wine-patches mailing list