Skip to content

Commit 02185fb

Browse files
committed
[MSXML3] Sync with wine-10.0
1 parent 8b7ade1 commit 02185fb

46 files changed

Lines changed: 2216 additions & 2511 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dll/win32/msxml3/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ list(APPEND SOURCE
3232
nodemap.c
3333
parseerror.c
3434
pi.c
35+
reactos.c
3536
saxreader.c
3637
schema.c
3738
selection.c
@@ -70,20 +71,25 @@ add_library(msxml3 MODULE
7071

7172
add_idl_headers(xmlparser_idlheader xmlparser.idl)
7273
set_module_type(msxml3 win32dll)
73-
target_link_libraries(msxml3 libxml2 iconv-static uuid wine zlib)
74+
target_link_libraries(msxml3 libxml2 iconv-static uuid wine wine_dll_register zlib)
7475

7576
if(MSVC)
7677
target_compile_options(msxml3 PRIVATE /FIwine/typeof.h /FImsvc.h)
7778

7879
# Disable warning C4090: 'function': different 'const' qualifiers
7980
target_compile_options(msxml3 PRIVATE /wd4090)
81+
82+
if(ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64")
83+
# Disable warning C4267: 'function': conversion from 'size_t' to 'UINT', possible loss of data
84+
target_compile_options(msxml3 PRIVATE "/wd4267")
85+
endif()
8086
endif()
8187

8288
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
8389
target_compile_options(msxml3 PRIVATE -Wno-incompatible-function-pointer-types)
8490
endif()
8591

86-
add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
92+
add_importlibs(msxml3 libxslt urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
8793
add_dependencies(msxml3 xmlparser_idlheader stdole2) # msxml3_v1.tlb needs stdole2.tlb
8894
add_pch(msxml3 precomp.h "${PCH_SKIP_SOURCE}")
8995
add_cd_file(TARGET msxml3 DESTINATION reactos/system32 FOR all)

dll/win32/msxml3/attribute.c

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020

2121
#define COBJMACROS
2222

23-
#include "config.h"
24-
2523
#include <stdarg.h>
26-
#ifdef HAVE_LIBXML2
27-
# include <libxml/parser.h>
28-
# include <libxml/xmlerror.h>
29-
# include <libxml/HTMLtree.h>
30-
#endif
24+
#include <libxml/parser.h>
25+
#include <libxml/xmlerror.h>
26+
#include <libxml/HTMLtree.h>
3127

3228
#include "windef.h"
3329
#include "winbase.h"
@@ -39,8 +35,6 @@
3935

4036
#include "wine/debug.h"
4137

42-
#ifdef HAVE_LIBXML2
43-
4438
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
4539

4640
static const xmlChar xmlns[] = "xmlns";
@@ -101,9 +95,9 @@ static HRESULT WINAPI domattr_QueryInterface(
10195
static ULONG WINAPI domattr_AddRef(
10296
IXMLDOMAttribute *iface )
10397
{
104-
domattr *This = impl_from_IXMLDOMAttribute( iface );
105-
ULONG ref = InterlockedIncrement( &This->ref );
106-
TRACE("(%p)->(%d)\n", This, ref);
98+
domattr *attr = impl_from_IXMLDOMAttribute( iface );
99+
ULONG ref = InterlockedIncrement( &attr->ref );
100+
TRACE("%p, refcount %lu.\n", iface, ref);
107101
return ref;
108102
}
109103

@@ -113,7 +107,7 @@ static ULONG WINAPI domattr_Release(
113107
domattr *This = impl_from_IXMLDOMAttribute( iface );
114108
ULONG ref = InterlockedDecrement( &This->ref );
115109

116-
TRACE("(%p)->(%d)\n", This, ref);
110+
TRACE("%p, refcount %lu.\n", iface, ref);
117111
if ( ref == 0 )
118112
{
119113
destroy_xmlnode(&This->node);
@@ -122,7 +116,7 @@ static ULONG WINAPI domattr_Release(
122116
xmlFreeNs( This->node.node->ns );
123117
xmlFreeNode( This->node.node );
124118
}
125-
heap_free( This );
119+
free( This );
126120
}
127121

128122
return ref;
@@ -549,33 +543,47 @@ static HRESULT WINAPI domattr_get_namespaceURI(
549543
IXMLDOMAttribute *iface,
550544
BSTR* p)
551545
{
552-
static const WCHAR w3xmlns[] = { 'h','t','t','p',':','/','/', 'w','w','w','.','w','3','.',
553-
'o','r','g','/','2','0','0','0','/','x','m','l','n','s','/',0 };
554546
domattr *This = impl_from_IXMLDOMAttribute( iface );
555547
xmlNsPtr ns = This->node.node->ns;
548+
BSTR nodename, pfx;
549+
BOOL is6, isdefault;
550+
HRESULT hr;
556551

557552
TRACE("(%p)->(%p)\n", This, p);
558553

559554
if (!p)
560555
return E_INVALIDARG;
561556

562557
*p = NULL;
558+
nodename = NULL;
559+
hr = IXMLDOMAttribute_get_nodeName(iface, &nodename);
560+
if (FAILED(hr))
561+
return hr;
562+
563+
pfx = NULL;
564+
hr = IXMLDOMAttribute_get_prefix(iface, &pfx);
565+
if (FAILED(hr))
566+
{
567+
SysFreeString(nodename);
568+
return hr;
569+
}
563570

564-
if (ns)
571+
is6 = xmldoc_version(This->node.node->doc) == MSXML6;
572+
isdefault = !wcscmp(nodename, L"xmlns");
573+
if (isdefault || (pfx && !wcscmp(L"xmlns", pfx)))
565574
{
566-
/* special case for default namespace definition */
567-
if (xmlStrEqual(This->node.node->name, xmlns))
568-
*p = bstr_from_xmlChar(xmlns);
569-
else if (xmlStrEqual(ns->prefix, xmlns))
570-
{
571-
if (xmldoc_version(This->node.node->doc) == MSXML6)
572-
*p = SysAllocString(w3xmlns);
573-
else
574-
*p = SysAllocStringLen(NULL, 0);
575-
}
576-
else if (ns->href)
577-
*p = bstr_from_xmlChar(ns->href);
575+
if (is6)
576+
*p = SysAllocString(L"http://www.w3.org/2000/xmlns/");
577+
else if (!ns || !isdefault)
578+
*p = SysAllocStringLen(NULL, 0);
579+
else
580+
*p = SysAllocString(L"xmlns");
578581
}
582+
else if (ns && ns->href)
583+
*p = bstr_from_xmlChar(ns->href);
584+
585+
SysFreeString(nodename);
586+
SysFreeString(pfx);
579587

580588
TRACE("uri: %s\n", debugstr_w(*p));
581589

@@ -595,14 +603,11 @@ static HRESULT WINAPI domattr_get_prefix(
595603

596604
*prefix = NULL;
597605

598-
if (ns)
599-
{
600-
/* special case for default namespace definition */
601-
if (xmlStrEqual(This->node.node->name, xmlns))
602-
*prefix = bstr_from_xmlChar(xmlns);
603-
else if (ns->prefix)
604-
*prefix = bstr_from_xmlChar(ns->prefix);
605-
}
606+
if (xmldoc_version(This->node.node->doc) != MSXML6 &&
607+
xmlStrEqual(This->node.node->name, xmlns))
608+
*prefix = bstr_from_xmlChar(xmlns);
609+
else if (ns && ns->prefix)
610+
*prefix = bstr_from_xmlChar(ns->prefix);
606611

607612
TRACE("prefix: %s\n", debugstr_w(*prefix));
608613

@@ -726,7 +731,7 @@ IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating )
726731
{
727732
domattr *This;
728733

729-
This = heap_alloc( sizeof *This );
734+
This = malloc(sizeof(*This));
730735
if ( !This )
731736
return NULL;
732737

@@ -738,5 +743,3 @@ IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating )
738743

739744
return (IUnknown*)&This->IXMLDOMAttribute_iface;
740745
}
741-
742-
#endif

dll/win32/msxml3/bsc.c

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@
1717
*/
1818

1919
#define COBJMACROS
20-
#define NONAMELESSUNION
21-
22-
#include "config.h"
2320

2421
#include <stdarg.h>
25-
#ifdef HAVE_LIBXML2
26-
# include <libxml/parser.h>
27-
# include <libxml/xmlerror.h>
28-
#endif
2922

3023
#include "windef.h"
3124
#include "winbase.h"
@@ -39,7 +32,7 @@
3932

4033
#include "wine/debug.h"
4134

42-
#include "msxml_private.h"
35+
#include "msxml_dispex.h"
4336

4437
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
4538

@@ -82,26 +75,29 @@ static HRESULT WINAPI bsc_QueryInterface(
8275
static ULONG WINAPI bsc_AddRef(
8376
IBindStatusCallback *iface )
8477
{
85-
bsc_t *This = impl_from_IBindStatusCallback(iface);
86-
LONG ref = InterlockedIncrement(&This->ref);
78+
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
79+
LONG ref = InterlockedIncrement(&bsc->ref);
8780

88-
TRACE("(%p) ref=%d\n", This, ref);
81+
TRACE("%p, refcount %ld.\n", iface, ref);
8982

9083
return ref;
9184
}
9285

9386
static ULONG WINAPI bsc_Release(
9487
IBindStatusCallback *iface )
9588
{
96-
bsc_t *This = impl_from_IBindStatusCallback(iface);
97-
LONG ref = InterlockedDecrement(&This->ref);
89+
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
90+
LONG ref = InterlockedDecrement(&bsc->ref);
9891

99-
TRACE("(%p) ref=%d\n", This, ref);
92+
TRACE("%p, refcount %ld.\n", iface, ref);
10093

101-
if(!ref) {
102-
if (This->binding) IBinding_Release(This->binding);
103-
if (This->memstream) IStream_Release(This->memstream);
104-
heap_free(This);
94+
if (!ref)
95+
{
96+
if (bsc->binding)
97+
IBinding_Release(bsc->binding);
98+
if (bsc->memstream)
99+
IStream_Release(bsc->memstream);
100+
free(bsc);
105101
}
106102

107103
return ref;
@@ -115,7 +111,7 @@ static HRESULT WINAPI bsc_OnStartBinding(
115111
bsc_t *This = impl_from_IBindStatusCallback(iface);
116112
HRESULT hr;
117113

118-
TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
114+
TRACE("%p, %lx, %p.\n", iface, dwReserved, pib);
119115

120116
This->binding = pib;
121117
IBinding_AddRef(pib);
@@ -159,7 +155,7 @@ static HRESULT WINAPI bsc_OnStopBinding(
159155
bsc_t *This = impl_from_IBindStatusCallback(iface);
160156
HRESULT hr = S_OK;
161157

162-
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
158+
TRACE("%p, %#lx, %s.\n", iface, hresult, debugstr_w(szError));
163159

164160
if(This->binding) {
165161
IBinding_Release(This->binding);
@@ -200,20 +196,20 @@ static HRESULT WINAPI bsc_OnDataAvailable(
200196
FORMATETC* pformatetc,
201197
STGMEDIUM* pstgmed)
202198
{
203-
bsc_t *This = impl_from_IBindStatusCallback(iface);
199+
bsc_t *bsc = impl_from_IBindStatusCallback(iface);
204200
BYTE buf[4096];
205201
DWORD read, written;
206202
HRESULT hr;
207203

208-
TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
204+
TRACE("%p, %lx, %lu, %p, %p.\n", iface, grfBSCF, dwSize, pformatetc, pstgmed);
209205

210206
do
211207
{
212-
hr = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &read);
208+
hr = IStream_Read(pstgmed->pstm, buf, sizeof(buf), &read);
213209
if(FAILED(hr))
214210
break;
215211

216-
hr = IStream_Write(This->memstream, buf, read, &written);
212+
hr = IStream_Write(bsc->memstream, buf, read, &written);
217213
} while(SUCCEEDED(hr) && written != 0 && read != 0);
218214

219215
return S_OK;
@@ -242,9 +238,10 @@ static const struct IBindStatusCallbackVtbl bsc_vtbl =
242238
bsc_OnObjectAvailable
243239
};
244240

245-
HRESULT create_uri(const WCHAR *url, IUri **uri)
241+
HRESULT create_uri(IUri *base, const WCHAR *url, IUri **uri)
246242
{
247243
WCHAR fileUrl[INTERNET_MAX_URL_LENGTH];
244+
HRESULT hr;
248245

249246
TRACE("%s\n", debugstr_w(url));
250247

@@ -253,21 +250,35 @@ HRESULT create_uri(const WCHAR *url, IUri **uri)
253250
WCHAR fullpath[MAX_PATH];
254251
DWORD needed = ARRAY_SIZE(fileUrl);
255252

256-
if (!PathSearchAndQualifyW(url, fullpath, ARRAY_SIZE(fullpath)))
253+
lstrcpynW(fileUrl, url, ARRAY_SIZE(fileUrl));
254+
UrlUnescapeW(fileUrl, NULL, NULL, URL_UNESCAPE_INPLACE);
255+
256+
if (!PathSearchAndQualifyW(fileUrl, fullpath, ARRAY_SIZE(fullpath)))
257257
{
258258
WARN("can't find path\n");
259259
return E_FAIL;
260260
}
261261

262-
if (FAILED(UrlCreateFromPathW(fullpath, fileUrl, &needed, 0)))
262+
if (FAILED(UrlApplySchemeW(fullpath, fileUrl, &needed, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE |
263+
URL_APPLY_DEFAULT)))
263264
{
264-
ERR("can't create url from path\n");
265+
ERR("Failed to apply url scheme.\n");
265266
return E_FAIL;
266267
}
267268
url = fileUrl;
268269
}
269270

270-
return CreateUri(url, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri);
271+
hr = CreateUri(url, Uri_CREATE_ALLOW_RELATIVE | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri);
272+
if (hr == S_OK && base)
273+
{
274+
IUri *rebased_uri;
275+
276+
hr = CoInternetCombineIUri(base, *uri, 0, &rebased_uri, 0);
277+
IUri_Release(*uri);
278+
*uri = rebased_uri;
279+
}
280+
281+
return hr;
271282
}
272283

273284
HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon)
@@ -277,7 +288,7 @@ HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon)
277288

278289
TRACE("%s\n", debugstr_w(url));
279290

280-
if (FAILED(hr = create_uri(url, &uri)))
291+
if (FAILED(hr = create_uri(NULL, url, &uri)))
281292
return hr;
282293

283294
hr = CreateURLMonikerEx2(NULL, uri, mon, 0);
@@ -298,7 +309,7 @@ HRESULT bind_url(IMoniker *mon, HRESULT (*onDataAvailable)(void*,char*,DWORD),
298309
if(FAILED(hr))
299310
return hr;
300311

301-
bsc = heap_alloc(sizeof(bsc_t));
312+
bsc = malloc(sizeof(bsc_t));
302313

303314
bsc->IBindStatusCallback_iface.lpVtbl = &bsc_vtbl;
304315
bsc->ref = 1;

0 commit comments

Comments
 (0)