Updated msxml3-FreeThreadedXMLHTTP60 patchset

Thanks Gijs Vermeulen.
This commit is contained in:
Alistair Leslie-Hughes 2021-05-19 11:33:46 +10:00
parent ab2f8734d9
commit b595359adf

View File

@ -1,17 +1,18 @@
From 16487de3a86ba56671d9868bdbe7b908bbb7d6bf Mon Sep 17 00:00:00 2001
From 740afed65c692a9f96494465ddb72a362fa91613 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.
Update from Gijs Vermeulen <gijsvrm@gmail.com>
---
dlls/msxml3/Makefile.in | 2 +-
dlls/msxml3/factory.c | 5 +
dlls/msxml3/httprequest.c | 493 +++++++++++++++++++++++++++++++++++-
dlls/msxml3/httprequest.c | 503 +++++++++++++++++++++++++++++++++++-
dlls/msxml3/msxml_private.h | 1 +
dlls/msxml3/tests/httpreq.c | 395 ++++++++++++++++++++++++++++-
dlls/msxml3/tests/schema.c | 5 +
dlls/msxml3/uuid.c | 4 +
7 files changed, 900 insertions(+), 5 deletions(-)
dlls/msxml3/tests/httpreq.c | 395 +++++++++++++++++++++++++++-
dlls/msxml3/tests/schema.c | 6 +
dlls/msxml3/uuid.c | 5 +
7 files changed, 912 insertions(+), 5 deletions(-)
diff --git a/dlls/msxml3/Makefile.in b/dlls/msxml3/Makefile.in
index 936c745895d..f9e629f89bc 100644
@ -48,7 +49,7 @@ index b8452ff4b4e..90a042fec92 100644
IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP30 ) ||
IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP40 ) ||
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 7286eb97bb7..ad74260193f 100644
index 7286eb97bb7..ed59a12912b 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -44,13 +44,16 @@
@ -69,7 +70,7 @@ index 7286eb97bb7..ad74260193f 100644
static const WCHAR colspaceW[] = {':',' ',0};
static const WCHAR crlfW[] = {'\r','\n',0};
@@ -2031,6 +2034,458 @@ static const struct IServerXMLHTTPRequestVtbl ServerXMLHTTPRequestVtbl =
@@ -2031,6 +2034,468 @@ static const struct IServerXMLHTTPRequestVtbl ServerXMLHTTPRequestVtbl =
ServerXMLHTTPRequest_setOption
};
@ -78,7 +79,7 @@ index 7286eb97bb7..ad74260193f 100644
+struct xml_http_request_2
+{
+ httprequest req;
+ IXMLHTTPRequest2 IXMLHTTPRequest2_iface;
+ IXMLHTTPRequest3 IXMLHTTPRequest3_iface;
+ IRtwqAsyncCallback IRtwqAsyncCallback_iface;
+ IDispatch IDispatch_iface;
+
@ -89,9 +90,9 @@ index 7286eb97bb7..ad74260193f 100644
+ ULONGLONG request_body_size;
+};
+
+static inline struct xml_http_request_2 *impl_from_IXMLHTTPRequest2(IXMLHTTPRequest2 *iface)
+static inline struct xml_http_request_2 *impl_from_IXMLHTTPRequest3(IXMLHTTPRequest3 *iface)
+{
+ return CONTAINING_RECORD(iface, struct xml_http_request_2, IXMLHTTPRequest2_iface);
+ return CONTAINING_RECORD(iface, struct xml_http_request_2, IXMLHTTPRequest3_iface);
+}
+
+static inline struct xml_http_request_2 *xml_http_request_2_from_IRtwqAsyncCallback(IRtwqAsyncCallback *iface)
@ -104,16 +105,17 @@ index 7286eb97bb7..ad74260193f 100644
+ return CONTAINING_RECORD(iface, struct xml_http_request_2, IDispatch_iface);
+}
+
+static HRESULT WINAPI xml_http_request_2_QueryInterface(IXMLHTTPRequest2 *iface, REFIID riid, void **obj)
+static HRESULT WINAPI xml_http_request_2_QueryInterface(IXMLHTTPRequest3 *iface, REFIID riid, void **obj)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
+
+ if (IsEqualGUID(riid, &IID_IXMLHTTPRequest2) || IsEqualGUID(riid, &IID_IUnknown))
+ if (IsEqualGUID(riid, &IID_IXMLHTTPRequest3) || IsEqualGUID(riid, &IID_IXMLHTTPRequest2)
+ || IsEqualGUID(riid, &IID_IUnknown))
+ {
+ IXMLHTTPRequest2_AddRef(iface);
+ *obj = iface;
+ IUnknown_AddRef((IUnknown*)*obj);
+ return S_OK;
+ }
+
@ -122,17 +124,17 @@ index 7286eb97bb7..ad74260193f 100644
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI xml_http_request_2_AddRef(IXMLHTTPRequest2 *iface)
+static ULONG WINAPI xml_http_request_2_AddRef(IXMLHTTPRequest3 *iface)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ ULONG ref = InterlockedIncrement(&This->req.ref);
+ TRACE("(%p)->(%u)\n", This, ref);
+ return ref;
+}
+
+static ULONG WINAPI xml_http_request_2_Release(IXMLHTTPRequest2 *iface)
+static ULONG WINAPI xml_http_request_2_Release(IXMLHTTPRequest3 *iface)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ ULONG ref = InterlockedDecrement(&This->req.ref);
+
+ TRACE("(%p)->(%u)\n", This, ref);
@ -152,14 +154,14 @@ index 7286eb97bb7..ad74260193f 100644
+ return ref;
+}
+
+static HRESULT WINAPI xml_http_request_2_Open(IXMLHTTPRequest2 *iface, const WCHAR *method,
+static HRESULT WINAPI xml_http_request_2_Open(IXMLHTTPRequest3 *iface, const WCHAR *method,
+ const WCHAR *url, IXMLHTTPRequest2Callback *callback,
+ const WCHAR *username, const WCHAR *password,
+ const WCHAR *proxy_username, const WCHAR *proxy_password)
+{
+ static const WCHAR accept_encoding[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0};
+ static const WCHAR empty = 0;
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ VARIANT async_v, username_v, password_v;
+ HRESULT hr;
+
@ -194,9 +196,9 @@ index 7286eb97bb7..ad74260193f 100644
+ return httprequest_setRequestHeader(&This->req, (BSTR)accept_encoding, (BSTR)&empty);
+}
+
+static HRESULT WINAPI xml_http_request_2_Send(IXMLHTTPRequest2 *iface, ISequentialStream *body, ULONGLONG body_size)
+static HRESULT WINAPI xml_http_request_2_Send(IXMLHTTPRequest3 *iface, ISequentialStream *body, ULONGLONG body_size)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ IRtwqAsyncResult *result;
+ HRESULT hr;
+
@ -218,62 +220,62 @@ index 7286eb97bb7..ad74260193f 100644
+ return hr;
+}
+
+static HRESULT WINAPI xml_http_request_2_Abort(IXMLHTTPRequest2 *iface)
+static HRESULT WINAPI xml_http_request_2_Abort(IXMLHTTPRequest3 *iface)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ TRACE("(%p) stub!\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_SetCookie(IXMLHTTPRequest2 *iface, const XHR_COOKIE *cookie, DWORD *state)
+static HRESULT WINAPI xml_http_request_2_SetCookie(IXMLHTTPRequest3 *iface, const XHR_COOKIE *cookie, DWORD *state)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%p %p) stub!\n", This, cookie, state);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest2 *iface, ISequentialStream *stream)
+static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest3 *iface, ISequentialStream *stream)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%p) stub!\n", This, stream);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_SetProperty(IXMLHTTPRequest2 *iface, XHR_PROPERTY property, ULONGLONG value)
+static HRESULT WINAPI xml_http_request_2_SetProperty(IXMLHTTPRequest3 *iface, XHR_PROPERTY property, ULONGLONG value)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value ));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest2 *iface,
+static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest3 *iface,
+ const WCHAR *header, const WCHAR *value)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ TRACE("(%p)->(%s %s)\n", This, debugstr_w(header), debugstr_w(value));
+ return httprequest_setRequestHeader(&This->req, (BSTR)header, (BSTR)value);
+}
+
+static HRESULT WINAPI xml_http_request_2_GetAllResponseHeaders(IXMLHTTPRequest2 *iface, WCHAR **headers)
+static HRESULT WINAPI xml_http_request_2_GetAllResponseHeaders(IXMLHTTPRequest3 *iface, WCHAR **headers)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%p) stub!\n", This, headers);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_GetCookie(IXMLHTTPRequest2 *iface, const WCHAR *url,
+static HRESULT WINAPI xml_http_request_2_GetCookie(IXMLHTTPRequest3 *iface, const WCHAR *url,
+ const WCHAR *name, DWORD flags,
+ ULONG *cookies_count, XHR_COOKIE **cookies)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%s %s %d %p %p) stub!\n", This, debugstr_w(url), debugstr_w(name), flags, cookies_count, cookies);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest2 *iface,
+static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *iface,
+ const WCHAR *header, WCHAR **value)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest2(iface);
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ HRESULT hr;
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value);
@ -292,7 +294,14 @@ index 7286eb97bb7..ad74260193f 100644
+ return hr;
+}
+
+static const struct IXMLHTTPRequest2Vtbl XMLHTTPRequest2Vtbl = {
+static HRESULT WINAPI xml_http_request_3_SetClientCertificate(IXMLHTTPRequest3 *iface, DWORD count, const BYTE *hashes, const WCHAR *pin)
+{
+ struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface);
+ FIXME("(%p)->(%d %p %s) stub!\n", This, count, hashes, debugstr_w(pin));
+ return E_NOTIMPL;
+}
+
+static const struct IXMLHTTPRequest3Vtbl XMLHTTPRequest3Vtbl = {
+ /* IUnknown methods */
+ xml_http_request_2_QueryInterface,
+ xml_http_request_2_AddRef,
@ -308,6 +317,8 @@ index 7286eb97bb7..ad74260193f 100644
+ xml_http_request_2_GetAllResponseHeaders,
+ xml_http_request_2_GetCookie,
+ xml_http_request_2_GetResponseHeader,
+ /* IXMLHTTPRequest3 methods */
+ xml_http_request_3_SetClientCertificate,
+};
+
+static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_QueryInterface(IRtwqAsyncCallback *iface, REFIID riid, void **obj)
@ -331,14 +342,14 @@ index 7286eb97bb7..ad74260193f 100644
+{
+ struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface);
+ TRACE("(%p)\n", This);
+ return xml_http_request_2_AddRef(&This->IXMLHTTPRequest2_iface);
+ return xml_http_request_2_AddRef(&This->IXMLHTTPRequest3_iface);
+}
+
+static ULONG WINAPI xml_http_request_2_IRtwqAsyncCallback_Release(IRtwqAsyncCallback *iface)
+{
+ struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface);
+ TRACE("(%p)\n", This);
+ return xml_http_request_2_Release(&This->IXMLHTTPRequest2_iface);
+ return xml_http_request_2_Release(&This->IXMLHTTPRequest3_iface);
+}
+
+static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_GetParameters(IRtwqAsyncCallback *iface,
@ -419,14 +430,14 @@ index 7286eb97bb7..ad74260193f 100644
+{
+ struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface);
+ TRACE("(%p)\n", This);
+ return xml_http_request_2_AddRef(&This->IXMLHTTPRequest2_iface);
+ return xml_http_request_2_AddRef(&This->IXMLHTTPRequest3_iface);
+}
+
+static ULONG WINAPI xml_http_request_2_IDispatch_Release(IDispatch *iface)
+{
+ struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface);
+ TRACE("(%p)\n", This);
+ return xml_http_request_2_Release(&This->IXMLHTTPRequest2_iface);
+ return xml_http_request_2_Release(&This->IXMLHTTPRequest3_iface);
+}
+
+static HRESULT WINAPI xml_http_request_2_IDispatch_GetTypeInfoCount(IDispatch *iface, UINT *value)
@ -460,7 +471,7 @@ index 7286eb97bb7..ad74260193f 100644
+ VARIANT *result, EXCEPINFO *exception, UINT *arg_err)
+{
+ struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface);
+ IXMLHTTPRequest2 *xhr2_iface = &This->IXMLHTTPRequest2_iface;
+ IXMLHTTPRequest2 *xhr2_iface = (IXMLHTTPRequest2*)&This->IXMLHTTPRequest3_iface;
+ HRESULT hr;
+ LONG status;
+ BSTR status_str = NULL;
@ -528,7 +539,7 @@ index 7286eb97bb7..ad74260193f 100644
static void init_httprequest(httprequest *req)
{
req->IXMLHTTPRequest_iface.lpVtbl = &XMLHTTPRequestVtbl;
@@ -2080,6 +2535,35 @@ HRESULT XMLHTTPRequest_create(void **obj)
@@ -2080,6 +2545,35 @@ HRESULT XMLHTTPRequest_create(void **obj)
return S_OK;
}
@ -540,7 +551,7 @@ index 7286eb97bb7..ad74260193f 100644
+ if (!(xhr2 = heap_alloc(sizeof(*xhr2)))) return E_OUTOFMEMORY;
+
+ init_httprequest(&xhr2->req);
+ xhr2->IXMLHTTPRequest2_iface.lpVtbl = &XMLHTTPRequest2Vtbl;
+ xhr2->IXMLHTTPRequest3_iface.lpVtbl = &XMLHTTPRequest3Vtbl;
+ xhr2->IRtwqAsyncCallback_iface.lpVtbl = &xml_http_request_2_IRtwqAsyncCallbackVtbl;
+ xhr2->IDispatch_iface.lpVtbl = &xml_http_request_2_IDispatchVtbl;
+
@ -556,7 +567,7 @@ index 7286eb97bb7..ad74260193f 100644
+ RtwqStartup();
+ if (!xhr2_work_queue) RtwqAllocateWorkQueue(RTWQ_MULTITHREADED_WORKQUEUE, &xhr2_work_queue);
+
+ *obj = &xhr2->IXMLHTTPRequest2_iface;
+ *obj = &xhr2->IXMLHTTPRequest3_iface;
+ TRACE("returning iface %p\n", *obj);
+ return S_OK;
+}
@ -564,7 +575,7 @@ index 7286eb97bb7..ad74260193f 100644
HRESULT ServerXMLHTTP_create(void **obj)
{
serverhttp *req;
@@ -2109,6 +2593,13 @@ HRESULT XMLHTTPRequest_create(void **ppObj)
@@ -2109,6 +2603,13 @@ HRESULT XMLHTTPRequest_create(void **ppObj)
return E_NOTIMPL;
}
@ -1023,10 +1034,10 @@ index 4a23f1d82a8..25378a99bdc 100644
CoUninitialize();
}
diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c
index 964e368bf84..947372bd0f8 100644
index 964e368bf84..1b3b5cbad1b 100644
--- a/dlls/msxml3/tests/schema.c
+++ b/dlls/msxml3/tests/schema.c
@@ -32,10 +32,15 @@
@@ -32,10 +32,16 @@
#include "dispex.h"
#include "cguid.h"
@ -1037,13 +1048,14 @@ index 964e368bf84..947372bd0f8 100644
DEFINE_GUID(CLSID_SAXXMLReader60, 0x88d96a0c, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
+DEFINE_GUID(IID_IXMLHTTPRequest2, 0xe5d37dc0, 0x552a, 0x4d52, 0x9c,0xc0, 0xa1,0x4d,0x54,0x6f,0xbd,0x04);
+DEFINE_GUID(IID_IXMLHTTPRequest3, 0xa1c9feee, 0x0617, 0x4f23, 0x9d,0x58, 0x89,0x61,0xea,0x43,0x56,0x7c);
+DEFINE_GUID(IID_IXMLHTTPRequest2Callback, 0xa44a9299, 0xe321, 0x40de, 0x88,0x66, 0x34,0x1b,0x41,0x66,0x91,0x62);
+DEFINE_GUID(IID_IXMLHTTPRequest3Callback, 0xb9e57830, 0x8c6c, 0x4a6f, 0x9c,0x13, 0x47,0x77,0x2b,0xb0,0x47,0xbb);
#include "wine/test.h"
diff --git a/dlls/msxml3/uuid.c b/dlls/msxml3/uuid.c
index 333d4f3d3c7..1eb09d003fe 100644
index 333d4f3d3c7..1b4f0452c5f 100644
--- a/dlls/msxml3/uuid.c
+++ b/dlls/msxml3/uuid.c
@@ -43,6 +43,7 @@
@ -1054,16 +1066,17 @@ index 333d4f3d3c7..1eb09d003fe 100644
DEFINE_GUID(CLSID_MXNamespaceManager60, 0x88d96a11, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
DEFINE_GUID(CLSID_MXXMLWriter60, 0x88d96a0f, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
DEFINE_GUID(CLSID_SAXAttributes60, 0x88d96a0e, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
@@ -51,6 +52,9 @@ DEFINE_GUID(CLSID_ServerXMLHTTP60, 0x88d96a0b, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0
@@ -51,6 +52,10 @@ DEFINE_GUID(CLSID_ServerXMLHTTP60, 0x88d96a0b, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0
DEFINE_GUID(CLSID_XMLHTTP60, 0x88d96a0a, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
DEFINE_GUID(CLSID_XSLTemplate60, 0x88d96a08, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5);
+DEFINE_GUID(IID_IXMLHTTPRequest2, 0xe5d37dc0, 0x552a, 0x4d52, 0x9c,0xc0, 0xa1,0x4d,0x54,0x6f,0xbd,0x04);
+DEFINE_GUID(IID_IXMLHTTPRequest3, 0xa1c9feee, 0x0617, 0x4f23, 0x9d,0x58, 0x89,0x61,0xea,0x43,0x56,0x7c);
+DEFINE_GUID(IID_IXMLHTTPRequest2Callback, 0xa44a9299, 0xe321, 0x40de, 0x88,0x66, 0x34,0x1b,0x41,0x66,0x91,0x62);
+DEFINE_GUID(IID_IXMLHTTPRequest3Callback, 0xb9e57830, 0x8c6c, 0x4a6f, 0x9c,0x13, 0x47,0x77,0x2b,0xb0,0x47,0xbb);
/*
* Note that because of a #define in msxml2.h, we end up initializing
--
2.29.2
2.30.2