Wine-Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 3 participants
- 84516 discussions
[tools] testbot: GetTaskURL() should load URI::Escape only when needed.
by Francois Gouget April 5, 2022
by Francois Gouget April 5, 2022
April 5, 2022
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
The build VM does not have URI::Escape and this dependency caused the
build to fail (Reconfig.pl which uses Utils.pm failed to start).
There is really no compeling reason to install URI::Escape on the
build VM so I decided to tweak GetTaskURL() to only import URI::Escape
when needed which should not happen in the VM code.
What this really shows is that GetTaskURL() probably does not belong in
Utils but I'm not sure where else to put it. So that patch will at
least fix the immediate issue. Since GetTaskURL() depends closely on
the web side some place in WineTestBot::CGI may seem logical. But it's
actually used by non-CGI scripts and having them use CGI::something
would be wrong. Maybe the Tasks module is the least bad option though
that's another place that should really not depend on URI::escape.
---
testbot/lib/WineTestBot/Utils.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index 13529c323..cf749310d 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -34,7 +34,6 @@ our @EXPORT = qw(SecureConnection MakeSecureURL GetTaskURL GenerateRandomString
BatchQuote ShQuote ShArgv2Cmd);
use Fcntl qw(O_CREAT O_EXCL O_WRONLY);
-use URI::Escape;
use WineTestBot::Config;
@@ -89,7 +88,11 @@ sub GetTaskURL($$$;$$)
my $StepTask = 100 * $StepNo + $TaskNo;
my $URL = "/JobDetails.pl?Key=$JobId";
$URL .= "&s$StepTask=1" if ($ShowScreenshot);
- $URL .= "&f$StepTask=". uri_escape($LogName) if ($LogName);
+ if (defined $LogName)
+ {
+ require URI::Escape;
+ $URL .= "&f$StepTask=". URI::Escape::uri_escape($LogName);
+ }
return "$URL#k$StepTask";
}
--
2.30.2
1
0
April 5, 2022
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 308bdda13..77fa41c86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ AS_IF([test "x$with_spirv_tools" = "xyes"],
HAVE_XCB=no
AS_IF([test "x$with_xcb" != "xno"],
- [PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms],
+ [PKG_CHECK_MODULES([XCB], [xcb xcb-event xcb-icccm xcb-keysyms],
[AC_DEFINE([HAVE_XCB], [1], [Define to 1 if you have libxcb.])
HAVE_XCB=yes],
[HAVE_XCB=no])])
--
2.35.1
4
14
[PATCH] xmllite/tests: Use wide string literals for the writer tests.
by Nikolay Sivov April 5, 2022
by Nikolay Sivov April 5, 2022
April 5, 2022
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/xmllite/tests/writer.c | 674 ++++++++++++++----------------------
1 file changed, 266 insertions(+), 408 deletions(-)
diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c
index 2f6edb26d16..3e1c362664e 100644
--- a/dlls/xmllite/tests/writer.c
+++ b/dlls/xmllite/tests/writer.c
@@ -32,8 +32,6 @@
#include "initguid.h"
DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
-static const WCHAR aW[] = {'a',0};
-
#define EXPECT_REF(obj, ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
{
@@ -92,19 +90,6 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l
#define CHECK_OUTPUT_TODO(stream, expected) check_output(stream, expected, TRUE, __LINE__)
#define CHECK_OUTPUT_RAW(stream, expected, size) check_output_raw(stream, expected, size, __LINE__)
-static WCHAR *strdupAtoW(const char *str)
-{
- WCHAR *ret = NULL;
- DWORD len;
-
- if (!str) return ret;
- len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
- ret = malloc(len * sizeof(WCHAR));
- if (ret)
- MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
- return ret;
-}
-
static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
{
HRESULT hr;
@@ -116,30 +101,29 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
/* used to test all Write* methods for consistent error state */
static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
{
- static const WCHAR aW[] = {'a',0};
HRESULT hr;
/* FIXME: add WriteAttributes */
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteCharEntity(writer, aW[0]);
+ hr = IXmlWriter_WriteCharEntity(writer, 'a');
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteChars(writer, aW, 1);
+ hr = IXmlWriter_WriteChars(writer, L"a", 1);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -148,40 +132,40 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteEntityRef(writer, aW);
+ hr = IXmlWriter_WriteEntityRef(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteNode */
/* FIXME: add WriteNodeShallow */
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
+ hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteRaw(writer, aW);
+ hr = IXmlWriter_WriteRaw(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteRawChars(writer, aW, 1);
+ hr = IXmlWriter_WriteRawChars(writer, L"a", 1);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteSurrogateCharEntity */
@@ -340,25 +324,25 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
/* TODO: WriteAttributes */
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteChars(writer, aW, 1);
+ hr = IXmlWriter_WriteChars(writer, L"a", 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -367,40 +351,40 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteEntityRef(writer, aW);
+ hr = IXmlWriter_WriteEntityRef(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteNode */
/* TODO: WriteNodeShallow */
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
+ hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteRaw(writer, aW);
+ hr = IXmlWriter_WriteRaw(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteRawChars(writer, aW, 1);
+ hr = IXmlWriter_WriteRawChars(writer, L"a", 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteSurrogateCharEntity */
@@ -412,9 +396,6 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
static void test_writeroutput(void)
{
- static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
- static const WCHAR usasciiW[] = {'u','s','-','a','s','c','i','i',0};
- static const WCHAR dummyW[] = {'d','u','m','m','y',0};
static const WCHAR utf16_outputW[] = {0xfeff,'<','a'};
IXmlWriterOutput *output;
IXmlWriter *writer;
@@ -428,7 +409,7 @@ static void test_writeroutput(void)
EXPECT_REF(output, 1);
IUnknown_Release(output);
- hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
@@ -458,7 +439,7 @@ static void test_writeroutput(void)
/* create with us-ascii */
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"us-ascii", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IUnknown_Release(output);
@@ -475,7 +456,7 @@ static void test_writeroutput(void)
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Failed to set writer output, hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Write failed, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -505,7 +486,7 @@ static void test_writeroutput(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, dummyW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"dummy", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_invalid_output_encoding(writer, output);
@@ -522,9 +503,6 @@ static void test_writestartdocument(void)
static const char fullprolog[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
static const char *prologversion2 = "<?xml version=\"1.0\" encoding=\"uS-asCii\"?>";
static const char prologversion[] = "<?xml version=\"1.0\"?>";
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR usasciiW[] = {'u','S','-','a','s','C','i','i',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
IXmlWriterOutput *output;
IXmlWriter *writer;
IStream *stream;
@@ -537,7 +515,7 @@ static void test_writestartdocument(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -565,7 +543,7 @@ static void test_writestartdocument(void)
/* now add PI manually, and try to start a document */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -575,7 +553,7 @@ static void test_writestartdocument(void)
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
/* another attempt to add 'xml' PI */
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -591,7 +569,7 @@ static void test_writestartdocument(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, usasciiW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"uS-asCii", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
@@ -646,8 +624,6 @@ static void test_flush(void)
static void test_omitxmldeclaration(void)
{
static const char prologversion[] = "<?xml version=\"1.0\"?>";
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
IXmlWriter *writer;
HGLOBAL hglobal;
IStream *stream;
@@ -683,7 +659,7 @@ static void test_omitxmldeclaration(void)
/* now add PI manually, and try to start a document */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -708,7 +684,7 @@ static void test_omitxmldeclaration(void)
CHECK_OUTPUT(stream, prologversion);
/* another attempt to add 'xml' PI */
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -723,9 +699,6 @@ static void test_bom(void)
static const WCHAR piW[] = {0xfeff,'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"','?','>'};
static const WCHAR aopenW[] = {0xfeff,'<','a'};
static const WCHAR afullW[] = {0xfeff,'<','a',' ','/','>'};
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
static const WCHAR bomW[] = {0xfeff};
IXmlWriterOutput *output;
IXmlWriter *writer;
@@ -736,7 +709,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
@@ -763,13 +736,13 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -784,13 +757,13 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -805,7 +778,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
@@ -813,7 +786,7 @@ static void test_bom(void)
writer_set_property(writer, XmlWriterProperty_Indent);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -830,67 +803,13 @@ static void test_bom(void)
IXmlWriter_Release(writer);
}
-static HRESULT write_start_element(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri)
-{
- WCHAR *prefixW, *localW, *uriW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
-
- hr = IXmlWriter_WriteStartElement(writer, prefixW, localW, uriW);
-
- free(prefixW);
- free(localW);
- free(uriW);
-
- return hr;
-}
-
-static HRESULT write_element_string(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri, const char *value)
-{
- WCHAR *prefixW, *localW, *uriW, *valueW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
- valueW = strdupAtoW(value);
-
- hr = IXmlWriter_WriteElementString(writer, prefixW, localW, uriW, valueW);
-
- free(prefixW);
- free(localW);
- free(uriW);
- free(valueW);
-
- return hr;
-}
-
-static HRESULT write_string(IXmlWriter *writer, const char *str)
-{
- WCHAR *strW;
- HRESULT hr;
-
- strW = strdupAtoW(str);
-
- hr = IXmlWriter_WriteString(writer, strW);
-
- free(strW);
-
- return hr;
-}
-
static void test_WriteStartElement(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
const char *output;
const char *output_partial;
HRESULT hr;
@@ -899,22 +818,21 @@ static void test_WriteStartElement(void)
}
start_element_tests[] =
{
- { "prefix", "local", "uri", "<prefix:local xmlns:prefix=\"uri\" />", "<prefix:local" },
- { NULL, "local", "uri", "<local xmlns=\"uri\" />", "<local" },
- { "", "local", "uri", "<local xmlns=\"uri\" />", "<local" },
- { "", "local", "uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"prefix", L"local", L"uri", "<prefix:local xmlns:prefix=\"uri\" />", "<prefix:local" },
+ { NULL, L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"", L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"", L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
- { "prefix", NULL, NULL, NULL, NULL, E_INVALIDARG },
- { NULL, NULL, "uri", NULL, NULL, E_INVALIDARG },
+ { L"prefix", NULL, NULL, NULL, NULL, E_INVALIDARG },
+ { NULL, NULL, L"uri", NULL, NULL, E_INVALIDARG },
{ NULL, NULL, NULL, NULL, NULL, E_INVALIDARG },
- { NULL, "prefix:local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { "pre:fix", "local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { NULL, ":local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { ":", "local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { NULL, "local", "http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSPREFIXDECLARATION },
- { "prefix", "local", "http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSURIDECLARATION },
+ { NULL, L"prefix:local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { L"pre:fix", L"local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { NULL, L":local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { L":", L"local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { NULL, L"local", L"http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSPREFIXDECLARATION },
+ { L"prefix", L"local", L"http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSURIDECLARATION },
};
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
unsigned int i;
@@ -923,12 +841,12 @@ static void test_WriteStartElement(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -945,7 +863,7 @@ static void test_WriteStartElement(void)
hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream);
@@ -955,27 +873,27 @@ static void test_WriteStartElement(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, "prefix", "a", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix", L"a", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "c", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"c", NULL, NULL);
ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "d", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"d", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, "", "e", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"", L"e", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, "prefix2", "f", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix2", L"f", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1001,7 +919,7 @@ static void test_WriteStartElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_start_element(writer, start_element_tests[i].prefix, start_element_tests[i].local,
+ hr = IXmlWriter_WriteStartElement(writer, start_element_tests[i].prefix, start_element_tests[i].local,
start_element_tests[i].uri);
ok(hr == start_element_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
@@ -1031,39 +949,39 @@ static void test_WriteElementString(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
- const char *value;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
+ const WCHAR *value;
const char *output;
HRESULT hr;
int todo;
}
element_string_tests[] =
{
- { "prefix", "local", "uri", "value", "<prefix:local xmlns:prefix=\"uri\">value</prefix:local>" },
- { NULL, "local", "uri", "value", "<local xmlns=\"uri\">value</local>" },
- { "", "local", "uri", "value", "<local xmlns=\"uri\">value</local>" },
- { "prefix", "local", "uri", NULL, "<prefix:local xmlns:prefix=\"uri\" />" },
- { NULL, "local", "uri", NULL, "<local xmlns=\"uri\" />" },
- { "", "local", "uri", NULL, "<local xmlns=\"uri\" />" },
- { NULL, "local", NULL, NULL, "<local />" },
- { "prefix", "local", "uri", "", "<prefix:local xmlns:prefix=\"uri\"></prefix:local>" },
- { NULL, "local", "uri", "", "<local xmlns=\"uri\"></local>" },
- { "", "local", "uri", "", "<local xmlns=\"uri\"></local>" },
- { NULL, "local", NULL, "", "<local></local>" },
- { "", "local", "http://www.w3.org/2000/xmlns/", NULL, "<local xmlns=\"http://www.w3.org/2000/xmlns/\" />" },
-
- { "prefix", NULL, NULL, "value", NULL, E_INVALIDARG },
- { NULL, NULL, "uri", "value", NULL, E_INVALIDARG },
- { NULL, NULL, NULL, "value", NULL, E_INVALIDARG },
- { NULL, "prefix:local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { NULL, ":local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { ":", "local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { "prefix", "local", NULL, "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
- { "prefix", "local", "", "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
- { NULL, "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSPREFIXDECLARATION },
- { "prefix", "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSURIDECLARATION },
+ { L"prefix", L"local", L"uri", L"value", "<prefix:local xmlns:prefix=\"uri\">value</prefix:local>" },
+ { NULL, L"local", L"uri", L"value", "<local xmlns=\"uri\">value</local>" },
+ { L"", L"local", L"uri", L"value", "<local xmlns=\"uri\">value</local>" },
+ { L"prefix", L"local", L"uri", NULL, "<prefix:local xmlns:prefix=\"uri\" />" },
+ { NULL, L"local", L"uri", NULL, "<local xmlns=\"uri\" />" },
+ { L"", L"local", L"uri", NULL, "<local xmlns=\"uri\" />" },
+ { NULL, L"local", NULL, NULL, "<local />" },
+ { L"prefix", L"local", L"uri", L"", "<prefix:local xmlns:prefix=\"uri\"></prefix:local>" },
+ { NULL, L"local", L"uri", L"", "<local xmlns=\"uri\"></local>" },
+ { L"", L"local", L"uri", L"", "<local xmlns=\"uri\"></local>" },
+ { NULL, L"local", NULL, L"", "<local></local>" },
+ { L"", L"local", L"http://www.w3.org/2000/xmlns/", NULL, "<local xmlns=\"http://www.w3.org/2000/xmlns/\" />" },
+
+ { L"prefix", NULL, NULL, L"value", NULL, E_INVALIDARG },
+ { NULL, NULL, L"uri", L"value", NULL, E_INVALIDARG },
+ { NULL, NULL, NULL, L"value", NULL, E_INVALIDARG },
+ { NULL, L"prefix:local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { NULL, L":local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { L":", L"local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { L"prefix", L"local", NULL, L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
+ { L"prefix", L"local", L"", L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
+ { NULL, L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSPREFIXDECLARATION },
+ { L"prefix", L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSURIDECLARATION },
};
IXmlWriter *writer;
IStream *stream;
@@ -1073,48 +991,48 @@ static void test_WriteElementString(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "b", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"b", L"uri", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, "prefix", "c", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix", L"c", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "d", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"d", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix2", "d", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix2", L"d", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "e", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"e", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "f", "uri2", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"f", L"uri2", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "g", "uri3", NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"g", L"uri3", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "h", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"h", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix_i", "i", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix_i", L"i", NULL, NULL);
ok(hr == WR_E_NSPREFIXWITHEMPTYNSURI, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "", "j", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"", L"j", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1143,7 +1061,7 @@ static void test_WriteElementString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_element_string(writer, element_string_tests[i].prefix, element_string_tests[i].local,
+ hr = IXmlWriter_WriteElementString(writer, element_string_tests[i].prefix, element_string_tests[i].local,
element_string_tests[i].uri, element_string_tests[i].value);
ok(hr == element_string_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
@@ -1180,10 +1098,10 @@ static void test_WriteEndElement(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -1203,8 +1121,6 @@ static void test_WriteEndElement(void)
static void test_writeenddocument(void)
{
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HGLOBAL hglobal;
@@ -1229,16 +1145,16 @@ static void test_writeenddocument(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1262,9 +1178,6 @@ static void test_writeenddocument(void)
static void test_WriteComment(void)
{
- static const WCHAR closeW[] = {'-','-','>',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1274,7 +1187,7 @@ static void test_WriteComment(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
@@ -1282,19 +1195,19 @@ static void test_WriteComment(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, closeW);
+ hr = IXmlWriter_WriteComment(writer, L"-->");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1308,10 +1221,6 @@ static void test_WriteComment(void)
static void test_WriteCData(void)
{
- static const WCHAR closeW[] = {']',']','>',0};
- static const WCHAR close2W[] = {'a',']',']','>','b',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1321,24 +1230,24 @@ static void test_WriteCData(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, closeW);
+ hr = IXmlWriter_WriteCData(writer, L"]]>");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, close2W);
+ hr = IXmlWriter_WriteCData(writer, L"a]]>b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1359,8 +1268,7 @@ static void test_WriteCData(void)
static void test_WriteRaw(void)
{
- static const WCHAR rawW[] = {'a','<',':',0};
- static const WCHAR aW[] = {'a',0};
+ static const WCHAR rawW[] = L"a<:";
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1391,7 +1299,7 @@ static void test_WriteRaw(void)
hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -1417,7 +1325,6 @@ static void test_WriteRaw(void)
static void test_writer_state(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1440,7 +1347,7 @@ static void test_writer_state(void)
/* WriteAttributeString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1467,7 +1374,7 @@ static void test_writer_state(void)
/* WriteCData */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1476,7 +1383,7 @@ static void test_writer_state(void)
/* WriteName */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1485,7 +1392,7 @@ static void test_writer_state(void)
/* WriteNmToken */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1494,7 +1401,7 @@ static void test_writer_state(void)
/* WriteString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1505,9 +1412,6 @@ static void test_writer_state(void)
static void test_indentation(void)
{
- static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1523,13 +1427,13 @@ static void test_indentation(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, commentW);
+ hr = IXmlWriter_WriteComment(writer, L"comment");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1549,13 +1453,13 @@ static void test_indentation(void)
/* WriteElementString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -1575,35 +1479,14 @@ static void test_indentation(void)
IXmlWriter_Release(writer);
}
-static HRESULT write_attribute_string(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri, const char *value)
-{
- WCHAR *prefixW, *localW, *uriW, *valueW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
- valueW = strdupAtoW(value);
-
- hr = IXmlWriter_WriteAttributeString(writer, prefixW, localW, uriW, valueW);
-
- free(prefixW);
- free(localW);
- free(uriW);
- free(valueW);
-
- return hr;
-}
-
static void test_WriteAttributeString(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
- const char *value;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
+ const WCHAR *value;
const char *output;
const char *output_partial;
HRESULT hr;
@@ -1613,62 +1496,62 @@ static void test_WriteAttributeString(void)
}
attribute_tests[] =
{
- { NULL, "a", NULL, "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "", "a", NULL, "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { NULL, "a", "", "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "", "a", "", "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "prefix", "local", "uri", "b", "<e prefix:local=\"b\" xmlns:prefix=\"uri\" />", "<e prefix:local=\"b\"" },
- { NULL, "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e xmlns:a=\"defuri\" />", "<e xmlns:a=\"defuri\"" },
- { "xmlns", "a", NULL, "uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
- { "xmlns", "a", "", "uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
- { "prefix", "xmlns", "uri", "value", "<e prefix:xmlns=\"value\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"value\"" },
- { "prefix", "xmlns", "uri", NULL, "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
- { "prefix", "xmlns", "uri", "", "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
- { "prefix", "xmlns", NULL, "uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
- { "prefix", "xmlns", "", "uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
- { "xml", "space", NULL, "preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
- { "xml", "space", "", "preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
- { "xml", "space", NULL, "default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
- { "xml", "space", "", "default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
- { "xml", "a", NULL, "value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
- { "xml", "a", "", "value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
+ { NULL, L"a", NULL, L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"", L"a", NULL, L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { NULL, L"a", L"", L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"", L"a", L"", L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"prefix", L"local", L"uri", L"b", "<e prefix:local=\"b\" xmlns:prefix=\"uri\" />", "<e prefix:local=\"b\"" },
+ { NULL, L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e xmlns:a=\"defuri\" />", "<e xmlns:a=\"defuri\"" },
+ { L"xmlns", L"a", NULL, L"uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
+ { L"xmlns", L"a", L"", L"uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
+ { L"prefix", L"xmlns", L"uri", L"value", "<e prefix:xmlns=\"value\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"value\"" },
+ { L"prefix", L"xmlns", L"uri", NULL, "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
+ { L"prefix", L"xmlns", L"uri", L"", "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
+ { L"prefix", L"xmlns", NULL, L"uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
+ { L"prefix", L"xmlns", L"", L"uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
+ { L"xml", L"space", NULL, L"preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
+ { L"xml", L"space", L"", L"preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
+ { L"xml", L"space", NULL, L"default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
+ { L"xml", L"space", L"", L"default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
+ { L"xml", L"a", NULL, L"value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
+ { L"xml", L"a", L"", L"value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
/* Autogenerated prefix names. */
- { NULL, "a", "defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { NULL, "a", "defuri", "b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
- { "", "a", "defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { NULL, "a", "defuri", "", "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { "", "a", "defuri", "b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", L"b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
+ { L"", L"a", L"defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", L"", "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { L"", L"a", L"defuri", L"b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
/* Failing cases. */
- { NULL, NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "", "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 1, 1, 1 },
- { "", NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "", "", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
- { NULL, "", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
- { "prefix", "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", WR_E_XMLNSURIDECLARATION, 1, 1, 1 },
- { "prefix", NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "prefix", NULL, NULL, "b", "<e />", "<e", E_INVALIDARG },
- { "prefix", NULL, "uri", NULL, "<e />", "<e", E_INVALIDARG },
- { "xml", NULL, NULL, "value", "<e />", "<e", E_INVALIDARG },
- { "xmlns", "a", "defuri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
- { "xmlns", "a", "b", "uri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
- { NULL, "xmlns", "uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
- { "xmlns", NULL, "uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
- { "pre:fix", "local", "uri", "b", "<e />", "<e", WC_E_NAMECHARACTER },
- { "pre:fix", NULL, "uri", "b", "<e />", "<e", E_INVALIDARG },
- { "prefix", "lo:cal", "uri", "b", "<e />", "<e", WC_E_NAMECHARACTER },
- { "xmlns", NULL, NULL, "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", NULL, "", "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", "", NULL, "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", "", "", "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xml", "space", "", "value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "a", "uri", "value", "<e />", "<e", WR_E_XMLPREFIXDECLARATION },
- { "xml", "space", NULL, "preServe", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "defAult", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, NULL, "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { NULL, NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"", L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 1, 1, 1 },
+ { L"", NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"", L"", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
+ { NULL, L"", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
+ { L"prefix", L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", WR_E_XMLNSURIDECLARATION, 1, 1, 1 },
+ { L"prefix", NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", NULL, NULL, L"b", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", NULL, L"uri", NULL, "<e />", "<e", E_INVALIDARG },
+ { L"xml", NULL, NULL, L"value", "<e />", "<e", E_INVALIDARG },
+ { L"xmlns", L"a", L"defuri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
+ { L"xmlns", L"a", L"b", L"uri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
+ { NULL, L"xmlns", L"uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
+ { L"xmlns", NULL, L"uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
+ { L"pre:fix", L"local", L"uri", L"b", "<e />", "<e", WC_E_NAMECHARACTER },
+ { L"pre:fix", NULL, L"uri", L"b", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", L"lo:cal", L"uri", L"b", "<e />", "<e", WC_E_NAMECHARACTER },
+ { L"xmlns", NULL, NULL, L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", NULL, L"", L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", L"", NULL, L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", L"", L"", L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xml", L"space", L"", L"value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"a", L"uri", L"value", "<e />", "<e", WR_E_XMLPREFIXDECLARATION },
+ { L"xml", L"space", NULL, L"preServe", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"defAult", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, NULL, "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"", "<e />", "<e", WR_E_INVALIDXMLSPACE },
};
IXmlWriter *writer;
@@ -1688,10 +1571,10 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "e", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"e", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, attribute_tests[i].prefix, attribute_tests[i].local,
+ hr = IXmlWriter_WriteAttributeString(writer, attribute_tests[i].prefix, attribute_tests[i].local,
attribute_tests[i].uri, attribute_tests[i].value);
todo_wine_if(attribute_tests[i].todo_hr)
ok(hr == attribute_tests[i].hr, "%u: unexpected hr %#lx, expected %#lx.\n", i, hr, attribute_tests[i].hr);
@@ -1717,32 +1600,32 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, "p", "a", "outeruri");
+ hr = IXmlWriter_WriteStartElement(writer, L"p", L"a", L"outeruri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "local", "uri", "b");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"local", L"uri", L"b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "a", NULL, "b");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
+ hr = IXmlWriter_WriteAttributeString(writer, L"xmlns", L"prefix", NULL, L"uri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "p", "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"p", L"attr", NULL, L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "local", NULL, "b");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"local", NULL, L"b");
todo_wine
ok(hr == WR_E_DUPLICATEATTRIBUTE, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "attr2", "outeruri", "value");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"attr2", L"outeruri", L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "pr", "attr3", "outeruri", "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"pr", L"attr3", L"outeruri", L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1764,13 +1647,13 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "e", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"e", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
+ hr = IXmlWriter_WriteAttributeString(writer, L"xmlns", L"prefix", NULL, L"uri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"attr", NULL, L"value");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1789,7 +1672,6 @@ static void test_WriteAttributeString(void)
static void test_WriteFullEndElement(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1806,7 +1688,7 @@ static void test_WriteFullEndElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
@@ -1831,10 +1713,10 @@ static void test_WriteFullEndElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
@@ -1857,7 +1739,6 @@ static void test_WriteFullEndElement(void)
static void test_WriteCharEntity(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1873,13 +1754,13 @@ static void test_WriteCharEntity(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1906,31 +1787,31 @@ static void test_WriteString(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = write_string(writer, "a");
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "a");
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* WriteString automatically escapes markup characters */
- hr = write_string(writer, "<&\">=");
+ hr = IXmlWriter_WriteString(writer, L"<&\">=");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1942,10 +1823,10 @@ static void test_WriteString(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1954,7 +1835,7 @@ static void test_WriteString(void)
CHECK_OUTPUT(stream,
"<b");
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1974,13 +1855,13 @@ static void test_WriteString(void)
writer_set_property(writer, XmlWriterProperty_Indent);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_string(writer, "text");
+ hr = IXmlWriter_WriteString(writer, L"text");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2015,10 +1896,10 @@ static void test_WriteString(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -2031,10 +1912,10 @@ static void test_WriteString(void)
"<a>\r\n"
" <b />");
- hr = write_start_element(writer, NULL, "c", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"c", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"attr", NULL, L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2045,7 +1926,7 @@ static void test_WriteString(void)
" <b />\r\n"
" <c attr=\"value\"");
- hr = write_string(writer, "text");
+ hr = IXmlWriter_WriteString(writer, L"text");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2067,10 +1948,10 @@ static void test_WriteString(void)
" <b />\r\n"
" <c attr=\"value\">text</c>");
- hr = write_start_element(writer, NULL, "d", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"d", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -2102,60 +1983,37 @@ static void test_WriteString(void)
IStream_Release(stream);
}
-static HRESULT write_doctype(IXmlWriter *writer, const char *name, const char *pubid, const char *sysid,
- const char *subset)
-{
- WCHAR *nameW, *pubidW, *sysidW, *subsetW;
- HRESULT hr;
-
- nameW = strdupAtoW(name);
- pubidW = strdupAtoW(pubid);
- sysidW = strdupAtoW(sysid);
- subsetW = strdupAtoW(subset);
-
- hr = IXmlWriter_WriteDocType(writer, nameW, pubidW, sysidW, subsetW);
-
- free(nameW);
- free(pubidW);
- free(sysidW);
- free(subsetW);
-
- return hr;
-}
-
static void test_WriteDocType(void)
{
static const struct
{
- const char *name;
- const char *pubid;
- const char *sysid;
- const char *subset;
+ const WCHAR *name;
+ const WCHAR *pubid;
+ const WCHAR *sysid;
+ const WCHAR *subset;
const char *output;
}
doctype_tests[] =
{
- { "a", "", NULL, NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
- { "a", NULL, NULL, NULL, "<!DOCTYPE a>" },
- { "a", NULL, "", NULL, "<!DOCTYPE a SYSTEM \"\">" },
- { "a", "", "", NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
- { "a", "pubid", "", NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
- { "a", "pubid", NULL, NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
- { "a", "", "sysid", NULL, "<!DOCTYPE a PUBLIC \"\" \"sysid\">" },
- { "a", NULL, NULL, "", "<!DOCTYPE a []>" },
- { "a", NULL, NULL, "subset", "<!DOCTYPE a [subset]>" },
- { "a", "", NULL, "subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
- { "a", NULL, "", "subset", "<!DOCTYPE a SYSTEM \"\" [subset]>" },
- { "a", "", "", "subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
- { "a", "pubid", NULL, "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
- { "a", "pubid", "", "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
- { "a", NULL, "sysid", "subset", "<!DOCTYPE a SYSTEM \"sysid\" [subset]>" },
- { "a", "", "sysid", "subset", "<!DOCTYPE a PUBLIC \"\" \"sysid\" [subset]>" },
- { "a", "pubid", "sysid", "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"sysid\" [subset]>" },
+ { L"a", L"", NULL, NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
+ { L"a", NULL, NULL, NULL, "<!DOCTYPE a>" },
+ { L"a", NULL, L"", NULL, "<!DOCTYPE a SYSTEM \"\">" },
+ { L"a", L"", L"", NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
+ { L"a", L"pubid", L"", NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
+ { L"a", L"pubid", NULL, NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
+ { L"a", L"", L"sysid", NULL, "<!DOCTYPE a PUBLIC \"\" \"sysid\">" },
+ { L"a", NULL, NULL, L"", "<!DOCTYPE a []>" },
+ { L"a", NULL, NULL, L"subset", "<!DOCTYPE a [subset]>" },
+ { L"a", L"", NULL, L"subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
+ { L"a", NULL, L"", L"subset", "<!DOCTYPE a SYSTEM \"\" [subset]>" },
+ { L"a", L"", L"", L"subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
+ { L"a", L"pubid", NULL, L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
+ { L"a", L"pubid", L"", L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
+ { L"a", NULL, L"sysid", L"subset", "<!DOCTYPE a SYSTEM \"sysid\" [subset]>" },
+ { L"a", L"", L"sysid", L"subset", "<!DOCTYPE a PUBLIC \"\" \"sysid\" [subset]>" },
+ { L"a", L"pubid", L"sysid", L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"sysid\" [subset]>" },
};
static const WCHAR pubidW[] = {'p',0x100,'i','d',0};
- static const WCHAR nameW[] = {'-','a',0};
- static const WCHAR emptyW[] = { 0 };
IXmlWriter *writer;
IStream *stream;
unsigned int i;
@@ -2169,15 +2027,15 @@ static void test_WriteDocType(void)
hr = IXmlWriter_WriteDocType(writer, NULL, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteDocType(writer, emptyW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"", NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Name validation. */
- hr = IXmlWriter_WriteDocType(writer, nameW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"-a", NULL, NULL, NULL);
ok(hr == WC_E_NAMECHARACTER, "Unexpected hr %#lx.\n", hr);
/* Pubid validation. */
- hr = IXmlWriter_WriteDocType(writer, aW, pubidW, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", pubidW, NULL, NULL);
ok(hr == WC_E_PUBLICID, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream);
@@ -2186,7 +2044,7 @@ static void test_WriteDocType(void)
{
stream = writer_set_output(writer);
- hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
+ hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset);
ok(hr == S_OK, "%u: failed to write doctype, hr %#lx.\n", i, hr);
@@ -2195,7 +2053,7 @@ static void test_WriteDocType(void)
CHECK_OUTPUT(stream, doctype_tests[i].output);
- hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
+ hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
--
2.35.1
1
0
Microsoft Edge calls this function expecting an
implementation. Without it, Internet browsing
does not work.
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
If you want to test this patch in Microsoft Edge, you have to wait
a few minutes after opening it before it becomes usable.
---
dlls/ncrypt/main.c | 24 ++++++++++++++++++++++--
dlls/ncrypt/ncrypt.spec | 2 +-
include/ncrypt.h | 1 +
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c
index cc979a539d2..912f7ef643e 100644
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -415,8 +415,28 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H
SECURITY_STATUS WINAPI NCryptIsAlgSupported(NCRYPT_PROV_HANDLE provider, const WCHAR *algid, DWORD flags)
{
- FIXME("(%#Ix, %s, %#lx): stub\n", provider, wine_dbgstr_w(algid), flags);
- return NTE_NOT_SUPPORTED;
+ NCRYPT_KEY_HANDLE key;
+ SECURITY_STATUS status;
+
+ TRACE("(%#Ix, %s, %#lx)\n", provider, wine_dbgstr_w(algid), flags);
+
+ if (!provider) return NTE_INVALID_HANDLE;
+ if (!algid) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER);
+ if (flags == NCRYPT_SILENT_FLAG)
+ {
+ FIXME("Silent flag not implemented\n");
+ }
+ else if (flags)
+ {
+ ERR("Invalid flags %#lx\n", flags);
+ return NTE_BAD_FLAGS;
+ }
+
+ status = NCryptCreatePersistedKey(provider, &key, algid, NULL, 0, 0);
+ NCryptFinalizeKey(key, 0);
+ NCryptFreeObject(key);
+ NCryptFreeObject(provider);
+ return status;
}
BOOL WINAPI NCryptIsKeyHandle(NCRYPT_KEY_HANDLE hKey)
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index bb914616373..60b367260d5 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -77,7 +77,7 @@
@ stdcall NCryptGetProperty(ptr wstr ptr long ptr long)
@ stub NCryptGetProtectionDescriptorInfo
@ stdcall NCryptImportKey(long long wstr ptr ptr ptr long long)
-@ stub NCryptIsAlgSupported(long wstr long)
+@ stdcall NCryptIsAlgSupported(long wstr long)
@ stdcall NCryptIsKeyHandle(long)
@ stub NCryptKeyDerivation
@ stub NCryptNotifyChangeKey
diff --git a/include/ncrypt.h b/include/ncrypt.h
index c09a1ec8676..18198fdc5bb 100644
--- a/include/ncrypt.h
+++ b/include/ncrypt.h
@@ -118,6 +118,7 @@ SECURITY_STATUS WINAPI NCryptFreeObject(NCRYPT_HANDLE);
SECURITY_STATUS WINAPI NCryptGetProperty(NCRYPT_HANDLE, const WCHAR *, BYTE *, DWORD, DWORD *, DWORD);
SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE, const WCHAR *, NCryptBufferDesc *,
NCRYPT_KEY_HANDLE *, BYTE *, DWORD, DWORD);
+SECURITY_STATUS WINAPI NCryptIsAlgSupported(NCRYPT_PROV_HANDLE, const WCHAR *, DWORD);
SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE *, const WCHAR *, DWORD, DWORD);
SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *, const WCHAR *, DWORD);
SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE, const WCHAR *, BYTE *, DWORD, DWORD);
--
2.35.1
2
4
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/d2d1/effect.c | 1 +
dlls/d2d1/tests/d2d1.c | 119 ++++++++++++++++++++++++++++++++++----
include/d2d1effects_2.idl | 1 +
3 files changed, 111 insertions(+), 10 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index e7215c4b38a..601932b005b 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -27,6 +27,7 @@ static const struct d2d_effect_info builtin_effects[] =
{&CLSID_D2D1Composite, 2, 1, 0xffffffff},
{&CLSID_D2D1Crop, 1, 1, 1},
{&CLSID_D2D1Shadow, 1, 1, 1},
+ {&CLSID_D2D1Grayscale, 1, 1, 1},
};
static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 722f46bffe6..826526d9d38 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -20,7 +20,7 @@
#include <limits.h>
#include <math.h>
#include <float.h>
-#include "d2d1_1.h"
+#include "d2d1_3.h"
#include "d3d11.h"
#include "wincrypt.h"
#include "wine/test.h"
@@ -9925,13 +9925,15 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11)
{
- unsigned int i, j, min_inputs, max_inputs, str_size, input_count;
+ unsigned int i, j, min_inputs, max_inputs, str_size, input_count, factory_version;
D2D1_BITMAP_PROPERTIES bitmap_desc;
D2D1_BUFFER_PRECISION precision;
ID2D1Image *image_a, *image_b;
struct d2d1_test_context ctx;
ID2D1DeviceContext *context;
- ID2D1Factory1 *factory;
+ ID2D1Factory1 *factory1;
+ ID2D1Factory2 *factory2;
+ ID2D1Factory3 *factory3;
ID2D1Bitmap *bitmap;
ID2D1Effect *effect;
D2D1_SIZE_U size;
@@ -9943,28 +9945,43 @@ static void test_effect(BOOL d3d11)
const struct effect_test
{
const CLSID *clsid;
+ UINT32 factory_version;
UINT32 default_input_count;
UINT32 min_inputs;
UINT32 max_inputs;
}
effect_tests[] =
{
- {&CLSID_D2D12DAffineTransform, 1, 1, 1},
- {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1},
- {&CLSID_D2D1Composite, 2, 1, 0xffffffff},
- {&CLSID_D2D1Crop, 1, 1, 1},
- {&CLSID_D2D1Shadow, 1, 1, 1},
+ {&CLSID_D2D12DAffineTransform, 1, 1, 1, 1},
+ {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1, 1},
+ {&CLSID_D2D1Composite, 1, 2, 1, 0xffffffff},
+ {&CLSID_D2D1Crop, 1, 1, 1, 1},
+ {&CLSID_D2D1Shadow, 1, 1, 1, 1},
+ {&CLSID_D2D1Grayscale, 3, 1, 1, 1},
};
if (!init_test_context(&ctx, d3d11))
return;
- if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
+ if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory1)))
{
win_skip("ID2D1Factory1 is not supported.\n");
release_test_context(&ctx);
return;
}
+ factory_version = 1;
+ if (SUCCEEDED(ID2D1Factory1_QueryInterface(factory1, &IID_ID2D1Factory2, (void **)&factory2)))
+ {
+ ID2D1Factory2_Release(factory2);
+ factory_version = 2;
+ }
+ if (SUCCEEDED(ID2D1Factory1_QueryInterface(factory1, &IID_ID2D1Factory3, (void **)&factory3)))
+ {
+ ID2D1Factory3_Release(factory3);
+ factory_version = 3;
+ }
+ if (factory_version < 3)
+ win_skip("ID2D1Factory%u is not supported.\n", factory_version + 1);
hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@@ -9973,6 +9990,9 @@ static void test_effect(BOOL d3d11)
{
const struct effect_test *test = effect_tests + i;
+ if (factory_version < test->factory_version)
+ continue;
+
winetest_push_context("Test %u", i);
hr = ID2D1DeviceContext_CreateEffect(context, test->clsid, &effect);
@@ -10109,7 +10129,7 @@ static void test_effect(BOOL d3d11)
}
ID2D1DeviceContext_Release(context);
- ID2D1Factory1_Release(factory);
+ ID2D1Factory1_Release(factory1);
release_test_context(&ctx);
}
@@ -10350,6 +10370,84 @@ static void test_effect_crop(BOOL d3d11)
release_test_context(&ctx);
}
+static void test_effect_grayscale(BOOL d3d11)
+{
+ DWORD colour, expected_colour, luminance;
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
+ struct d2d1_test_context ctx;
+ struct resource_readback rb;
+ ID2D1DeviceContext *context;
+ D2D1_SIZE_U input_size;
+ ID2D1Factory3 *factory;
+ ID2D1Bitmap1 *bitmap;
+ ID2D1Effect *effect;
+ ID2D1Image *output;
+ unsigned int i;
+ HRESULT hr;
+
+ const DWORD test_pixels[] = {0xffffffff, 0x12345678, 0x89abcdef, 0x77777777, 0xdeadbeef};
+
+ if (!init_test_context(&ctx, d3d11))
+ return;
+
+ if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory3, NULL, (void **)&factory)))
+ {
+ win_skip("ID2D1Factory3 is not supported.\n");
+ release_test_context(&ctx);
+ return;
+ }
+
+ hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Grayscale, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(test_pixels); ++i)
+ {
+ DWORD pixel = test_pixels[i];
+ winetest_push_context("Test %u", i);
+
+ set_size_u(&input_size, 1, 1);
+ bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
+ bitmap_desc.dpiX = 96.0f;
+ bitmap_desc.dpiY = 96.0f;
+ bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_NONE;
+ bitmap_desc.colorContext = NULL;
+ hr = ID2D1DeviceContext_CreateBitmap(context, input_size, &pixel, sizeof(pixel), &bitmap_desc, &bitmap);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
+ ID2D1Effect_GetOutput(effect, &output);
+
+ ID2D1DeviceContext_BeginDraw(context);
+ ID2D1DeviceContext_Clear(context, 0);
+ ID2D1DeviceContext_DrawImage(context, output, NULL, NULL, 0, 0);
+ hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ get_surface_readback(&ctx, &rb);
+ colour = get_readback_colour(&rb, 0, 0);
+ luminance = (DWORD)(0.299f * ((pixel >> 16) & 0xff)
+ + 0.587f * ((pixel >> 8) & 0xff)
+ + 0.114f * ((pixel >> 0) & 0xff) + 0.5f);
+ expected_colour = (pixel & 0xff000000) | (luminance << 16) | (luminance << 8) | luminance;
+ todo_wine ok(compare_colour(colour, expected_colour, 1),
+ "Got unexpected colour %#lx, expected %#lx.\n", colour, expected_colour);
+ release_resource_readback(&rb);
+
+ ID2D1Image_Release(output);
+ ID2D1Bitmap1_Release(bitmap);
+ winetest_pop_context();
+ }
+
+ ID2D1Effect_Release(effect);
+ ID2D1DeviceContext_Release(context);
+ ID2D1Factory3_Release(factory);
+ release_test_context(&ctx);
+}
+
static void test_stroke_contains_point(BOOL d3d11)
{
ID2D1TransformedGeometry *transformed_geometry;
@@ -10735,6 +10833,7 @@ START_TEST(d2d1)
queue_test(test_effect);
queue_test(test_effect_2d_affine);
queue_test(test_effect_crop);
+ queue_test(test_effect_grayscale);
queue_d3d10_test(test_stroke_contains_point);
run_queued_tests();
diff --git a/include/d2d1effects_2.idl b/include/d2d1effects_2.idl
index 79895361118..9cd93a8d3bf 100644
--- a/include/d2d1effects_2.idl
+++ b/include/d2d1effects_2.idl
@@ -18,6 +18,7 @@
import "d2d1effects_1.idl";
+cpp_quote("DEFINE_GUID(CLSID_D2D1Grayscale, 0x36dde0eb,0x3725,0x42e0,0x83,0x6d,0x52,0xfb,0x20,0xae,0xe6,0x44);")
cpp_quote("DEFINE_GUID(CLSID_D2D1HighlightsShadows, 0xcadc8384,0x323f,0x4c7e,0xa3,0x61,0x2e,0x2b,0x24,0xdf,0x6e,0xe4);")
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_PROP
--
2.25.1
3
2
[PATCH] combase/tests: Add some RoGetActivationFactory tests with manifest.
by Rémi Bernon April 5, 2022
by Rémi Bernon April 5, 2022
April 5, 2022
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/combase/tests/Makefile.in | 7 +-
dlls/combase/tests/combase.manifest | 15 ++
dlls/combase/tests/combase.rc | 22 +++
dlls/combase/tests/roapi.c | 52 +++++++
dlls/combase/tests/wine.combase.test.c | 159 ++++++++++++++++++++++
dlls/combase/tests/wine.combase.test.spec | 3 +
6 files changed, 256 insertions(+), 2 deletions(-)
create mode 100644 dlls/combase/tests/combase.manifest
create mode 100644 dlls/combase/tests/combase.rc
create mode 100644 dlls/combase/tests/wine.combase.test.c
create mode 100644 dlls/combase/tests/wine.combase.test.spec
diff --git a/dlls/combase/tests/Makefile.in b/dlls/combase/tests/Makefile.in
index 1c3d77725b3..99c036b78d9 100644
--- a/dlls/combase/tests/Makefile.in
+++ b/dlls/combase/tests/Makefile.in
@@ -1,6 +1,9 @@
TESTDLL = combase.dll
IMPORTS = combase
-C_SRCS = \
+SOURCES = \
roapi.c \
- string.c
+ string.c \
+ combase.rc \
+ wine.combase.test.c \
+ wine.combase.test.spec
diff --git a/dlls/combase/tests/combase.manifest b/dlls/combase/tests/combase.manifest
new file mode 100644
index 00000000000..72f3ac915e0
--- /dev/null
+++ b/dlls/combase/tests/combase.manifest
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ type="win32"
+ name="wine.combase.test"
+ version="1.0.0.0"
+ processorArchitecture="*"
+ />
+<description>Wine combase test suite</description>
+<file name="wine.combase.test.dll">
+ <activatableClass name="Wine.Test.Missing" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+ <activatableClass name="Wine.Test.Class" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+ <activatableClass name="Wine.Test.Trusted" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+</file>
+</assembly>
diff --git a/dlls/combase/tests/combase.rc b/dlls/combase/tests/combase.rc
new file mode 100644
index 00000000000..865bf703d5c
--- /dev/null
+++ b/dlls/combase/tests/combase.rc
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2022 Rémi Bernon for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "winuser.h"
+
+/* @makedep: combase.manifest */
+1 RT_MANIFEST combase.manifest
diff --git a/dlls/combase/tests/roapi.c b/dlls/combase/tests/roapi.c
index b1ac15a08cb..1fb8e3e5dc0 100644
--- a/dlls/combase/tests/roapi.c
+++ b/dlls/combase/tests/roapi.c
@@ -28,12 +28,31 @@
#include "wine/test.h"
+static void load_resource(const WCHAR *filename)
+{
+ DWORD written;
+ HANDLE file;
+ HRSRC res;
+ void *ptr;
+
+ file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ ok(file != INVALID_HANDLE_VALUE, "failed to create %s, error %lu\n", debugstr_w(filename), GetLastError());
+
+ res = FindResourceW(NULL, filename, L"TESTDLL");
+ ok(res != 0, "couldn't find resource\n");
+ ptr = LockResource(LoadResource(GetModuleHandleW(NULL), res));
+ WriteFile(file, ptr, SizeofResource(GetModuleHandleW(NULL), res), &written, NULL);
+ ok(written == SizeofResource(GetModuleHandleW(NULL), res), "couldn't write resource\n");
+ CloseHandle(file);
+}
+
static void test_ActivationFactories(void)
{
HRESULT hr;
HSTRING str, str2;
IActivationFactory *factory = NULL;
IInspectable *inspect = NULL;
+ ULONG ref;
hr = WindowsCreateString(L"Windows.Data.Xml.Dom.XmlDocument",
ARRAY_SIZE(L"Windows.Data.Xml.Dom.XmlDocument") - 1, &str);
@@ -63,10 +82,43 @@ static void test_ActivationFactories(void)
WindowsDeleteString(str2);
WindowsDeleteString(str);
+
+ hr = WindowsCreateString(L"Wine.Test.Missing", ARRAY_SIZE(L"Wine.Test.Missing") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ ok(hr == REGDB_E_CLASSNOTREG, "RoGetActivationFactory returned %#lx.\n", hr);
+ ok(factory == NULL, "got factory %p.\n", factory);
+ WindowsDeleteString(str);
+ hr = WindowsCreateString(L"Wine.Test.Class", ARRAY_SIZE(L"Wine.Test.Class") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ todo_wine
+ ok(hr == E_NOTIMPL, "RoGetActivationFactory returned %#lx.\n", hr);
+ ok(factory == NULL, "got factory %p.\n", factory);
+ WindowsDeleteString(str);
+ hr = WindowsCreateString(L"Wine.Test.Trusted", ARRAY_SIZE(L"Wine.Test.Trusted") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ todo_wine
+ ok(hr == S_OK, "RoGetActivationFactory returned %#lx.\n", hr);
+ todo_wine
+ ok(!!factory, "got factory %p.\n", factory);
+ if (!factory) ref = 0;
+ else ref = IActivationFactory_Release(factory);
+ ok(ref == 0, "Release returned %lu\n", ref);
+ WindowsDeleteString(str);
+
RoUninitialize();
}
START_TEST(roapi)
{
+ BOOL ret;
+
+ load_resource(L"wine.combase.test.dll");
+
test_ActivationFactories();
+
+ ret = DeleteFileW(L"wine.combase.test.dll");
+ ok(ret, "Failed to delete file, error %lu\n", GetLastError());
}
diff --git a/dlls/combase/tests/wine.combase.test.c b/dlls/combase/tests/wine.combase.test.c
new file mode 100644
index 00000000000..e6171c6c6e7
--- /dev/null
+++ b/dlls/combase/tests/wine.combase.test.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2022 Rémi Bernon for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#define COBJMACROS
+#include "windef.h"
+#include "winbase.h"
+
+#include "initguid.h"
+#include "inspectable.h"
+#include "roapi.h"
+#include "winstring.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(combase);
+
+struct factory
+{
+ IActivationFactory IActivationFactory_iface;
+ LONG ref;
+ BOOL trusted;
+};
+
+static inline struct factory *impl_from_IActivationFactory(IActivationFactory *iface)
+{
+ return CONTAINING_RECORD(iface, struct factory, IActivationFactory_iface);
+}
+
+static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_IUnknown)
+ || IsEqualGUID(iid, &IID_IInspectable)
+ || IsEqualGUID(iid, &IID_IAgileObject)
+ || IsEqualGUID(iid, &IID_IActivationFactory))
+ {
+ IInspectable_AddRef((*out = &impl->IActivationFactory_iface));
+ return S_OK;
+ }
+
+ FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI factory_AddRef(IActivationFactory *iface)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ TRACE("iface %p increasing refcount to %lu.\n", iface, ref);
+ return ref;
+}
+
+static ULONG WINAPI factory_Release(IActivationFactory *iface)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ TRACE("iface %p decreasing refcount to %lu.\n", iface, ref);
+ return ref;
+}
+
+static HRESULT WINAPI factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids)
+{
+ FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetRuntimeClassName(IActivationFactory *iface, HSTRING *class_name)
+{
+ FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetTrustLevel(IActivationFactory *iface, TrustLevel *trust_level)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+
+ FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+
+ if (!impl->trusted) return E_NOTIMPL;
+
+ *trust_level = BaseTrust;
+ return S_OK;
+}
+
+static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance)
+{
+ FIXME("iface %p, instance %p stub!\n", iface, instance);
+ return E_NOTIMPL;
+}
+
+static const struct IActivationFactoryVtbl factory_vtbl =
+{
+ factory_QueryInterface,
+ factory_AddRef,
+ factory_Release,
+ /* IInspectable methods */
+ factory_GetIids,
+ factory_GetRuntimeClassName,
+ factory_GetTrustLevel,
+ /* IActivationFactory methods */
+ factory_ActivateInstance,
+};
+
+static struct factory class_factory = {{&factory_vtbl}, 0};
+static struct factory trusted_factory = {{&factory_vtbl}, 0, TRUE};
+
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+ FIXME("stub!\n");
+ return S_OK;
+}
+
+HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory)
+{
+ const WCHAR *buffer = WindowsGetStringRawBuffer(classid, NULL);
+
+ FIXME("class %s, factory %p stub!\n", debugstr_w(buffer), factory);
+
+ if (!wcscmp(buffer, L"Wine.Test.Class"))
+ {
+ IActivationFactory_AddRef((*factory = &class_factory.IActivationFactory_iface));
+ return S_OK;
+ }
+ if (!wcscmp(buffer, L"Wine.Test.Trusted"))
+ {
+ IActivationFactory_AddRef((*factory = &trusted_factory.IActivationFactory_iface));
+ return S_OK;
+ }
+
+ return REGDB_E_CLASSNOTREG;
+}
+
+HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
+{
+ FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
diff --git a/dlls/combase/tests/wine.combase.test.spec b/dlls/combase/tests/wine.combase.test.spec
new file mode 100644
index 00000000000..20a8bfa98ea
--- /dev/null
+++ b/dlls/combase/tests/wine.combase.test.spec
@@ -0,0 +1,3 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetActivationFactory(ptr ptr)
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
--
2.35.1
2
1
[PATCH vkd3d 01/11] vkd3d-shader/hlsl: Report failure when encountering matrix instructions.
by Matteo Bruni April 5, 2022
by Matteo Bruni April 5, 2022
April 5, 2022
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
The immediate reason for this patch is to avoid returning a broken
shader in test_reflection() in Wine's d3dcompiler:hlsl_d3d11 tests.
libs/vkd3d-shader/hlsl_sm4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
index 94765f9e..9b6fa371 100644
--- a/libs/vkd3d-shader/hlsl_sm4.c
+++ b/libs/vkd3d-shader/hlsl_sm4.c
@@ -2067,7 +2067,7 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
{
if (instr->data_type->type == HLSL_CLASS_MATRIX)
{
- FIXME("Matrix operations need to be lowered.\n");
+ hlsl_fixme(ctx, &instr->loc, "Matrix operations need to be lowered.");
break;
}
else if (instr->data_type->type == HLSL_CLASS_OBJECT)
--
2.34.1
2
21
[PATCH 1/2] kernel32/tests: Add broken results for GlobalMemoryStatus test.
by Rémi Bernon April 5, 2022
by Rémi Bernon April 5, 2022
April 5, 2022
As seen on win81_cw-gtx560-32 and win81_cw-rx460-32.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/kernel32/tests/heap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c
index 566e2d6b987..a27e3296c01 100644
--- a/dlls/kernel32/tests/heap.c
+++ b/dlls/kernel32/tests/heap.c
@@ -1505,8 +1505,12 @@ static void test_GlobalMemoryStatus(void)
ok( memex.ullAvailExtendedVirtual == 0, "got ullAvailExtendedVirtual %#I64x\n", memex.ullAvailExtendedVirtual );
ok( mem.dwMemoryLoad == memex.dwMemoryLoad, "got dwMemoryLoad %lu\n", mem.dwMemoryLoad );
- ok( mem.dwTotalPhys == min( ~(SIZE_T)0 >> 1, memex.ullTotalPhys ), "got dwTotalPhys %#Ix\n", mem.dwTotalPhys );
- ok( IS_WITHIN_RANGE( mem.dwAvailPhys, min( ~(SIZE_T)0 >> 1, memex.ullAvailPhys ) ), "got dwAvailPhys %#Ix\n", mem.dwAvailPhys );
+ ok( mem.dwTotalPhys == min( ~(SIZE_T)0 >> 1, memex.ullTotalPhys ) ||
+ broken( mem.dwTotalPhys == ~(SIZE_T)0 ) /* Win <= 8.1 with RAM size > 4GB */,
+ "got dwTotalPhys %#Ix\n", mem.dwTotalPhys );
+ ok( IS_WITHIN_RANGE( mem.dwAvailPhys, min( ~(SIZE_T)0 >> 1, memex.ullAvailPhys ) ) ||
+ broken( mem.dwAvailPhys == ~(SIZE_T)0 ) /* Win <= 8.1 with RAM size > 4GB */,
+ "got dwAvailPhys %#Ix\n", mem.dwAvailPhys );
#ifndef _WIN64
todo_wine_if(memex.ullTotalPageFile > 0xfff7ffff)
#endif
--
2.35.1
1
1
[PATCH 1/4] include: Add CWMAEncMediaObject class declaration to wmcodecdsp.idl.
by Rémi Bernon April 5, 2022
by Rémi Bernon April 5, 2022
April 5, 2022
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
include/wmcodecdsp.idl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/wmcodecdsp.idl b/include/wmcodecdsp.idl
index ae2a42419b4..4ad965ab3d9 100644
--- a/include/wmcodecdsp.idl
+++ b/include/wmcodecdsp.idl
@@ -45,6 +45,11 @@ coclass CMSH264DecoderMFT {}
]
coclass CWMADecMediaObject {};
+[
+ uuid(70f598e9-f4ab-495a-99e2-a7c4d3d89abf)
+]
+coclass CWMAEncMediaObject {};
+
[
uuid(93af0c51-2275-45d2-a35b-f2ba21caed00)
]
--
2.35.1
1
3
April 5, 2022
Signed-off-by: Torge Matthies <openglfreak(a)googlemail.com>
---
dlls/kernel32/tests/console.c | 46 +++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 98692760acf..9195ac204f7 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -4689,7 +4689,7 @@ static void copy_change_subsystem(const char* in, const char* out, DWORD subsyst
CloseHandle(hFile);
}
-static BOOL check_whether_child_attached(const char* exec, DWORD flags)
+static BOOL check_subprocess(const char* exec, const char* verb, DWORD flags)
{
STARTUPINFOA si = { sizeof(si) };
PROCESS_INFORMATION info;
@@ -4698,7 +4698,7 @@ static BOOL check_whether_child_attached(const char* exec, DWORD flags)
BOOL res;
DWORD ret;
- sprintf(buf, "\"%s\" console check_console", exec);
+ sprintf(buf, "\"%s\" console %s", exec, verb);
res = CreateProcessA(NULL, buf, NULL, NULL, FALSE, flags, NULL, NULL, &si, &info);
ok(res, "CreateProcess failed: %lu %s\n", GetLastError(), buf);
CloseHandle(info.hThread);
@@ -4711,6 +4711,18 @@ static BOOL check_whether_child_attached(const char* exec, DWORD flags)
return exit_code != 0;
}
+static BOOL check_whether_child_attached(const char* exec, DWORD flags)
+{
+ return check_subprocess(exec, "check_console", flags);
+}
+
+static BOOL check_same_console(const char* exec, DWORD flags)
+{
+ char buf[MAX_PATH];
+ sprintf(buf, "check_same_console %lx", GetCurrentProcessId());
+ return check_subprocess(exec, buf, flags);
+}
+
static void test_CreateProcessCUI(void)
{
char guiexec[MAX_PATH];
@@ -4726,14 +4738,33 @@ static void test_CreateProcessCUI(void)
strcat(cuiexec, "console_cui.exe");
copy_change_subsystem(argv[0], cuiexec, IMAGE_SUBSYSTEM_WINDOWS_CUI);
+ AllocConsole();
+
+ res = check_same_console(cuiexec, 0);
+ ok(res, "Expected child to be attached to the same console\n");
+ res = check_same_console(cuiexec, DETACHED_PROCESS);
+ ok(!res, "Expected child to be attached to a different console\n");
+ res = check_same_console(cuiexec, CREATE_NO_WINDOW);
+ todo_wine ok(!res, "Expected child to be attached to a different console\n");
+ res = check_same_console(cuiexec, CREATE_NO_WINDOW|DETACHED_PROCESS);
+ ok(!res, "Expected child to be attached to a different console\n");
+ res = check_same_console(cuiexec, CREATE_NO_WINDOW|CREATE_NEW_CONSOLE);
+ ok(!res, "Expected child to be attached to a different console\n");
+
FreeConsole();
res = check_whether_child_attached(guiexec, DETACHED_PROCESS);
ok(!res, "Don't expecting child to be attached to a console\n");
+ res = check_whether_child_attached(guiexec, CREATE_NO_WINDOW);
+ ok(!res, "Don't expecting child to be attached to a console\n");
res = check_whether_child_attached(guiexec, 0);
ok(!res, "Don't expecting child to be attached to a console\n");
res = check_whether_child_attached(cuiexec, DETACHED_PROCESS);
ok(!res, "Don't expecting child to be attached to a console\n");
+ res = check_whether_child_attached(cuiexec, CREATE_NO_WINDOW);
+ ok(res, "Expecting child to be attached to a console\n");
+ res = check_whether_child_attached(cuiexec, CREATE_NO_WINDOW|DETACHED_PROCESS);
+ ok(!res, "Don't expecting child to be attached to a console\n");
res = check_whether_child_attached(cuiexec, 0);
ok(res, "Expecting child to be attached to a console\n");
@@ -4774,6 +4805,17 @@ START_TEST(console)
ExitProcess(GetConsoleCP() != 0);
}
+ if (argc > 3 && !strcmp(argv[2], "check_same_console"))
+ {
+ DWORD parent_pid, count, pids[2];
+ sscanf(argv[3], "%lx", &parent_pid);
+ count = GetConsoleProcessList(pids, ARRAY_SIZE(pids));
+ while (count--)
+ if (pids[count] == parent_pid)
+ ExitProcess(1);
+ ExitProcess(0);
+ }
+
test_current = argc >= 3 && !strcmp(argv[2], "--current");
using_pseudo_console = argc >= 3 && !strcmp(argv[2], "--pseudo-console");
--
2.35.1
3
7