Updated msxml3-FreeThreadedXMLHTTP60 patchset

This allows Tonk Hawk 1+2 on EGS connect to it's servers succesfully.

It would error on SetProperty, and then abort the connection.
This commit is contained in:
Alistair Leslie-Hughes 2023-01-12 09:32:29 +11:00
parent dc27f103e5
commit 0a970828aa
5 changed files with 273 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 5aa6c213ced971079f236acfe25437f5d49cebbf Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 10 Jan 2023 16:22:14 +1100
Subject: [PATCH 1/4] include: Add _XHR enum values
---
include/msxml6.idl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/msxml6.idl b/include/msxml6.idl
index 4672ae80626..aa03a8a310a 100644
--- a/include/msxml6.idl
+++ b/include/msxml6.idl
@@ -256,6 +256,20 @@ typedef enum _SCHEMATYPEVARIETY
} SCHEMATYPEVARIETY;
cpp_quote("#endif /* __msxml_som_enums__ */")
+typedef [v1_enum] enum _XHR_CRED_PROMPT
+{
+ XHR_CRED_PROMPT_ALL = 0x0,
+ XHR_CRED_PROMPT_NONE = 0x1,
+ XHR_CRED_PROMPT_PROXY = 0x2,
+} XHR_CRED_PROMPT;
+
+typedef [v1_enum] enum _XHR_AUTH
+{
+ XHR_AUTH_ALL = 0x0,
+ XHR_AUTH_NONE = 0x1,
+ XHR_AUTH_PROXY = 0x2,
+} XHR_AUTH;
+
typedef [v1_enum] enum _XHR_PROPERTY
{
XHR_PROP_NO_CRED_PROMPT,
--
2.39.0

View File

@ -0,0 +1,114 @@
From b6db59b7d1a7ca08a2cb3c0fb52145fa89cd2e17 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
---
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
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -102,6 +102,21 @@ typedef struct
/* IObjectSafety */
DWORD safeopt;
+
+ /* Properties */
+ DWORD no_prompt;
+ DWORD no_auth;
+ DWORD timeout;
+ BOOL no_headeres;
+ BOOL redirect;
+ BOOL cache;
+ BOOL extended;
+ BOOL query_utf8;
+ BOOL ignore_errors;
+ BOOL threshold;
+ DWORD enterrprised_id;
+ DWORD max_connections;
+
} httprequest;
typedef struct
@@ -2230,8 +2245,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);
- FIXME("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value ));
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value ));
+
+ switch (property)
+ {
+ case XHR_PROP_NO_CRED_PROMPT:
+ This->req.no_prompt = value;
+ break;
+ case XHR_PROP_NO_AUTH:
+ This->req.no_auth = value;
+ break;
+ case XHR_PROP_TIMEOUT:
+ This->req.timeout = value;
+ break;
+ case XHR_PROP_NO_DEFAULT_HEADERS:
+ This->req.no_headeres = value != 0;
+ break;
+ case XHR_PROP_REPORT_REDIRECT_STATUS:
+ This->req.redirect = value != 0;
+ break;
+ case XHR_PROP_NO_CACHE:
+ This->req.cache = value != 0;
+ break;
+ case XHR_PROP_EXTENDED_ERROR:
+ This->req.extended = value != 0;
+ break;
+ case XHR_PROP_QUERY_STRING_UTF8:
+ This->req.query_utf8 = value != 0;
+ break;
+ case XHR_PROP_IGNORE_CERT_ERRORS:
+ This->req.ignore_errors = value != 0;
+ break;
+ case XHR_PROP_ONDATA_THRESHOLD:
+ This->req.threshold = value;
+ break;
+ case XHR_PROP_SET_ENTERPRISEID:
+ This->req.enterrprised_id = value;
+ break;
+ case XHR_PROP_MAX_CONNECTIONS:
+ This->req.max_connections = value;
+ break;
+ default:
+ WARN("Invalid property %#x\n", property);
+ return E_INVALIDARG;
+ }
+ return S_OK;
}
static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest3 *iface,
@@ -2551,6 +2610,20 @@ static void init_httprequest(httprequest *req)
req->site = NULL;
req->safeopt = 0;
+
+ /* Properties */
+ req->no_prompt = XHR_CRED_PROMPT_ALL;
+ req->no_auth = XHR_AUTH_ALL;
+ req->timeout = 0xFFFFFFFF;
+ req->no_headeres = FALSE;
+ req->redirect = FALSE;
+ req->cache = FALSE;
+ req->extended = FALSE;
+ req->query_utf8 = FALSE;;
+ req->ignore_errors = FALSE;;
+ req->threshold = 0x100;
+ req->enterrprised_id = 0;
+ req->max_connections = 10;
}
HRESULT XMLHTTPRequest_create(void **obj)
--
2.39.0

View File

@ -0,0 +1,91 @@
From ca9c7d377e3e5e9689d67fbb9622ac1554442cdc 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 3/4] 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 | 44 ++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index d8360680411..48ed444576e 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++)
+ {
+ if (str[i] > 127)
+ {
+ cp = CP_UTF8;
+ break;
+ }
+ }
+ size = WideCharToMultiByte(cp, 0, str, len, NULL, 0, NULL, NULL);
+ if (!(ptr = heap_alloc(size)))
{
- cp = CP_UTF8;
- break;
+ 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);
--
2.39.0

View File

@ -0,0 +1,26 @@
From a4077e33ab9e41927433479a9a8af9ed11990c04 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
---
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
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -2339,8 +2339,7 @@ static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *ifa
TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value);
- if (FAILED(hr = httprequest_getResponseHeader(&This->req, (BSTR)header, value)))
- return hr;
+ hr = httprequest_getResponseHeader(&This->req, (BSTR)header, value);
#define E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80070002)
--
2.39.0

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "9e33e4f4a26091fc02106a1cd874f77098b99883"
echo "90d975ac1ed5da6de23d4edb732c0d08954b000a"
}
# Show version information
@ -2047,6 +2047,10 @@ fi
if test "$enable_msxml3_FreeThreadedXMLHTTP60" -eq 1; then
patch_apply msxml3-FreeThreadedXMLHTTP60/0001-include-Remove-interfaces-already-define-in-msxml6.i.patch
patch_apply msxml3-FreeThreadedXMLHTTP60/0003-msxml3-Implement-FreeThreadedXMLHTTP60.patch
patch_apply msxml3-FreeThreadedXMLHTTP60/0004-include-Add-_XHR-enum-values.patch
patch_apply msxml3-FreeThreadedXMLHTTP60/0005-msxml3-Implement-IXMLHTTPRequest3-SetProperty.patch
patch_apply msxml3-FreeThreadedXMLHTTP60/0006-msxml3-Copy-body-size-to-request-object.patch
patch_apply msxml3-FreeThreadedXMLHTTP60/0007-msxml3-Correct-xml_http_request_2_GetResponseHeader.patch
fi
# Patchset ntdll-APC_Performance