msxml3: fix domdoc_load
Stefan Huehner
stefan at huehner.org
Sun Oct 23 14:18:45 CDT 2005
Hi,
attached patch fixes wrong behaviour in IXMLDOMDocument_load. Testcase
showing this error is included. It succeeds after applying the patch.
ChangeLog:
- fix IXMLDOMDocument error-handling
Regards,
Sefan
-------------- next part --------------
Index: dlls/msxml3/domdoc.c
===================================================================
RCS file: /home/wine/wine/dlls/msxml3/domdoc.c,v
retrieving revision 1.13
diff -u -p -r1.13 domdoc.c
--- dlls/msxml3/domdoc.c 6 Oct 2005 11:34:15 -0000 1.13
+++ dlls/msxml3/domdoc.c 23 Oct 2005 19:16:25 -0000
@@ -727,8 +727,10 @@ static HRESULT WINAPI domdoc_load(
return S_FALSE;
xmldoc = doread( filename );
- if ( !xmldoc )
+ if ( !xmldoc ) {
+ *isSuccessful = VARIANT_FALSE;
return S_FALSE;
+ }
This->node = create_node( (xmlNodePtr) xmldoc );
if ( !This->node )
Index: dlls/msxml3/tests/domdoc.c
===================================================================
RCS file: /home/wine/wine/dlls/msxml3/tests/domdoc.c,v
retrieving revision 1.2
diff -u -p -r1.2 domdoc.c
--- dlls/msxml3/tests/domdoc.c 23 Aug 2005 09:37:42 -0000 1.2
+++ dlls/msxml3/tests/domdoc.c 23 Oct 2005 19:16:25 -0000
@@ -61,6 +61,10 @@ static const WCHAR szComplete4[] = {
'f','n','2','.','t','x','t','<','/','p','r','>',
'<','/','l','c','>','\n',0
};
+static const WCHAR szNonExistentFile[] = {
+ 'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
+};
+
static const WCHAR szOpen[] = { 'o','p','e','n',0 };
static const WCHAR szdl[] = { 'd','l',0 };
static const WCHAR szlc[] = { 'l','c',0 };
@@ -77,6 +81,7 @@ void test_domdoc( void )
IXMLDOMDocument *doc = NULL;
IXMLDOMElement *element = NULL;
VARIANT_BOOL b;
+ VARIANT var;
BSTR str;
r = CoCreateInstance( &CLSID_DOMDocument, NULL,
@@ -93,6 +98,18 @@ void test_domdoc( void )
ok( r == S_FALSE, "loadXML failed\n");
ok( b == VARIANT_FALSE, "failed to load XML string\n");
+ /* try to laod an document from an non-existent file */
+ b = VARIANT_TRUE;
+ str = SysAllocString ( szNonExistentFile );
+ VariantInit(&var);
+ V_VT(&var) = VT_BSTR;
+ V_BSTR(&var) = str;
+
+ r = IXMLDOMDocument_load( doc, var, &b);
+ ok( r == S_FALSE, "load (from file) failed\n");
+ ok( b == VARIANT_FALSE, "failed to load XML file\n");
+ SysFreeString( str );
+
/* try load an empty document */
b = VARIANT_TRUE;
str = SysAllocString( szEmpty );
More information about the wine-patches
mailing list