Updated msxml3-FreeThreadedXMLHTTP60 patchset.

This commit is contained in:
Paul Gofman 2023-10-05 13:53:15 -06:00
parent a777ae6b81
commit 953c54145c
8 changed files with 242 additions and 124 deletions

View File

@ -1,4 +1,4 @@
From 0d226ed6deed34649926c32dffe7086d2ce4f06b Mon Sep 17 00:00:00 2001
From aba54e8536ab5423e8293452db6462dcca0bea0b Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 11 Sep 2020 17:55:59 +1000
Subject: [PATCH] include: Remove interfaces already define in msxml6.idl
@ -26,7 +26,7 @@ index c2d3cd30c60..243ee379712 100644
/* undef the #define in msxml2 so that we can access the v.2 version
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index d8101c4ce94..d19ad28fba9 100644
index e123d4eba5a..48cfa8f5593 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -29,6 +29,7 @@
@ -38,7 +38,7 @@ index d8101c4ce94..d19ad28fba9 100644
#include "ocidl.h"
#include "dispex.h"
diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c
index cf55f53dbc9..fd7abca151d 100644
index efc3a8e56e3..a4fe29aca02 100644
--- a/dlls/msxml3/tests/schema.c
+++ b/dlls/msxml3/tests/schema.c
@@ -32,6 +32,11 @@
@ -76,7 +76,7 @@ index 4abbe5e4763..333d4f3d3c7 100644
* Note that because of a #define in msxml2.h, we end up initializing
* CLSID_DOMDocument2 to be the v.3 version independent DOMDocument
diff --git a/include/msxml2.idl b/include/msxml2.idl
index 916e0e8ab3d..1d1ba7a5248 100644
index ede4113ecbf..85bb6a5b0cb 100644
--- a/include/msxml2.idl
+++ b/include/msxml2.idl
@@ -1612,15 +1612,6 @@ coclass FreeThreadedDOMDocument40
@ -259,10 +259,10 @@ index 916e0e8ab3d..1d1ba7a5248 100644
helpstring("SAXAttributes"),
progid("Msxml2.SAXAttributes"),
diff --git a/include/msxml6.idl b/include/msxml6.idl
index 4948de39f1f..e6a0a5feda5 100644
index d4a5c490243..7396826a1f6 100644
--- a/include/msxml6.idl
+++ b/include/msxml6.idl
@@ -3048,18 +3048,6 @@ coclass DOMDocument60
@@ -3065,18 +3065,6 @@ coclass DOMDocument60
[default, source] dispinterface XMLDOMDocumentEvents;
}
@ -281,7 +281,7 @@ index 4948de39f1f..e6a0a5feda5 100644
[
helpstring("SAX XML Reader 6.0"),
progid("Msxml2.SAXXMLReader.6.0"),
@@ -3165,6 +3153,18 @@ coclass XSLTemplate60
@@ -3182,6 +3170,18 @@ coclass XSLTemplate60
[default] interface IXSLTemplate;
}
@ -301,5 +301,5 @@ index 4948de39f1f..e6a0a5feda5 100644
helpstring("XML HTTP 6.0"),
progid("Msxml2.XMLHTTP.6.0"),
--
2.34.1
2.41.0

View File

@ -1,4 +1,4 @@
From 19c928c1e4b5737956a694fed6ab2b244365b0f0 Mon Sep 17 00:00:00 2001
From e11874a28a68cd3cd9c031f475d59435d94aa3fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 8 Sep 2020 18:43:52 +0200
Subject: [PATCH] msxml3: Implement FreeThreadedXMLHTTP60.
@ -12,7 +12,8 @@ Update from Gijs Vermeulen <gijsvrm@gmail.com>
dlls/msxml3/tests/httpreq.c | 395 +++++++++++++++++++++++++++-
dlls/msxml3/tests/schema.c | 6 +
dlls/msxml3/uuid.c | 5 +
7 files changed, 904 insertions(+), 5 deletions(-)
include/msxml6.idl | 22 +-
8 files changed, 915 insertions(+), 16 deletions(-)
diff --git a/dlls/msxml3/Makefile.in b/dlls/msxml3/Makefile.in
index 2bf789732da..e2d737599b1 100644
@ -1016,7 +1017,7 @@ index bccfbaf582a..23d7680d196 100644
CoUninitialize();
}
diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c
index 99c7d35cc10..2b63182e2e4 100644
index a4fe29aca02..fd244ee2e1c 100644
--- a/dlls/msxml3/tests/schema.c
+++ b/dlls/msxml3/tests/schema.c
@@ -32,10 +32,16 @@
@ -1059,6 +1060,46 @@ index 333d4f3d3c7..1b4f0452c5f 100644
/*
* Note that because of a #define in msxml2.h, we end up initializing
diff --git a/include/msxml6.idl b/include/msxml6.idl
index 7396826a1f6..b2d8bd3b337 100644
--- a/include/msxml6.idl
+++ b/include/msxml6.idl
@@ -1715,17 +1715,6 @@ interface ISAXDeclHandler : IUnknown
[in] int nSystemId);
}
-[
- helpstring("Free Threaded XML HTTP Request class 6.0"),
- progid("Msxml2.FreeThreadedXMLHTTP60.6.0"),
- threading(both),
- uuid(88d96a09-f192-11d4-a65f-0040963251e5)
-]
-coclass FreeThreadedXMLHTTP60
-{
- [default] interface IXMLHTTPRequest2;
-}
-
[
object,
local,
@@ -3053,6 +3042,17 @@ interface ISchemaNotation;
SCHEMATYPEVARIETY __schemaTypeVariety__;
} __msxml6_ReferenceRemainingTypes__;
+[
+ helpstring("Free Threaded XML HTTP Request class 6.0"),
+ progid("Msxml2.FreeThreadedXMLHTTP60.6.0"),
+ threading(both),
+ uuid(88d96a09-f192-11d4-a65f-0040963251e5)
+]
+coclass FreeThreadedXMLHTTP60
+{
+ [default] interface IXMLHTTPRequest2;
+}
+
[
helpstring("XML DOM Document 6.0"),
progid("Msxml2.DOMDocument.6.0"),
--
2.40.1
2.41.0

View File

@ -1,17 +1,17 @@
From b6db59b7d1a7ca08a2cb3c0fb52145fa89cd2e17 Mon Sep 17 00:00:00 2001
From 7a0c4087a5a3a2afe1c87c55874fcc2c1f10b3b2 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 5 Jan 2023 14:36:31 +1100
Subject: [PATCH 2/4] msxml3: Implement IXMLHTTPRequest3 SetProperty
Subject: [PATCH] msxml3: Implement IXMLHTTPRequest3 SetProperty
---
dlls/msxml3/httprequest.c | 77 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 75 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 98dd23c9fbb..d8360680411 100644
index d059c20ae81..0e28fea0437 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -102,6 +102,21 @@ typedef struct
@@ -101,6 +101,21 @@ typedef struct
/* IObjectSafety */
DWORD safeopt;
@ -33,7 +33,7 @@ index 98dd23c9fbb..d8360680411 100644
} httprequest;
typedef struct
@@ -2230,8 +2245,52 @@ static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest
@@ -2229,8 +2244,52 @@ static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest
static HRESULT WINAPI xml_http_request_2_SetProperty(IXMLHTTPRequest3 *iface, XHR_PROPERTY property, ULONGLONG value)
{
struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
@ -88,7 +88,7 @@ index 98dd23c9fbb..d8360680411 100644
}
static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest3 *iface,
@@ -2551,6 +2610,20 @@ static void init_httprequest(httprequest *req)
@@ -2550,6 +2609,20 @@ static void init_httprequest(httprequest *req)
req->site = NULL;
req->safeopt = 0;
@ -110,5 +110,5 @@ index 98dd23c9fbb..d8360680411 100644
HRESULT XMLHTTPRequest_create(void **obj)
--
2.39.0
2.41.0

View File

@ -1,17 +1,17 @@
From a4077e33ab9e41927433479a9a8af9ed11990c04 Mon Sep 17 00:00:00 2001
From ea093721b1f774dee875dc930d8bd084dd32875b Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 12 Jan 2023 08:21:48 +1100
Subject: [PATCH 4/4] msxml3: Correct xml_http_request_2_GetResponseHeader
Subject: [PATCH] msxml3: Correct xml_http_request_2_GetResponseHeader
---
dlls/msxml3/httprequest.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 48ed444576e..111ac39f62f 100644
index 0e28fea0437..ee46885dabd 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -2339,8 +2339,7 @@ static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *ifa
@@ -2324,8 +2324,7 @@ static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *ifa
TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value);
@ -22,5 +22,5 @@ index 48ed444576e..111ac39f62f 100644
#define E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80070002)
--
2.39.0
2.41.0

View File

@ -0,0 +1,66 @@
From 3ef2f1338b0b315bc3bf887b67646d29e5c839a9 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Thu, 5 Oct 2023 11:38:00 -0600
Subject: [PATCH] msxml3: Treat body as data array in
xml_http_request_2_IRtwqAsyncCallback_Invoke().
---
dlls/msxml3/httprequest.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index ee46885dabd..0e3a06bf920 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -2411,6 +2411,7 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
IRtwqAsyncResult *result)
{
struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface);
+ SAFEARRAY *sa = NULL;
VARIANT body_v;
HRESULT hr;
ULONG read;
@@ -2421,14 +2422,25 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
if (This->request_body)
{
- V_VT(&body_v) = VT_BSTR;
- V_BSTR(&body_v) = CoTaskMemAlloc(This->request_body_size);
+ SAFEARRAYBOUND bound;
+ void *ptr;
- if (FAILED(hr = ISequentialStream_Read(This->request_body, V_BSTR(&body_v), This->request_body_size, &read)) ||
- read < This->request_body_size)
+ bound.lLbound = 0;
+ bound.cElements = This->request_body_size;
+ if (!(sa = SafeArrayCreate(VT_UI1, 1, &bound)))
+ {
+ ERR("No memory.\n");
+ hr = E_OUTOFMEMORY;
+ goto done;
+ }
+ V_ARRAY(&body_v) = sa;
+ V_VT(&body_v) = VT_ARRAY | VT_UI1;
+ SafeArrayAccessData(sa, &ptr);
+ hr = ISequentialStream_Read(This->request_body, ptr, This->request_body_size, &read);
+ SafeArrayUnaccessData(sa);
+ if (FAILED(hr) || read < This->request_body_size)
{
- ERR("Failed to allocate request body memory, hr %#lx\n", hr);
- CoTaskMemFree(V_BSTR(&body_v));
+ ERR("Failed to read from stream, hr %#lx\n", hr);
goto done;
}
@@ -2439,6 +2451,8 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
hr = httprequest_send(&This->req, body_v);
done:
+ if (sa)
+ SafeArrayDestroy(sa);
return IRtwqAsyncResult_SetStatus(result, hr);
}
--
2.41.0

View File

@ -1,100 +0,0 @@
From 19e3e3de97851559f2b5d67582e8b58606a4d7ff Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 5 Jan 2023 14:36:08 +1100
Subject: [PATCH] msxml3: Copy body size to request object
Dont assume that the data needs to be convert
NOTE: should use SetProperty value.
---
dlls/msxml3/httprequest.c | 46 +++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index d8360680411..e7e66dec202 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -117,6 +117,7 @@ typedef struct
DWORD enterrprised_id;
DWORD max_connections;
+ ULONGLONG request_body_size;
} httprequest;
typedef struct
@@ -737,27 +738,40 @@ static HRESULT BindStatusCallback_create(httprequest* This, BindStatusCallback *
{
case VT_BSTR:
{
- int len = SysStringLen(V_BSTR(body));
- const WCHAR *str = V_BSTR(body);
- UINT i, cp = CP_ACP;
+ int len = This->request_body_size ? This->request_body_size : SysStringLen(V_BSTR(body));
- for (i = 0; i < len; i++)
+ if(!This->request_body_size)
{
- if (str[i] > 127)
+ const WCHAR *str = V_BSTR(body);
+ UINT i, cp = CP_ACP;
+
+ for (i = 0; i < len; i++)
{
- cp = CP_UTF8;
- break;
+ if (str[i] > 127)
+ {
+ cp = CP_UTF8;
+ break;
+ }
}
+ size = WideCharToMultiByte(cp, 0, str, len, NULL, 0, NULL, NULL);
+ if (!(ptr = heap_alloc(size)))
+ {
+ heap_free(bsc);
+ return E_OUTOFMEMORY;
+ }
+ WideCharToMultiByte(cp, 0, str, len, ptr, size, NULL, NULL);
+ if (cp == CP_UTF8) This->use_utf8_content = TRUE;
}
-
- size = WideCharToMultiByte(cp, 0, str, len, NULL, 0, NULL, NULL);
- if (!(ptr = heap_alloc(size)))
+ else
{
- heap_free(bsc);
- return E_OUTOFMEMORY;
+ size = This->request_body_size;
+ if (!(ptr = heap_alloc(size)))
+ {
+ heap_free(bsc);
+ return E_OUTOFMEMORY;
+ }
+ memcpy(ptr, V_BSTR(body), size);
}
- WideCharToMultiByte(cp, 0, str, len, ptr, size, NULL, NULL);
- if (cp == CP_UTF8) This->use_utf8_content = TRUE;
break;
}
case VT_ARRAY|VT_UI1:
@@ -2436,6 +2450,8 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
ISequentialStream_Release(This->request_body);
This->request_body = NULL;
+
+ This->req.request_body_size = This->request_body_size;
}
hr = httprequest_send(&This->req, body_v);
@@ -2624,6 +2640,8 @@ static void init_httprequest(httprequest *req)
req->threshold = 0x100;
req->enterrprised_id = 0;
req->max_connections = 10;
+
+ req->request_body_size = 0;
}
HRESULT XMLHTTPRequest_create(void **obj)
--
2.40.1

View File

@ -0,0 +1,79 @@
From d157a334b25ae669d1ff35d5bba36d66f7295188 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Thu, 5 Oct 2023 12:05:28 -0600
Subject: [PATCH] msxml3: Try to get body size from stream in
xml_http_request_2_IRtwqAsyncCallback_Invoke().
---
dlls/msxml3/httprequest.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 0e3a06bf920..186deb5e54a 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -2411,6 +2411,7 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
IRtwqAsyncResult *result)
{
struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface);
+ IStream *stream = NULL;
SAFEARRAY *sa = NULL;
VARIANT body_v;
HRESULT hr;
@@ -2423,10 +2424,27 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
if (This->request_body)
{
SAFEARRAYBOUND bound;
+ ULONGLONG body_size;
+ STATSTG stream_stat;
+ LARGE_INTEGER li;
void *ptr;
+ if (SUCCEEDED(ISequentialStream_QueryInterface(This->request_body, &IID_IStream, (void **)&stream))
+ && SUCCEEDED(IStream_Stat(stream, &stream_stat, 0)))
+ {
+ body_size = stream_stat.cbSize.QuadPart;
+ li.QuadPart = 0;
+ IStream_Seek(stream, li, STREAM_SEEK_SET, NULL);
+ }
+ else
+ {
+ body_size = This->request_body_size;
+ }
+
+ TRACE("body_size %I64u.\n", body_size);
+
bound.lLbound = 0;
- bound.cElements = This->request_body_size;
+ bound.cElements = body_size;
if (!(sa = SafeArrayCreate(VT_UI1, 1, &bound)))
{
ERR("No memory.\n");
@@ -2436,9 +2454,13 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
V_ARRAY(&body_v) = sa;
V_VT(&body_v) = VT_ARRAY | VT_UI1;
SafeArrayAccessData(sa, &ptr);
- hr = ISequentialStream_Read(This->request_body, ptr, This->request_body_size, &read);
+
+ if (stream)
+ hr = IStream_Read(stream, ptr, body_size, &read);
+ else
+ hr = ISequentialStream_Read(This->request_body, ptr, body_size, &read);
SafeArrayUnaccessData(sa);
- if (FAILED(hr) || read < This->request_body_size)
+ if (FAILED(hr) || read < body_size)
{
ERR("Failed to read from stream, hr %#lx\n", hr);
goto done;
@@ -2453,6 +2475,8 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
done:
if (sa)
SafeArrayDestroy(sa);
+ if (stream)
+ IStream_Release(stream);
return IRtwqAsyncResult_SetStatus(result, hr);
}
--
2.41.0

View File

@ -0,0 +1,32 @@
From 90c794e738044606c36d769a38817fdbb7e141a1 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Thu, 5 Oct 2023 12:02:44 -0600
Subject: [PATCH] msxml3: Don't fail
xml_http_request_2_IRtwqAsyncCallback_Invoke() on stream read failures.
---
dlls/msxml3/httprequest.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 186deb5e54a..72a54740e18 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -2462,8 +2462,12 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal
SafeArrayUnaccessData(sa);
if (FAILED(hr) || read < body_size)
{
- ERR("Failed to read from stream, hr %#lx\n", hr);
- goto done;
+ /* Windows doesn't send the body in this case but still sends request with Content-Length
+ * set to requested body size. */
+ ERR("Failed to read from stream, hr %#lx, read %lu\n", hr, read);
+ SafeArrayDestroy(sa);
+ sa = NULL;
+ V_VT(&body_v) = VT_NULL;
}
ISequentialStream_Release(This->request_body);
--
2.41.0